mldonkey-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/driver/dr...


From: mldonkey-commits
Subject: [Mldonkey-commits] mldonkey distrib/ChangeLog src/daemon/driver/dr...
Date: Mon, 06 Mar 2006 18:02:17 +0000

CVSROOT:        /sources/mldonkey
Module name:    mldonkey
Branch:         
Changes by:     spiralvoice <address@hidden>    06/03/06 18:02:17

Modified files:
        distrib        : ChangeLog 
        src/daemon/driver: driverCommands.ml 
        src/utils/lib  : unix32.ml unix32.mli 

Log message:
        patch #4954

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/distrib/ChangeLog.diff?tr1=1.761&tr2=1.762&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/daemon/driver/driverCommands.ml.diff?tr1=1.127&tr2=1.128&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/unix32.ml.diff?tr1=1.59&tr2=1.60&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/mldonkey/mldonkey/src/utils/lib/unix32.mli.diff?tr1=1.22&tr2=1.23&r1=text&r2=text

Patches:
Index: mldonkey/distrib/ChangeLog
diff -u mldonkey/distrib/ChangeLog:1.761 mldonkey/distrib/ChangeLog:1.762
--- mldonkey/distrib/ChangeLog:1.761    Mon Mar  6 17:59:44 2006
+++ mldonkey/distrib/ChangeLog  Mon Mar  6 18:02:16 2006
@@ -15,6 +15,10 @@
 =========
 
 2006/03/06
+4954: New function Unix32.owner to read user and group entry of a file 
+- to debug use command debug_fileinfo <file>
+- renamed debug command "disk" to "debug_disk"
+- renamed debug command "rlimit" to "debug_rlimit"
 4950: Close unneeded file descriptors
 
 2006/03/05
Index: mldonkey/src/daemon/driver/driverCommands.ml
diff -u mldonkey/src/daemon/driver/driverCommands.ml:1.127 
mldonkey/src/daemon/driver/driverCommands.ml:1.128
--- mldonkey/src/daemon/driver/driverCommands.ml:1.127  Sun Mar  5 10:43:46 2006
+++ mldonkey/src/daemon/driver/driverCommands.ml        Mon Mar  6 18:02:16 2006
@@ -1955,7 +1955,7 @@
         _s ""
     ), ":\t\t\t\tcheck shared files for removal";
 
-     "disk", Arg_one (fun arg o ->
+     "debug_disk", Arg_one (fun arg o ->
          let buf = o.conn_buf in
         let print_i64o = function
           | None -> "Unknown"
@@ -1981,7 +1981,23 @@
          _s ""
      ), "debug command (example: disk .)";
 
-     "rlimit", Arg_none (fun o ->
+     "debug_fileinfo", Arg_one (fun arg o ->
+         let buf = o.conn_buf in
+        (try
+           let s = Unix.stat arg in
+            Printf.bprintf buf "st_dev %d\n" s.Unix.st_dev;
+            Printf.bprintf buf "st_ino %d\n" s.Unix.st_ino;
+            Printf.bprintf buf "st_uid %d\n" s.Unix.st_uid;
+            Printf.bprintf buf "st_gid %d\n" s.Unix.st_gid;
+            Printf.bprintf buf "st_size %d\n" s.Unix.st_size;
+           let user,group = Unix32.owner arg in
+            Printf.bprintf buf "username %s\n" user;
+            Printf.bprintf buf "groupname %s\n" group;
+         with e -> Printf.bprintf buf "Error %s when opening %s\n" 
(Printexc2.to_string e) arg);
+         _s ""
+     ), "debug command (example: file .)";
+
+     "debug_rlimit", Arg_none (fun o ->
          let buf = o.conn_buf in
         let cpu = Unix2.ml_getrlimit Unix2.RLIMIT_CPU in
         let fsize = Unix2.ml_getrlimit Unix2.RLIMIT_FSIZE in
Index: mldonkey/src/utils/lib/unix32.ml
diff -u mldonkey/src/utils/lib/unix32.ml:1.59 
mldonkey/src/utils/lib/unix32.ml:1.60
--- mldonkey/src/utils/lib/unix32.ml:1.59       Mon Mar  6 17:59:45 2006
+++ mldonkey/src/utils/lib/unix32.ml    Mon Mar  6 18:02:16 2006
@@ -212,6 +212,19 @@
         (Printexc2.to_string e);
       raise e
 
+    let owner t =
+      try
+      check_destroyed t;
+      let s = Unix.fstat (local_force_fd t) in
+      let user = Unix.getpwuid s.Unix.st_uid in
+      let group = Unix.getgrgid s.Unix.st_gid in
+      user.Unix.pw_name, group.Unix.gr_name
+      with e ->
+      if !verbose then lprintf_nl "Exception in FDCache.owner %s: %s"
+        t.filename
+        (Printexc2.to_string e);
+      raise e
+
     let mtime64 t =
       try
       check_destroyed t;
@@ -349,6 +362,7 @@
     let ftruncate64 = FDCache.ftruncate64
 
     let getsize64 = FDCache.getsize64
+    let owner = FDCache.owner
     let mtime64 = FDCache.mtime64
     let exists = FDCache.exists
     let remove = FDCache.remove
@@ -1406,6 +1420,22 @@
       exists
     with Unix.Unix_error (Unix.ENOENT, _, _) -> false
 
+let owner_fd t =
+  match t.file_kind with
+  | DiskFile t -> DiskFile.owner t
+  | MultiFile t -> "", ""
+  | SparseFile t -> "", ""
+  | Destroyed -> "", ""
+
+let owner s =
+  try
+    let old_fd_exists = fd_exists s in
+    let fd = create_ro s in
+    let user,group = owner_fd fd in
+    if not old_fd_exists then close fd;
+    user,group
+  with _ -> "", ""
+
 let rename t f =
   flush_fd t;
   close t;
Index: mldonkey/src/utils/lib/unix32.mli
diff -u mldonkey/src/utils/lib/unix32.mli:1.22 
mldonkey/src/utils/lib/unix32.mli:1.23
--- mldonkey/src/utils/lib/unix32.mli:1.22      Mon Feb 20 01:30:19 2006
+++ mldonkey/src/utils/lib/unix32.mli   Mon Mar  6 18:02:16 2006
@@ -44,6 +44,7 @@
 val max_cache_size : int ref
 val mtime : string -> float
 val mtime64 : t -> float
+val owner : string -> (string * string)
   
 val flush : unit -> unit
 val flush_fd : t -> unit




reply via email to

[Prev in Thread] Current Thread [Next in Thread]