summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2013-06-05 01:26:00 +0000
committerguenther <guenther@openbsd.org>2013-06-05 01:26:00 +0000
commitaf69e8976a19e4314d09f2fbbb378b149f5ac30b (patch)
tree99b78d62fff027d6fd42eb9e9c2f142e4307897e
parentditch local ld.script and use conf/ld.script instead, and adjust entry (diff)
downloadwireguard-openbsd-af69e8976a19e4314d09f2fbbb378b149f5ac30b.tar.xz
wireguard-openbsd-af69e8976a19e4314d09f2fbbb378b149f5ac30b.zip
Move FHASLOCK from f_flag to f_iflags, freeing up a bit for passing
O_* flags and eliminating an XXX comment. ok matthew@ deraadt@
-rw-r--r--sys/kern/kern_descrip.c6
-rw-r--r--sys/kern/vfs_syscalls.c6
-rw-r--r--sys/kern/vfs_vnops.c4
-rw-r--r--sys/sys/fcntl.h7
-rw-r--r--sys/sys/file.h3
-rw-r--r--usr.sbin/pstat/pstat.c6
6 files changed, 14 insertions, 18 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 457578e9963..26ab25644bb 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.99 2012/08/23 00:11:56 guenther Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.100 2013/06/05 01:26:00 guenther Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -1145,7 +1145,7 @@ sys_flock(struct proc *p, void *v, register_t *retval)
lf.l_len = 0;
if (how & LOCK_UN) {
lf.l_type = F_UNLCK;
- fp->f_flag &= ~FHASLOCK;
+ fp->f_iflags &= ~FIF_HASLOCK;
error = VOP_ADVLOCK(vp, (caddr_t)fp, F_UNLCK, &lf, F_FLOCK);
goto out;
}
@@ -1157,7 +1157,7 @@ sys_flock(struct proc *p, void *v, register_t *retval)
error = EINVAL;
goto out;
}
- fp->f_flag |= FHASLOCK;
+ fp->f_iflags |= FIF_HASLOCK;
if (how & LOCK_NB)
error = VOP_ADVLOCK(vp, (caddr_t)fp, F_SETLK, &lf, F_FLOCK);
else
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 3f1991ec207..880c32b6185 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.192 2013/04/15 15:32:19 jsing Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.193 2013/06/05 01:26:00 guenther Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -1107,7 +1107,7 @@ doopenat(struct proc *p, int fd, const char *path, int oflags, mode_t mode,
goto out;
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- fp->f_flag |= FHASLOCK;
+ fp->f_iflags |= FIF_HASLOCK;
}
if (localtrunc) {
if ((fp->f_flag & FWRITE) == 0)
@@ -1289,7 +1289,7 @@ sys_fhopen(struct proc *p, void *v, register_t *retval)
goto bad;
}
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
- fp->f_flag |= FHASLOCK;
+ fp->f_iflags |= FIF_HASLOCK;
}
VOP_UNLOCK(vp, 0, p);
*retval = indx;
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 9d8ead6f30c..19302ba5e2c 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vnops.c,v 1.72 2013/03/30 06:32:25 tedu Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.73 2013/06/05 01:26:00 guenther Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
@@ -536,7 +536,7 @@ vn_closefile(struct file *fp, struct proc *p)
struct vnode *vp = fp->f_data;
struct flock lf;
- if ((fp->f_flag & FHASLOCK)) {
+ if ((fp->f_iflags & FIF_HASLOCK)) {
lf.l_whence = SEEK_SET;
lf.l_start = 0;
lf.l_len = 0;
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
index 98fa0d6ec02..47b7219561d 100644
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fcntl.h,v 1.19 2011/07/18 17:29:49 matthew Exp $ */
+/* $OpenBSD: fcntl.h,v 1.20 2013/06/05 01:26:00 guenther Exp $ */
/* $NetBSD: fcntl.h,v 1.8 1995/03/26 20:24:12 jtc Exp $ */
/*-
@@ -92,11 +92,6 @@
#define O_TRUNC 0x0400 /* truncate to zero length */
#define O_EXCL 0x0800 /* error if already exists */
-/* XXX - FHASLOCK should be FIF_HASLOCK. */
-#ifdef _KERNEL
-#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
-#endif
-
/*
* POSIX 1003.1 specifies a higher granularity for synchronous operations
* than we support. Since synchronicity is all or nothing in OpenBSD
diff --git a/sys/sys/file.h b/sys/sys/file.h
index 9c294f0f835..9de94514edf 100644
--- a/sys/sys/file.h
+++ b/sys/sys/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.30 2012/05/01 03:43:23 guenther Exp $ */
+/* $OpenBSD: file.h,v 1.31 2013/06/05 01:26:00 guenther Exp $ */
/* $NetBSD: file.h,v 1.11 1995/03/26 20:24:13 jtc Exp $ */
/*
@@ -85,6 +85,7 @@ struct file {
u_int64_t f_wbytes; /* total bytes written */
};
+#define FIF_HASLOCK 0x01 /* descriptor holds advisory lock */
#define FIF_LARVAL 0x02 /* not fully constructed, don't use */
#define FIF_MARK 0x04 /* mark during gc() */
#define FIF_DEFER 0x08 /* defer for next gc() pass */
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index 998ce4035d3..8ae34e9e90b 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pstat.c,v 1.84 2013/04/21 20:49:39 guenther Exp $ */
+/* $OpenBSD: pstat.c,v 1.85 2013/06/05 01:26:00 guenther Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
@@ -1045,11 +1045,11 @@ filemode(void)
*fbp++ = 'W';
if (kf->f_flag & FAPPEND)
*fbp++ = 'A';
- if (kf->f_flag & FHASLOCK)
- *fbp++ = 'L';
if (kf->f_flag & FASYNC)
*fbp++ = 'I';
+ if (kf->f_iflags & FIF_HASLOCK)
+ *fbp++ = 'L';
if (kf->f_iflags & FIF_LARVAL)
*fbp++ = 'l';
if (kf->f_iflags & FIF_MARK)