Deleted Added
full compact
ibcs2_xenix.c (115684) ibcs2_xenix.c (141488)
1/*-
2 * Copyright (c) 1994 Sean Eric Fagan
3 * Copyright (c) 1994 S�ren Schmidt
4 * Copyright (c) 1995 Steven Wallace
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1994 Sean Eric Fagan
3 * Copyright (c) 1994 S�ren Schmidt
4 * Copyright (c) 1995 Steven Wallace
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31#include <sys/cdefs.h>
32__FBSDID("$FreeBSD: head/sys/i386/ibcs2/ibcs2_xenix.c 115684 2003-06-02 06:48:51Z obrien $");
32__FBSDID("$FreeBSD: head/sys/i386/ibcs2/ibcs2_xenix.c 141488 2005-02-07 22:02:18Z jhb $");
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/namei.h>
37#include <sys/sysproto.h>
38#include <sys/jail.h>
39#include <sys/kernel.h>
33
34#include <sys/param.h>
35#include <sys/systm.h>
36#include <sys/namei.h>
37#include <sys/sysproto.h>
38#include <sys/jail.h>
39#include <sys/kernel.h>
40#include <sys/malloc.h>
40#include <sys/filio.h>
41#include <sys/vnode.h>
41#include <sys/filio.h>
42#include <sys/vnode.h>
43#include <sys/syscallsubr.h>
42#include <sys/sysctl.h>
44#include <sys/sysctl.h>
45#include <sys/unistd.h>
43
44#include <machine/cpu.h>
45
46#include <i386/ibcs2/ibcs2_types.h>
47#include <i386/ibcs2/ibcs2_unistd.h>
48#include <i386/ibcs2/ibcs2_signal.h>
49#include <i386/ibcs2/ibcs2_util.h>
50#include <i386/ibcs2/ibcs2_proto.h>

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

190 /* scoinfo (not documented) */
191 td->td_retval[0] = 0;
192 return 0;
193}
194
195int
196xenix_eaccess(struct thread *td, struct xenix_eaccess_args *uap)
197{
46
47#include <machine/cpu.h>
48
49#include <i386/ibcs2/ibcs2_types.h>
50#include <i386/ibcs2/ibcs2_unistd.h>
51#include <i386/ibcs2/ibcs2_signal.h>
52#include <i386/ibcs2/ibcs2_util.h>
53#include <i386/ibcs2/ibcs2_proto.h>

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

193 /* scoinfo (not documented) */
194 td->td_retval[0] = 0;
195 return 0;
196}
197
198int
199xenix_eaccess(struct thread *td, struct xenix_eaccess_args *uap)
200{
198 struct ucred *cred = td->td_ucred;
199 struct vnode *vp;
200 struct nameidata nd;
201 int error, flags;
202 caddr_t sg = stackgap_init();
201 char *path;
202 int error, bsd_flags;
203
203
204 CHECKALTEXIST(td, &sg, uap->path);
204 bsd_flags = 0;
205 if (uap->flags & IBCS2_R_OK)
206 bsd_flags |= R_OK;
207 if (uap->flags & IBCS2_W_OK)
208 bsd_flags |= W_OK;
209 if (uap->flags & IBCS2_X_OK)
210 bsd_flags |= X_OK;
205
211
206 NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
207 uap->path, td);
208 if ((error = namei(&nd)) != 0)
209 return error;
210 vp = nd.ni_vp;
211
212 /* Flags == 0 means only check for existence. */
213 if (uap->flags) {
214 flags = 0;
215 if (uap->flags & IBCS2_R_OK)
216 flags |= VREAD;
217 if (uap->flags & IBCS2_W_OK)
218 flags |= VWRITE;
219 if (uap->flags & IBCS2_X_OK)
220 flags |= VEXEC;
221 if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
222 error = VOP_ACCESS(vp, flags, cred, td);
223 }
224 NDFREE(&nd, NDF_ONLY_PNBUF);
225 vput(vp);
226 return error;
212 CHECKALTEXIST(td, uap->path, &path);
213 error = kern_access(td, path, UIO_SYSSPACE, bsd_flags);
214 free(path, M_TEMP);
215 return (error);
227}
216}