Attached is the second part of the patches for file record locking: libnetfs_file_record_lock.patch pflocal_fs.c.patch hurd_add_RPC.patch
Thanks!
hurd/ChangeLog 2019-02-01 Svante Signell <svante.sign...@gmail.com> * Update copyright years. 2018-01-05 Svante Signell <svante.sign...@gmail.com> * Update copyright years. * fs.defs: Add new argument rendezvous: mach_port_send_t to RPC file_record_lock. 2017-01-05 Svante Signell <svante.sign...@gmail.com> * Update copyright years and headers. 2016-05-23 Svante Signell <svante.sign...@gmail.com> * 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 <n...@cs.uml.edu> * fs.defs: New RPC file_record_lock. * hurd_types.defs: Import <fcntl.h>. Index: hurd-0.9.git20181030-4.1/hurd/fs.defs =================================================================== --- hurd-0.9.git20181030-4.1.orig/hurd/fs.defs +++ hurd-0.9.git20181030-4.1/hurd/fs.defs @@ -1,23 +1,22 @@ /* Definitions for the filesystem interface. - Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2010 + + Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2002, 2010, 2014-2019 Free Software Foundation, Inc. -This file is part of the GNU Hurd. + This file is part of the GNU Hurd. -The GNU Hurd is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -The GNU Hurd is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the GNU Hurd; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + The GNU Hurd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The GNU Hurd is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ /* All these objects also implement the generic IO facilities. */ @@ -358,6 +357,18 @@ routine file_reparent ( skip; /* Was: file_get_children. */ skip; /* Was: file_get_source. */ + +/* 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 <fcntl.h>. RENDEZVOUS is MACH_PORT_NULL for per opened + file locking and !MACH_PORT_NULL for per process file locking */ +routine file_record_lock ( + file: file_t; + RPT + cmd: int; + inout flock64: flock_t; + rendezvous: mach_port_send_t); + /* Overlay a task with a file. Necessary initialization, including authentication changes associated with set[ug]id execution must be handled by the filesystem. Filesystems normally implement this by Index: hurd-0.9.git20181030-4.1/hurd/hurd_types.defs =================================================================== --- hurd-0.9.git20181030-4.1.orig/hurd/hurd_types.defs +++ hurd-0.9.git20181030-4.1/hurd/hurd_types.defs @@ -1,22 +1,22 @@ /* MiG type declarations for Hurd interfaces -*- C -*- - Copyright (C) 1993,94,95,96,98,2001,02,17 Free Software Foundation, Inc. -This file is part of the GNU Hurd. + Copyright (C) 1993-1996, 1998, 2001, 2002, 2014-2019 + Free Software Foundation, Inc. -The GNU Hurd is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -The GNU Hurd is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the GNU Hurd; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + This file is part of the GNU Hurd. + The GNU Hurd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The GNU Hurd is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HURD_SERVER /* The Hurd uses protected payloads to quickly look up the object @@ -389,7 +389,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; @@ -403,3 +403,5 @@ import <sys/statfs.h>; import <sys/resource.h>; import <sys/utsname.h>; import <hurd/hurd_types.h>; +import <fcntl.h>; + Index: hurd-0.9.git20181030-4.1/hurd/hurd_types.h =================================================================== --- hurd-0.9.git20181030-4.1.orig/hurd/hurd_types.h +++ hurd-0.9.git20181030-4.1/hurd/hurd_types.h @@ -1,22 +1,22 @@ /* C declarations for Hurd server interfaces - Copyright (C) 1993, 1994, 1995, 1996, 1998, 1999, 2001, 2002, - 2010, 2017 Free Software Foundation, Inc. -This file is part of the GNU Hurd. + Copyright (C) 1993-1996, 1998, 1999, 2001, 2002, 2010, 2014-2019 + Free Software Foundation, Inc. -The GNU Hurd is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -The GNU Hurd is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with the GNU Hurd; see the file COPYING. If not, write to -the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + The GNU Hurd is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _HURD_TYPES_H #define _HURD_TYPES_H @@ -73,7 +73,7 @@ typedef const uid_t *const_idarray_t; typedef __loff_t *off_array_t; typedef const __loff_t *const_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;
libnetfs/ChangeLog 2019-02-01 Svante Signell <svante.sign...@gmail.com> * Update copyright years. * file-record-lock.c(netfs_S_file_record_lock): Don't set rendezvous to MACH_PORT_NULL. 2017-01-05 Svante Signell <svante.sign...@gmail.com> * Update copyright years and headers. * dir-lookup.c(netfs_S_dir_lookup): Call fshelp_rlock_tweak() with new last argument rendezvous = MACH_PORT_NULL. * file-lock.c(netfs_S_file_lock): Likewise. * file-record-lock.c(netfs_S_file_record_lock): Likewise. (netfs_S_file_record_lock): Add new argument mach_port_t rendezvous. 2016-05-23 Svante Signell <svante.sign...@gmail.com> * netfs.h (struct peropen): Change the type of rlock_status from an int to a struct rlock_peropen. (struct node): Change the type of userbox from a struct lock_box to a struct rlock_box. * dir-lookup.c (netfs_S_dir_lookup): Use fshelp_rlock_tweak. * file-lock-stat.c (netfs_S_file_lock_stat): Total rewrite around the new record locking functions. * file-lock.c (netfs_S_file_lock): Likewise. * file-record-lock.c (netfs_S_file_record_lock): Likewise. * make-node.c (netfs_make_node): Initialize userbox with fshelp_rlock_init. * make-peropen.c (netfs_make_peropen): Initialize lock_status using fshelp_rlock_po_init. (netfs_make_peropen): Add a comment that po->refcnt starts at zero. * relese-peropen.c (netfs_release_peropen): Release lock_status using fshelp_rlock_drop_peropen. 2001-04-11 Neal H Walfield <n...@cs.uml.edu> * file-record-lock.c: New file. Implement netfs_S_file_record_lock. * Makefile (SRCS): Add file-record-lock.c Index: hurd-0.9.git20181030-4.1/libnetfs/Makefile =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/Makefile +++ hurd-0.9.git20181030-4.1/libnetfs/Makefile @@ -1,5 +1,5 @@ -# Copyright (C) 1995, 1996, 1997, 1999, 2001, 2002, 2008, 2012 Free Software -# Foundation +# Copyright (C) 1995-1997, 1999, 2001-2002, 2008, 2012, 2016-2019 +# Free Software Foundation # # Written by Michael I. Bushnell. # @@ -14,10 +14,9 @@ # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. -# + # You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +# along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. dir := libnetfs makemode := library @@ -34,7 +33,8 @@ FSSRCS= dir-link.c dir-lookup.c dir-mkdi file-get-translator.c file-getcontrol.c file-getlinknode.c \ file-lock-stat.c file-lock.c file-set-size.c \ file-set-translator.c file-statfs.c file-sync.c file-syncfs.c \ - file-utimes.c file-reparent.c fsstubs.c file-get-transcntl.c + file-utimes.c file-record-lock.c file-reparent.c fsstubs.c \ + file-get-transcntl.c IOSRCS= io-read.c io-readable.c io-seek.c io-write.c io-stat.c io-async.c \ io-set-all-openmodes.c io-get-openmodes.c io-set-some-openmodes.c \ Index: hurd-0.9.git20181030-4.1/libnetfs/netfs.h =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/netfs.h +++ hurd-0.9.git20181030-4.1/libnetfs/netfs.h @@ -1,6 +1,6 @@ /* - - Copyright (C) 1994,95,96,97,99,2000,02,13 Free Software Foundation, Inc. + Copyright (C) 1994-1997, 1999, 2000, 2002, 2013-2019 + Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -13,8 +13,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _HURD_NETFS_H_ #define _HURD_NETFS_H_ @@ -24,6 +23,7 @@ #include <hurd/iohelp.h> #include <assert-backtrace.h> #include <pthread.h> +#include <refcount.h> /* This library supports client-side network file system implementations. It is analogous to the diskfs library provided for @@ -50,7 +50,7 @@ struct protid struct peropen { loff_t filepointer; - int lock_status; + struct rlock_peropen lock_status; refcount_t refcnt; int openstat; @@ -93,7 +93,7 @@ struct node struct transbox transbox; - struct lock_box userlock; + struct rlock_box userlock; struct conch conch; Index: hurd-0.9.git20181030-4.1/libnetfs/dir-lookup.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/dir-lookup.c +++ hurd-0.9.git20181030-4.1/libnetfs/dir-lookup.c @@ -1,6 +1,5 @@ /* - Copyright (C) 1995,96,97,98,99,2000,01,02,13,14 - Free Software Foundation, Inc. + Copyright (C) 1995-2002, 2013-2019 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -16,8 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #include <fcntl.h> #include <assert-backtrace.h> @@ -438,24 +436,50 @@ netfs_S_dir_lookup (struct protid *dircr goto out; } - free (newpi->po->path); - if (dircred->po->path == NULL || !strcmp (dircred->po->path,".")) + mach_port_t rendezvous = MACH_PORT_NULL; + struct flock64 lock = { - /* dircred is the root directory. */ - newpi->po->path = relpath; - relpath = NULL; /* Do not free relpath. */ + l_start: 0, + l_len: 0, + l_whence: SEEK_SET + }; + + if (flags & O_EXLOCK) + { + lock.l_type = F_WRLCK; + err = fshelp_rlock_tweak (&np->userlock, &np->lock, + &newpi->po->lock_status, flags, 0, 0, + F_SETLK64, &lock, rendezvous); } - else + else if (flags & O_SHLOCK) { - newpi->po->path = NULL; - asprintf (&newpi->po->path, "%s/%s", dircred->po->path, relpath); + lock.l_type = F_RDLCK; + err = fshelp_rlock_tweak (&np->userlock, &np->lock, + &newpi->po->lock_status, flags, 0, 0, + F_SETLK64, &lock, rendezvous); } - if (! newpi->po->path) - err = errno; + if (! err) + { + free (newpi->po->path); + if (dircred->po->path == NULL || !strcmp (dircred->po->path,".")) + { + /* dircred is the root directory. */ + newpi->po->path = relpath; + relpath = NULL; /* Do not free relpath. */ + } + else + { + newpi->po->path = NULL; + asprintf (&newpi->po->path, "%s/%s", dircred->po->path, relpath); + } + + if (! newpi->po->path) + err = errno; - *retry_port = ports_get_right (newpi); - ports_port_deref (newpi); + *retry_port = ports_get_right (newpi); + ports_port_deref (newpi); + } out: if (np) Index: hurd-0.9.git20181030-4.1/libnetfs/file-lock-stat.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/file-lock-stat.c +++ hurd-0.9.git20181030-4.1/libnetfs/file-lock-stat.c @@ -1,5 +1,5 @@ -/* - Copyright (C) 1995 Free Software Foundation, Inc. +/* + Copyright (C) 1995, 2015-2019 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -15,23 +15,30 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #include "netfs.h" #include "fs_S.h" +#include <fcntl.h> +#include <sys/file.h> + error_t netfs_S_file_lock_stat (struct protid *user, int *mystatus, int *otherstatus) { + + struct node *node; + if (!user) return EOPNOTSUPP; - - pthread_mutex_lock (&user->po->np->lock); - *mystatus = user->po->lock_status; - *otherstatus = user->po->np->userlock.type; - pthread_mutex_unlock (&user->po->np->lock); + + node = user->po->np; + pthread_mutex_lock (&node->lock); + *mystatus = fshelp_rlock_peropen_status (&user->po->lock_status); + *otherstatus = fshelp_rlock_node_status (&node->userlock); + pthread_mutex_unlock (&node->lock); + return 0; } Index: hurd-0.9.git20181030-4.1/libnetfs/file-lock.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/file-lock.c +++ hurd-0.9.git20181030-4.1/libnetfs/file-lock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995 Free Software Foundation, Inc. + Copyright (C) 1995, 2015-2019 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -15,22 +15,51 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #include "netfs.h" #include "fs_S.h" +#include <fcntl.h> +#include <sys/file.h> + error_t netfs_S_file_lock (struct protid *user, int flags) { error_t err; + struct flock64 lock; + struct node *node; + int openstat = user->po->openstat; + mach_port_t rendezvous = MACH_PORT_NULL; + if (!user) return EOPNOTSUPP; - pthread_mutex_lock (&user->po->np->lock); - err = fshelp_acquire_lock (&user->po->np->userlock, &user->po->lock_status, - &user->po->np->lock, flags); - pthread_mutex_unlock (&user->po->np->lock); + + lock.l_whence = SEEK_SET; + lock.l_start = 0; + lock.l_len = 0; + + if (flags & LOCK_UN) + lock.l_type = F_UNLCK; + else if (flags & LOCK_SH) + lock.l_type = F_RDLCK; + else if (flags & LOCK_EX) + lock.l_type = F_WRLCK; + else + return EINVAL; + + node = user->po->np; + + /* XXX: Fix for flock(2) calling fcntl(2) */ + if ((openstat & O_RDONLY) && !(openstat & O_WRONLY)) openstat |= O_WRONLY; + if (!(openstat & O_RDONLY) && (openstat & O_WRONLY)) openstat |= O_RDONLY; + pthread_mutex_lock (&node->lock); + err = fshelp_rlock_tweak (&node->userlock, &node->lock, + &user->po->lock_status, openstat, + 0, 0, flags & LOCK_NB ? F_SETLK64 : F_SETLKW64, + &lock, rendezvous); + pthread_mutex_unlock (&node->lock); + return err; } Index: hurd-0.9.git20181030-4.1/libnetfs/make-node.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/make-node.c +++ hurd-0.9.git20181030-4.1/libnetfs/make-node.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2000, 2015-2019 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -15,8 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #include "netfs.h" #include <hurd/fshelp.h> @@ -32,7 +31,7 @@ init_node (struct node *np, struct netno np->owner = 0; fshelp_transbox_init (&np->transbox, &np->lock, np); - fshelp_lock_init (&np->userlock); + fshelp_rlock_init (&np->userlock); return np; } Index: hurd-0.9.git20181030-4.1/libnetfs/make-peropen.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/make-peropen.c +++ hurd-0.9.git20181030-4.1/libnetfs/make-peropen.c @@ -1,5 +1,5 @@ -/* - Copyright (C) 1995, 1997 Free Software Foundation, Inc. +/* + Copyright (C) 1995, 1997, 2015-2019 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -15,22 +15,26 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #include "netfs.h" +#include <errno.h> +#include <stdlib.h> #include <sys/file.h> struct peropen * netfs_make_peropen (struct node *np, int flags, struct peropen *context) { + error_t err; struct peropen *po = malloc (sizeof (struct peropen)); if (!po) return NULL; po->filepointer = 0; - po->lock_status = LOCK_UN; + err = fshelp_rlock_po_init (&po->lock_status); + if (err) + return NULL; refcount_init (&po->refcnt, 1); po->openstat = flags; po->np = np; Index: hurd-0.9.git20181030-4.1/libnetfs/release-peropen.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/libnetfs/release-peropen.c +++ hurd-0.9.git20181030-4.1/libnetfs/release-peropen.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2015-2019 Free Software Foundation, Inc. Written by Michael I. Bushnell, p/BSG. This file is part of the GNU Hurd. @@ -15,8 +15,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ #include <sys/file.h> #include "netfs.h" @@ -39,9 +38,7 @@ netfs_release_peropen (struct peropen *p if (po->shadow_root_parent) mach_port_deallocate (mach_task_self (), po->shadow_root_parent); - if (po->lock_status != LOCK_UN) - fshelp_acquire_lock (&po->np->userlock, &po->lock_status, - &po->np->lock, LOCK_UN); + fshelp_rlock_drop_peropen (&po->lock_status); netfs_nput (po->np); Index: hurd-0.9.git20181030-4.1/libnetfs/file-record-lock.c =================================================================== --- /dev/null +++ hurd-0.9.git20181030-4.1/libnetfs/file-record-lock.c @@ -0,0 +1,44 @@ +/* Copyright (C) 2001, 2014-2019 Free Software Foundation, Inc. + + Written by Neal H Walfield <n...@cs.uml.edu> + + This file is part of the GNU Hurd. + + The GNU Hurd is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + The GNU Hurd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */ + +#include "netfs.h" + +#include <hurd/fshelp.h> + +error_t +netfs_S_file_record_lock (struct protid *cred, + int cmd, + struct flock64 *lock, + mach_port_t rendezvous) +{ + struct node *node; + error_t err; + + if (! cred) + return EOPNOTSUPP; + + node = cred->po->np; + pthread_mutex_lock (&node->lock); + err = fshelp_rlock_tweak (&node->userlock, &node->lock, + &cred->po->lock_status, cred->po->openstat, + node->nn_stat.st_size, cred->po->filepointer, + cmd, lock, rendezvous); + pthread_mutex_unlock (&node->lock); + return err; +}
pflocal/ChangeLog 2019-02-01 Svante Signell <svante.sign...@gmail.com> * Update copyright years. 2018-12-07 Svante Signell <svante.sign...@gmail.com> * Update copyright years. * fs.c(S_file_record_lock): Add new argument mach_port_t rendezvous. 2017-01-05 Svante Signell <svante.sign...@gmail.com> * Update copyright years and headers. 2016-05-23 Svante Signell <svante.sign...@gmail.com> * fs.c: Add stub implementation of S_file_record_lock. Index: hurd-0.9.git20181030-4.1/pflocal/fs.c =================================================================== --- hurd-0.9.git20181030-4.1.orig/pflocal/fs.c +++ hurd-0.9.git20181030-4.1/pflocal/fs.c @@ -1,6 +1,6 @@ /* Socket I/O operations - Copyright (C) 2016 Free Software Foundation, Inc. + Copyright (C) 2016-2019 Free Software Foundation, Inc. Written by Miles Bader <mi...@gnu.org> @@ -15,16 +15,14 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. +*/ #include <fcntl.h> - #include "sock.h" -#include "sserver.h" #include "fs_S.h" - + error_t S_file_check_access (struct sock_user *cred, int *type) { @@ -39,3 +37,10 @@ S_file_check_access (struct sock_user *c return 0; } + +error_t +S_file_record_lock (struct sock_user *cred, int cmd, + flock_t *flock64, mach_port_t rendezvous) +{ + return EOPNOTSUPP; +}