Deleted Added
full compact
ibcs2_fcntl.c (139799) ibcs2_fcntl.c (141488)
1/*-
2 * Copyright (c) 1995 Scott Bartram
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

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

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1995 Scott Bartram
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

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

21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/i386/ibcs2/ibcs2_fcntl.c 139799 2005-01-06 23:22:04Z imp $");
29__FBSDID("$FreeBSD: head/sys/i386/ibcs2/ibcs2_fcntl.c 141488 2005-02-07 22:02:18Z jhb $");
30
31#include "opt_spx_hack.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/fcntl.h>
36#include <sys/file.h>
37#include <sys/filedesc.h>
38#include <sys/lock.h>
30
31#include "opt_spx_hack.h"
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/fcntl.h>
36#include <sys/file.h>
37#include <sys/filedesc.h>
38#include <sys/lock.h>
39#include <sys/malloc.h>
39#include <sys/mutex.h>
40#include <sys/syscallsubr.h>
41#include <sys/sysproto.h>
42#include <sys/ttycom.h>
43
44#include <i386/ibcs2/ibcs2_fcntl.h>
45#include <i386/ibcs2/ibcs2_signal.h>
46#include <i386/ibcs2/ibcs2_proto.h>

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

170 return r;
171}
172
173int
174ibcs2_open(td, uap)
175 struct thread *td;
176 struct ibcs2_open_args *uap;
177{
40#include <sys/mutex.h>
41#include <sys/syscallsubr.h>
42#include <sys/sysproto.h>
43#include <sys/ttycom.h>
44
45#include <i386/ibcs2/ibcs2_fcntl.h>
46#include <i386/ibcs2/ibcs2_signal.h>
47#include <i386/ibcs2/ibcs2_proto.h>

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

171 return r;
172}
173
174int
175ibcs2_open(td, uap)
176 struct thread *td;
177 struct ibcs2_open_args *uap;
178{
178 struct proc *p = td->td_proc;
179 int noctty = uap->flags & IBCS2_O_NOCTTY;
180 int ret;
181 caddr_t sg = stackgap_init();
179 struct proc *p;
180 char *path;
181 int flags, noctty, ret;
182
182
183 uap->flags = cvt_o_flags(uap->flags);
183 p = td->td_proc;
184 noctty = uap->flags & IBCS2_O_NOCTTY;
185 flags = cvt_o_flags(uap->flags);
184 if (uap->flags & O_CREAT)
186 if (uap->flags & O_CREAT)
185 CHECKALTCREAT(td, &sg, uap->path);
187 CHECKALTCREAT(td, uap->path, &path);
186 else
188 else
187 CHECKALTEXIST(td, &sg, uap->path);
188 ret = open(td, (struct open_args *)uap);
189 CHECKALTEXIST(td, uap->path, &path);
190 ret = kern_open(td, path, UIO_SYSSPACE, flags, uap->mode);
189
190#ifdef SPX_HACK
191 if (ret == ENXIO) {
191
192#ifdef SPX_HACK
193 if (ret == ENXIO) {
192 if (!strcmp(uap->path, "/compat/ibcs2/dev/spx"))
193 ret = spx_open(td, uap);
194 if (!strcmp(path, "/compat/ibcs2/dev/spx"))
195 ret = spx_open(td);
196 free(path, M_TEMP);
194 } else
195#endif /* SPX_HACK */
197 } else
198#endif /* SPX_HACK */
199 free(path, M_TEMP);
196 PROC_LOCK(p);
197 if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
198 struct file *fp;
199 int error;
200
201 error = fget(td, td->td_retval[0], &fp);
202 PROC_UNLOCK(p);
203 if (error)

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

212 PROC_UNLOCK(p);
213 return ret;
214}
215
216int
217ibcs2_creat(td, uap)
218 struct thread *td;
219 struct ibcs2_creat_args *uap;
200 PROC_LOCK(p);
201 if (!ret && !noctty && SESS_LEADER(p) && !(p->p_flag & P_CONTROLT)) {
202 struct file *fp;
203 int error;
204
205 error = fget(td, td->td_retval[0], &fp);
206 PROC_UNLOCK(p);
207 if (error)

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

216 PROC_UNLOCK(p);
217 return ret;
218}
219
220int
221ibcs2_creat(td, uap)
222 struct thread *td;
223 struct ibcs2_creat_args *uap;
220{
221 struct open_args cup;
222 caddr_t sg = stackgap_init();
224{
225 char *path;
226 int error;
223
227
224 CHECKALTCREAT(td, &sg, uap->path);
225 cup.path = uap->path;
226 cup.mode = uap->mode;
227 cup.flags = O_WRONLY | O_CREAT | O_TRUNC;
228 return open(td, &cup);
228 CHECKALTCREAT(td, uap->path, &path);
229 error = kern_open(td, path, UIO_SYSSPACE, O_WRONLY | O_CREAT | O_TRUNC,
230 uap->mode);
231 free(path, M_TEMP);
232 return (error);
229}
230
231int
232ibcs2_access(td, uap)
233 struct thread *td;
234 struct ibcs2_access_args *uap;
235{
233}
234
235int
236ibcs2_access(td, uap)
237 struct thread *td;
238 struct ibcs2_access_args *uap;
239{
236 struct access_args cup;
237 caddr_t sg = stackgap_init();
240 char *path;
241 int error;
238
242
239 CHECKALTEXIST(td, &sg, uap->path);
240 cup.path = uap->path;
241 cup.flags = uap->flags;
242 return access(td, &cup);
243 CHECKALTEXIST(td, uap->path, &path);
244 error = kern_access(td, path, UIO_SYSSPACE, uap->flags);
245 free(path, M_TEMP);
246 return (error);
243}
244
245int
246ibcs2_fcntl(td, uap)
247 struct thread *td;
248 struct ibcs2_fcntl_args *uap;
249{
250 intptr_t arg;

--- 59 unchanged lines hidden ---
247}
248
249int
250ibcs2_fcntl(td, uap)
251 struct thread *td;
252 struct ibcs2_fcntl_args *uap;
253{
254 intptr_t arg;

--- 59 unchanged lines hidden ---