From 3cabe8d87469422c549d61e7845cc044fe72c660 Mon Sep 17 00:00:00 2001 From: Thomas Bushnell Date: Thu, 10 Oct 1996 21:13:37 +0000 Subject: *** empty log message *** --- libdiskfs/ChangeLog | 5 +++++ libdiskfs/dir-lookup.c | 17 ++++++++++++++--- libfshelp/ChangeLog | 5 +++++ libfshelp/lock-acquire.c | 6 ++++-- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/libdiskfs/ChangeLog b/libdiskfs/ChangeLog index 64116b74..0ee2d73c 100644 --- a/libdiskfs/ChangeLog +++ b/libdiskfs/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 10 17:11:05 1996 Thomas Bushnell, n/BSG + + * dir-lookup.c (diskfs_S_dir_lookup): Implement O_SHLOCK and + O_EXLOCK directly here. + Thu Oct 10 10:53:28 1996 Miles Bader * peropen-rele.c (diskfs_release_peropen): Before freeing PO, diff --git a/libdiskfs/dir-lookup.c b/libdiskfs/dir-lookup.c index 36f2bceb..272b8bd8 100644 --- a/libdiskfs/dir-lookup.c +++ b/libdiskfs/dir-lookup.c @@ -397,15 +397,26 @@ diskfs_S_dir_lookup (struct protid *dircred, if ((flags & O_NOATIME) && (diskfs_isowner (np, dircred) == EPERM)) flags &= ~O_NOATIME; - - flags &= ~OPENONLY_STATE_MODES; - error = diskfs_create_protid (diskfs_make_peropen (np, flags, + error = diskfs_create_protid (diskfs_make_peropen (np, + (flags + & OPENONLY_STATE_MODES), dircred->po->dotdotport), dircred->uids, dircred->nuids, dircred->gids, dircred->ngids, &newpi); + if (! error) + { + if (flags & O_EXLOCK) + error = fshelp_acquire_lock (&np->userlock, &po->lock_status, + &np->lock, LOCK_EX); + else if (flags & O_SHLOCK) + error = fshelp_acquire_lock (&np->userlock, &po->lock_status, + &np->lock, LOCK_SH); + } + + if (!error) { *returned_port = ports_get_right (newpi); ports_port_deref (newpi); diff --git a/libfshelp/ChangeLog b/libfshelp/ChangeLog index a7cd8b0e..997b1a3b 100644 --- a/libfshelp/ChangeLog +++ b/libfshelp/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 10 17:12:19 1996 Thomas Bushnell, n/BSG + + * lock-acquire.c (fshelp_acquire_lock): Use hurd_condition_wait so + we are properly interruptible. + Thu Sep 12 16:21:51 1996 Thomas Bushnell, n/BSG * Makefile (HURDLIBS): New variable. diff --git a/libfshelp/lock-acquire.c b/libfshelp/lock-acquire.c index 9c81634a..42e75dd0 100644 --- a/libfshelp/lock-acquire.c +++ b/libfshelp/lock-acquire.c @@ -80,7 +80,8 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, if (flags & LOCK_NB) return EWOULDBLOCK; box->waiting = 1; - condition_wait (&box->wait, mut); + if (hurd_condition_wait (&box->wait, mut)) + return EINTR; } /* If we have a shared lock, release it. */ @@ -116,7 +117,8 @@ fshelp_acquire_lock (struct lock_box *box, int *user, struct mutex *mut, else { box->waiting = 1; - condition_wait (&box->wait, mut); + if (hurd_condition_wait (&box->wait, mut)) + return EINTR; } } box->type = LOCK_EX; -- cgit v1.2.3