Re: [PATCH glibc] Add file record locking support
Hello, Svante Signell, le Thu 08 Jan 2015 19:54:12 +0100, a écrit : > You made me confused, so all changes were not made. I think the malloc > version was better for symmetry reasons. Changed anyway. Which symmetry? You mean fl->foo vs fl.foo? It is not worth spending a malloc call for this. > + if (cmd == F_GETLK) > + cmd = F_GETLK64; > + if (cmd == F_SETLK) > + cmd = F_SETLK64; > + if (cmd == F_SETLKW) > + cmd = F_SETLKW64; Better use a switch () statement for that. > + default: > + errno = EINVAL; > return -1; > + break; Do not add a break after a return, it is completely useless. Same below. Apart from that it seems good. Samuel -- To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/2015012613.gh2...@type.youpi.perso.aquilenet.fr
Re: [PATCH hurd 1/6] Add file record locking support
Svante Signell, le Thu 08 Jan 2015 12:28:24 +0100, a écrit : > hurd: add new RPC: file_record_lock It seems good. > hurd/ChangeLog > 2014-08-21 Svante Signell > > * fs.defs: Added description. > * hurd_types.defs: Make struct flock_t seven integers long since > l_start and l_len are 64bit. > * hurd_types.h: typedef flock_t as flock64. > > 2001-04-10 Neal H Walfield > > * fs.defs: New rpc file_record_lock. > * hurd_types.defs: Import . > > Index: hurd-0.5.git20141210/hurd/fs.defs > === > --- hurd-0.5.git20141210.orig/hurd/fs.defs > +++ hurd-0.5.git20141210/hurd/fs.defs > @@ -373,3 +373,12 @@ routine file_get_source ( > file: file_t; > RPT > out source: string_t); > + > +/* Do fcntl type locking on FILE. CMD is from the set > + F_GETLK64, F_SETLK64, F_SETLKW64. FLOCK64 is passed > + by the user and is as defined by . */ > +routine file_record_lock ( > + file: file_t; > + RPT > + cmd: int; > + inout flock64: flock_t); > Index: hurd-0.5.git20141210/hurd/hurd_types.defs > === > --- hurd-0.5.git20141210.orig/hurd/hurd_types.defs > +++ hurd-0.5.git20141210/hurd/hurd_types.defs > @@ -372,7 +372,7 @@ type idarray_t = array[] of uid_t; > > type rusage_t = struct[18] of int; /* XXX */ > > -type flock_t = struct[5] of int; > +type flock_t = struct[7] of int; /* l_start and l_len are 64 bit */ > > type timespec_t = struct[2] of int; > > @@ -386,3 +386,5 @@ import ; > import ; > import ; > import ; > +import ; > + > Index: hurd-0.5.git20141210/hurd/hurd_types.h > === > --- hurd-0.5.git20141210.orig/hurd/hurd_types.h > +++ hurd-0.5.git20141210/hurd/hurd_types.h > @@ -65,7 +65,7 @@ typedef pid_t *pidarray_t; > typedef uid_t *idarray_t; > typedef loff_t *off_array_t; > typedef struct rusage rusage_t; > -typedef struct flock flock_t; > +typedef struct flock64 flock_t; > typedef struct utsname utsname_t; > #if _FILE_OFFSET_BITS == 64 > typedef struct stat io_statbuf_t; -- Samuel r: et la marmotte, elle écrit un papier IPDPS -- To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150120002330.ga12...@type.youpi.perso.aquilenet.fr
Re: [PATCH hurd 0/6] Add file record locking support
Svante Signell, le Thu 08 Jan 2015 12:28:05 +0100, a écrit : > 3/6: libfshelp_rlock.patch: implement fshelp_rlock_* functions It seems this one didn't make its way to the list. Samuel -- To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150120002721.gb12...@type.youpi.perso.aquilenet.fr
Re: [PATCH hurd 0/6] Add file record locking support
Hello, Thanks for reviving this, it'll definitely be useful! Svante Signell, le Thu 08 Jan 2015 12:28:05 +0100, a écrit : > 1) l_pid of struct flock is not set. According to the manpage (and > posix) the PID of the process blocking the lock should be reported. Can > maybe be solved by a shared memory solution in glibc or as indicated in > task 1022. We can not trust a shared memory solution, we need an io_reidentify round through the proc server. > 2) fork(2) does not create a process without the locks set for the > child. > (This is probably the main cause tdbtorture in tdb does not work well > with the current file record locking patches.) I don't think tdbtorture forks with locks held: AIUI it just starts several processes and let them play at will with locks, without creating or terminating them. Samuel -- To UNSUBSCRIBE, email to debian-hurd-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/20150120003712.gj2...@type.youpi.perso.aquilenet.fr