Const poisoning and CHECK_ALT_CREAT fixes

This commit is contained in:
christos 1999-02-09 20:29:24 +00:00
parent e8ae49d4af
commit 49692434d8
3 changed files with 28 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_misc.c,v 1.98 1998/12/21 10:34:59 drochner Exp $ */
/* $NetBSD: sunos_misc.c,v 1.99 1999/02/09 20:29:24 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@ -158,7 +158,7 @@ sunos_sys_creat(p, v, retval)
struct sys_open_args ouap;
caddr_t sg = stackgap_init(p->p_emul);
SUNOS_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
SUNOS_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
SCARG(&ouap, path) = SCARG(uap, path);
SCARG(&ouap, flags) = O_WRONLY | O_CREAT | O_TRUNC;
@ -213,7 +213,7 @@ sunos_sys_execv(p, v, retval)
register_t *retval;
{
struct sunos_sys_execv_args /* {
syscallarg(char *) path;
syscallarg(const char *) path;
syscallarg(char **) argv;
} */ *uap = v;
struct sys_execve_args ap;
@ -236,7 +236,7 @@ sunos_sys_execve(p, v, retval)
register_t *retval;
{
struct sunos_sys_execve_args /* {
syscallarg(char *) path;
syscallarg(const char *) path;
syscallarg(char **) argv;
syscallarg(char **) envp;
} */ *uap = v;
@ -818,7 +818,6 @@ sunos_sys_open(p, v, retval)
int ret;
caddr_t sg = stackgap_init(p->p_emul);
SUNOS_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
/* convert mode into NetBSD mode */
l = SCARG(uap, flags);
@ -829,6 +828,11 @@ sunos_sys_open(p, v, retval)
r |= ((l & 0x0100) ? O_EXLOCK : 0);
r |= ((l & 0x2000) ? O_FSYNC : 0);
if (r & O_CREAT)
SUNOS_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
else
SUNOS_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
SCARG(uap, flags) = r;
ret = sys_open(p, (struct sys_open_args *)uap, retval);
@ -1024,7 +1028,7 @@ sunos_sys_mknod(p, v, retval)
struct sunos_sys_mknod_args *uap = v;
caddr_t sg = stackgap_init(p->p_emul);
SUNOS_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
SUNOS_CHECK_ALT_CREAT(p, &sg, SCARG(uap, path));
if (S_ISFIFO(SCARG(uap, mode)))
return sys_mkfifo(p, uap, retval);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sunos_util.h,v 1.5 1998/09/05 14:50:27 christos Exp $ */
/* $NetBSD: sunos_util.h,v 1.6 1999/02/09 20:29:24 christos Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -73,4 +73,7 @@ extern const char sunos_emul_path[];
#define SUNOS_CHECK_ALT_EXIST(p, sgp, path) \
CHECK_ALT_EXIST(p, sgp, sunos_emul_path, path)
#define SUNOS_CHECK_ALT_CREAT(p, sgp, path) \
CHECK_ALT_CREAT(p, sgp, sunos_emul_path, path)
#endif /* !_SUNOS_UTIL_H_ */

View File

@ -1,4 +1,4 @@
$NetBSD: syscalls.master,v 1.50 1998/12/18 18:49:59 drochner Exp $
$NetBSD: syscalls.master,v 1.51 1999/02/09 20:29:24 christos Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@ -51,17 +51,19 @@
2 NOARGS { int sys_fork(void); }
3 NOARGS { int sys_read(int fd, char *buf, u_int nbyte); }
4 NOARGS { int sys_write(int fd, char *buf, u_int nbyte); }
5 STD { int sunos_sys_open(char *path, int flags, int mode); }
5 STD { int sunos_sys_open(const char *path, int flags, \
int mode); }
6 NOARGS { int sys_close(int fd); }
7 STD { int sunos_sys_wait4(int pid, int *status, \
int options, struct rusage *rusage); }
8 STD { int sunos_sys_creat(char *path, int mode); }
8 STD { int sunos_sys_creat(const char *path, int mode); }
9 NOARGS { int sys_link(char *path, char *link); }
10 NOARGS { int sys_unlink(char *path); }
11 STD { int sunos_sys_execv(char *path, char **argp); }
11 STD { int sunos_sys_execv(const char *path, char **argp); }
12 NOARGS { int sys_chdir(char *path); }
13 OBSOL time
14 STD { int sunos_sys_mknod(char *path, int mode, int dev); }
14 STD { int sunos_sys_mknod(const char *path, int mode, \
int dev); }
15 NOARGS { int sys_chmod(char *path, int mode); }
16 NOARGS { int sys_chown(char *path, int uid, int gid); }
17 NOARGS { int sys_obreak(char *nsize); } break
@ -81,14 +83,16 @@
30 UNIMPL sunos_utime
31 UNIMPL sunos_stty
32 UNIMPL sunos_gtty
33 STD { int sunos_sys_access(char *path, int flags); }
33 STD { int sunos_sys_access(const char *path, int flags); }
34 UNIMPL sunos_nice
35 UNIMPL sunos_ftime
36 NOARGS { int sys_sync(void); }
37 NOARGS { int sys_kill(int pid, int signum); }
38 STD { int sunos_sys_stat(char *path, struct stat43 *ub); }
38 STD { int sunos_sys_stat(const char *path, \
struct stat43 *ub); }
39 UNIMPL sunos_setpgrp
40 STD { int sunos_sys_lstat(char *path, struct stat43 *ub); }
40 STD { int sunos_sys_lstat(const char *path, \
struct stat43 *ub); }
41 NOARGS { int sys_dup(u_int fd); }
42 NOARGS { int sys_pipe(void); }
43 UNIMPL sunos_times
@ -110,7 +114,7 @@
56 OBSOL sunos_owait3
57 NOARGS { int sys_symlink(char *path, char *link); }
58 NOARGS { int sys_readlink(char *path, char *buf, int count); }
59 STD { int sunos_sys_execve(char *path, char **argp, \
59 STD { int sunos_sys_execve(const char *path, char **argp, \
char **envp); }
60 NOARGS { int sys_umask(int newmask); }
61 NOARGS { int sys_chroot(char *path); }
@ -247,7 +251,7 @@
#endif
156 NOARGS { int compat_12_sys_getdirentries(int fd, char *buf, \
u_int count, long *basep); }
157 STD { int sunos_sys_statfs(char *path, \
157 STD { int sunos_sys_statfs(const char *path, \
struct sunos_statfs *buf); }
158 STD { int sunos_sys_fstatfs(int fd, \
struct sunos_statfs *buf); }