diff options
author | John Baldwin <jhb@FreeBSD.org> | 2014-09-12 21:29:10 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2014-09-12 21:29:10 +0000 |
commit | 2d69d0dcc2bb94d874dd0fa77d53b08112b9d530 (patch) | |
tree | fc1dbe779c09eb00d34cdab6782e26b3e78ede72 /sys/kern/uipc_shm.c | |
parent | cd550b9b521ba1403f48a6a8e8d67061c7526874 (diff) | |
download | src-2d69d0dcc2bb94d874dd0fa77d53b08112b9d530.tar.gz src-2d69d0dcc2bb94d874dd0fa77d53b08112b9d530.zip |
Fix various issues with invalid file operations:
- Add invfo_rdwr() (for read and write), invfo_ioctl(), invfo_poll(),
and invfo_kqfilter() for use by file types that do not support the
respective operations. Home-grown versions of invfo_poll() were
universally broken (they returned an errno value, invfo_poll()
uses poll_no_poll() to return an appropriate event mask). Home-grown
ioctl routines also tended to return an incorrect errno (invfo_ioctl
returns ENOTTY).
- Use the invfo_*() functions instead of local versions for
unsupported file operations.
- Reorder fileops members to match the order in the structure definition
to make it easier to spot missing members.
- Add several missing methods to linuxfileops used by the OFED shim
layer: fo_write(), fo_truncate(), fo_kqfilter(), and fo_stat(). Most
of these used invfo_*(), but a dummy fo_stat() implementation was
added.
Notes
Notes:
svn path=/head/; revision=271489
Diffstat (limited to 'sys/kern/uipc_shm.c')
-rw-r--r-- | sys/kern/uipc_shm.c | 32 |
1 files changed, 3 insertions, 29 deletions
diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index 435b8e10be23..9a558bec1fd8 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -120,9 +120,6 @@ static int shm_dotruncate(struct shmfd *shmfd, off_t length); static fo_rdwr_t shm_read; static fo_rdwr_t shm_write; static fo_truncate_t shm_truncate; -static fo_ioctl_t shm_ioctl; -static fo_poll_t shm_poll; -static fo_kqfilter_t shm_kqfilter; static fo_stat_t shm_stat; static fo_close_t shm_close; static fo_chmod_t shm_chmod; @@ -134,9 +131,9 @@ static struct fileops shm_ops = { .fo_read = shm_read, .fo_write = shm_write, .fo_truncate = shm_truncate, - .fo_ioctl = shm_ioctl, - .fo_poll = shm_poll, - .fo_kqfilter = shm_kqfilter, + .fo_ioctl = invfo_ioctl, + .fo_poll = invfo_poll, + .fo_kqfilter = invfo_kqfilter, .fo_stat = shm_stat, .fo_close = shm_close, .fo_chmod = shm_chmod, @@ -355,29 +352,6 @@ shm_truncate(struct file *fp, off_t length, struct ucred *active_cred, } static int -shm_ioctl(struct file *fp, u_long com, void *data, - struct ucred *active_cred, struct thread *td) -{ - - return (EOPNOTSUPP); -} - -static int -shm_poll(struct file *fp, int events, struct ucred *active_cred, - struct thread *td) -{ - - return (EOPNOTSUPP); -} - -static int -shm_kqfilter(struct file *fp, struct knote *kn) -{ - - return (EOPNOTSUPP); -} - -static int shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred, struct thread *td) { |