diff options
| -rw-r--r-- | sys/kern/kern_descrip.c | 85 |
1 files changed, 28 insertions, 57 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c index 5595639b9ec1..0f376c85a16c 100644 --- a/sys/kern/kern_descrip.c +++ b/sys/kern/kern_descrip.c @@ -135,7 +135,6 @@ struct mtx sigio_lock; /* mtx to protect pointers to sigio */ /* A mutex to protect the association between a proc and filedesc. */ struct mtx fdesc_mtx; -MTX_SYSINIT(fdesc, &fdesc_mtx, "fdesc", MTX_DEF); /* * Find the first zero bit in the given bitmap, starting at low and not @@ -2423,101 +2422,73 @@ SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD, &openfiles, 0, "System-wide number of open files"); -static fo_rdwr_t badfo_readwrite; -static fo_ioctl_t badfo_ioctl; -static fo_poll_t badfo_poll; -static fo_kqfilter_t badfo_kqfilter; -static fo_stat_t badfo_stat; -static fo_close_t badfo_close; +/* ARGSUSED*/ +static void +filelistinit(void *dummy) +{ -struct fileops badfileops = { - .fo_read = badfo_readwrite, - .fo_write = badfo_readwrite, - .fo_ioctl = badfo_ioctl, - .fo_poll = badfo_poll, - .fo_kqfilter = badfo_kqfilter, - .fo_stat = badfo_stat, - .fo_close = badfo_close, -}; + file_zone = uma_zcreate("Files", sizeof(struct file), NULL, NULL, + NULL, NULL, UMA_ALIGN_PTR, 0); + sx_init(&filelist_lock, "filelist lock"); + mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); + mtx_init(&fdesc_mtx, "fdesc", NULL, MTX_DEF); +} +SYSINIT(select, SI_SUB_LOCK, SI_ORDER_FIRST, filelistinit, NULL) + +/*-------------------------------------------------------------------*/ static int -badfo_readwrite(fp, uio, active_cred, flags, td) - struct file *fp; - struct uio *uio; - struct ucred *active_cred; - struct thread *td; - int flags; +badfo_readwrite(struct file *fp, struct uio *uio, struct ucred *active_cred, int flags, struct thread *td) { return (EBADF); } static int -badfo_ioctl(fp, com, data, active_cred, td) - struct file *fp; - u_long com; - void *data; - struct ucred *active_cred; - struct thread *td; +badfo_ioctl(struct file *fp, u_long com, void *data, struct ucred *active_cred, struct thread *td) { return (EBADF); } static int -badfo_poll(fp, events, active_cred, td) - struct file *fp; - int events; - struct ucred *active_cred; - struct thread *td; +badfo_poll(struct file *fp, int events, struct ucred *active_cred, struct thread *td) { return (0); } static int -badfo_kqfilter(fp, kn) - struct file *fp; - struct knote *kn; +badfo_kqfilter(struct file *fp, struct knote *kn) { return (0); } static int -badfo_stat(fp, sb, active_cred, td) - struct file *fp; - struct stat *sb; - struct ucred *active_cred; - struct thread *td; +badfo_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, struct thread *td) { return (EBADF); } static int -badfo_close(fp, td) - struct file *fp; - struct thread *td; +badfo_close(struct file *fp, struct thread *td) { return (EBADF); } -static void filelistinit(void *); -SYSINIT(select, SI_SUB_LOCK, SI_ORDER_FIRST, filelistinit, NULL) - -/* ARGSUSED*/ -static void -filelistinit(dummy) - void *dummy; -{ +struct fileops badfileops = { + .fo_read = badfo_readwrite, + .fo_write = badfo_readwrite, + .fo_ioctl = badfo_ioctl, + .fo_poll = badfo_poll, + .fo_kqfilter = badfo_kqfilter, + .fo_stat = badfo_stat, + .fo_close = badfo_close, +}; - file_zone = uma_zcreate("Files", sizeof(struct file), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, 0); - sx_init(&filelist_lock, "filelist lock"); - mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF); -} /*-------------------------------------------------------------------*/ |
