diff options
author | wollman <wollman@FreeBSD.org> | 1997-12-15 03:09:59 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1997-12-15 03:09:59 +0000 |
commit | 1a06d8809828f2017adc8b31c76d4f07c3a92169 (patch) | |
tree | de4e7dc4bf84fe154d0df8264982bcf11791b066 /sys/miscfs/deadfs | |
parent | b7cdca40ba7917454003700ecf7d97d1c402ac47 (diff) | |
download | FreeBSD-src-1a06d8809828f2017adc8b31c76d4f07c3a92169.zip FreeBSD-src-1a06d8809828f2017adc8b31c76d4f07c3a92169.tar.gz |
Add support for poll(2) on files. vop_nopoll() now returns POLLNVAL
if one of the new poll types is requested; hopefully this will not break
any existing code. (This is done so that programs have a dependable
way of determining whether a filesystem supports the extended poll types
or not.)
The new poll types added are:
POLLWRITE - file contents may have been modified
POLLNLINK - file was linked, unlinked, or renamed
POLLATTRIB - file's attributes may have been changed
POLLEXTEND - file was extended
Note that the internal operation of poll() means that it is impossible
for two processes to reliably poll for the same event (this could
be fixed but may not be worth it), so it is not possible to rewrite
`tail -f' to use poll at this time.
Diffstat (limited to 'sys/miscfs/deadfs')
-rw-r--r-- | sys/miscfs/deadfs/dead_vnops.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sys/miscfs/deadfs/dead_vnops.c b/sys/miscfs/deadfs/dead_vnops.c index 99f58a6..fb11c2a 100644 --- a/sys/miscfs/deadfs/dead_vnops.c +++ b/sys/miscfs/deadfs/dead_vnops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)dead_vnops.c 8.1 (Berkeley) 6/10/93 - * $Id: dead_vnops.c,v 1.21 1997/10/26 20:55:10 phk Exp $ + * $Id: dead_vnops.c,v 1.22 1997/12/05 19:55:41 bde Exp $ */ #include <sys/param.h> @@ -40,20 +40,22 @@ #include <sys/lock.h> #include <sys/vnode.h> #include <sys/buf.h> +#include <sys/poll.h> static int chkvnlock __P((struct vnode *)); /* * Prototypes for dead operations on vnodes. */ static int dead_badop __P((void)); +static int dead_bmap __P((struct vop_bmap_args *)); +static int dead_ioctl __P((struct vop_ioctl_args *)); +static int dead_lock __P((struct vop_lock_args *)); static int dead_lookup __P((struct vop_lookup_args *)); static int dead_open __P((struct vop_open_args *)); +static int dead_poll __P((struct vop_poll_args *)); +static int dead_print __P((struct vop_print_args *)); static int dead_read __P((struct vop_read_args *)); static int dead_write __P((struct vop_write_args *)); -static int dead_ioctl __P((struct vop_ioctl_args *)); -static int dead_lock __P((struct vop_lock_args *)); -static int dead_bmap __P((struct vop_bmap_args *)); -static int dead_print __P((struct vop_print_args *)); vop_t **dead_vnodeop_p; static struct vnodeopv_entry_desc dead_vnodeop_entries[] = { @@ -73,6 +75,7 @@ static struct vnodeopv_entry_desc dead_vnodeop_entries[] = { { &vop_mmap_desc, (vop_t *) dead_badop }, { &vop_open_desc, (vop_t *) dead_open }, { &vop_pathconf_desc, (vop_t *) vop_ebadf }, /* per pathconf(2) */ + { &vop_poll_desc, (vop_t *) dead_poll }, { &vop_print_desc, (vop_t *) dead_print }, { &vop_read_desc, (vop_t *) dead_read }, { &vop_readdir_desc, (vop_t *) vop_ebadf }, @@ -288,3 +291,15 @@ chkvnlock(vp) } return (locked); } + +/* + * Trivial poll routine that always returns POLLHUP. + * This is necessary so that a process which is polling a file + * gets notified when that file is revoke()d. + */ +static int +dead_poll(ap) + struct vop_poll_args *ap; +{ + return (POLLHUP); +} |