uipc_sem.c (6cec9cad762b6476313fb1f8e931a1647822db6b) uipc_sem.c (2d69d0dcc2bb94d874dd0fa77d53b08112b9d530)
1/*-
2 * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>
3 * Copyright (c) 2003-2005 SPARTA, Inc.
4 * Copyright (c) 2005 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * This software was developed for the FreeBSD Project in part by Network
8 * Associates Laboratories, the Security Research Division of Network

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

121static struct ksem *ksem_hold(struct ksem *ks);
122static void ksem_insert(char *path, Fnv32_t fnv, struct ksem *ks);
123static struct ksem *ksem_lookup(char *path, Fnv32_t fnv);
124static void ksem_module_destroy(void);
125static int ksem_module_init(void);
126static int ksem_remove(char *path, Fnv32_t fnv, struct ucred *ucred);
127static int sem_modload(struct module *module, int cmd, void *arg);
128
1/*-
2 * Copyright (c) 2002 Alfred Perlstein <alfred@FreeBSD.org>
3 * Copyright (c) 2003-2005 SPARTA, Inc.
4 * Copyright (c) 2005 Robert N. M. Watson
5 * All rights reserved.
6 *
7 * This software was developed for the FreeBSD Project in part by Network
8 * Associates Laboratories, the Security Research Division of Network

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

121static struct ksem *ksem_hold(struct ksem *ks);
122static void ksem_insert(char *path, Fnv32_t fnv, struct ksem *ks);
123static struct ksem *ksem_lookup(char *path, Fnv32_t fnv);
124static void ksem_module_destroy(void);
125static int ksem_module_init(void);
126static int ksem_remove(char *path, Fnv32_t fnv, struct ucred *ucred);
127static int sem_modload(struct module *module, int cmd, void *arg);
128
129static fo_rdwr_t ksem_read;
130static fo_rdwr_t ksem_write;
131static fo_truncate_t ksem_truncate;
132static fo_ioctl_t ksem_ioctl;
133static fo_poll_t ksem_poll;
134static fo_kqfilter_t ksem_kqfilter;
135static fo_stat_t ksem_stat;
136static fo_close_t ksem_closef;
137static fo_chmod_t ksem_chmod;
138static fo_chown_t ksem_chown;
139
140/* File descriptor operations. */
141static struct fileops ksem_ops = {
129static fo_stat_t ksem_stat;
130static fo_close_t ksem_closef;
131static fo_chmod_t ksem_chmod;
132static fo_chown_t ksem_chown;
133
134/* File descriptor operations. */
135static struct fileops ksem_ops = {
142 .fo_read = ksem_read,
143 .fo_write = ksem_write,
144 .fo_truncate = ksem_truncate,
145 .fo_ioctl = ksem_ioctl,
146 .fo_poll = ksem_poll,
147 .fo_kqfilter = ksem_kqfilter,
136 .fo_read = invfo_rdwr,
137 .fo_write = invfo_rdwr,
138 .fo_truncate = invfo_truncate,
139 .fo_ioctl = invfo_ioctl,
140 .fo_poll = invfo_poll,
141 .fo_kqfilter = invfo_kqfilter,
148 .fo_stat = ksem_stat,
149 .fo_close = ksem_closef,
150 .fo_chmod = ksem_chmod,
151 .fo_chown = ksem_chown,
152 .fo_sendfile = invfo_sendfile,
153 .fo_flags = DFLAG_PASSABLE
154};
155
156FEATURE(posix_sem, "POSIX semaphores");
157
158static int
142 .fo_stat = ksem_stat,
143 .fo_close = ksem_closef,
144 .fo_chmod = ksem_chmod,
145 .fo_chown = ksem_chown,
146 .fo_sendfile = invfo_sendfile,
147 .fo_flags = DFLAG_PASSABLE
148};
149
150FEATURE(posix_sem, "POSIX semaphores");
151
152static int
159ksem_read(struct file *fp, struct uio *uio, struct ucred *active_cred,
160 int flags, struct thread *td)
161{
162
163 return (EOPNOTSUPP);
164}
165
166static int
167ksem_write(struct file *fp, struct uio *uio, struct ucred *active_cred,
168 int flags, struct thread *td)
169{
170
171 return (EOPNOTSUPP);
172}
173
174static int
175ksem_truncate(struct file *fp, off_t length, struct ucred *active_cred,
176 struct thread *td)
177{
178
179 return (EINVAL);
180}
181
182static int
183ksem_ioctl(struct file *fp, u_long com, void *data,
184 struct ucred *active_cred, struct thread *td)
185{
186
187 return (EOPNOTSUPP);
188}
189
190static int
191ksem_poll(struct file *fp, int events, struct ucred *active_cred,
192 struct thread *td)
193{
194
195 return (EOPNOTSUPP);
196}
197
198static int
199ksem_kqfilter(struct file *fp, struct knote *kn)
200{
201
202 return (EOPNOTSUPP);
203}
204
205static int
206ksem_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
207 struct thread *td)
208{
209 struct ksem *ks;
210#ifdef MAC
211 int error;
212#endif
213

--- 898 unchanged lines hidden ---
153ksem_stat(struct file *fp, struct stat *sb, struct ucred *active_cred,
154 struct thread *td)
155{
156 struct ksem *ks;
157#ifdef MAC
158 int error;
159#endif
160

--- 898 unchanged lines hidden ---