diff options
author | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2010-02-28 18:42:20 -0800 |
---|---|---|
committer | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2010-02-28 18:42:20 -0800 |
commit | 8fd04b8338ed5093ec2d1e668fa620b7de44c177 (patch) | |
tree | dc9fcd7d90062fa1e2b53b41a9b6e091194b875a /usr/src/uts/common | |
parent | e3c57d6a57265f8b9bf3871878cf9b92213e1188 (diff) | |
download | illumos-joyent-8fd04b8338ed5093ec2d1e668fa620b7de44c177.tar.gz |
PSARC 2009/657 delete obsolete system call traps
6906485 delete obsolete system call traps
--HG--
rename : usr/src/cmd/truss/xstat.c => usr/src/cmd/truss/stat.c
rename : usr/src/lib/libc/port/gen/dup2.c => usr/src/lib/libc/port/gen/dup.c
rename : usr/src/lib/libc/port/sys/libc_fcntl.c => usr/src/lib/libc/port/sys/fcntl.c
rename : usr/src/lib/libc/port/sys/libc_open.c => usr/src/lib/libc/port/sys/open.c
Diffstat (limited to 'usr/src/uts/common')
30 files changed, 676 insertions, 1355 deletions
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files index 3dba7ff046..b751c7e30a 100644 --- a/usr/src/uts/common/Makefile.files +++ b/usr/src/uts/common/Makefile.files @@ -172,7 +172,6 @@ GENUNIX_OBJS += \ fm.o \ fork.o \ vpm.o \ - fsat.o \ fs_reparse.o \ fs_subr.o \ fsflush.o \ @@ -279,7 +278,6 @@ GENUNIX_OBJS += \ process.o \ rlimit.o \ rmap.o \ - rmdir.o \ rw.o \ rwstlock.o \ sad_conf.o \ diff --git a/usr/src/uts/common/brand/sn1/sn1_brand.c b/usr/src/uts/common/brand/sn1/sn1_brand.c index bf985bfcbf..f75e55045e 100644 --- a/usr/src/uts/common/brand/sn1/sn1_brand.c +++ b/usr/src/uts/common/brand/sn1/sn1_brand.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -772,7 +772,6 @@ _init(void) sn1_emulation_table = kmem_zalloc(NSYSCALL, KM_SLEEP); sn1_emulation_table[SYS_read] = 1; /* 3 */ sn1_emulation_table[SYS_write] = 1; /* 4 */ - sn1_emulation_table[SYS_wait] = 1; /* 7 */ sn1_emulation_table[SYS_time] = 1; /* 13 */ sn1_emulation_table[SYS_getpid] = 1; /* 20 */ sn1_emulation_table[SYS_mount] = 1; /* 21 */ @@ -781,6 +780,7 @@ _init(void) sn1_emulation_table[SYS_getgid] = 1; /* 47 */ sn1_emulation_table[SYS_utssys] = 1; /* 57 */ sn1_emulation_table[SYS_readlink] = 1; /* 90 */ + sn1_emulation_table[SYS_waitid] = 1; /* 107 */ sn1_emulation_table[SYS_uname] = 1; /* 135 */ err = mod_install(&modlinkage); diff --git a/usr/src/uts/common/brand/solaris10/s10_brand.c b/usr/src/uts/common/brand/solaris10/s10_brand.c index 289ddd349a..ce25f37c03 100644 --- a/usr/src/uts/common/brand/solaris10/s10_brand.c +++ b/usr/src/uts/common/brand/solaris10/s10_brand.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -948,24 +949,58 @@ _init(void) * library. */ s10_emulation_table = kmem_zalloc(NSYSCALL, KM_SLEEP); - s10_emulation_table[SYS_exec] = 1; /* 11 */ + s10_emulation_table[S10_SYS_forkall] = 1; /* 2 */ + s10_emulation_table[S10_SYS_open] = 1; /* 5 */ + s10_emulation_table[S10_SYS_wait] = 1; /* 7 */ + s10_emulation_table[S10_SYS_creat] = 1; /* 8 */ + s10_emulation_table[S10_SYS_unlink] = 1; /* 10 */ + s10_emulation_table[S10_SYS_exec] = 1; /* 11 */ + s10_emulation_table[S10_SYS_chown] = 1; /* 16 */ + s10_emulation_table[S10_SYS_stat] = 1; /* 18 */ + s10_emulation_table[S10_SYS_umount] = 1; /* 22 */ + s10_emulation_table[S10_SYS_fstat] = 1; /* 28 */ + s10_emulation_table[S10_SYS_utime] = 1; /* 30 */ + s10_emulation_table[S10_SYS_access] = 1; /* 33 */ + s10_emulation_table[S10_SYS_dup] = 1; /* 41 */ s10_emulation_table[SYS_ioctl] = 1; /* 54 */ s10_emulation_table[SYS_execve] = 1; /* 59 */ s10_emulation_table[SYS_acctctl] = 1; /* 71 */ s10_emulation_table[S10_SYS_issetugid] = 1; /* 75 */ + s10_emulation_table[S10_SYS_fsat] = 1; /* 76 */ + s10_emulation_table[S10_SYS_rmdir] = 1; /* 79 */ s10_emulation_table[SYS_getdents] = 1; /* 81 */ + s10_emulation_table[S10_SYS_poll] = 1; /* 87 */ + s10_emulation_table[S10_SYS_lstat] = 1; /* 88 */ + s10_emulation_table[S10_SYS_fchown] = 1; /* 94 */ +#if defined(__x86) + s10_emulation_table[S10_SYS_xstat] = 1; /* 123 */ + s10_emulation_table[S10_SYS_lxstat] = 1; /* 124 */ + s10_emulation_table[S10_SYS_fxstat] = 1; /* 125 */ + s10_emulation_table[S10_SYS_xmknod] = 1; /* 126 */ +#endif + s10_emulation_table[S10_SYS_lchown] = 1; /* 130 */ + s10_emulation_table[S10_SYS_rename] = 1; /* 134 */ s10_emulation_table[SYS_uname] = 1; /* 135 */ s10_emulation_table[SYS_systeminfo] = 1; /* 139 */ -#ifdef __amd64 + s10_emulation_table[S10_SYS_fork1] = 1; /* 143 */ + s10_emulation_table[S10_SYS_lwp_sema_wait] = 1; /* 147 */ + s10_emulation_table[S10_SYS_utimes] = 1; /* 154 */ +#if defined(__amd64) s10_emulation_table[SYS_lwp_create] = 1; /* 159 */ s10_emulation_table[SYS_lwp_private] = 1; /* 166 */ #endif /* __amd64 */ + s10_emulation_table[S10_SYS_lwp_mutex_lock] = 1; /* 169 */ s10_emulation_table[SYS_pwrite] = 1; /* 174 */ s10_emulation_table[SYS_auditsys] = 1; /* 186 */ s10_emulation_table[SYS_sigqueue] = 1; /* 190 */ s10_emulation_table[SYS_lwp_mutex_timedlock] = 1; /* 210 */ s10_emulation_table[SYS_getdents64] = 1; /* 213 */ + s10_emulation_table[S10_SYS_stat64] = 1; /* 215 */ + s10_emulation_table[S10_SYS_lstat64] = 1; /* 216 */ + s10_emulation_table[S10_SYS_fstat64] = 1; /* 217 */ s10_emulation_table[SYS_pwrite64] = 1; /* 223 */ + s10_emulation_table[S10_SYS_creat64] = 1; /* 224 */ + s10_emulation_table[S10_SYS_open64] = 1; /* 225 */ s10_emulation_table[SYS_zone] = 1; /* 227 */ s10_emulation_table[SYS_lwp_mutex_trylock] = 1; /* 251 */ diff --git a/usr/src/uts/common/brand/solaris10/s10_brand.h b/usr/src/uts/common/brand/solaris10/s10_brand.h index 80bd78fe6b..8fdb2bd65f 100644 --- a/usr/src/uts/common/brand/solaris10/s10_brand.h +++ b/usr/src/uts/common/brand/solaris10/s10_brand.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -100,10 +100,44 @@ enum s10_emulated_features { #define AT_SUN_BRAND_S10_LDDATA AT_SUN_BRAND_AUX1 /* - * S10 system call codes for S10 traps that have been removed or - * re-assigned. + * S10 system call codes for S10 traps that have been removed or reassigned, + * or that are to be removed or reassigned after the dtrace syscall provider + * has been reengineered to deal properly with syscall::open (for example). */ +#define S10_SYS_forkall 2 +#define S10_SYS_open 5 +#define S10_SYS_wait 7 +#define S10_SYS_creat 8 +#define S10_SYS_unlink 10 +#define S10_SYS_exec 11 +#define S10_SYS_chown 16 +#define S10_SYS_stat 18 +#define S10_SYS_umount 22 +#define S10_SYS_fstat 28 +#define S10_SYS_utime 30 +#define S10_SYS_access 33 +#define S10_SYS_dup 41 #define S10_SYS_issetugid 75 +#define S10_SYS_fsat 76 +#define S10_SYS_rmdir 79 +#define S10_SYS_poll 87 +#define S10_SYS_lstat 88 +#define S10_SYS_fchown 94 +#define S10_SYS_xstat 123 +#define S10_SYS_lxstat 124 +#define S10_SYS_fxstat 125 +#define S10_SYS_xmknod 126 +#define S10_SYS_lchown 130 +#define S10_SYS_rename 134 +#define S10_SYS_fork1 143 +#define S10_SYS_lwp_sema_wait 147 +#define S10_SYS_utimes 154 +#define S10_SYS_lwp_mutex_lock 169 +#define S10_SYS_stat64 215 +#define S10_SYS_lstat64 216 +#define S10_SYS_fstat64 217 +#define S10_SYS_creat64 224 +#define S10_SYS_open64 225 /* * solaris10-brand-specific attributes diff --git a/usr/src/uts/common/c2/audit.c b/usr/src/uts/common/c2/audit.c index a39d9b86e3..7c12cf3406 100644 --- a/usr/src/uts/common/c2/audit.c +++ b/usr/src/uts/common/c2/audit.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -300,11 +300,11 @@ audit_savepath( */ if (tad->tad_flag) { - if (flag && (tad->tad_scid == SYS_open || + if (flag && + (tad->tad_scid == SYS_open || tad->tad_scid == SYS_open64 || - tad->tad_scid == SYS_creat || - tad->tad_scid == SYS_creat64 || - tad->tad_scid == SYS_fsat)) { + tad->tad_scid == SYS_openat || + tad->tad_scid == SYS_openat64)) { tad->tad_ctrl |= PAD_TRUE_CREATE; } @@ -328,7 +328,7 @@ audit_savepath( } } - /* free up space if we're not going to save path (open, crate) */ + /* free up space if we're not going to save path (open, creat) */ if ((tad->tad_ctrl & PAD_SAVPATH) == 0) { if (tad->tad_aupath != NULL) { au_pathrele(tad->tad_aupath); @@ -366,7 +366,7 @@ audit_pathbuild(struct pathname *pnp) mutex_enter(&pad->pad_lock); if (tad->tad_aupath != NULL) { pfxapp = tad->tad_aupath; - } else if (tad->tad_scid == SYS_fsat && pnp->pn_buf[0] != '/') { + } else if ((tad->tad_ctrl & PAD_ATCALL) && pnp->pn_buf[0] != '/') { ASSERT(tad->tad_atpath != NULL); pfxapp = tad->tad_atpath; } else if (tad->tad_ctrl & PAD_ABSPATH) { @@ -378,7 +378,7 @@ audit_pathbuild(struct pathname *pnp) mutex_exit(&pad->pad_lock); /* get an expanded buffer to hold the anchored path */ - newsect = tad->tad_ctrl & PAD_ATPATH; + newsect = tad->tad_ctrl & PAD_ATTPATH; newapp = au_pathdup(pfxapp, newsect, len); au_pathrele(pfxapp); @@ -400,7 +400,7 @@ audit_pathbuild(struct pathname *pnp) tad->tad_aupath = newapp; /* for case where multiple lookups in one syscall (rename) */ - tad->tad_ctrl &= ~(PAD_ABSPATH | PAD_ATPATH); + tad->tad_ctrl &= ~(PAD_ABSPATH | PAD_ATTPATH); } @@ -1120,9 +1120,10 @@ audit_setf(file_t *fp, int fd) tad = T2A(curthread); fad = F2A(fp); - if (!(tad->tad_scid == SYS_open || tad->tad_scid == SYS_creat || - tad->tad_scid == SYS_open64 || tad->tad_scid == SYS_creat64 || - tad->tad_scid == SYS_fsat)) + if (!(tad->tad_scid == SYS_open || + tad->tad_scid == SYS_open64 || + tad->tad_scid == SYS_openat || + tad->tad_scid == SYS_openat64)) return; /* no path */ @@ -1138,7 +1139,7 @@ audit_setf(file_t *fp, int fd) tad->tad_vn = NULL; if (!(tad->tad_ctrl & PAD_TRUE_CREATE)) { - /* adjust event type */ + /* adjust event type by dropping the 'creat' part */ switch (tad->tad_event) { case AUE_OPEN_RC: tad->tad_event = AUE_OPEN_R; @@ -1293,57 +1294,43 @@ audit_setfsat_path(int argnum) struct f_audit_data *fad; p_audit_data_t *pad; /* current process */ struct a { - long id; long arg1; long arg2; long arg3; long arg4; long arg5; } *uap; - struct b { - long arg1; - long arg2; - long arg3; - long arg4; - long arg5; - } *uap1; if (clwp == NULL) return; - uap1 = (struct b *)&clwp->lwp_ap[1]; uap = (struct a *)clwp->lwp_ap; tad = U2A(u); - ASSERT(tad != NULL); - if (tad->tad_scid != SYS_fsat) - return; - - switch (argnum) { - case 1: - fd = (uint32_t)uap1->arg1; + switch (tad->tad_scid) { + case SYS_faccessat: + case SYS_fchownat: + case SYS_fstatat: + case SYS_fstatat64: + case SYS_openat: + case SYS_openat64: + case SYS_unlinkat: + fd = uap->arg1; break; - case 2: - fd = (uint32_t)uap1->arg2; - break; - case 3: - fd = (uint32_t)uap1->arg3; - break; - case 4: - fd = (uint32_t)uap1->arg4; + case SYS_renameat: + if (argnum == 3) + fd = uap->arg3; + else + fd = uap->arg1; break; - case 5: - fd = (uint32_t)uap1->arg5; + case SYS_utimesys: + fd = uap->arg2; break; default: return; } - if (uap->id == 9 && tad->tad_atpath != NULL) { /* openattrdir */ - tad->tad_ctrl |= PAD_ATPATH; - return; - } if (tad->tad_atpath != NULL) { au_pathrele(tad->tad_atpath); tad->tad_atpath = NULL; @@ -1353,7 +1340,6 @@ audit_setfsat_path(int argnum) tad->tad_ctrl |= PAD_NOPATH; return; } - fad = F2A(fp); ASSERT(fad); if (fad->fad_aupath == NULL) { @@ -1678,8 +1664,11 @@ audit_getf(int fd) tad = T2A(curthread); - if (!(tad->tad_scid == SYS_open || tad->tad_scid == SYS_creat)) - return; + if (!(tad->tad_scid == SYS_openat || + tad->tad_scid == SYS_openat64 || + tad->tad_scid == SYS_open || + tad->tad_scid == SYS_open64)) + return (0); #endif return (0); } diff --git a/usr/src/uts/common/c2/audit_event.c b/usr/src/uts/common/c2/audit_event.c index fbb96fcaf3..ed1d8c8f76 100644 --- a/usr/src/uts/common/c2/audit_event.c +++ b/usr/src/uts/common/c2/audit_event.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -81,14 +81,16 @@ char _depends_on[] = "fs/sockfs"; +static au_event_t aui_fchownat(au_event_t); static au_event_t aui_open(au_event_t); -static au_event_t aui_fsat(au_event_t); +static au_event_t aui_openat(au_event_t); +static au_event_t aui_unlinkat(au_event_t); +static au_event_t aui_fstatat(au_event_t); static au_event_t aui_msgsys(au_event_t); static au_event_t aui_shmsys(au_event_t); static au_event_t aui_semsys(au_event_t); static au_event_t aui_utssys(au_event_t); static au_event_t aui_fcntl(au_event_t); -static au_event_t aui_execv(au_event_t); static au_event_t aui_execve(au_event_t); static au_event_t aui_memcntl(au_event_t); static au_event_t aui_sysinfo(au_event_t); @@ -103,20 +105,20 @@ static au_event_t aui_labelsys(au_event_t); static au_event_t aui_setpgrp(au_event_t); static void aus_open(struct t_audit_data *); +static void aus_openat(struct t_audit_data *); static void aus_acl(struct t_audit_data *); static void aus_acct(struct t_audit_data *); static void aus_chown(struct t_audit_data *); static void aus_fchown(struct t_audit_data *); static void aus_lchown(struct t_audit_data *); +static void aus_fchownat(struct t_audit_data *); static void aus_chmod(struct t_audit_data *); static void aus_facl(struct t_audit_data *); static void aus_fchmod(struct t_audit_data *); static void aus_fcntl(struct t_audit_data *); -static void aus_fsat(struct t_audit_data *); static void aus_mkdir(struct t_audit_data *); static void aus_mknod(struct t_audit_data *); static void aus_mount(struct t_audit_data *); -static void aus_umount(struct t_audit_data *); static void aus_umount2(struct t_audit_data *); static void aus_msgsys(struct t_audit_data *); static void aus_semsys(struct t_audit_data *); @@ -143,7 +145,6 @@ static void aus_auditsys(struct t_audit_data *); static void aus_sysinfo(struct t_audit_data *); static void aus_modctl(struct t_audit_data *); static void aus_kill(struct t_audit_data *); -static void aus_xmknod(struct t_audit_data *); static void aus_setregid(struct t_audit_data *); static void aus_setreuid(struct t_audit_data *); static void aus_labelsys(struct t_audit_data *); @@ -152,7 +153,6 @@ static void auf_mknod(struct t_audit_data *, int, rval_t *); static void auf_msgsys(struct t_audit_data *, int, rval_t *); static void auf_semsys(struct t_audit_data *, int, rval_t *); static void auf_shmsys(struct t_audit_data *, int, rval_t *); -static void auf_xmknod(struct t_audit_data *, int, rval_t *); static void auf_read(struct t_audit_data *, int, rval_t *); static void auf_write(struct t_audit_data *, int, rval_t *); @@ -201,7 +201,7 @@ aui_null, AUE_NULL, aus_null, /* 0 unused (indirect) */ auf_null, 0, aui_null, AUE_EXIT, aus_null, /* 1 exit */ auf_null, S2E_NPT, -aui_null, AUE_FORKALL, aus_null, /* 2 forkall */ +aui_null, AUE_NULL, aus_null, /* 2 (loadable) was forkall */ auf_null, 0, aui_null, AUE_READ, aus_null, /* 3 read */ auf_read, S2E_PUB, @@ -211,16 +211,16 @@ aui_open, AUE_OPEN, aus_open, /* 5 open */ auf_null, S2E_SP, aui_null, AUE_CLOSE, aus_close, /* 6 close */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 7 wait */ +aui_null, AUE_NULL, aus_null, /* 7 (loadable) was wait */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 8 (loadable) was creat */ auf_null, 0, -aui_null, AUE_CREAT, aus_null, /* 8 create */ - auf_null, S2E_SP, aui_null, AUE_LINK, aus_null, /* 9 link */ auf_null, 0, aui_null, AUE_UNLINK, aus_null, /* 10 unlink */ auf_null, 0, -aui_execv, AUE_EXEC, aus_null, /* 11 exec */ - auf_null, S2E_MLD, +aui_null, AUE_NULL, aus_null, /* 11 (loadable) was exec */ + auf_null, 0, aui_null, AUE_CHDIR, aus_null, /* 12 chdir */ auf_null, S2E_SP, aui_null, AUE_NULL, aus_null, /* 13 time */ @@ -241,7 +241,7 @@ aui_null, AUE_NULL, aus_null, /* 20 getpid */ auf_null, 0, aui_null, AUE_MOUNT, aus_mount, /* 21 mount */ auf_null, S2E_MLD, -aui_null, AUE_UMOUNT, aus_umount, /* 22 umount */ +aui_null, AUE_NULL, aus_null, /* 22 (loadable) was umount */ auf_null, 0, aui_null, AUE_SETUID, aus_setuid, /* 23 setuid */ auf_null, 0, @@ -249,7 +249,7 @@ aui_null, AUE_NULL, aus_null, /* 24 getuid */ auf_null, 0, aui_null, AUE_STIME, aus_null, /* 25 stime */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 26 (loadable) was ptrace */ +aui_null, AUE_NULL, aus_null, /* 26 pcsample */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 27 alarm */ auf_null, 0, @@ -257,7 +257,7 @@ aui_null, AUE_NULL, aus_null, /* 28 fstat */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 29 pause */ auf_null, 0, -aui_null, AUE_UTIME, aus_null, /* 30 utime */ +aui_null, AUE_NULL, aus_null, /* 30 (loadable) was utime */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 31 stty (TIOCSETP-audit?) */ auf_null, 0, @@ -279,24 +279,23 @@ aui_setpgrp, AUE_SETPGRP, aus_setpgrp, /* 39 setpgrp */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 40 uucopystr */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 41 dup */ +aui_null, AUE_NULL, aus_null, /* 41 (loadable) was dup */ auf_null, 0, -aui_null, AUE_PIPE, aus_null, /* 42 pipe */ +aui_null, AUE_PIPE, aus_null, /* 42 (loadable) pipe */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 43 times */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 44 profil */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 45 (loadable) */ - /* was proc lock */ - auf_null, 0, +aui_null, AUE_ACCESS, aus_null, /* 45 faccessat */ + auf_null, S2E_PUB | S2E_ATC, aui_null, AUE_SETGID, aus_setgid, /* 46 setgid */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 47 getgid */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 48 sig */ +aui_null, AUE_NULL, aus_null, /* 48 (loadable) was ssig */ auf_null, 0, -aui_msgsys, AUE_MSGSYS, aus_msgsys, /* 49 (loadable) was msgsys */ +aui_msgsys, AUE_MSGSYS, aus_msgsys, /* 49 (loadable) msgsys */ auf_msgsys, 0, #if defined(__x86) aui_null, AUE_NULL, aus_null, /* 50 sysi86 */ @@ -305,18 +304,18 @@ aui_null, AUE_NULL, aus_null, /* 50 sysi86 */ aui_null, AUE_NULL, aus_null, /* 50 (loadable) was sys3b */ auf_null, 0, #endif /* __x86 */ -aui_null, AUE_ACCT, aus_acct, /* 51 acct */ +aui_null, AUE_ACCT, aus_acct, /* 51 (loadable) sysacct */ auf_null, 0, -aui_shmsys, AUE_SHMSYS, aus_shmsys, /* 52 shared memory */ +aui_shmsys, AUE_SHMSYS, aus_shmsys, /* 52 (loadable) shmsys */ auf_shmsys, 0, -aui_semsys, AUE_SEMSYS, aus_semsys, /* 53 IPC semaphores */ +aui_semsys, AUE_SEMSYS, aus_semsys, /* 53 (loadable) semsys */ auf_semsys, 0, aui_null, AUE_IOCTL, aus_ioctl, /* 54 ioctl */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 55 uadmin */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 56 (loadable) was uexch */ - auf_null, 0, +aui_fchownat, AUE_NULL, aus_fchownat, /* 56 fchownat */ + auf_null, S2E_ATC, aui_utssys, AUE_FUSERS, aus_null, /* 57 utssys */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 58 fsync */ @@ -331,38 +330,35 @@ aui_fcntl, AUE_FCNTL, aus_fcntl, /* 62 fcntl */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 63 ulimit */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 64 (loadable) */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 65 (loadable) */ +aui_null, AUE_RENAME, aus_null, /* 64 renameat */ + auf_null, S2E_ATC, +aui_unlinkat, AUE_NULL, aus_null, /* 65 unlinkat */ + auf_null, S2E_ATC, +aui_fstatat, AUE_NULL, aus_null, /* 66 fstatat */ + auf_null, S2E_PUB | S2E_ATC, +aui_fstatat, AUE_NULL, aus_null, /* 67 fstatat64 */ + auf_null, S2E_PUB | S2E_ATC, +aui_openat, AUE_OPEN, aus_openat, /* 68 openat */ + auf_null, S2E_SP | S2E_ATC, +aui_openat, AUE_OPEN, aus_openat, /* 69 openat64 */ + auf_null, S2E_SP | S2E_ATC, +aui_null, AUE_NULL, aus_null, /* 70 tasksys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 66 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 71 (loadable) acctctl */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 67 (loadable) */ - /* file locking call */ +aui_null, AUE_NULL, aus_null, /* 72 (loadable) exacct */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 68 (loadable) */ - /* local system calls */ +aui_null, AUE_NULL, aus_null, /* 73 getpagesizes */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 69 (loadable) inode open */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 70 (loadable) was advfs */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 71 (loadable) was unadvfs */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 72 (loadable) was notused */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 73 (loadable) was notused */ - auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 74 (loadable) was notused */ +aui_null, AUE_NULL, aus_null, /* 74 rctlsys */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 75 sidsys */ - /* was sigret (SunOS) */ auf_null, 0, -aui_fsat, AUE_FSAT, aus_fsat, /* 76 fsat */ +aui_null, AUE_NULL, aus_null, /* 76 (loadable) was fsat */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 77 (loadable) was rfstop */ +aui_null, AUE_NULL, aus_null, /* 77 syslwp_park */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 78 (loadable) was rfssys */ +aui_null, AUE_NULL, aus_null, /* 78 sendfilev */ auf_null, 0, aui_null, AUE_RMDIR, aus_null, /* 79 rmdir */ auf_null, 0, @@ -371,10 +367,8 @@ aui_null, AUE_MKDIR, aus_mkdir, /* 80 mkdir */ aui_null, AUE_NULL, aus_null, /* 81 getdents */ auf_null, 0, aui_privsys, AUE_NULL, aus_null, /* 82 privsys */ - /* was libattach */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 83 (loadable) */ - /* was libdetach */ +aui_null, AUE_NULL, aus_null, /* 83 ucredsys */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 84 sysfs */ auf_null, 0, @@ -382,7 +376,7 @@ aui_null, AUE_GETMSG, aus_getmsg, /* 85 getmsg */ auf_null, 0, aui_null, AUE_PUTMSG, aus_putmsg, /* 86 putmsg */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 87 poll */ +aui_null, AUE_NULL, aus_null, /* 87 (loadable) was poll */ auf_null, 0, aui_null, AUE_LSTAT, aus_null, /* 88 lstat */ auf_null, S2E_PUB, @@ -410,22 +404,21 @@ aui_null, AUE_NULL, aus_null, /* 99 sigpending */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 100 setcontext */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 101 (loadable) was evsys */ +aui_null, AUE_NULL, aus_null, /* 101 (loadable) */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 102 (loadable) */ - /* was evtrapret */ auf_null, 0, aui_null, AUE_STATVFS, aus_null, /* 103 statvfs */ auf_null, S2E_PUB, aui_null, AUE_NULL, aus_null, /* 104 fstatvfs */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 105 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 105 getloadavg */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 106 nfssys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 107 waitset */ +aui_null, AUE_NULL, aus_null, /* 107 waitsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 108 sigsendset */ +aui_null, AUE_NULL, aus_null, /* 108 sigsendsys */ auf_null, 0, #if defined(__x86) aui_null, AUE_NULL, aus_null, /* 109 hrtsys */ @@ -434,12 +427,12 @@ aui_null, AUE_NULL, aus_null, /* 109 hrtsys */ aui_null, AUE_NULL, aus_null, /* 109 (loadable) */ auf_null, 0, #endif /* __x86 */ -aui_null, AUE_NULL, aus_null, /* 110 (loadable) was acancel */ +aui_null, AUE_UTIMES, aus_null, /* 110 utimesys */ + auf_null, S2E_ATC, +aui_null, AUE_NULL, aus_null, /* 111 sigresend */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 111 (loadable) was async */ +aui_null, AUE_PRIOCNTLSYS, aus_priocntlsys, /* 112 priocntlsys */ auf_null, 0, -aui_null, AUE_PRIOCNTLSYS, aus_priocntlsys, - auf_null, 0, /* 112 priocntlsys */ aui_null, AUE_PATHCONF, aus_null, /* 113 pathconf */ auf_null, S2E_PUB, aui_null, AUE_NULL, aus_null, /* 114 mincore */ @@ -460,15 +453,15 @@ aui_null, AUE_READ, aus_null, /* 121 readv */ auf_read, S2E_PUB, aui_null, AUE_WRITE, aus_null, /* 122 writev */ auf_write, 0, -aui_null, AUE_STAT, aus_null, /* 123 xstat (x86) */ - auf_null, S2E_PUB, -aui_null, AUE_LSTAT, aus_null, /* 124 lxstat (x86) */ - auf_null, S2E_PUB, -aui_null, AUE_NULL, aus_null, /* 125 fxstat (x86) */ +aui_null, AUE_NULL, aus_null, /* 123 (loadable) was xstat */ auf_null, 0, -aui_null, AUE_MKNOD, aus_xmknod, /* 126 xmknod (x86) */ - auf_xmknod, 0, -aui_null, AUE_NULL, aus_null, /* 127 (loadable) was clocal */ +aui_null, AUE_NULL, aus_null, /* 124 (loadable) was lxstat */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 125 (loadable) was fxstat */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 126 (loadable) was xmknod */ + auf_null, 0, +aui_null, AUE_NULL, aus_null, /* 127 mmapobj */ auf_null, 0, aui_null, AUE_SETRLIMIT, aus_null, /* 128 setrlimit */ auf_null, 0, @@ -494,13 +487,13 @@ aui_null, AUE_ADJTIME, aus_null, /* 138 adjtime */ auf_null, 0, aui_sysinfo, AUE_SYSINFO, aus_sysinfo, /* 139 systeminfo */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 140 reserved */ +aui_null, AUE_NULL, aus_null, /* 140 (loadable) sharefs */ auf_null, 0, aui_null, AUE_SETEUID, aus_seteuid, /* 141 seteuid */ auf_null, 0, aui_forksys, AUE_NULL, aus_null, /* 142 forksys */ auf_null, 0, -aui_null, AUE_FORK1, aus_null, /* 143 fork1 */ +aui_null, AUE_NULL, aus_null, /* 143 (loadable) was fork1 */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 144 sigwait */ auf_null, 0, @@ -508,21 +501,22 @@ aui_null, AUE_NULL, aus_null, /* 145 lwp_info */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 146 yield */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 147 lwp_sema_wait */ +aui_null, AUE_NULL, aus_null, /* 147 (loadable) */ + /* was lwp_sema_wait */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 148 lwp_sema_post */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 149 lwp_sema_trywait */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 150 (loadable reserved) */ +aui_null, AUE_NULL, aus_null, /* 150 lwp_detach */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 151 (loadable reserved) */ +aui_null, AUE_NULL, aus_null, /* 151 corectl */ auf_null, 0, aui_modctl, AUE_MODCTL, aus_modctl, /* 152 modctl */ auf_null, 0, aui_null, AUE_FCHROOT, aus_null, /* 153 fchroot */ auf_null, 0, -aui_null, AUE_UTIMES, aus_null, /* 154 utimes */ +aui_null, AUE_NULL, aus_null, /* 154 (loadable) was utimes */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 155 vhangup */ auf_null, 0, @@ -544,17 +538,16 @@ aui_null, AUE_NULL, aus_null, /* 163 lwp_kill */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 164 lwp_self */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 165 (loadable) */ - /* was lwp_setprivate */ +aui_null, AUE_NULL, aus_null, /* 165 lwp_sigmask */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 166 (loadable) */ - /* was lwp_getprivate */ +aui_null, AUE_NULL, aus_null, /* 166 lwp_private */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 167 lwp_wait */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 168 lwp_mutex_wakeup */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 169 lwp_mutex_lock */ +aui_null, AUE_NULL, aus_null, /* 169 (loadable) */ + /* was lwp_mutex_lock */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 170 lwp_cond_wait */ auf_null, 0, @@ -568,22 +561,21 @@ aui_null, AUE_WRITE, aus_null, /* 174 pwrite */ auf_write, 0, aui_null, AUE_NULL, aus_null, /* 175 llseek */ auf_null, 0, -aui_null, AUE_INST_SYNC, aus_inst_sync, /* 176 (loadable) */ - /* aus_inst_sync */ +aui_null, AUE_INST_SYNC, aus_inst_sync, /* 176 (loadable) inst_sync */ auf_null, 0, aui_null, AUE_BRANDSYS, aus_brandsys, /* 177 brandsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 178 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 178 (loadable) kaio */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 179 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 179 (loadable) cpc */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 180 (loadable) kaio */ +aui_null, AUE_NULL, aus_null, /* 180 lgrpsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 181 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 181 rusagesys */ auf_null, 0, aui_portfs, AUE_PORTFS, aus_null, /* 182 (loadable) portfs */ auf_null, S2E_MLD, -aui_null, AUE_NULL, aus_null, /* 183 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 183 pollsys */ auf_null, 0, aui_labelsys, AUE_NULL, aus_labelsys, /* 184 labelsys */ auf_null, 0, @@ -591,8 +583,8 @@ aui_acl, AUE_ACLSET, aus_acl, /* 185 acl */ auf_null, 0, aui_auditsys, AUE_AUDITSYS, aus_auditsys, /* 186 auditsys */ auf_null, 0, -aui_null, AUE_PROCESSOR_BIND, aus_processor_bind, - auf_null, 0, /* 187 processor_bind */ +aui_null, AUE_PROCESSOR_BIND, aus_processor_bind, /* 187 processor_bind */ + auf_null, 0, aui_null, AUE_NULL, aus_null, /* 188 processor_info */ auf_null, 0, aui_null, AUE_P_ONLINE, aus_p_online, /* 189 p_online */ @@ -633,7 +625,7 @@ aui_null, AUE_NULL, aus_null, /* 206 schedctl */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 207 (loadable) pset */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 208 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 208 sparc_utrap_install */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 209 resolvepath */ auf_null, 0, @@ -643,7 +635,7 @@ aui_null, AUE_NULL, aus_null, /* 211 lwp_sema_timedwait */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 212 lwp_rwlock_sys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 213 getdents64 (__ppc) */ +aui_null, AUE_NULL, aus_null, /* 213 getdents64 */ auf_null, 0, aui_null, AUE_MMAP, aus_mmap, /* 214 mmap64 */ auf_null, 0, @@ -665,17 +657,17 @@ aui_null, AUE_READ, aus_null, /* 222 pread64 */ auf_read, S2E_PUB, aui_null, AUE_WRITE, aus_null, /* 223 pwrite64 */ auf_write, 0, -aui_null, AUE_CREAT, aus_null, /* 224 creat64 */ - auf_null, S2E_SP, +aui_null, AUE_NULL, aus_null, /* 224 (loadable) was creat64 */ + auf_null, 0, aui_open, AUE_OPEN, aus_open, /* 225 open64 */ auf_null, S2E_SP, aui_null, AUE_NULL, aus_null, /* 226 (loadable) rpcsys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 227 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 227 zone */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 228 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 228 (loadable) autofssys */ auf_null, 0, -aui_null, AUE_NULL, aus_null, /* 229 (loadable) */ +aui_null, AUE_NULL, aus_null, /* 229 getcwd */ auf_null, 0, aui_null, AUE_SOCKET, aus_socket, /* 230 so_socket */ auf_null, 0, @@ -715,7 +707,7 @@ aui_null, AUE_SOCKCONFIG, aus_sockconfig, /* 247 sockconfig */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 248 ntp_gettime */ auf_null, 0, -aui_null, AUE_NTP_ADJTIME, aus_null, /* 249 ntp_adjtime */ +aui_null, AUE_NTP_ADJTIME, aus_null, /* 249 ntp_adjtime */ auf_null, 0, aui_null, AUE_NULL, aus_null, /* 250 lwp_mutex_unlock */ auf_null, 0, @@ -840,6 +832,51 @@ aus_lchown(struct t_audit_data *tad) au_uwrite(au_to_arg32(3, "new file gid", gid)); } +static au_event_t +aui_fchownat(au_event_t e) +{ + klwp_t *clwp = ttolwp(curthread); + + struct a { + long fd; + long fname; /* char * */ + long uid; + long gid; + long flags; + } *uap = (struct a *)clwp->lwp_ap; + + if (uap->fname == NULL) + e = AUE_FCHOWN; + else if (uap->flags & AT_SYMLINK_NOFOLLOW) + e = AUE_LCHOWN; + else + e = AUE_CHOWN; + + return (e); +} + +/*ARGSUSED*/ +static void +aus_fchownat(struct t_audit_data *tad) +{ + klwp_t *clwp = ttolwp(curthread); + uint32_t uid, gid; + + struct a { + long fd; + long fname; /* char * */ + long uid; + long gid; + long flags; + } *uap = (struct a *)clwp->lwp_ap; + + uid = (uint32_t)uap->uid; + gid = (uint32_t)uap->gid; + + au_uwrite(au_to_arg32(3, "new file uid", uid)); + au_uwrite(au_to_arg32(4, "new file gid", gid)); +} + /* chmod start function */ /*ARGSUSED*/ static void @@ -901,11 +938,64 @@ aus_fchmod(struct t_audit_data *tad) releasef(fd); } +/* + * convert open mode to appropriate open event + */ +au_event_t +open_event(uint_t fm) +{ + au_event_t e; + + switch (fm & (O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC)) { + case O_RDONLY: + e = AUE_OPEN_R; + break; + case O_RDONLY | O_CREAT: + e = AUE_OPEN_RC; + break; + case O_RDONLY | O_TRUNC: + e = AUE_OPEN_RT; + break; + case O_RDONLY | O_TRUNC | O_CREAT: + e = AUE_OPEN_RTC; + break; + case O_WRONLY: + e = AUE_OPEN_W; + break; + case O_WRONLY | O_CREAT: + e = AUE_OPEN_WC; + break; + case O_WRONLY | O_TRUNC: + e = AUE_OPEN_WT; + break; + case O_WRONLY | O_TRUNC | O_CREAT: + e = AUE_OPEN_WTC; + break; + case O_RDWR: + e = AUE_OPEN_RW; + break; + case O_RDWR | O_CREAT: + e = AUE_OPEN_RWC; + break; + case O_RDWR | O_TRUNC: + e = AUE_OPEN_RWT; + break; + case O_RDWR | O_TRUNC | O_CREAT: + e = AUE_OPEN_RWTC; + break; + default: + e = AUE_NULL; + break; + } -/* convert open to appropriate event */ + return (e); +} + +/* ARGSUSED */ static au_event_t aui_open(au_event_t e) { + t_audit_data_t *tad = T2A(curthread); klwp_t *clwp = ttolwp(curthread); uint_t fm; @@ -917,22 +1007,13 @@ aui_open(au_event_t e) fm = (uint_t)uap->fmode; - if (fm & O_WRONLY) - e = AUE_OPEN_W; - else if (fm & O_RDWR) - e = AUE_OPEN_RW; - else - e = AUE_OPEN_R; - - if (fm & O_CREAT) - e += 1; - if (fm & O_TRUNC) - e += 2; + /* convert to appropriate au_ctrl */ + if (fm & (FXATTR | FXATTRDIROPEN)) + tad->tad_ctrl |= PAD_ATTPATH; - return (e); + return (open_event(fm)); } -/*ARGSUSED*/ static void aus_open(struct t_audit_data *tad) { @@ -948,130 +1029,93 @@ aus_open(struct t_audit_data *tad) fm = (uint_t)uap->fmode; /* If no write, create, or trunc modes, mark as a public op */ - if (!(fm & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))) + if ((fm & (O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC)) == O_RDONLY) tad->tad_ctrl |= PAD_PUBLIC_EV; } -/* convert openat(2) to appropriate event */ +/* ARGSUSED */ static au_event_t -aui_fsat(au_event_t e) +aui_openat(au_event_t e) { - t_audit_data_t *tad = U2A(u); + t_audit_data_t *tad = T2A(curthread); klwp_t *clwp = ttolwp(curthread); - uint_t fmcode, fm; + uint_t fm; + struct a { - long id; - long arg1; - long arg2; - long arg3; - long arg4; - long arg5; + long filedes; + long fnamep; /* char * */ + long fmode; + long cmode; } *uap = (struct a *)clwp->lwp_ap; - fmcode = (uint_t)uap->id; - - switch (fmcode) { + fm = (uint_t)uap->fmode; - case 0: /* openat */ - case 1: /* openat64 */ - fm = (uint_t)uap->arg3; - if (fm & O_WRONLY) - e = AUE_OPENAT_W; - else if (fm & O_RDWR) - e = AUE_OPENAT_RW; - else - e = AUE_OPENAT_R; + /* convert to appropriate au_ctrl */ + if (fm & (FXATTR | FXATTRDIROPEN)) + tad->tad_ctrl |= PAD_ATTPATH; - /* - * openat modes are defined in the following order: - * Read only - * Read|Create - * Read|Trunc - * Read|Create|Trunc - * Write Only - * Write|Create - * Write|Trunc - * Write|Create|Trunc * RW Only - * RW|Create - * RW|Trunc - * RW|Create|Trunc - */ - if (fm & O_CREAT) - e += 1; /* increment to include CREAT in mode */ - if (fm & O_TRUNC) - e += 2; /* increment to include TRUNC in mode */ + return (open_event(fm)); +} - /* convert to appropriate au_ctrl */ - tad->tad_ctrl |= PAD_SAVPATH; - if (fm & FXATTR) - tad->tad_ctrl |= PAD_ATPATH; +static void +aus_openat(struct t_audit_data *tad) +{ + klwp_t *clwp = ttolwp(curthread); + uint_t fm; + struct a { + long filedes; + long fnamep; /* char * */ + long fmode; + long cmode; + } *uap = (struct a *)clwp->lwp_ap; - break; - case 2: /* fstatat64 */ - case 3: /* fstatat */ - e = AUE_FSTATAT; - break; - case 4: /* fchownat */ - e = AUE_FCHOWNAT; - break; - case 5: /* unlinkat */ - e = AUE_UNLINKAT; - break; - case 6: /* futimesat */ - e = AUE_FUTIMESAT; - break; - case 7: /* renameat */ - e = AUE_RENAMEAT; - break; - case 8: /* faccessat */ - e = AUE_FACCESSAT; - break; - case 9: /* __openattrdirat */ - tad->tad_ctrl |= PAD_SAVPATH; - /*FALLTHROUGH*/ - default: - e = AUE_NULL; - break; - } + fm = (uint_t)uap->fmode; - return (e); + /* If no write, create, or trunc modes, mark as a public op */ + if ((fm & (O_RDONLY|O_WRONLY|O_RDWR|O_CREAT|O_TRUNC)) == O_RDONLY) + tad->tad_ctrl |= PAD_PUBLIC_EV; } -/*ARGSUSED*/ -static void -aus_fsat(struct t_audit_data *tad) +static au_event_t +aui_unlinkat(au_event_t e) { klwp_t *clwp = ttolwp(curthread); - uint_t fmcode, fm; + struct a { - long id; - long arg1; - long arg2; - long arg3; - long arg4; - long arg5; + long filedes; + long fnamep; /* char * */ + long flags; } *uap = (struct a *)clwp->lwp_ap; - fmcode = (uint_t)uap->id; + if (uap->flags & AT_REMOVEDIR) + e = AUE_RMDIR; + else + e = AUE_UNLINK; - switch (fmcode) { + return (e); +} - case 0: /* openat */ - case 1: /* openat64 */ - fm = (uint_t)uap->arg3; - /* If no write, create, or trunc modes, mark as a public op */ - if (!(fm & (O_WRONLY|O_RDWR|O_CREAT|O_TRUNC))) - tad->tad_ctrl |= PAD_PUBLIC_EV; +static au_event_t +aui_fstatat(au_event_t e) +{ + klwp_t *clwp = ttolwp(curthread); - break; - case 2: /* fstatat64 */ - case 3: /* fstatat */ - tad->tad_ctrl |= PAD_PUBLIC_EV; - break; - default: - break; - } + struct a { + long filedes; + long fnamep; /* char * */ + long statb; + long flags; + } *uap = (struct a *)clwp->lwp_ap; + + if (uap->fnamep == NULL) + e = AUE_FSTAT; + else if (uap->flags & AT_SYMLINK_NOFOLLOW) + e = AUE_LSTAT; + else + e = AUE_STAT; + + return (e); } /* msgsys */ @@ -1314,13 +1358,6 @@ aui_fcntl(au_event_t e) /* null function for now */ static au_event_t -aui_execv(au_event_t e) -{ - return (e); -} - -/* null function for now */ -static au_event_t aui_execve(au_event_t e) { return (e); @@ -1474,32 +1511,6 @@ aus_mknod(struct t_audit_data *tad) /*ARGSUSED*/ static void -aus_xmknod(struct t_audit_data *tad) -{ - klwp_t *clwp = ttolwp(curthread); - uint32_t fmode; - dev_t dev; - - struct a { - long version; /* version */ - long pnamep; /* char * */ - long fmode; - long dev; - } *uap = (struct a *)clwp->lwp_ap; - - fmode = (uint32_t)uap->fmode; - dev = (dev_t)uap->dev; - - au_uwrite(au_to_arg32(2, "mode", fmode)); -#ifdef _LP64 - au_uwrite(au_to_arg64(3, "dev", dev)); -#else - au_uwrite(au_to_arg32(3, "dev", dev)); -#endif -} - -/*ARGSUSED*/ -static void auf_mknod(struct t_audit_data *tad, int error, rval_t *rval) { klwp_t *clwp = ttolwp(curthread); @@ -1530,38 +1541,6 @@ auf_mknod(struct t_audit_data *tad, int error, rval_t *rval) /*ARGSUSED*/ static void -auf_xmknod(struct t_audit_data *tad, int error, rval_t *rval) -{ - klwp_t *clwp = ttolwp(curthread); - vnode_t *dvp; - caddr_t pnamep; - - struct a { - long version; /* version */ - long pnamep; /* char * */ - long fmode; - long dev; - } *uap = (struct a *)clwp->lwp_arg; - - - /* no error, then already path token in audit record */ - if (error != EPERM) - return; - - /* not auditing this event, nothing then to do */ - if (tad->tad_flag == 0) - return; - - /* do the lookup to force generation of path token */ - pnamep = (caddr_t)uap->pnamep; - tad->tad_ctrl |= PAD_NOATTRB; - error = lookupname(pnamep, UIO_USERSPACE, NO_FOLLOW, &dvp, NULLVPP); - if (error == 0) - VN_RELE(dvp); -} - -/*ARGSUSED*/ -static void aus_mount(struct t_audit_data *tad) { /* AUS_START */ klwp_t *clwp = ttolwp(curthread); @@ -1654,23 +1633,6 @@ umount2_free_dir: kmem_free(path, path_len); } -/* - * the umount syscall is implemented as a call to umount2, but the args - * are different... - */ - -/*ARGSUSED*/ -static void -aus_umount(struct t_audit_data *tad) -{ - klwp_t *clwp = ttolwp(curthread); - struct a { - long dir; /* char * */ - } *uap = (struct a *)clwp->lwp_ap; - - aus_umount_path((caddr_t)uap->dir); -} - /*ARGSUSED*/ static void aus_umount2(struct t_audit_data *tad) diff --git a/usr/src/uts/common/c2/audit_kernel.h b/usr/src/uts/common/c2/audit_kernel.h index 9e145fffd0..df6c2910eb 100644 --- a/usr/src/uts/common/c2/audit_kernel.h +++ b/usr/src/uts/common/c2/audit_kernel.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -84,6 +84,7 @@ extern "C" { #define S2E_MLD PAD_MLD /* only one lookup per system call */ #define S2E_NPT PAD_NOPATH /* force no path in audit record */ #define S2E_PUB PAD_PUBLIC_EV /* syscall is defined as a public op */ +#define S2E_ATC PAD_ATCALL /* syscall is one of the *at() family */ /* * At present, we are using the audit classes imbedded with in the kernel. Each @@ -169,14 +170,15 @@ typedef struct p_audit_data p_audit_data_t; extern kmem_cache_t *au_pad_cache; /* - * Defines for pad_ctrl + * Defines for tad_ctrl */ #define PAD_SAVPATH 0x00000001 /* save path for further processing */ #define PAD_MLD 0x00000002 /* system call involves MLD */ #define PAD_NOPATH 0x00000004 /* force no paths in audit record */ #define PAD_ABSPATH 0x00000008 /* path from lookup is absolute */ #define PAD_NOATTRB 0x00000010 /* do not automatically add attribute */ - /* 0x20, 0x40 unused */ + /* 0x20 unused */ +#define PAD_ATCALL 0x00000040 /* *at() syscall, like openat() */ #define PAD_LFLOAT 0x00000080 /* Label float */ #define PAD_NOAUDIT 0x00000100 /* discard audit record */ #define PAD_PATHFND 0x00000200 /* found path, don't retry lookup */ @@ -185,7 +187,7 @@ extern kmem_cache_t *au_pad_cache; #define PAD_SMAC 0x00001000 /* succ mac use. extra audit_finish */ #define PAD_FMAC 0x00002000 /* fail mac use. extra audit_finish */ #define PAD_AUDITME 0x00004000 /* audit me because of NFS operation */ -#define PAD_ATPATH 0x00008000 /* attribute file lookup */ +#define PAD_ATTPATH 0x00008000 /* attribute file lookup */ #define PAD_TRUE_CREATE 0x00010000 /* true create, file not found */ #define PAD_CORE 0x00020000 /* save attribute during core dump */ #define PAD_ERRJMP 0x00040000 /* abort record generation on error */ diff --git a/usr/src/uts/common/c2/audit_kevents.h b/usr/src/uts/common/c2/audit_kevents.h index 7c85544506..fdc3c4dc37 100644 --- a/usr/src/uts/common/c2/audit_kevents.h +++ b/usr/src/uts/common/c2/audit_kevents.h @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,10 +47,10 @@ extern "C" { #define AUE_EXIT 1 /* =ps exit(2) */ #define AUE_FORKALL 2 /* =ps forkall(2) */ #define AUE_OPEN 3 /* =no open(2): place holder */ -#define AUE_CREAT 4 /* =fc create(2) */ +#define AUE_CREAT 4 /* =no obsolete */ #define AUE_LINK 5 /* =fc link(2) */ #define AUE_UNLINK 6 /* =fd unlink(2) */ -#define AUE_EXEC 7 /* =ps,ex exec(2) */ +#define AUE_EXEC 7 /* =no obsolete */ #define AUE_CHDIR 8 /* =pm chdir(2) */ #define AUE_MKNOD 9 /* =fc mknod(2) */ #define AUE_CHMOD 10 /* =fm chmod(2) */ @@ -92,7 +92,7 @@ extern "C" { #define AUE_SHUTDOWN 46 /* =nt shutdown(2) */ #define AUE_MKDIR 47 /* =fc mkdir(2) */ #define AUE_RMDIR 48 /* =fd rmdir(2) */ -#define AUE_UTIMES 49 /* =fm utimes(2) */ +#define AUE_UTIMES 49 /* =fm futimens(2), utimensat(2) */ #define AUE_ADJTIME 50 /* =as adjtime(2) */ #define AUE_SETRLIMIT 51 /* =ua setrlimit(2) */ #define AUE_KILLPG 52 /* =no killpg(2) */ @@ -113,7 +113,7 @@ extern "C" { #define AUE_RFSSYS 67 /* =no rfssys(2): place holder */ #define AUE_FCHDIR 68 /* =pm fchdir(2) */ #define AUE_FCHROOT 69 /* =pm fchroot(2) */ -#define AUE_VPIXSYS 70 /* =no vpixsys(2): obsolete */ +#define AUE_VPIXSYS 70 /* =no obsolete */ #define AUE_PATHCONF 71 /* =fa pathconf(2) */ #define AUE_OPEN_R 72 /* =fr open(2): read */ #define AUE_OPEN_RC 73 /* =fc,fr open(2): read,creat */ @@ -169,7 +169,7 @@ extern "C" { #define AUE_SETAUDIT 133 /* =aa setaudit(2) */ /* 134 OBSOLETE */ /* 135 OBSOLETE */ -#define AUE_AUDITSVC 136 /* =no auditsvc(2): obsolete */ +#define AUE_AUDITSVC 136 /* =no obsolete */ /* 137 OBSOLETE */ #define AUE_AUDITON 138 /* =no auditon(2) */ #define AUE_AUDITON_GTERMID 139 /* =no auditctl(2): GETTERMID */ @@ -232,17 +232,17 @@ extern "C" { #define AUE_WRITEV 196 /* =no writev(2) */ #define AUE_NFS 197 /* =no NFS server */ #define AUE_READV 198 /* =no readv(2) */ -#define AUE_OSTAT 199 /* =no old stat(2) */ +#define AUE_OSTAT 199 /* =no obsolete */ #define AUE_SETUID 200 /* =pm old setuid(2) */ #define AUE_STIME 201 /* =as old stime(2) */ -#define AUE_UTIME 202 /* =fm old utime(2) */ +#define AUE_UTIME 202 /* =no obsolete */ #define AUE_NICE 203 /* =pm old nice(2) */ #define AUE_OSETPGRP 204 /* =no old setpgrp(2) */ #define AUE_SETGID 205 /* =pm old setgid(2) */ #define AUE_READL 206 /* =no readl(2) */ #define AUE_READVL 207 /* =no readvl(2) */ #define AUE_FSTAT 208 /* =no fstat(2) */ -#define AUE_DUP2 209 /* =no dup2(2) u-o-p */ +#define AUE_DUP2 209 /* =no obsolete */ #define AUE_MMAP 210 /* =no mmap(2) u-o-p */ #define AUE_AUDIT 211 /* =no audit(2) u-o-p */ #define AUE_PRIOCNTLSYS 212 /* =pm priocntlsys */ @@ -268,12 +268,12 @@ extern "C" { #define AUE_AUDITON_SETCLASS 232 /* =as */ #define AUE_FUSERS 233 /* =fa */ #define AUE_STATVFS 234 /* =fa */ -#define AUE_XSTAT 235 /* =no */ -#define AUE_LXSTAT 236 /* =no */ +#define AUE_XSTAT 235 /* =no obsolete */ +#define AUE_LXSTAT 236 /* =no obsolete */ #define AUE_LCHOWN 237 /* =fm */ #define AUE_MEMCNTL 238 /* =ot */ #define AUE_SYSINFO 239 /* =as */ -#define AUE_XMKNOD 240 /* =no */ +#define AUE_XMKNOD 240 /* =no obsolete */ #define AUE_FORK1 241 /* =ps */ #define AUE_MODCTL 242 /* =no */ #define AUE_MODLOAD 243 /* =as */ @@ -301,25 +301,25 @@ extern "C" { #define AUE_SOCKCONFIG 265 /* =nt */ #define AUE_SETAUDIT_ADDR 266 /* =aa setaudit_addr(2) */ #define AUE_GETAUDIT_ADDR 267 /* =aa getaudit_addr(2) */ -#define AUE_UMOUNT2 268 /* =as umount(2) */ -#define AUE_FSAT 269 /* =no openat(2): place holder */ -#define AUE_OPENAT_R 270 /* =fr openat(2): read */ -#define AUE_OPENAT_RC 271 /* =fc,fr openat(2): read,creat */ -#define AUE_OPENAT_RT 272 /* =fd,fr openat(2): read,trunc */ -#define AUE_OPENAT_RTC 273 /* =fc,fd,fr openat(2): rd,cr,tr */ -#define AUE_OPENAT_W 274 /* =fw openat(2): write */ -#define AUE_OPENAT_WC 275 /* =fc,fw openat(2): write,creat */ -#define AUE_OPENAT_WT 276 /* =fd,fw openat(2): write,trunc */ -#define AUE_OPENAT_WTC 277 /* =fc,fd,fw openat(2): wr,cr,tr */ -#define AUE_OPENAT_RW 278 /* =fr,fw openat(2): read,write */ -#define AUE_OPENAT_RWC 279 /* =fc,fw,fr openat(2): rd,wr,cr */ -#define AUE_OPENAT_RWT 280 /* =fd,fr,fw openat(2): rd,wr,tr */ -#define AUE_OPENAT_RWTC 281 /* =fc,fd,fw,fr openat(2): rd,wr,cr,tr */ -#define AUE_RENAMEAT 282 /* =fc,fd renameat(2) */ -#define AUE_FSTATAT 283 /* =no fstatat(2) */ -#define AUE_FCHOWNAT 284 /* =fm fchownat(2) */ -#define AUE_FUTIMESAT 285 /* =fm futimesat(2) */ -#define AUE_UNLINKAT 286 /* =fd unlinkat(2) */ +#define AUE_UMOUNT2 268 /* =as umount2(2) */ +#define AUE_FSAT 269 /* =no obsolete */ +#define AUE_OPENAT_R 270 /* =no obsolete */ +#define AUE_OPENAT_RC 271 /* =no obsolete */ +#define AUE_OPENAT_RT 272 /* =no obsolete */ +#define AUE_OPENAT_RTC 273 /* =no obsolete */ +#define AUE_OPENAT_W 274 /* =no obsolete */ +#define AUE_OPENAT_WC 275 /* =no obsolete */ +#define AUE_OPENAT_WT 276 /* =no obsolete */ +#define AUE_OPENAT_WTC 277 /* =no obsolete */ +#define AUE_OPENAT_RW 278 /* =no obsolete */ +#define AUE_OPENAT_RWC 279 /* =no obsolete */ +#define AUE_OPENAT_RWT 280 /* =no obsolete */ +#define AUE_OPENAT_RWTC 281 /* =no obsolete */ +#define AUE_RENAMEAT 282 /* =no obsolete */ +#define AUE_FSTATAT 283 /* =no obsolete */ +#define AUE_FCHOWNAT 284 /* =no obsolete */ +#define AUE_FUTIMESAT 285 /* =no obsolete */ +#define AUE_UNLINKAT 286 /* =no obsolete */ #define AUE_CLOCK_SETTIME 287 /* =as clock_settime(3RT) */ #define AUE_NTP_ADJTIME 288 /* =as ntp_adjtime(2) */ #define AUE_SETPPRIV 289 /* =pm setppriv(2) */ @@ -342,7 +342,7 @@ extern "C" { #define AUE_PORTFS_DISSOCIATE 306 /* =fa portfs(2) - port disassociate */ #define AUE_SETSID 307 /* =pm setsid(2) */ #define AUE_SETPGID 308 /* =pm setpgid(2) */ -#define AUE_FACCESSAT 309 /* =fa faccessat(2) */ +#define AUE_FACCESSAT 309 /* =no obsolete */ diff --git a/usr/src/uts/common/fs/proc/prioctl.c b/usr/src/uts/common/fs/proc/prioctl.c index 721e8e20a6..e49da69bed 100644 --- a/usr/src/uts/common/fs/proc/prioctl.c +++ b/usr/src/uts/common/fs/proc/prioctl.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1466,8 +1466,7 @@ oprgetstatus32(kthread_t *t, prstatus32_t *sp, zone_t *zp) sp->pr_syscall = get_syscall32_args(lwp, (int *)sp->pr_sysarg, &i); sp->pr_nsysarg = (short)i; - if (t->t_whystop == PR_SYSEXIT && - (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve)) { + if (t->t_whystop == PR_SYSEXIT && t->t_sysnum == SYS_execve) { sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (caddr32_t)up->u_argv; sp->pr_sysarg[2] = (caddr32_t)up->u_envp; @@ -3303,8 +3302,7 @@ oprgetstatus(kthread_t *t, prstatus_t *sp, zone_t *zp) sp->pr_syscall = get_syscall_args(lwp, (long *)sp->pr_sysarg, &i); sp->pr_nsysarg = (short)i; - if (t->t_whystop == PR_SYSEXIT && - (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve)) { + if (t->t_whystop == PR_SYSEXIT && t->t_sysnum == SYS_execve) { sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (uintptr_t)up->u_argv; sp->pr_sysarg[2] = (uintptr_t)up->u_envp; diff --git a/usr/src/uts/common/fs/proc/prsubr.c b/usr/src/uts/common/fs/proc/prsubr.c index d84cb0a137..5f1b2d6942 100644 --- a/usr/src/uts/common/fs/proc/prsubr.c +++ b/usr/src/uts/common/fs/proc/prsubr.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1056,7 +1056,7 @@ prgetlwpstatus32(kthread_t *t, lwpstatus32_t *sp, zone_t *zp) } else sp->pr_errpriv = lwp->lwp_badpriv; - if (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve) { + if (t->t_sysnum == SYS_execve) { up = PTOU(p); sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (caddr32_t)up->u_argv; @@ -1281,7 +1281,7 @@ prgetlwpstatus(kthread_t *t, lwpstatus_t *sp, zone_t *zp) else sp->pr_errpriv = lwp->lwp_badpriv; - if (t->t_sysnum == SYS_exec || t->t_sysnum == SYS_execve) { + if (t->t_sysnum == SYS_execve) { up = PTOU(p); sp->pr_sysarg[0] = 0; sp->pr_sysarg[1] = (uintptr_t)up->u_argv; diff --git a/usr/src/uts/common/os/exec.c b/usr/src/uts/common/os/exec.c index 2f03e83563..fc299421fa 100644 --- a/usr/src/uts/common/os/exec.c +++ b/usr/src/uts/common/os/exec.c @@ -92,15 +92,6 @@ uint_t auxv_hwcap32 = 0; /* 32-bit version of auxv_hwcap */ #define PSUIDFLAGS (SNOCD|SUGID) /* - * exec() - wrapper around exece providing NULL environment pointer - */ -int -exec(const char *fname, const char **argp) -{ - return (exece(fname, argp, NULL)); -} - -/* * exece() - system call wrapper around exec_common() */ int diff --git a/usr/src/uts/common/os/exit.c b/usr/src/uts/common/os/exit.c index cf2e3de913..d2f5fd5767 100644 --- a/usr/src/uts/common/os/exit.c +++ b/usr/src/uts/common/os/exit.c @@ -1133,25 +1133,6 @@ waitid(idtype_t idtype, id_t id, k_siginfo_t *ip, int options) return (ECHILD); } -/* - * The wait() system call trap is no longer invoked by libc. - * It is retained only for the benefit of statically linked applications. - * Delete this when we no longer care about these old and broken applications. - */ -int64_t -wait(void) -{ - int error; - k_siginfo_t info; - rval_t r; - - if (error = waitid(P_ALL, (id_t)0, &info, WEXITED|WTRAPPED)) - return (set_errno(error)); - r.r_val1 = info.si_pid; - r.r_val2 = wstat(info.si_code, info.si_status); - return (r.r_vals); -} - int waitsys(idtype_t idtype, id_t id, siginfo_t *infop, int options) { diff --git a/usr/src/uts/common/os/fork.c b/usr/src/uts/common/os/fork.c index f75ef84034..b9f9dba96d 100644 --- a/usr/src/uts/common/os/fork.c +++ b/usr/src/uts/common/os/fork.c @@ -93,16 +93,10 @@ int fork_fail_pending; extern struct kmem_cache *process_cache; /* - * forkall system call. - */ -int64_t -forkall(void) -{ - return (cfork(0, 0, 0)); -} - -/* - * The parent is stopped until the child invokes relvm(). + * The vfork() system call trap is no longer invoked by libc. + * It is retained only for the benefit of applications running + * within a solaris10 branded zone. It should be eliminated + * when we no longer support solaris10 branded zones. */ int64_t vfork(void) @@ -112,24 +106,8 @@ vfork(void) } /* - * fork system call, aka fork1. - */ -int64_t -fork1(void) -{ - return (cfork(0, 1, 0)); -} - -/* - * The forkall(), vfork(), and fork1() system calls are no longer - * invoked by libc. They are retained only for the benefit of - * old statically-linked applications. They should be eliminated - * when we no longer care about such old and broken applications. - */ - -/* - * forksys system call - forkx, forkallx, vforkx. - * This is the interface now invoked by libc. + * forksys system call - forkx, forkallx, vforkx. This is the + * interface invoked by libc for fork1(), forkall(), and vfork() */ int64_t forksys(int subcode, int flags) diff --git a/usr/src/uts/common/os/sysent.c b/usr/src/uts/common/os/sysent.c index c80048ade0..07c8fe03f6 100644 --- a/usr/src/uts/common/os/sysent.c +++ b/usr/src/uts/common/os/sysent.c @@ -21,7 +21,7 @@ /* ONC_PLUS EXTRACT START */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -57,17 +57,13 @@ int chown(); int chroot(); int cladm(); int close(); -int creat(); -int dup(); -int exec(); int exece(); +int faccessat(); +int fchownat(); int fcntl(); -int64_t forkall(); int64_t vfork(); int64_t forksys(); -int64_t fork1(); int fstat(); -int fsat32(); int fdsync(); int64_t getgid(); int ucredsys(); @@ -94,6 +90,7 @@ int mount(); int nice(); int nullsys(); int open(); +int openat(); int pause(); long pcsample(); int privsys(); @@ -102,6 +99,7 @@ ssize_t pread(); ssize_t pwrite(); ssize_t read(); int rename(); +int renameat(); void rexit(); int semsys(); int setgid(); @@ -118,6 +116,7 @@ int sigresend(); int sigtimedwait(); int getsetcontext(); int stat(); +int fstatat(); int stime(); int stty(); int syssync(); @@ -127,16 +126,14 @@ long ulimit(); int getrlimit32(); int setrlimit32(); int umask(); -int umount(); int umount2(); int unlink(); -int utime(); +int unlinkat(); int utimesys(); int64_t utssys32(); int64_t utssys64(); int uucopy(); ssize_t uucopystr(); -int64_t wait(); ssize_t write(); ssize_t readv(); ssize_t writev(); @@ -148,7 +145,6 @@ int statfs32(); int fstatfs32(); int sysfs(); int getmsg(); -int poll(); int pollsys(); int putmsg(); int uadmin(); @@ -181,12 +177,6 @@ caddr_t smmap32(); int smmaplf32(); int mprotect(); int munmap(); -#if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT) -int xstat(); -int lxstat(); -int fxstat(); -int xmknod(); -#endif int uname(); int lchown(); int getpmsg(); @@ -217,7 +207,6 @@ int lwp_self(); int64_t lwp_sigmask(); int yield(); int lwp_wait(); -int lwp_mutex_lock(); int lwp_mutex_timedlock(); int lwp_mutex_wakeup(); int lwp_mutex_unlock(); @@ -225,7 +214,6 @@ int lwp_mutex_trylock(); int lwp_mutex_register(); int lwp_rwlock_sys(); int lwp_sema_post(); -int lwp_sema_wait(); int lwp_sema_timedwait(); int lwp_sema_trywait(); int lwp_cond_wait(); @@ -256,7 +244,6 @@ int signotify(); int getdents64(); int stat64(); -int fsat64(); int lstat64(); int fstatat64(); int fstat64(); @@ -266,8 +253,8 @@ int setrlimit64(); int getrlimit64(); int pread64(); int pwrite64(); -int creat64(); int open64(); +int openat64(); /* * NTP syscalls @@ -281,11 +268,10 @@ int ntp_adjtime(); * ++ SunOS4.1 Buyback ++ * ++++++++++++++++++++++++ * - * fchroot, utimes, vhangup, gettimeofday + * fchroot, vhangup, gettimeofday */ int fchroot(); -int utimes(); int vhangup(); int gettimeofday(); int getitimer(); @@ -433,16 +419,16 @@ struct sysent sysent[NSYSCALL] = SYSENT_NOSYS(), SYSENT_C("indir", indir, 1)), /* 1 */ SYSENT_CI("exit", rexit, 1), - /* 2 */ SYSENT_2CI("forkall", forkall, 0), + /* 2 */ SYSENT_LOADABLE(), /* (was forkall) */ /* 3 */ SYSENT_CL("read", read, 3), /* 4 */ SYSENT_CL("write", write, 3), /* 5 */ SYSENT_CI("open", open, 3), /* 6 */ SYSENT_CI("close", close, 1), - /* 7 */ SYSENT_2CI("wait", wait, 0), - /* 8 */ SYSENT_CI("creat", creat, 2), + /* 7 */ SYSENT_LOADABLE(), /* (was wait) */ + /* 8 */ SYSENT_LOADABLE(), /* (was creat) */ /* 9 */ SYSENT_CI("link", link, 2), /* 10 */ SYSENT_CI("unlink", unlink, 1), - /* 11 */ SYSENT_CI("exec", exec, 2), + /* 11 */ SYSENT_LOADABLE(), /* (was exec) */ /* 12 */ SYSENT_CI("chdir", chdir, 1), /* 13 */ SYSENT_CL("time", gtime, 0), /* 14 */ SYSENT_CI("mknod", mknod, 3), @@ -455,7 +441,7 @@ struct sysent sysent[NSYSCALL] = SYSENT_CL("lseek", lseek32, 3)), /* 20 */ SYSENT_2CI("getpid", getpid, 0), /* 21 */ SYSENT_AP("mount", mount, 8), - /* 22 */ SYSENT_CI("umount", umount, 1), + /* 22 */ SYSENT_LOADABLE(), /* (was umount) */ /* 23 */ SYSENT_CI("setuid", setuid, 1), /* 24 */ SYSENT_2CI("getuid", getuid, 0), /* 25 */ SYSENT_CI("stime", stime, 1), @@ -463,7 +449,7 @@ struct sysent sysent[NSYSCALL] = /* 27 */ SYSENT_CI("alarm", alarm, 1), /* 28 */ SYSENT_CI("fstat", fstat, 2), /* 29 */ SYSENT_CI("pause", pause, 0), - /* 30 */ SYSENT_CI("utime", utime, 2), + /* 30 */ SYSENT_LOADABLE(), /* (was utime) */ /* 31 */ SYSENT_CI("stty", stty, 2), /* 32 */ SYSENT_CI("gtty", gtty, 2), /* 33 */ SYSENT_CI("access", access, 2), @@ -478,11 +464,11 @@ struct sysent sysent[NSYSCALL] = SYSENT_CI("fstatfs", fstatfs32, 4)), /* 39 */ SYSENT_CI("setpgrp", setpgrp, 3), /* 40 */ SYSENT_CI("uucopystr", uucopystr, 3), - /* 41 */ SYSENT_CI("dup", dup, 1), + /* 41 */ SYSENT_LOADABLE(), /* (was dup) */ /* 42 */ SYSENT_LOADABLE(), /* pipe */ /* 43 */ SYSENT_CL("times", times, 1), /* 44 */ SYSENT_CI("prof", profil, 4), - /* 45 */ SYSENT_LOADABLE(), /* (was proc lock) */ + /* 45 */ SYSENT_CI("faccessat", faccessat, 4), /* 46 */ SYSENT_CI("setgid", setgid, 1), /* 47 */ SYSENT_2CI("getgid", getgid, 0), /* 48 */ SYSENT_LOADABLE(), /* (was ssig) */ @@ -495,7 +481,7 @@ struct sysent sysent[NSYSCALL] = /* 53 */ SYSENT_LOADABLE(), /* semsys */ /* 54 */ SYSENT_CI("ioctl", ioctl, 3), /* 55 */ SYSENT_CI("uadmin", uadmin, 3), - /* 56 */ SYSENT_LOADABLE(), + /* 56 */ SYSENT_CI("fchownat", fchownat, 5), /* 57 */ IF_LP64( SYSENT_2CI("utssys", utssys64, 4), SYSENT_2CI("utssys", utssys32, 4)), @@ -505,26 +491,23 @@ struct sysent sysent[NSYSCALL] = /* 61 */ SYSENT_CI("chroot", chroot, 1), /* 62 */ SYSENT_CI("fcntl", fcntl, 3), /* 63 */ SYSENT_CI("ulimit", ulimit, 2), - - /* - * The following 6 entries were reserved for the UNIX PC. - */ - /* 64 */ SYSENT_LOADABLE(), - /* 65 */ SYSENT_LOADABLE(), - /* 66 */ SYSENT_LOADABLE(), - /* 67 */ SYSENT_LOADABLE(), /* file locking call */ - /* 68 */ SYSENT_LOADABLE(), /* local system calls */ - /* 69 */ SYSENT_LOADABLE(), /* inode open */ - + /* 64 */ SYSENT_CI("renameat", renameat, 4), + /* 65 */ SYSENT_CI("unlinkat", unlinkat, 3), + /* 66 */ SYSENT_CI("fstatat", fstatat, 4), + /* 67 */ IF_LP64( + SYSENT_NOSYS(), + SYSENT_CI("fstatat64", fstatat64, 4)), + /* 68 */ SYSENT_CI("openat", openat, 4), + /* 69 */ IF_LP64( + SYSENT_NOSYS(), + SYSENT_CI("openat64", openat64, 4)), /* 70 */ SYSENT_CI("tasksys", tasksys, 5), /* 71 */ SYSENT_LOADABLE(), /* acctctl */ /* 72 */ SYSENT_LOADABLE(), /* exacct */ /* 73 */ SYSENT_CI("getpagesizes", getpagesizes, 3), /* 74 */ SYSENT_CI("rctlsys", rctlsys, 6), /* 75 */ SYSENT_2CI("sidsys", sidsys, 4), - /* 76 */ IF_LP64( - SYSENT_CI("fsat", fsat64, 6), - SYSENT_CI("fsat", fsat32, 6)), + /* 76 */ SYSENT_LOADABLE(), /* (was fsat) */ /* 77 */ SYSENT_CI("lwp_park", syslwp_park, 3), /* 78 */ SYSENT_CL("sendfilev", sendfilev, 5), /* 79 */ SYSENT_CI("rmdir", rmdir, 1), @@ -537,7 +520,7 @@ struct sysent sysent[NSYSCALL] = /* 84 */ SYSENT_CI("sysfs", sysfs, 3), /* 85 */ SYSENT_CI("getmsg", getmsg, 4), /* 86 */ SYSENT_CI("putmsg", putmsg, 4), - /* 87 */ SYSENT_CI("poll", poll, 3), + /* 87 */ SYSENT_LOADABLE(), /* (was poll) */ /* 88 */ SYSENT_CI("lstat", lstat, 2), /* 89 */ SYSENT_CI("symlink", symlink, 2), /* 90 */ SYSENT_CL("readlink", readlink, 3), @@ -550,10 +533,9 @@ struct sysent sysent[NSYSCALL] = /* 97 */ SYSENT_CI("sigaltstack", sigaltstack, 2), /* 98 */ SYSENT_CI("sigaction", sigaction, 3), /* 99 */ SYSENT_CI("sigpending", sigpending, 2), - /* 100 */ SYSENT_CI("getsetcontext", getsetcontext, 2), - /* 101 */ SYSENT_LOADABLE(), /* (was evsys) */ - /* 102 */ SYSENT_LOADABLE(), /* (was evtrapret) */ + /* 101 */ SYSENT_LOADABLE(), + /* 102 */ SYSENT_LOADABLE(), /* 103 */ SYSENT_CI("statvfs", statvfs, 2), /* 104 */ SYSENT_CI("fstatvfs", fstatvfs, 2), /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2), @@ -580,26 +562,10 @@ struct sysent sysent[NSYSCALL] = /* 120 */ SYSENT_CI("fchdir", fchdir, 1), /* 121 */ SYSENT_CL("readv", readv, 3), /* 122 */ SYSENT_CL("writev", writev, 3), - /* 123 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("xstat", xstat, 3), - SYSENT_NOSYS())), - /* 124 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("lxstat", lxstat, 3), - SYSENT_NOSYS())), - /* 125 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("fxstat", fxstat, 3), - SYSENT_NOSYS())), - /* 126 */ IF_LP64( - SYSENT_NOSYS(), - IF_i386( - SYSENT_CI("xmknod", xmknod, 4), - SYSENT_NOSYS())), + /* 123 */ SYSENT_LOADABLE(), /* (was xstat) */ + /* 124 */ SYSENT_LOADABLE(), /* (was lxstat) */ + /* 125 */ SYSENT_LOADABLE(), /* (was fxstat) */ + /* 126 */ SYSENT_LOADABLE(), /* (was xmknod) */ /* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5), /* 128 */ IF_LP64( SYSENT_CI("setrlimit", setrlimit64, 2), @@ -620,18 +586,18 @@ struct sysent sysent[NSYSCALL] = /* 140 */ SYSENT_LOADABLE(), /* sharefs */ /* 141 */ SYSENT_CI("seteuid", seteuid, 1), /* 142 */ SYSENT_2CI("forksys", forksys, 2), - /* 143 */ SYSENT_2CI("fork1", fork1, 0), + /* 143 */ SYSENT_LOADABLE(), /* (was fork1) */ /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), /* 146 */ SYSENT_CI("yield", yield, 0), - /* 147 */ SYSENT_CI("lwp_sema_wait", lwp_sema_wait, 1), + /* 147 */ SYSENT_LOADABLE(), /* (was lwp_sema_wait) */ /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), /* 151 */ SYSENT_CI("corectl", corectl, 4), /* 152 */ SYSENT_CI("modctl", modctl, 6), /* 153 */ SYSENT_CI("fchroot", fchroot, 1), - /* 154 */ SYSENT_CI("utimes", utimes, 2), + /* 154 */ SYSENT_LOADABLE(), /* (was utimes) */ /* 155 */ SYSENT_CI("vhangup", vhangup, 0), /* 156 */ SYSENT_CI("gettimeofday", gettimeofday, 1), /* 157 */ SYSENT_CI("getitimer", getitimer, 2), @@ -648,7 +614,7 @@ struct sysent sysent[NSYSCALL] = SYSENT_NOSYS()), /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), - /* 169 */ SYSENT_CI("lwp_mutex_lock", lwp_mutex_lock, 1), + /* 169 */ SYSENT_LOADABLE(), /* (was lwp_mutex_lock) */ /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), @@ -740,9 +706,7 @@ struct sysent sysent[NSYSCALL] = /* 223 */ IF_LP64( SYSENT_NOSYS(), SYSENT_CI("pwrite64", pwrite64, 5)), - /* 224 */ IF_LP64( - SYSENT_NOSYS(), - SYSENT_CI("creat64", creat64, 2)), + /* 224 */ SYSENT_LOADABLE(), /* (was creat64) */ /* 225 */ IF_LP64( SYSENT_NOSYS(), SYSENT_CI("open64", open64, 3)), @@ -792,12 +756,7 @@ extern ssize_t readv32(); extern ssize_t writev32(); extern ssize_t readlink32(); extern int open32(); -extern int creat32(); -#if (defined(__i386) && !defined(__amd64)) || defined(__i386_COMPAT) -extern int xstat32(); -extern int lxstat32(); -extern int fxstat32(); -#endif +extern int openat32(); extern int stat32(); extern int fstatat32(); extern int lstat32(); @@ -842,16 +801,16 @@ struct sysent sysent32[NSYSCALL] = /* ONC_PLUS EXTRACT END */ /* 0 */ SYSENT_C("indir", indir, 1), /* 1 */ SYSENT_CI("exit", (int (*)())rexit, 1), - /* 2 */ SYSENT_2CI("forkall", forkall, 0), + /* 2 */ SYSENT_LOADABLE32(), /* (was forkall) */ /* 3 */ SYSENT_CI("read", read32, 3), /* 4 */ SYSENT_CI("write", write32, 3), /* 5 */ SYSENT_CI("open", open32, 3), /* 6 */ SYSENT_CI("close", close, 1), - /* 7 */ SYSENT_2CI("wait", wait, 0), - /* 8 */ SYSENT_CI("creat", creat32, 2), + /* 7 */ SYSENT_LOADABLE32(), /* (was wait) */ + /* 8 */ SYSENT_LOADABLE32(), /* (was creat32) */ /* 9 */ SYSENT_CI("link", link, 2), /* 10 */ SYSENT_CI("unlink", unlink, 1), - /* 11 */ SYSENT_CI("exec", exec, 2), + /* 11 */ SYSENT_LOADABLE32(), /* (was exec) */ /* 12 */ SYSENT_CI("chdir", chdir, 1), /* 13 */ SYSENT_CI("time", gtime, 0), /* 14 */ SYSENT_CI("mknod", mknod, 3), @@ -862,7 +821,7 @@ struct sysent sysent32[NSYSCALL] = /* 19 */ SYSENT_CI("lseek", lseek32, 3), /* 20 */ SYSENT_2CI("getpid", getpid, 0), /* 21 */ SYSENT_AP("mount", mount, 8), - /* 22 */ SYSENT_CI("umount", umount, 1), + /* 22 */ SYSENT_LOADABLE32(), /* (was umount) */ /* 23 */ SYSENT_CI("setuid", setuid, 1), /* 24 */ SYSENT_2CI("getuid", getuid, 0), /* 25 */ SYSENT_CI("stime", stime32, 1), @@ -870,7 +829,7 @@ struct sysent sysent32[NSYSCALL] = /* 27 */ SYSENT_CI("alarm", alarm, 1), /* 28 */ SYSENT_CI("fstat", fstat32, 2), /* 29 */ SYSENT_CI("pause", pause, 0), - /* 30 */ SYSENT_CI("utime", utime, 2), + /* 30 */ SYSENT_LOADABLE32(), /* (was utime) */ /* 31 */ SYSENT_CI("stty", stty, 2), /* 32 */ SYSENT_CI("gtty", gtty, 2), /* 33 */ SYSENT_CI("access", access, 2), @@ -881,24 +840,24 @@ struct sysent sysent32[NSYSCALL] = /* 38 */ SYSENT_CI("fstatfs", fstatfs32, 4), /* 39 */ SYSENT_CI("setpgrp", setpgrp, 3), /* 40 */ SYSENT_CI("uucopystr", uucopystr, 3), - /* 41 */ SYSENT_CI("dup", dup, 1), + /* 41 */ SYSENT_LOADABLE32(), /* (was dup) */ /* 42 */ SYSENT_LOADABLE32(), /* pipe */ /* 43 */ SYSENT_CI("times", times32, 1), /* 44 */ SYSENT_CI("prof", profil, 4), - /* 45 */ SYSENT_LOADABLE32(), /* (was proc lock) */ + /* 45 */ SYSENT_CI("faccessat", faccessat, 4), /* 46 */ SYSENT_CI("setgid", setgid, 1), /* 47 */ SYSENT_2CI("getgid", getgid, 0), /* 48 */ SYSENT_LOADABLE32(), /* (was ssig) */ /* 49 */ SYSENT_LOADABLE32(), /* msgsys */ /* 50 */ IF_386_ABI( SYSENT_CI("sysi86", sysi86, 4), - SYSENT_LOADABLE()), /* (was sys3b) */ + SYSENT_LOADABLE32()), /* (was sys3b) */ /* 51 */ SYSENT_LOADABLE32(), /* sysacct */ /* 52 */ SYSENT_LOADABLE32(), /* shmsys */ /* 53 */ SYSENT_LOADABLE32(), /* semsys */ /* 54 */ SYSENT_CI("ioctl", ioctl, 3), /* 55 */ SYSENT_CI("uadmin", uadmin, 3), - /* 56 */ SYSENT_LOADABLE32(), + /* 56 */ SYSENT_CI("fchownat", fchownat, 5), /* 57 */ SYSENT_2CI("utssys", utssys32, 4), /* 58 */ SYSENT_CI("fdsync", fdsync, 2), /* 59 */ SYSENT_CI("exece", exece, 3), @@ -906,24 +865,19 @@ struct sysent sysent32[NSYSCALL] = /* 61 */ SYSENT_CI("chroot", chroot, 1), /* 62 */ SYSENT_CI("fcntl", fcntl, 3), /* 63 */ SYSENT_CI("ulimit", ulimit32, 2), - - /* - * The following 6 entries were reserved for the UNIX PC. - */ - /* 64 */ SYSENT_LOADABLE32(), - /* 65 */ SYSENT_LOADABLE32(), - /* 66 */ SYSENT_LOADABLE32(), - /* 67 */ SYSENT_LOADABLE32(), /* file locking call */ - /* 68 */ SYSENT_LOADABLE32(), /* local system calls */ - /* 69 */ SYSENT_LOADABLE32(), /* inode open */ - + /* 64 */ SYSENT_CI("renameat", renameat, 4), + /* 65 */ SYSENT_CI("unlinkat", unlinkat, 3), + /* 66 */ SYSENT_CI("fstatat", fstatat32, 4), + /* 67 */ SYSENT_CI("fstatat64", fstatat64_32, 4), + /* 68 */ SYSENT_CI("openat", openat32, 4), + /* 69 */ SYSENT_CI("openat64", openat64, 4), /* 70 */ SYSENT_CI("tasksys", tasksys, 5), /* 71 */ SYSENT_LOADABLE32(), /* acctctl */ /* 72 */ SYSENT_LOADABLE32(), /* exacct */ /* 73 */ SYSENT_CI("getpagesizes", getpagesizes32, 3), /* 74 */ SYSENT_CI("rctlsys", rctlsys, 6), /* 75 */ SYSENT_2CI("sidsys", sidsys, 4), - /* 76 */ SYSENT_CI("fsat", fsat32, 6), + /* 76 */ SYSENT_LOADABLE32(), /* (was fsat) */ /* 77 */ SYSENT_CI("lwp_park", syslwp_park, 3), /* 78 */ SYSENT_CI("sendfilev", sendfilev, 5), /* 79 */ SYSENT_CI("rmdir", rmdir, 1), @@ -934,7 +888,7 @@ struct sysent sysent32[NSYSCALL] = /* 84 */ SYSENT_CI("sysfs", sysfs, 3), /* 85 */ SYSENT_CI("getmsg", getmsg32, 4), /* 86 */ SYSENT_CI("putmsg", putmsg32, 4), - /* 87 */ SYSENT_CI("poll", poll, 3), + /* 87 */ SYSENT_LOADABLE32(), /* (was poll) */ /* 88 */ SYSENT_CI("lstat", lstat32, 2), /* 89 */ SYSENT_CI("symlink", symlink, 2), /* 90 */ SYSENT_CI("readlink", readlink32, 3), @@ -947,10 +901,9 @@ struct sysent sysent32[NSYSCALL] = /* 97 */ SYSENT_CI("sigaltstack", sigaltstack32, 2), /* 98 */ SYSENT_CI("sigaction", sigaction32, 3), /* 99 */ SYSENT_CI("sigpending", sigpending, 2), - /* 100 */ SYSENT_CI("getsetcontext", getsetcontext32, 2), - /* 101 */ SYSENT_LOADABLE32(), /* (was evsys) */ - /* 102 */ SYSENT_LOADABLE32(), /* (was evtrapret) */ + /* 101 */ SYSENT_LOADABLE32(), + /* 102 */ SYSENT_LOADABLE32(), /* 103 */ SYSENT_CI("statvfs", statvfs32, 2), /* 104 */ SYSENT_CI("fstatvfs", fstatvfs32, 2), /* 105 */ SYSENT_CI("getloadavg", getloadavg, 2), @@ -975,18 +928,10 @@ struct sysent sysent32[NSYSCALL] = /* 120 */ SYSENT_CI("fchdir", fchdir, 1), /* 121 */ SYSENT_CI("readv", readv32, 3), /* 122 */ SYSENT_CI("writev", writev32, 3), - /* 123 */ IF_386_ABI( - SYSENT_CI("xstat", xstat32, 3), - SYSENT_NOSYS()), - /* 124 */ IF_386_ABI( - SYSENT_CI("lxstat", lxstat32, 3), - SYSENT_NOSYS()), - /* 125 */ IF_386_ABI( - SYSENT_CI("fxstat", fxstat32, 3), - SYSENT_NOSYS()), - /* 126 */ IF_386_ABI( - SYSENT_CI("xmknod", xmknod, 4), - SYSENT_NOSYS()), + /* 123 */ SYSENT_LOADABLE32(), /* was xstat32 */ + /* 124 */ SYSENT_LOADABLE32(), /* was lxstat32 */ + /* 125 */ SYSENT_LOADABLE32(), /* was fxstat32 */ + /* 126 */ SYSENT_LOADABLE32(), /* was xmknod */ /* 127 */ SYSENT_CI("mmapobj", mmapobjsys, 5), /* 128 */ SYSENT_CI("setrlimit", setrlimit32, 2), /* 129 */ SYSENT_CI("getrlimit", getrlimit32, 2), @@ -995,7 +940,6 @@ struct sysent sysent32[NSYSCALL] = /* 132 */ SYSENT_CI("getpmsg", getpmsg32, 5), /* 133 */ SYSENT_CI("putpmsg", putpmsg32, 5), /* 134 */ SYSENT_CI("rename", rename, 2), - /* 135 */ SYSENT_CI("uname", uname, 1), /* 136 */ SYSENT_CI("setegid", setegid, 1), /* 137 */ SYSENT_CI("sysconfig", sysconfig, 1), @@ -1004,18 +948,18 @@ struct sysent sysent32[NSYSCALL] = /* 140 */ SYSENT_LOADABLE32(), /* sharefs */ /* 141 */ SYSENT_CI("seteuid", seteuid, 1), /* 142 */ SYSENT_2CI("forksys", forksys, 2), - /* 143 */ SYSENT_2CI("fork1", fork1, 0), + /* 143 */ SYSENT_LOADABLE32(), /* (was fork1) */ /* 144 */ SYSENT_CI("sigtimedwait", sigtimedwait, 3), /* 145 */ SYSENT_CI("lwp_info", lwp_info, 1), /* 146 */ SYSENT_CI("yield", yield, 0), - /* 147 */ SYSENT_CI("lwp_sema_wait", lwp_sema_wait, 1), + /* 147 */ SYSENT_LOADABLE32(), /* (was lwp_sema_wait) */ /* 148 */ SYSENT_CI("lwp_sema_post", lwp_sema_post, 1), /* 149 */ SYSENT_CI("lwp_sema_trywait", lwp_sema_trywait, 1), /* 150 */ SYSENT_CI("lwp_detach", lwp_detach, 1), /* 151 */ SYSENT_CI("corectl", corectl, 4), /* 152 */ SYSENT_CI("modctl", modctl, 6), /* 153 */ SYSENT_CI("fchroot", fchroot, 1), - /* 154 */ SYSENT_CI("utimes", utimes, 2), + /* 154 */ SYSENT_LOADABLE32(), /* (was utimes) */ /* 155 */ SYSENT_CI("vhangup", vhangup, 0), /* 156 */ SYSENT_CI("gettimeofday", gettimeofday, 1), /* 157 */ SYSENT_CI("getitimer", getitimer, 2), @@ -1032,7 +976,7 @@ struct sysent sysent32[NSYSCALL] = SYSENT_NOSYS()), /* 167 */ SYSENT_CI("lwp_wait", lwp_wait, 2), /* 168 */ SYSENT_CI("lwp_mutex_wakeup", lwp_mutex_wakeup, 2), - /* 169 */ SYSENT_CI("lwp_mutex_lock", lwp_mutex_lock, 1), + /* 169 */ SYSENT_LOADABLE32(), /* (was lwp_mutex_lock) */ /* 170 */ SYSENT_CI("lwp_cond_wait", lwp_cond_wait, 4), /* 171 */ SYSENT_CI("lwp_cond_signal", lwp_cond_signal, 1), /* 172 */ SYSENT_CI("lwp_cond_broadcast", lwp_cond_broadcast, 1), @@ -1090,7 +1034,7 @@ struct sysent sysent32[NSYSCALL] = /* 221 */ SYSENT_CI("getrlimit64", getrlimit64, 2), /* 222 */ SYSENT_CI("pread64", pread64, 5), /* 223 */ SYSENT_CI("pwrite64", pwrite64, 5), - /* 224 */ SYSENT_CI("creat64", creat64, 2), + /* 224 */ SYSENT_LOADABLE32(), /* (was creat64) */ /* 225 */ SYSENT_CI("open64", open64, 3), /* 226 */ SYSENT_LOADABLE32(), /* rpcsys */ /* 227 */ SYSENT_CI("zone", zone, 6), diff --git a/usr/src/uts/common/sys/exec.h b/usr/src/uts/common/sys/exec.h index d9bcf11e55..d246d5e885 100644 --- a/usr/src/uts/common/sys/exec.h +++ b/usr/src/uts/common/sys/exec.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -206,7 +206,6 @@ extern char aout_omagicstr[]; extern char nomagicstr[]; extern int exec_args(execa_t *, uarg_t *, intpdata_t *, void **); -extern int exec(const char *fname, const char **argp); extern int exece(const char *fname, const char **argp, const char **envp); extern int exec_common(const char *fname, const char **argp, const char **envp, int brand_action); diff --git a/usr/src/uts/common/sys/syscall.h b/usr/src/uts/common/sys/syscall.h index 41a95c33d2..170483de8d 100644 --- a/usr/src/uts/common/sys/syscall.h +++ b/usr/src/uts/common/sys/syscall.h @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,16 +49,12 @@ extern "C" { #define SYS_syscall 0 #define SYS_exit 1 -#define SYS_forkall 2 #define SYS_read 3 #define SYS_write 4 #define SYS_open 5 #define SYS_close 6 -#define SYS_wait 7 -#define SYS_creat 8 #define SYS_link 9 #define SYS_unlink 10 -#define SYS_exec 11 #define SYS_chdir 12 #define SYS_time 13 #define SYS_mknod 14 @@ -69,7 +65,6 @@ extern "C" { #define SYS_lseek 19 #define SYS_getpid 20 #define SYS_mount 21 -#define SYS_umount 22 #define SYS_setuid 23 #define SYS_getuid 24 #define SYS_stime 25 @@ -77,7 +72,6 @@ extern "C" { #define SYS_alarm 27 #define SYS_fstat 28 #define SYS_pause 29 -#define SYS_utime 30 #define SYS_stty 31 #define SYS_gtty 32 #define SYS_access 33 @@ -97,11 +91,10 @@ extern "C" { * setpgid(pid,pgid) :: syscall(39,5,pid,pgid) */ #define SYS_uucopystr 40 -#define SYS_dup 41 #define SYS_pipe 42 #define SYS_times 43 #define SYS_profil 44 -#define SYS_plock 45 +#define SYS_faccessat 45 #define SYS_setgid 46 #define SYS_getgid 47 #define SYS_msgsys 49 @@ -143,6 +136,7 @@ extern "C" { */ #define SYS_ioctl 54 #define SYS_uadmin 55 +#define SYS_fchownat 56 #define SYS_utssys 57 /* * subcodes (third argument): @@ -158,12 +152,12 @@ extern "C" { #define SYS_chroot 61 #define SYS_fcntl 62 #define SYS_ulimit 63 -#define SYS_reserved_64 64 /* 64 reserved */ -#define SYS_reserved_65 65 /* 65 reserved */ -#define SYS_reserved_66 66 /* 66 reserved */ -#define SYS_reserved_67 67 /* 67 reserved */ -#define SYS_reserved_68 68 /* 68 reserved */ -#define SYS_reserved_69 69 /* 69 reserved */ +#define SYS_renameat 64 +#define SYS_unlinkat 65 +#define SYS_fstatat 66 +#define SYS_fstatat64 67 +#define SYS_openat 68 +#define SYS_openat64 69 #define SYS_tasksys 70 /* * subcodes: @@ -200,20 +194,6 @@ extern "C" { * idmap_reg(...) :: sidsys(1, ...) * idmap_unreg(...) :: sidsys(2, ...) */ -#define SYS_fsat 76 - /* - * subcodes: - * openat(...) :: fsat(0, ...) - * openat64(...) :: fsat(1, ...) - * fstatat64(...) :: fsat(2, ...) - * fstatat(...) :: fsat(3, ...) - * fchownat(...) :: fsat(4, ...) - * unlinkat(...) :: fsat(5, ...) - * futimesat(...) :: fsat(6, ...) - * renameat(...) :: fsat(7, ...) - * faccessat(...) :: fsat(8, ...) - * openattrdirat(...) :: fsat(9, ...) - */ #define SYS_lwp_park 77 /* * subcodes: @@ -256,8 +236,6 @@ extern "C" { */ #define SYS_getmsg 85 #define SYS_putmsg 86 -#define SYS_poll 87 - #define SYS_lstat 88 #define SYS_symlink 89 #define SYS_readlink 90 @@ -282,8 +260,6 @@ extern "C" { * getcontext(...) :: syscall(100, 0, ...) * setcontext(...) :: syscall(100, 1, ...) */ -#define SYS_evsys 101 -#define SYS_evtrapret 102 #define SYS_statvfs 103 #define SYS_fstatvfs 104 #define SYS_getloadavg 105 @@ -310,10 +286,6 @@ extern "C" { #define SYS_fchdir 120 #define SYS_readv 121 #define SYS_writev 122 -#define SYS_xstat 123 -#define SYS_lxstat 124 -#define SYS_fxstat 125 -#define SYS_xmknod 126 #define SYS_mmapobj 127 #define SYS_setrlimit 128 #define SYS_getrlimit 129 @@ -336,18 +308,15 @@ extern "C" { * forkallx(flags) :: forksys(1, flags) * vforkx(flags) :: forksys(2, flags) */ -#define SYS_fork1 143 #define SYS_sigtimedwait 144 #define SYS_lwp_info 145 #define SYS_yield 146 -#define SYS_lwp_sema_wait 147 #define SYS_lwp_sema_post 148 #define SYS_lwp_sema_trywait 149 #define SYS_lwp_detach 150 #define SYS_corectl 151 #define SYS_modctl 152 #define SYS_fchroot 153 -#define SYS_utimes 154 #define SYS_vhangup 155 #define SYS_gettimeofday 156 #define SYS_getitimer 157 @@ -362,7 +331,6 @@ extern "C" { #define SYS_lwp_private 166 #define SYS_lwp_wait 167 #define SYS_lwp_mutex_wakeup 168 -#define SYS_lwp_mutex_lock 169 #define SYS_lwp_cond_wait 170 #define SYS_lwp_cond_signal 171 #define SYS_lwp_cond_broadcast 172 @@ -467,7 +435,6 @@ extern "C" { #define SYS_getrlimit64 221 #define SYS_pread64 222 #define SYS_pwrite64 223 -#define SYS_creat64 224 #define SYS_open64 225 #define SYS_rpcsys 226 #define SYS_zone 227 @@ -520,7 +487,6 @@ extern "C" { #define SYS_uucopy 254 #define SYS_umount2 255 - #ifndef _ASM typedef struct { /* syscall set type */ diff --git a/usr/src/uts/common/syscall/access.c b/usr/src/uts/common/syscall/access.c index 2fcdb870e5..bf71b77b8c 100644 --- a/usr/src/uts/common/syscall/access.c +++ b/usr/src/uts/common/syscall/access.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -118,12 +118,6 @@ lookup: } int -access(char *fname, int fmode) -{ - return (caccess(fname, fmode, NULL)); -} - -int faccessat(int fd, char *fname, int fmode, int flag) { file_t *dirfp; @@ -172,3 +166,9 @@ faccessat(int fd, char *fname, int fmode, int flag) return (error); } + +int +access(char *fname, int fmode) +{ + return (faccessat(AT_FDCWD, fname, fmode, 0)); +} diff --git a/usr/src/uts/common/syscall/chown.c b/usr/src/uts/common/syscall/chown.c index 706b3b4f71..04250e1e35 100644 --- a/usr/src/uts/common/syscall/chown.c +++ b/usr/src/uts/common/syscall/chown.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -54,15 +53,10 @@ #include <c2/audit.h> /* - * nmflag has the following values - * - * 1 - Always do lookup. i.e. chown, lchown. - * 2 - Name is optional i.e. fchownat - * 0 - Don't lookup name, vp is in file_p. i.e. fchown - * + * Change ownership of file. */ int -cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) +fchownat(int fd, char *name, uid_t uid, gid_t gid, int flags) { vnode_t *startvp, *vp; file_t *filefp; @@ -87,11 +81,12 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) if (fd == AT_FDCWD && name == NULL) return (set_errno(EFAULT)); - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { + if (name != NULL) { if (copyin(name, &startchar, sizeof (char))) return (set_errno(EFAULT)); - } else + } else { startchar = '\0'; + } if (fd == AT_FDCWD) @@ -100,10 +95,9 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) /* * only get fd if not doing absolute lookup */ - if (startchar != '/' || nmflag == 0) { - if ((filefp = getf(fd)) == NULL) { + if (startchar != '/') { + if ((filefp = getf(fd)) == NULL) return (set_errno(EBADF)); - } startvp = filefp->f_vnode; VN_HOLD(startvp); releasef(fd); @@ -112,13 +106,13 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) } } - if ((nmflag == 2) && audit_active) + if (audit_active) audit_setfsat_path(1); /* - * Do lookups for chown, lchown and fchownat when name not NULL + * Do lookup for fchownat when name not NULL */ - if ((nmflag == 2 && name != NULL) || nmflag == 1) { + if (name != NULL) { if (error = lookupnameat(name, UIO_USERSPACE, (flags == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW, @@ -149,33 +143,21 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) else return (error); } -/* - * Change ownership of file given file name. - */ + int chown(char *fname, uid_t uid, gid_t gid) { - return (cfchownat(AT_FDCWD, fname, 1, uid, gid, 0)); + return (fchownat(AT_FDCWD, fname, uid, gid, 0)); } int lchown(char *fname, uid_t uid, gid_t gid) { - return (cfchownat(AT_FDCWD, fname, 1, uid, gid, AT_SYMLINK_NOFOLLOW)); + return (fchownat(AT_FDCWD, fname, uid, gid, AT_SYMLINK_NOFOLLOW)); } -/* - * Change ownership of file given file descriptor. - */ int fchown(int fd, uid_t uid, uid_t gid) { - return (cfchownat(fd, NULL, 0, uid, gid, 0)); -} - -int -fchownat(int fd, char *name, uid_t uid, gid_t gid, int flags) -{ - return (cfchownat(fd, name, 2, uid, gid, flags)); - + return (fchownat(fd, NULL, uid, gid, 0)); } diff --git a/usr/src/uts/common/syscall/fcntl.c b/usr/src/uts/common/syscall/fcntl.c index 021064d1cd..5ad1497d3b 100644 --- a/usr/src/uts/common/syscall/fcntl.c +++ b/usr/src/uts/common/syscall/fcntl.c @@ -21,7 +21,7 @@ /* ONC_PLUS EXTRACT START */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -33,7 +33,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* ONC_PLUS EXTRACT END */ #include <sys/param.h> @@ -687,12 +686,6 @@ out: return (retval); } -int -dup(int fd) -{ - return (fcntl(fd, F_DUPFD, 0)); -} - /* ONC_PLUS EXTRACT START */ int flock_check(vnode_t *vp, flock64_t *flp, offset_t offset, offset_t max) diff --git a/usr/src/uts/common/syscall/fsat.c b/usr/src/uts/common/syscall/fsat.c deleted file mode 100644 index d9b7f4e288..0000000000 --- a/usr/src/uts/common/syscall/fsat.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/types.h> -#include <sys/errno.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <sys/vnode.h> -#include <sys/vfs.h> -#include <sys/time.h> -#include <sys/systm.h> -#include <sys/debug.h> - -extern int openat(int, char *, int, int); -extern int renameat(int, char *, int, char *); -extern int unlinkat(int, char *, int); -extern int fchownat(int, char *, uid_t, gid_t, int); -extern int fstatat(int, char *, struct stat *, int); -extern int futimesat(int, char *, struct timeval *); -extern int faccessat(int, char *, int, int); -extern int openattrdirat(int, char *); -#if defined(_SYSCALL32_IMPL) || defined(_ILP32) -extern int fstatat64_32(int, char *, struct stat64_32 *, int); -extern int fstatat32(int, char *, struct stat32 *, int); -extern int openat32(int, char *, int, int); -extern int fstatat64(int, char *, struct stat64 *, int); -extern int openat64(int, char *, int, int); -extern int fstatat64_32(int, char *, struct stat64_32 *, int); -#endif - - -/* - * Handle all of the *at system calls - * - * subcodes: - * 0 - openat - * 1 - openat64 - * 2 - fstatat64 - * 3 - fstatat - * 4 - fchownat - * 5 - unlinkat - * 6 - futimesat - * 7 - renameat - * 8 - faccessat - * 9 - openattrdirat - * - * The code for handling the at functionality exists in the file where the - * base syscall is defined. For example openat is in open.c - */ - -#if defined(_SYSCALL32_IMPL) || defined(_ILP32) - -int -fsat32(int code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, - uintptr_t arg4, uintptr_t arg5) -{ - switch (code) { - - case 0: /* openat */ -#if defined(_LP64) - return (openat32((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); -#else - return (openat((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); -#endif - case 1: /* openat64 */ - return (openat64((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); - case 2: /* fstatat64 */ -#if defined(_LP64) - return (fstatat64_32((int)arg1, (char *)arg2, - (struct stat64_32 *)arg3, (int)arg4)); -#else - return (fstatat64((int)arg1, (char *)arg2, - (struct stat64 *)arg3, (int)arg4)); -#endif - case 3: /* fstatat */ -#if defined(_LP64) - return (fstatat32((int)arg1, (char *)arg2, - (struct stat32 *)arg3, (int)arg4)); -#else - return (fstatat((int)arg1, (char *)arg2, - (struct stat *)arg3, (int)arg4)); -#endif - case 4: /* fchownat */ - return (fchownat((int)arg1, (char *)arg2, - (uid_t)arg3, (gid_t)arg4, (int)arg5)); - case 5: /* unlinkat */ - return (unlinkat((int)arg1, (char *)arg2, (int)arg3)); - case 6: /* futimesat */ - return (futimesat((int)arg1, - (char *)arg2, (struct timeval *)arg3)); - case 7: /* renameat */ - return (renameat((int)arg1, (char *)arg2, (int)arg3, - (char *)arg4)); - case 8: /* faccessat */ - return (faccessat((int)arg1, (char *)arg2, (int)arg3, - (int)arg4)); - case 9: /* openattrdirat */ - return (openattrdirat((int)arg1, (char *)arg2)); - default: - return (set_errno(EINVAL)); - } -} - -#endif - -/* - * For 64 kernels, use fsat64 - */ - -#if defined(_LP64) - -int -fsat64(int code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, - uintptr_t arg4, uintptr_t arg5) -{ - switch (code) { - - case 0: /* openat */ - return (openat((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); - case 1: /* openat64 */ - return (set_errno(ENOSYS)); - case 2: /* fstatat64 */ - return (set_errno(ENOSYS)); - case 3: /* fstatat */ - return (fstatat((int)arg1, (char *)arg2, - (struct stat *)arg3, (int)arg4)); - case 4: /* fchownat */ - return (fchownat((int)arg1, (char *)arg2, - (uid_t)arg3, (gid_t)arg4, (int)arg5)); - case 5: /* unlinkat */ - return (unlinkat((int)arg1, (char *)arg2, (int)arg3)); - case 6: /* futimesat */ - return (futimesat((int)arg1, - (char *)arg2, (struct timeval *)arg3)); - case 7: /* renameat */ - return (renameat((int)arg1, (char *)arg2, (int)arg3, - (char *)arg4)); - case 8: /* faccessat */ - return (faccessat((int)arg1, (char *)arg2, (int)arg3, - (int)arg4)); - case 9: /* openattrdirat */ - return (openattrdirat((int)arg1, (char *)arg2)); - default: - return (set_errno(EINVAL)); - } -} -#endif diff --git a/usr/src/uts/common/syscall/lwp_sobj.c b/usr/src/uts/common/syscall/lwp_sobj.c index 3a7e5997c5..94492d64f0 100644 --- a/usr/src/uts/common/syscall/lwp_sobj.c +++ b/usr/src/uts/common/syscall/lwp_sobj.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1358,20 +1358,6 @@ out: return (0); } -/* - * Obsolete lwp_mutex_lock() interface, no longer called from libc. - * libc now calls lwp_mutex_timedlock(lp, NULL, NULL). - * This system call trap continues to exist solely for the benefit - * of old statically-linked binaries from Solaris 9 and before. - * It should be removed from the system when we no longer care - * about such applications. - */ -int -lwp_mutex_lock(lwp_mutex_t *lp) -{ - return (lwp_mutex_timedlock(lp, NULL, NULL)); -} - static int iswanted(kthread_t *t, lwpchan_t *lwpchan) { @@ -2165,19 +2151,6 @@ out: return (0); } -/* - * Obsolete lwp_sema_wait() interface, no longer called from libc. - * libc now calls lwp_sema_timedwait(). - * This system call trap exists solely for the benefit of old - * statically linked applications from Solaris 9 and before. - * It should be removed when we no longer care about such applications. - */ -int -lwp_sema_wait(lwp_sema_t *sp) -{ - return (lwp_sema_timedwait(sp, NULL, 0)); -} - int lwp_sema_post(lwp_sema_t *sp) { diff --git a/usr/src/uts/common/syscall/mknod.c b/usr/src/uts/common/syscall/mknod.c index 2b61dac506..73258f9c2f 100644 --- a/usr/src/uts/common/syscall/mknod.c +++ b/usr/src/uts/common/syscall/mknod.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -94,14 +93,3 @@ mknod(char *fname, mode_t fmode, dev_t dev) VN_RELE(vp); return (0); } - -#if defined(__i386) || defined(__i386_COMPAT) - -/*ARGSUSED*/ -int -xmknod(int version, char *fname, mode_t fmode, dev_t dev) -{ - return (mknod(fname, fmode, dev)); -} - -#endif diff --git a/usr/src/uts/common/syscall/open.c b/usr/src/uts/common/syscall/open.c index a2504bc1c4..e4fc89f3ec 100644 --- a/usr/src/uts/common/syscall/open.c +++ b/usr/src/uts/common/syscall/open.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -50,8 +51,8 @@ #include <sys/cmn_err.h> /* - * Common code for open()/openat() and creat(). Check permissions, allocate - * an open file structure, and call the device open routine (if any). + * Common code for openat(). Check permissions, allocate an open + * file structure, and call the device open routine (if any). */ static int @@ -100,8 +101,8 @@ copen(int startfd, char *fname, int filemode, int createmode) * Handle openattrdirat request */ if (filemode & FXATTRDIROPEN) { - if (audit_active) - audit_setfsat_path(1); + if (audit_active) + audit_setfsat_path(1); if (error = lookupnameat(fname, seg, FOLLOW, NULLVPP, &vp, startvp)) @@ -254,95 +255,61 @@ out: } #define OPENMODE32(fmode) ((int)((fmode)-FOPEN)) -#define CREATMODE32 (FWRITE|FCREAT|FTRUNC) #define OPENMODE64(fmode) (OPENMODE32(fmode) | FOFFMAX) #define OPENMODEATTRDIR FXATTRDIROPEN -#define CREATMODE64 (CREATMODE32 | FOFFMAX) #ifdef _LP64 #define OPENMODE(fmode) OPENMODE64(fmode) -#define CREATMODE CREATMODE64 #else #define OPENMODE OPENMODE32 -#define CREATMODE CREATMODE32 #endif /* * Open a file. */ int -open(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE(fmode), cmode)); -} - -/* - * Create a file. - */ -int -creat(char *fname, int cmode) +openat(int fd, char *path, int fmode, int cmode) { - return (copen(AT_FDCWD, fname, CREATMODE, cmode)); + return (copen(fd, path, OPENMODE(fmode), cmode)); } int -openat(int fd, char *path, int fmode, int cmode) +open(char *path, int fmode, int cmode) { - return (copen(fd, path, OPENMODE(fmode), cmode)); + return (openat(AT_FDCWD, path, fmode, cmode)); } #if defined(_ILP32) || defined(_SYSCALL32_IMPL) /* - * Open and Creat for large files in 32-bit environment. Sets the FOFFMAX flag. + * Open for large files in 32-bit environment. Sets the FOFFMAX flag. */ int -open64(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE64(fmode), cmode)); -} - -int -creat64(char *fname, int cmode) +openat64(int fd, char *path, int fmode, int cmode) { - return (copen(AT_FDCWD, fname, CREATMODE64, cmode)); + return (copen(fd, path, OPENMODE64(fmode), cmode)); } int -openat64(int fd, char *path, int fmode, int cmode) +open64(char *path, int fmode, int cmode) { - return (copen(fd, path, OPENMODE64(fmode), cmode)); + return (openat64(AT_FDCWD, path, fmode, cmode)); } #endif /* _ILP32 || _SYSCALL32_IMPL */ #ifdef _SYSCALL32_IMPL /* - * Open and Creat for 32-bit compatibility on 64-bit kernel + * Open for 32-bit compatibility on 64-bit kernel */ int -open32(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE32(fmode), cmode)); -} - -int -creat32(char *fname, int cmode) -{ - return (copen(AT_FDCWD, fname, CREATMODE32, cmode)); -} - -int openat32(int fd, char *path, int fmode, int cmode) { return (copen(fd, path, OPENMODE32(fmode), cmode)); } -#endif /* _SYSCALL32_IMPL */ - -/* - * Special interface to open hidden attribute directory. - */ int -openattrdirat(int fd, char *fname) +open32(char *path, int fmode, int cmode) { - return (copen(fd, fname, OPENMODEATTRDIR, 0)); + return (openat32(AT_FDCWD, path, fmode, cmode)); } + +#endif /* _SYSCALL32_IMPL */ diff --git a/usr/src/uts/common/syscall/poll.c b/usr/src/uts/common/syscall/poll.c index bed14f800a..dfcbb6dc9f 100644 --- a/usr/src/uts/common/syscall/poll.c +++ b/usr/src/uts/common/syscall/poll.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -618,28 +618,6 @@ pollout: } /* - * This system call trap exists solely for binary compatibility with - * old statically-linked applications. It is not called from libc. - * It should be removed in the next release. - */ -int -poll(pollfd_t *fds, nfds_t nfds, int time_out) -{ - timespec_t ts; - timespec_t *tsp; - - if (time_out < 0) - tsp = NULL; - else { - ts.tv_sec = time_out / MILLISEC; - ts.tv_nsec = (time_out % MILLISEC) * MICROSEC; - tsp = &ts; - } - - return (poll_common(fds, nfds, tsp, NULL)); -} - -/* * This is the system call trap that poll(), * select() and pselect() are built upon. * It is a private interface between libc and the kernel. diff --git a/usr/src/uts/common/syscall/rename.c b/usr/src/uts/common/syscall/rename.c index 4d8d5270ed..4228ea688a 100644 --- a/usr/src/uts/common/syscall/rename.c +++ b/usr/src/uts/common/syscall/rename.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -47,19 +45,6 @@ #include <sys/fcntl.h> /* - * Rename or move an existing file. - */ -int -rename(char *from, char *to) -{ - int error; - - if (error = vn_rename(from, to, UIO_USERSPACE)) - return (set_errno(error)); - return (0); -} - -/* * Rename a file relative to a given directory */ int @@ -137,3 +122,9 @@ renameat(int fromfd, char *old, int tofd, char *new) return (set_errno(error)); return (error); } + +int +rename(char *old, char *new) +{ + return (renameat(AT_FDCWD, old, AT_FDCWD, new)); +} diff --git a/usr/src/uts/common/syscall/rmdir.c b/usr/src/uts/common/syscall/rmdir.c deleted file mode 100644 index 0a0ad7e2cd..0000000000 --- a/usr/src/uts/common/syscall/rmdir.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/isa_defs.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/systm.h> -#include <sys/errno.h> -#include <sys/vnode.h> -#include <sys/uio.h> -#include <sys/filio.h> - -#include <sys/debug.h> - -/* - * Remove a directory. - */ -int -rmdir(char *dname) -{ - int error; - - if (error = vn_remove(dname, UIO_USERSPACE, RMDIRECTORY)) - return (set_errno(error)); - return (0); -} diff --git a/usr/src/uts/common/syscall/stat.c b/usr/src/uts/common/syscall/stat.c index 8bd03c2454..87ede7fe62 100644 --- a/usr/src/uts/common/syscall/stat.c +++ b/usr/src/uts/common/syscall/stat.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Get file attribute information through a file name or a file descriptor. */ @@ -63,17 +62,8 @@ * to VOP_GETATTR */ -/* - * nmflag has the following values - * - * 1 - Always do lookup. i.e. stat, lstat. - * 2 - Name is optional i.e. fstatat - * 0 - Don't lookup name, vp is in file_p. i.e. fstat - * - */ static int -cstatat_getvp(int fd, char *name, int nmflag, - int follow, vnode_t **vp, cred_t **cred) +cstatat_getvp(int fd, char *name, int follow, vnode_t **vp, cred_t **cred) { vnode_t *startvp; file_t *fp; @@ -88,22 +78,15 @@ cstatat_getvp(int fd, char *name, int nmflag, */ if (fd == AT_FDCWD) { - if (name != NULL || nmflag != 2) { - startvp = NULL; - cr = CRED(); - crhold(cr); - } else - return (EFAULT); + startvp = NULL; + cr = CRED(); + crhold(cr); } else { char startchar; - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { - if (copyin(name, &startchar, sizeof (char))) - return (EFAULT); - } else { - startchar = '\0'; - } - if (startchar != '/' || nmflag == 0) { + if (copyin(name, &startchar, sizeof (char))) + return (EFAULT); + if (startchar != '/') { if ((fp = getf(fd)) == NULL) { return (EBADF); } @@ -123,24 +106,19 @@ cstatat_getvp(int fd, char *name, int nmflag, if (audit_active) audit_setfsat_path(1); - - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { lookup: - if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP, - vp, startvp)) { - if ((error == ESTALE) && - fs_need_estale_retry(estale_retry++)) - goto lookup; - if (startvp != NULL) - VN_RELE(startvp); - crfree(cr); - return (error); - } + if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP, + vp, startvp)) { + if ((error == ESTALE) && + fs_need_estale_retry(estale_retry++)) + goto lookup; if (startvp != NULL) VN_RELE(startvp); - } else { - *vp = startvp; + crfree(cr); + return (error); } + if (startvp != NULL) + VN_RELE(startvp); return (0); } @@ -151,21 +129,9 @@ lookup: * N-bit kernel, N-bit applications, N-bit file offsets */ -static int cstatat(int, char *, int, struct stat *, int, int); +static int cstatat(int, char *, struct stat *, int, int); static int cstat(vnode_t *vp, struct stat *, int, cred_t *); -int -stat(char *fname, struct stat *sb) -{ - return (cstatat(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); -} - -int -lstat(char *fname, struct stat *sb) -{ - return (cstatat(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); -} - /* * fstat can and should be fast, do an inline implementation here. */ @@ -174,6 +140,8 @@ lstat(char *fname, struct stat *sb) file_t *fp; \ int error; \ \ + if (fd == AT_FDCWD) \ + return (set_errno(EFAULT)); \ if ((fp = getf(fd)) == NULL) \ return (set_errno(EBADF)); \ if (audit_active) \ @@ -194,48 +162,32 @@ fstat(int fd, struct stat *sb) int fstatat(int fd, char *name, struct stat *sb, int flags) { - return (cstatat(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); -} + int followflag; + int csflags; -#if defined(__i386) || defined(__i386_COMPAT) + if (name == NULL) + return (fstat(fd, sb)); -/* - * Handle all the "extended" stat operations in the same way; - * validate the version, then call the real handler. - */ - -#define XSTAT_BODY(ver, f, s, fn) \ - return (ver != _STAT_VER ? set_errno(EINVAL) : fn(f, s)); - -#endif /* __i386 || __i386_COMPAT */ + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ -#if defined(__i386) - -/* - * Syscalls for i386 applications that issue {,l,f}xstat() directly - */ -int -xstat(int version, char *fname, struct stat *sb) -{ - XSTAT_BODY(version, fname, sb, stat) + return (cstatat(fd, name, sb, followflag, csflags)); } int -lxstat(int version, char *fname, struct stat *sb) +stat(char *name, struct stat *sb) { - XSTAT_BODY(version, fname, sb, lstat) + return (fstatat(AT_FDCWD, name, sb, 0)); } int -fxstat(int version, int fd, struct stat *sb) +lstat(char *name, struct stat *sb) { - XSTAT_BODY(version, fd, sb, fstat) + return (fstatat(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } -#endif /* __i386 */ - /* * Common code for stat(), lstat(), and fstat(). * (32-bit kernel, 32-bit applications, 32-bit files) @@ -304,7 +256,7 @@ cstat(vnode_t *vp, struct stat *ubp, int flag, cred_t *cr) } static int -cstatat(int fd, char *name, int nmflag, struct stat *sb, int follow, int flags) +cstatat(int fd, char *name, struct stat *sb, int follow, int flags) { vnode_t *vp; int error; @@ -314,16 +266,14 @@ cstatat(int fd, char *name, int nmflag, struct stat *sb, int follow, int flags) link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -335,19 +285,8 @@ out: /* * 64-bit kernel, 32-bit applications, 32-bit file offsets */ -static int cstatat32(int, char *, int, struct stat32 *, int, int); +static int cstatat32(int, char *, struct stat32 *, int, int); static int cstat32(vnode_t *, struct stat32 *, int, cred_t *); -int -stat32(char *fname, struct stat32 *sb) -{ - return (cstatat32(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); -} - -int -lstat32(char *fname, struct stat32 *sb) -{ - return (cstatat32(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); -} int fstat32(int fd, struct stat32 *sb) @@ -358,36 +297,32 @@ fstat32(int fd, struct stat32 *sb) int fstatat32(int fd, char *name, struct stat32 *sb, int flags) { - return (cstatat32(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); -} + int followflag; + int csflags; -#if defined(__i386_COMPAT) + if (name == NULL) + return (fstat32(fd, sb)); -/* - * Syscalls for i386 applications that issue {,l,f}xstat() directly - */ -int -xstat32(int version, char *fname, struct stat32 *sb) -{ - XSTAT_BODY(version, fname, sb, stat32) + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat32(fd, name, sb, followflag, csflags)); } int -lxstat32(int version, char *fname, struct stat32 *sb) +stat32(char *name, struct stat32 *sb) { - XSTAT_BODY(version, fname, sb, lstat32) + return (fstatat32(AT_FDCWD, name, sb, 0)); } int -fxstat32(int version, int fd, struct stat32 *sb) +lstat32(char *name, struct stat32 *sb) { - XSTAT_BODY(version, fd, sb, fstat32) + return (fstatat32(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } -#endif /* __i386_COMPAT */ - static int cstat32(vnode_t *vp, struct stat32 *ubp, int flag, struct cred *cr) { @@ -444,8 +379,7 @@ cstat32(vnode_t *vp, struct stat32 *ubp, int flag, struct cred *cr) } static int -cstatat32(int fd, char *name, int nmflag, struct stat32 *sb, - int follow, int flags) +cstatat32(int fd, char *name, struct stat32 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -455,16 +389,14 @@ cstatat32(int fd, char *name, int nmflag, struct stat32 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat32(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -480,33 +412,42 @@ out: * * These routines are implemented differently on 64-bit kernels. */ -static int cstatat64(int, char *, int, struct stat64 *, int, int); +static int cstatat64(int, char *, struct stat64 *, int, int); static int cstat64(vnode_t *, struct stat64 *, int, cred_t *); int -stat64(char *fname, struct stat64 *sb) +fstat64(int fd, struct stat64 *sb) { - return (cstatat64(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); + FSTAT_BODY(fd, sb, cstat64) } int -lstat64(char *fname, struct stat64 *sb) +fstatat64(int fd, char *name, struct stat64 *sb, int flags) { - return (cstatat64(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); + int followflag; + int csflags; + + if (name == NULL) + return (fstat64(fd, sb)); + + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat64(fd, name, sb, followflag, csflags)); } int -fstat64(int fd, struct stat64 *sb) +stat64(char *name, struct stat64 *sb) { - FSTAT_BODY(fd, sb, cstat64) + return (fstatat64(AT_FDCWD, name, sb, 0)); } int -fstatat64(int fd, char *name, struct stat64 *sb, int flags) +lstat64(char *name, struct stat64 *sb) { - return (cstatat64(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); + return (fstatat64(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } static int @@ -546,8 +487,7 @@ cstat64(vnode_t *vp, struct stat64 *ubp, int flag, cred_t *cr) } static int -cstatat64(int fd, char *name, int nmflag, struct stat64 *sb, - int follow, int flags) +cstatat64(int fd, char *name, struct stat64 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -557,16 +497,14 @@ cstatat64(int fd, char *name, int nmflag, struct stat64 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat64(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -585,33 +523,42 @@ out: * differently from the way the 32-bit ABI defines it. */ -static int cstatat64_32(int, char *, int, struct stat64_32 *, int, int); +static int cstatat64_32(int, char *, struct stat64_32 *, int, int); static int cstat64_32(vnode_t *, struct stat64_32 *, int, cred_t *); int -stat64_32(char *fname, struct stat64_32 *sb) +fstat64_32(int fd, struct stat64_32 *sb) { - return (cstatat64_32(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); + FSTAT_BODY(fd, sb, cstat64_32) } int -lstat64_32(char *fname, struct stat64_32 *sb) +fstatat64_32(int fd, char *name, struct stat64_32 *sb, int flags) { - return (cstatat64_32(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); + int followflag; + int csflags; + + if (name == NULL) + return (fstat64_32(fd, sb)); + + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat64_32(fd, name, sb, followflag, csflags)); } int -fstat64_32(int fd, struct stat64_32 *sb) +stat64_32(char *name, struct stat64_32 *sb) { - FSTAT_BODY(fd, sb, cstat64_32) + return (fstatat64_32(AT_FDCWD, name, sb, 0)); } int -fstatat64_32(int fd, char *name, struct stat64_32 *sb, int flags) +lstat64_32(char *name, struct stat64_32 *sb) { - return (cstatat64_32(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); + return (fstatat64_32(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } static int @@ -659,8 +606,7 @@ cstat64_32(vnode_t *vp, struct stat64_32 *ubp, int flag, cred_t *cr) } static int -cstatat64_32(int fd, char *name, int nmflag, struct stat64_32 *sb, - int follow, int flags) +cstatat64_32(int fd, char *name, struct stat64_32 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -670,16 +616,14 @@ cstatat64_32(int fd, char *name, int nmflag, struct stat64_32 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat64_32(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } diff --git a/usr/src/uts/common/syscall/umount.c b/usr/src/uts/common/syscall/umount.c index 970afd9b2b..a2deedb163 100644 --- a/usr/src/uts/common/syscall/umount.c +++ b/usr/src/uts/common/syscall/umount.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/t_lock.h> #include <sys/param.h> @@ -193,13 +192,3 @@ umount2(char *pathp, int flag) return (umount2_engine(vfsp, flag, CRED(), 1)); } - -/* - * Old umount() system call for compatibility. - * Changes due to support for forced unmount. - */ -int -umount(char *pathp) -{ - return (umount2(pathp, 0)); -} diff --git a/usr/src/uts/common/syscall/unlink.c b/usr/src/uts/common/syscall/unlink.c index cd97f970ca..27546c959a 100644 --- a/usr/src/uts/common/syscall/unlink.c +++ b/usr/src/uts/common/syscall/unlink.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -47,19 +46,6 @@ #include <c2/audit.h> /* - * Unlink (i.e. delete) a file. - */ -int -unlink(char *fname) -{ - int error; - - if (error = vn_remove(fname, UIO_USERSPACE, RMFILE)) - return (set_errno(error)); - return (0); -} - -/* * Unlink a file from a directory */ int @@ -106,3 +92,15 @@ unlinkat(int fd, char *name, int flags) return (set_errno(error)); return (0); } + +int +unlink(char *name) +{ + return (unlinkat(AT_FDCWD, name, 0)); +} + +int +rmdir(char *name) +{ + return (unlinkat(AT_FDCWD, name, AT_REMOVEDIR)); +} diff --git a/usr/src/uts/common/syscall/utime.c b/usr/src/uts/common/syscall/utime.c index 38cf6069f7..43cdf1d62b 100644 --- a/usr/src/uts/common/syscall/utime.c +++ b/usr/src/uts/common/syscall/utime.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,48 +115,6 @@ cfutimesat(int fd, char *fname, int nmflag, vattr_t *vap, int flags, int follow) return (0); } -/* - * Expunge this function when futimesat() and utimes() - * are expunged from the kernel. - */ -static int -get_timeval_vattr(struct timeval *tvptr, struct vattr *vattr, int *flags) -{ - struct timeval tv[2]; - - if (tvptr != NULL) { - if (get_udatamodel() == DATAMODEL_NATIVE) { - if (copyin(tvptr, tv, sizeof (tv))) - return (EFAULT); - } else { - struct timeval32 tv32[2]; - - if (copyin(tvptr, tv32, sizeof (tv32))) - return (EFAULT); - - TIMEVAL32_TO_TIMEVAL(&tv[0], &tv32[0]); - TIMEVAL32_TO_TIMEVAL(&tv[1], &tv32[1]); - } - - if (tv[0].tv_usec < 0 || tv[0].tv_usec >= MICROSEC || - tv[1].tv_usec < 0 || tv[1].tv_usec >= MICROSEC) - return (EINVAL); - - vattr->va_atime.tv_sec = tv[0].tv_sec; - vattr->va_atime.tv_nsec = tv[0].tv_usec * 1000; - vattr->va_mtime.tv_sec = tv[1].tv_sec; - vattr->va_mtime.tv_nsec = tv[1].tv_usec * 1000; - *flags = ATTR_UTIME; - } else { - gethrestime(&vattr->va_atime); - vattr->va_mtime = vattr->va_atime; - *flags = 0; - } - vattr->va_mask = AT_ATIME | AT_MTIME; - - return (0); -} - static int get_timespec_vattr(timespec_t *tsptr, struct vattr *vattr, int *flags) { @@ -212,90 +170,6 @@ get_timespec_vattr(timespec_t *tsptr, struct vattr *vattr, int *flags) return (0); } -/* - * The futimesat() system call is no longer invoked from libc. - * The futimesat() function has been implemented in libc using calls - * to futimens() and utimensat(). The kernel code for futimesat() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - * This includes the calls to futimesat in common/syscall/fsat.c - */ -int -futimesat(int fd, char *fname, struct timeval *tvptr) -{ - struct vattr vattr; - int flags; - int error; - - if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) - return (set_errno(error)); - - return (cfutimesat(fd, fname, 2, &vattr, flags, FOLLOW)); -} - -/* - * The utime() system call is no longer invoked from libc. - * The utime() function has been implemented in libc using - * a call to utimensat(). The kernel code for utime() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - */ -int -utime(char *fname, time_t *tptr) -{ - time_t tv[2]; - struct vattr vattr; - int flags; - - if (tptr != NULL) { - if (get_udatamodel() == DATAMODEL_NATIVE) { - if (copyin(tptr, tv, sizeof (tv))) - return (set_errno(EFAULT)); - } else { - time32_t tv32[2]; - - if (copyin(tptr, &tv32, sizeof (tv32))) - return (set_errno(EFAULT)); - - tv[0] = (time_t)tv32[0]; - tv[1] = (time_t)tv32[1]; - } - - vattr.va_atime.tv_sec = tv[0]; - vattr.va_atime.tv_nsec = 0; - vattr.va_mtime.tv_sec = tv[1]; - vattr.va_mtime.tv_nsec = 0; - flags = ATTR_UTIME; - } else { - gethrestime(&vattr.va_atime); - vattr.va_mtime = vattr.va_atime; - flags = 0; - } - - vattr.va_mask = AT_ATIME|AT_MTIME; - return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); -} - -/* - * The utimes() system call is no longer invoked from libc. - * The utimes() function has been implemented in libc using - * a call to utimensat(). The kernel code for utimes() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - */ -int -utimes(char *fname, struct timeval *tvptr) -{ - struct vattr vattr; - int flags; - int error; - - if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) - return (set_errno(error)); - - return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); -} - int futimens(int fd, timespec_t *tsptr) { |