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

Re: Comment on glibc2.28: Re: [PATCH glibc] Add file record locking support



Svante Signell, le sam. 01 déc. 2018 16:27:24 +0100, a ecrit:
> On Thu, 2015-01-08 at 12:40 +0100, Svante Signell wrote:
> > Attached is the patch adding support for file record locking in glibc,
> > as implemented in Hurd by Neal Walfield and others. This patch should be
> > applied after the corresponding hurd patch series in case glibc and hurd
> > are not built simultaneously.
> 
> With the new version of glibc (2.28) the new file f-setlk.c (and f-setlk.h) is
> introduced. This makes the file-record-locking patch for glibc very cumbersome.
[...]
> +  err = HURD_FD_PORT_USE (d, __file_record_lock (port, cmd, fl64));

Ah, the introduced file_record_lock RPC takes the flock64, I thought it
was taking the parameters one by one, sorry about that.

Then I'd say that in your patch you can indeed just drop the f_setlk.c
file (which was just meant to be compatibility between fcntl locking and
flock locking), and in fcntl.c, in the 64bit case just call the RPC,
and in the non-64bit case, fill a struct flock64 with the fields of the
struct flock parameter content, and call the RPC, something like:

    case F_GETLK:
    case F_SETLK:
    case F_SETLKW:
      {
	struct flock *fl = va_arg (ap, struct flock *);
	struct flock64 fl64 = {
	  .l_type = fl->l_type,
	  .l_whence = fl->l_whence,
	  etc.
	};

        err = HURD_FD_PORT_USE (d, __file_record_lock (port, cmd, &fl64));
	result = err ? __hurd_dfail(fd, err) : 0;

	break;
      }

    case F_GETLK64:
    case F_SETLK64:
    case F_SETLKW64:
      {
	struct flock64 *fl64 = va_arg (ap, struct flock64 *);
        err = HURD_FD_PORT_USE (d, __file_record_lock (port, cmd, fl64));
	result = err ? __hurd_dfail(fd, err) : 0;
	break;
      }

Samuel


Reply to: