uipc_shm.c (c9daea0b861f05bedaa176e24c51eb096e28b75e) uipc_shm.c (2d69d0dcc2bb94d874dd0fa77d53b08112b9d530)
1/*-
2 * Copyright (c) 2006, 2011 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 106 unchanged lines hidden (view full) ---

115static void shm_insert(char *path, Fnv32_t fnv, struct shmfd *shmfd);
116static struct shmfd *shm_lookup(char *path, Fnv32_t fnv);
117static int shm_remove(char *path, Fnv32_t fnv, struct ucred *ucred);
118static int shm_dotruncate(struct shmfd *shmfd, off_t length);
119
120static fo_rdwr_t shm_read;
121static fo_rdwr_t shm_write;
122static fo_truncate_t shm_truncate;
1/*-
2 * Copyright (c) 2006, 2011 Robert N. M. Watson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 106 unchanged lines hidden (view full) ---

115static void shm_insert(char *path, Fnv32_t fnv, struct shmfd *shmfd);
116static struct shmfd *shm_lookup(char *path, Fnv32_t fnv);
117static int shm_remove(char *path, Fnv32_t fnv, struct ucred *ucred);
118static int shm_dotruncate(struct shmfd *shmfd, off_t length);
119
120static fo_rdwr_t shm_read;
121static fo_rdwr_t shm_write;
122static fo_truncate_t shm_truncate;
123static fo_ioctl_t shm_ioctl;
124static fo_poll_t shm_poll;
125static fo_kqfilter_t shm_kqfilter;
126static fo_stat_t shm_stat;
127static fo_close_t shm_close;
128static fo_chmod_t shm_chmod;
129static fo_chown_t shm_chown;
130static fo_seek_t shm_seek;
131
132/* File descriptor operations. */
133static struct fileops shm_ops = {
134 .fo_read = shm_read,
135 .fo_write = shm_write,
136 .fo_truncate = shm_truncate,
123static fo_stat_t shm_stat;
124static fo_close_t shm_close;
125static fo_chmod_t shm_chmod;
126static fo_chown_t shm_chown;
127static fo_seek_t shm_seek;
128
129/* File descriptor operations. */
130static struct fileops shm_ops = {
131 .fo_read = shm_read,
132 .fo_write = shm_write,
133 .fo_truncate = shm_truncate,
137 .fo_ioctl = shm_ioctl,
138 .fo_poll = shm_poll,
139 .fo_kqfilter = shm_kqfilter,
134 .fo_ioctl = invfo_ioctl,
135 .fo_poll = invfo_poll,
136 .fo_kqfilter = invfo_kqfilter,
140 .fo_stat = shm_stat,
141 .fo_close = shm_close,
142 .fo_chmod = shm_chmod,
143 .fo_chown = shm_chown,
144 .fo_sendfile = vn_sendfile,
145 .fo_seek = shm_seek,
146 .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
147};

--- 202 unchanged lines hidden (view full) ---

350 error = mac_posixshm_check_truncate(active_cred, fp->f_cred, shmfd);
351 if (error)
352 return (error);
353#endif
354 return (shm_dotruncate(shmfd, length));
355}
356
357static int
137 .fo_stat = shm_stat,
138 .fo_close = shm_close,
139 .fo_chmod = shm_chmod,
140 .fo_chown = shm_chown,
141 .fo_sendfile = vn_sendfile,
142 .fo_seek = shm_seek,
143 .fo_flags = DFLAG_PASSABLE | DFLAG_SEEKABLE
144};

--- 202 unchanged lines hidden (view full) ---

347 error = mac_posixshm_check_truncate(active_cred, fp->f_cred, shmfd);
348 if (error)
349 return (error);
350#endif
351 return (shm_dotruncate(shmfd, length));
352}
353
354static int
358shm_ioctl(struct file *fp, u_long com, void *data,
359 struct ucred *active_cred, struct thread *td)
360{
361
362 return (EOPNOTSUPP);
363}
364
365static int
366shm_poll(struct file *fp, int events, struct ucred *active_cred,
367 struct thread *td)
368{
369
370 return (EOPNOTSUPP);
371}
372
373static int
374shm_kqfilter(struct file *fp, struct knote *kn)
375{
376
377 return (EOPNOTSUPP);
378}
379
380static int
381shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
382 struct thread *td)
383{
384 struct shmfd *shmfd;
385#ifdef MAC
386 int error;
387#endif
388

--- 673 unchanged lines hidden ---
355shm_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
356 struct thread *td)
357{
358 struct shmfd *shmfd;
359#ifdef MAC
360 int error;
361#endif
362

--- 673 unchanged lines hidden ---