summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorRoger A. Faulkner <Roger.Faulkner@Sun.COM>2010-02-28 18:42:20 -0800
committerRoger A. Faulkner <Roger.Faulkner@Sun.COM>2010-02-28 18:42:20 -0800
commit8fd04b8338ed5093ec2d1e668fa620b7de44c177 (patch)
treedc9fcd7d90062fa1e2b53b41a9b6e091194b875a /usr/src/lib
parente3c57d6a57265f8b9bf3871878cf9b92213e1188 (diff)
downloadillumos-gate-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/lib')
-rw-r--r--usr/src/lib/brand/lx/lx_brand/common/ptrace.c18
-rw-r--r--usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c7
-rw-r--r--usr/src/lib/brand/solaris10/s10_brand/Makefile.com4
-rw-r--r--usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c126
-rw-r--r--usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c529
-rw-r--r--usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h38
-rw-r--r--usr/src/lib/libbc/inc/include/sys/fcntlcom.h32
-rw-r--r--usr/src/lib/libbc/libc/gen/common/ttyslot.c38
-rw-r--r--usr/src/lib/libbc/libc/sys/4.2/chown.c14
-rw-r--r--usr/src/lib/libbc/libc/sys/4.2/execve.c19
-rw-r--r--usr/src/lib/libbc/libc/sys/4.2/rename.c7
-rw-r--r--usr/src/lib/libbc/libc/sys/4.2/rmdir.c13
-rw-r--r--usr/src/lib/libbc/libc/sys/4.2/stat.c14
-rw-r--r--usr/src/lib/libbc/libc/sys/4.2/unlink.c9
-rw-r--r--usr/src/lib/libbc/libc/sys/common/_access.c7
-rw-r--r--usr/src/lib/libbc/libc/sys/common/_creat.c15
-rw-r--r--usr/src/lib/libbc/libc/sys/common/_open.c26
-rw-r--r--usr/src/lib/libbc/libc/sys/common/_stat.c19
-rw-r--r--usr/src/lib/libbc/libc/sys/common/dup.c7
-rw-r--r--usr/src/lib/libbc/libc/sys/common/syscall.c56
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/chown.c13
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/execve.c19
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/rename.c7
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/rmdir.c13
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/stat.c14
-rw-r--r--usr/src/lib/libbc/libc/sys/sys5/unlink.c9
-rw-r--r--usr/src/lib/libbc/sparc/Makefile15
-rw-r--r--usr/src/lib/libbsm/audit_event.txt43
-rw-r--r--usr/src/lib/libc/amd64/Makefile39
-rw-r--r--usr/src/lib/libc/amd64/crt/_rtld.c330
-rw-r--r--usr/src/lib/libc/amd64/crt/alias_boot.h52
-rw-r--r--usr/src/lib/libc/common/sys/access.s43
-rw-r--r--usr/src/lib/libc/common/sys/chown.s43
-rw-r--r--usr/src/lib/libc/common/sys/dup.s43
-rw-r--r--usr/src/lib/libc/common/sys/fchown.s43
-rw-r--r--usr/src/lib/libc/common/sys/fcntl.s37
-rw-r--r--usr/src/lib/libc/common/sys/fstat.s60
-rw-r--r--usr/src/lib/libc/common/sys/lchown.s43
-rw-r--r--usr/src/lib/libc/common/sys/lstat.s60
-rw-r--r--usr/src/lib/libc/common/sys/open.s52
-rw-r--r--usr/src/lib/libc/common/sys/rename.s43
-rw-r--r--usr/src/lib/libc/common/sys/rmdir.s43
-rw-r--r--usr/src/lib/libc/common/sys/stat.s60
-rw-r--r--usr/src/lib/libc/common/sys/unlink.s43
-rw-r--r--usr/src/lib/libc/i386/Makefile.com44
-rw-r--r--usr/src/lib/libc/i386/crt/_rtboot.s15
-rw-r--r--usr/src/lib/libc/i386/crt/_rtld.c25
-rw-r--r--usr/src/lib/libc/i386/crt/alias_boot.h15
-rw-r--r--usr/src/lib/libc/i386/sys/fxstat.s37
-rw-r--r--usr/src/lib/libc/i386/sys/lxstat.s37
-rw-r--r--usr/src/lib/libc/i386/sys/xmknod.s38
-rw-r--r--usr/src/lib/libc/i386/sys/xstat.c80
-rw-r--r--usr/src/lib/libc/i386/sys/xstat.s38
-rw-r--r--usr/src/lib/libc/inc/libc.h11
-rw-r--r--usr/src/lib/libc/inc/thr_uberdata.h7
-rw-r--r--usr/src/lib/libc/port/gen/attrat.c12
-rw-r--r--usr/src/lib/libc/port/gen/dup.c (renamed from usr/src/lib/libc/port/gen/dup2.c)14
-rw-r--r--usr/src/lib/libc/port/sys/access.c (renamed from usr/src/lib/libc/common/sys/creat.s)43
-rw-r--r--usr/src/lib/libc/port/sys/chown.c (renamed from usr/src/lib/libc/port/sys/fsmisc.c)45
-rw-r--r--usr/src/lib/libc/port/sys/fcntl.c (renamed from usr/src/lib/libc/port/sys/libc_fcntl.c)8
-rw-r--r--usr/src/lib/libc/port/sys/open.c (renamed from usr/src/lib/libc/port/sys/libc_open.c)93
-rw-r--r--usr/src/lib/libc/port/sys/rename.c (renamed from usr/src/lib/libc/port/sys/fstatat.c)34
-rw-r--r--usr/src/lib/libc/port/sys/stat.c117
-rw-r--r--usr/src/lib/libc/port/sys/unlink.c (renamed from usr/src/lib/libc/port/sys/openat.c)47
-rw-r--r--usr/src/lib/libc/port/threads/scalls.c54
-rw-r--r--usr/src/lib/libc/port/threads/spawn.c6
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com41
-rw-r--r--usr/src/lib/libc/sparc/crt/_rtboot.s28
-rw-r--r--usr/src/lib/libc/sparc/crt/_rtld.c14
-rw-r--r--usr/src/lib/libc/sparc/crt/alias_boot.h15
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com33
-rw-r--r--usr/src/lib/libdtrace/common/dt_proc.c10
-rw-r--r--usr/src/lib/libpctx/common/libpctx.c14
-rw-r--r--usr/src/lib/libproc/common/Pcontrol.c16
-rw-r--r--usr/src/lib/libproc/common/pr_open.c69
-rw-r--r--usr/src/lib/libproc/common/pr_rename.c54
-rw-r--r--usr/src/lib/libproc/common/pr_stat.c225
-rw-r--r--usr/src/lib/libproc/common/proc_names.c62
-rw-r--r--usr/src/lib/libsocket/socket/_soutil.c8
-rw-r--r--usr/src/lib/libtnfctl/continue.c27
-rw-r--r--usr/src/lib/libtnfctl/open.c37
81 files changed, 1638 insertions, 2000 deletions
diff --git a/usr/src/lib/brand/lx/lx_brand/common/ptrace.c b/usr/src/lib/brand/lx/lx_brand/common/ptrace.c
index 57c564cbb4..041fff736c 100644
--- a/usr/src/lib/brand/lx/lx_brand/common/ptrace.c
+++ b/usr/src/lib/brand/lx/lx_brand/common/ptrace.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <errno.h>
#include <sys/types.h>
#include <sys/param.h>
@@ -444,8 +442,7 @@ getregs(pid_t pid, lwpid_t lwpid, lx_user_regs_t *rp)
* had called execve (respectively).
*/
if (status.pr_why == PR_SYSEXIT &&
- (status.pr_what == SYS_exec ||
- status.pr_what == SYS_execve)) {
+ status.pr_what == SYS_execve) {
rp->lxur_eax = 0;
rp->lxur_orig_eax = LX_SYS_execve;
}
@@ -1529,7 +1526,6 @@ ptrace_attach_common(int fd, pid_t lxpid, pid_t pid, lwpid_t lwpid, int run)
sysp = (sysset_t *)ctlp;
ctlp += sizeof (sysset_t) / sizeof (long);
premptyset(sysp);
- praddset(sysp, SYS_exec);
praddset(sysp, SYS_execve);
if (run) {
*ctlp++ = PCRUN;
@@ -1800,8 +1796,7 @@ ptrace_catch_fork(pid_t pid, int monitor)
sysp = (sysset_t *)ctlp;
ctlp += sizeof (sysset_t) / sizeof (long);
premptyset(sysp);
- praddset(sysp, SYS_fork1); /* for old libc */
- praddset(sysp, SYS_forksys); /* new libc: fork1() is forksys(0, 0) */
+ praddset(sysp, SYS_forksys); /* fork1() is forksys(0, 0) */
*ctlp++ = PCRUN;
*ctlp++ = 0;
*ctlp++ = PCWSTOP;
@@ -1815,10 +1810,8 @@ ptrace_catch_fork(pid_t pid, int monitor)
sysp = (sysset_t *)ctlp;
ctlp += sizeof (sysset_t) / sizeof (long);
premptyset(sysp);
- if (monitor) {
- praddset(sysp, SYS_exec);
+ if (monitor)
praddset(sysp, SYS_execve);
- }
size = (char *)ctlp - (char *)&ctl[0];
assert(size <= sizeof (ctl));
@@ -2097,8 +2090,7 @@ found:
* in that state as though it had reached the ptrace trace
* point.
*/
- if (status.pr_lwp.pr_what == SYS_exec ||
- status.pr_lwp.pr_what == SYS_execve) {
+ if (status.pr_lwp.pr_what == SYS_execve) {
infop->si_code = CLD_TRAPPED;
infop->si_status = SIGTRAP;
break;
diff --git a/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c b/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c
index 816ef31df2..852cfa38a6 100644
--- a/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c
+++ b/usr/src/lib/brand/sn1/sn1_brand/common/sn1_brand.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -479,7 +480,6 @@ sn1_##name(sysret_t *rv, \
*/
IN_KERNEL_SYSCALL(read, SYS_read) /* 3 */
IN_KERNEL_SYSCALL(write, SYS_write) /* 4 */
-IN_KERNEL_SYSCALL(wait, SYS_wait) /* 7 */
IN_KERNEL_SYSCALL(time, SYS_time) /* 13 */
IN_KERNEL_SYSCALL(getpid, SYS_getpid) /* 20 */
IN_KERNEL_SYSCALL(mount, SYS_mount) /* 21 */
@@ -488,6 +488,7 @@ IN_KERNEL_SYSCALL(times, SYS_times) /* 43 */
IN_KERNEL_SYSCALL(getgid, SYS_getgid) /* 47 */
IN_KERNEL_SYSCALL(utssys, SYS_utssys) /* 57 */
IN_KERNEL_SYSCALL(readlink, SYS_readlink) /* 90 */
+IN_KERNEL_SYSCALL(waitid, SYS_waitid) /* 107 */
/*
* This table must have at least NSYSCALL entries in it.
@@ -510,7 +511,7 @@ sn1_sysent_table_t sn1_sysent_table[] = {
EMULATE(sn1_write, 3 | RV_DEFAULT), /* 4 */
NOSYS, /* 5 */
NOSYS, /* 6 */
- EMULATE(sn1_wait, 0 | RV_32RVAL2), /* 7 */
+ NOSYS, /* 7 */
NOSYS, /* 8 */
NOSYS, /* 9 */
NOSYS, /* 10 */
@@ -610,7 +611,7 @@ sn1_sysent_table_t sn1_sysent_table[] = {
NOSYS, /* 104 */
NOSYS, /* 105 */
NOSYS, /* 106 */
- NOSYS, /* 107 */
+ EMULATE(sn1_waitid, 4 | RV_DEFAULT), /* 107 */
NOSYS, /* 108 */
NOSYS, /* 109 */
NOSYS, /* 110 */
diff --git a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com
index a57a9b3726..078dec2b6f 100644
--- a/usr/src/lib/brand/solaris10/s10_brand/Makefile.com
+++ b/usr/src/lib/brand/solaris10/s10_brand/Makefile.com
@@ -19,13 +19,13 @@
# 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.
#
LIBRARY = s10_brand.a
VERS = .1
-COBJS = s10_brand.o
+COBJS = s10_brand.o s10_deleted.o
ASOBJS = s10_crt.o s10_handler.o s10_runexe.o
OFFSETS_SRC = ../common/offsets.in
OFFSETS_H = assym.h
diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c
index d3b6955288..a5176e4179 100644
--- a/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c
+++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_brand.c
@@ -18,6 +18,7 @@
*
* CDDL HEADER END
*/
+
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
@@ -254,7 +255,7 @@ _s10_abort(int err, const char *msg, const char *file, int line)
(void) __systemcall(&rval, SYS_lwp_kill + 1024, _lwp_self(), SIGKILL);
}
-static int
+int
s10_uucopy(const void *from, void *to, size_t size)
{
sysret_t rval;
@@ -267,7 +268,7 @@ s10_uucopy(const void *from, void *to, size_t size)
/*
* ATTENTION: uucopystr() does NOT ensure that string are null terminated!
*/
-static int
+int
s10_uucopystr(const void *from, void *to, size_t size)
{
sysret_t rval;
@@ -488,13 +489,13 @@ mntfs_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg)
struct mntentbuf *embufp;
static size_t bufsize = MNT_LINE_MAX;
-
/* Do not emulate mntfs commands from up-to-date clients. */
if (S10_FEATURE_IS_PRESENT(S10_FEATURE_ALTERED_MNTFS_IOCTL))
return (__systemcall(rval, SYS_ioctl + 1024, fdes, cmd, arg));
/* Do not emulate mntfs commands directed at other file systems. */
- if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &statbuf)) != 0)
+ if ((err = __systemcall(rval, SYS_fstatat + 1024,
+ fdes, NULL, &statbuf, 0)) != 0)
return (err);
if (strcmp(statbuf.st_fstype, MNTTYPE_MNTFS) != 0)
return (__systemcall(rval, SYS_ioctl + 1024, fdes, cmd, arg));
@@ -651,12 +652,13 @@ crypto_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg)
struct stat sbuf;
if (crypto_dev == (dev_t)-1) {
- if ((err = __systemcall(rval, SYS_stat + 1024, "/dev/crypto",
- &sbuf)) != 0)
+ if ((err = __systemcall(rval, SYS_fstatat + 1024,
+ AT_FDCWD, "/dev/crypto", &sbuf, 0)) != 0)
goto nonemuioctl;
crypto_dev = major(sbuf.st_rdev);
}
- if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &sbuf)) != 0)
+ if ((err = __systemcall(rval, SYS_fstatat + 1024,
+ fdes, NULL, &sbuf, 0)) != 0)
return (err);
/* Each open fd of /dev/crypto gets a new minor device. */
if (major(sbuf.st_rdev) != crypto_dev)
@@ -785,7 +787,8 @@ ctfs_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg)
ct_param_t param;
struct stat statbuf;
- if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &statbuf)) != 0)
+ if ((err = __systemcall(rval, SYS_fstatat + 1024,
+ fdes, NULL, &statbuf, 0)) != 0)
return (err);
if (strcmp(statbuf.st_fstype, MNTTYPE_CTFS) != 0)
return (__systemcall(rval, SYS_ioctl + 1024, fdes, cmd, arg));
@@ -845,12 +848,13 @@ zfs_ioctl(sysret_t *rval, int fdes, int cmd, intptr_t arg)
struct stat sbuf;
if (zfs_dev == (dev_t)-1) {
- if ((err = __systemcall(rval, SYS_stat + 1024, "/dev/zfs",
- &sbuf)) != 0)
+ if ((err = __systemcall(rval, SYS_fstatat + 1024,
+ AT_FDCWD, "/dev/zfs", &sbuf, 0) != 0) != 0)
goto nonemuioctl;
zfs_dev = major(sbuf.st_rdev);
}
- if ((err = __systemcall(rval, SYS_fstat + 1024, fdes, &sbuf)) != 0)
+ if ((err = __systemcall(rval, SYS_fstatat + 1024,
+ fdes, NULL, &sbuf, 0)) != 0)
return (err);
if (major(sbuf.st_rdev) != zfs_dev)
goto nonemuioctl;
@@ -969,7 +973,7 @@ s10_pwrite(sysret_t *rval, int fd, const void *bufferp, size_t num_bytes,
offset));
}
-#ifndef _LP64
+#if !defined(_LP64)
/*
* This is the large file version of the pwrite() system call for 32-bit
* processes. This exists for the same reason that s10_pwrite() exists; see
@@ -1324,7 +1328,7 @@ s10_exec(sysret_t *rval, const char *fname, const char **argp)
return (err);
/* If an exec call succeeds, it never returns */
- err = __systemcall(rval, SYS_exec + 1024, fname, argp);
+ err = __systemcall(rval, SYS_execve + 1024, fname, argp, NULL);
s10_assert(err != 0);
return (err);
}
@@ -1437,8 +1441,8 @@ s10_sysinfo(sysret_t *rv, int command, char *buf, long count)
return (0);
}
-#ifdef __x86
-#ifdef __amd64
+#if defined(__x86)
+#if defined(__amd64)
/*
* 64-bit x86 LWPs created by SYS_lwp_create start here if they need to set
* their %fs registers to the legacy Solaris 10 selector value.
@@ -1539,6 +1543,7 @@ s10_lwp_create_correct_fs(sysret_t *rval, ucontext_t *ucp, int flags,
*/
if (s10_uucopy(ucp, &s10_uc, sizeof (s10_uc)) != 0)
return (EFAULT);
+
s10_uc.uc_mcontext.gregs[REG_R14] = s10_uc.uc_mcontext.gregs[REG_RIP];
s10_uc.uc_mcontext.gregs[REG_RIP] = (greg_t)s10_lwp_create_entry_point;
@@ -1575,7 +1580,7 @@ s10_lwp_create(sysret_t *rval, ucontext_t *ucp, int flags, id_t *new_lwp)
static int
s10_lwp_private(sysret_t *rval, int cmd, int which, uintptr_t base)
{
-#ifdef __amd64
+#if defined(__amd64)
int err;
/*
@@ -1962,42 +1967,42 @@ s10_init(int argc, char *argv[], char *envp[])
s10_sysent_table_t s10_sysent_table[] = {
#if defined(__sparc) && !defined(__sparcv9)
EMULATE(s10_indir, 9 | RV_64RVAL), /* 0 */
-#else /* !__sparc || __sparcv9 */
+#else
NOSYS, /* 0 */
-#endif /* !__sparc || __sparcv9 */
+#endif
NOSYS, /* 1 */
- NOSYS, /* 2 */
+ EMULATE(s10_forkall, 0 | RV_32RVAL2), /* 2 */
NOSYS, /* 3 */
NOSYS, /* 4 */
- NOSYS, /* 5 */
+ EMULATE(s10_open, 3 | RV_DEFAULT), /* 5 */
NOSYS, /* 6 */
- NOSYS, /* 7 */
- NOSYS, /* 8 */
+ EMULATE(s10_wait, 0 | RV_32RVAL2), /* 7 */
+ EMULATE(s10_creat, 2 | RV_DEFAULT), /* 8 */
NOSYS, /* 9 */
- NOSYS, /* 10 */
+ EMULATE(s10_unlink, 1 | RV_DEFAULT), /* 10 */
EMULATE(s10_exec, 2 | RV_DEFAULT), /* 11 */
NOSYS, /* 12 */
NOSYS, /* 13 */
NOSYS, /* 14 */
NOSYS, /* 15 */
- NOSYS, /* 16 */
+ EMULATE(s10_chown, 3 | RV_DEFAULT), /* 16 */
NOSYS, /* 17 */
- NOSYS, /* 18 */
+ EMULATE(s10_stat, 2 | RV_DEFAULT), /* 18 */
NOSYS, /* 19 */
NOSYS, /* 20 */
NOSYS, /* 21 */
- NOSYS, /* 22 */
+ EMULATE(s10_umount, 1 | RV_DEFAULT), /* 22 */
NOSYS, /* 23 */
NOSYS, /* 24 */
NOSYS, /* 25 */
NOSYS, /* 26 */
NOSYS, /* 27 */
- NOSYS, /* 28 */
+ EMULATE(s10_fstat, 2 | RV_DEFAULT), /* 28 */
NOSYS, /* 29 */
- NOSYS, /* 30 */
+ EMULATE(s10_utime, 2 | RV_DEFAULT), /* 30 */
NOSYS, /* 31 */
NOSYS, /* 32 */
- NOSYS, /* 33 */
+ EMULATE(s10_access, 2 | RV_DEFAULT), /* 33 */
NOSYS, /* 34 */
NOSYS, /* 35 */
NOSYS, /* 36 */
@@ -2005,7 +2010,7 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 38 */
NOSYS, /* 39 */
NOSYS, /* 40 */
- NOSYS, /* 41 */
+ EMULATE(s10_dup, 1 | RV_DEFAULT), /* 41 */
NOSYS, /* 42 */
NOSYS, /* 43 */
NOSYS, /* 44 */
@@ -2040,10 +2045,10 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 73 */
NOSYS, /* 74 */
EMULATE(s10_issetugid, 0 | RV_DEFAULT), /* 75 */
- NOSYS, /* 76 */
+ EMULATE(s10_fsat, 6 | RV_DEFAULT), /* 76 */
NOSYS, /* 77 */
NOSYS, /* 78 */
- NOSYS, /* 79 */
+ EMULATE(s10_rmdir, 1 | RV_DEFAULT), /* 79 */
NOSYS, /* 80 */
EMULATE(s10_getdents, 3 | RV_DEFAULT), /* 81 */
NOSYS, /* 82 */
@@ -2051,14 +2056,14 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 84 */
NOSYS, /* 85 */
NOSYS, /* 86 */
- NOSYS, /* 87 */
- NOSYS, /* 88 */
+ EMULATE(s10_poll, 3 | RV_DEFAULT), /* 87 */
+ EMULATE(s10_lstat, 2 | RV_DEFAULT), /* 88 */
NOSYS, /* 89 */
NOSYS, /* 90 */
NOSYS, /* 91 */
NOSYS, /* 92 */
NOSYS, /* 93 */
- NOSYS, /* 94 */
+ EMULATE(s10_fchown, 3 | RV_DEFAULT), /* 94 */
NOSYS, /* 95 */
NOSYS, /* 96 */
NOSYS, /* 97 */
@@ -2087,18 +2092,25 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 120 */
NOSYS, /* 121 */
NOSYS, /* 122 */
+#if defined(__x86)
+ EMULATE(s10_xstat, 3 | RV_DEFAULT), /* 123 */
+ EMULATE(s10_lxstat, 3 | RV_DEFAULT), /* 124 */
+ EMULATE(s10_fxstat, 3 | RV_DEFAULT), /* 125 */
+ EMULATE(s10_xmknod, 4 | RV_DEFAULT), /* 126 */
+#else
NOSYS, /* 123 */
NOSYS, /* 124 */
NOSYS, /* 125 */
NOSYS, /* 126 */
+#endif
NOSYS, /* 127 */
NOSYS, /* 128 */
NOSYS, /* 129 */
- NOSYS, /* 130 */
+ EMULATE(s10_lchown, 3 | RV_DEFAULT), /* 130 */
NOSYS, /* 131 */
NOSYS, /* 132 */
NOSYS, /* 133 */
- NOSYS, /* 134 */
+ EMULATE(s10_rename, 2 | RV_DEFAULT), /* 134 */
EMULATE(s10_uname, 1 | RV_DEFAULT), /* 135 */
NOSYS, /* 136 */
NOSYS, /* 137 */
@@ -2107,18 +2119,18 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 140 */
NOSYS, /* 141 */
NOSYS, /* 142 */
- NOSYS, /* 143 */
+ EMULATE(s10_fork1, 0 | RV_32RVAL2), /* 143 */
NOSYS, /* 144 */
NOSYS, /* 145 */
NOSYS, /* 146 */
- NOSYS, /* 147 */
+ EMULATE(s10_lwp_sema_wait, 1 | RV_DEFAULT), /* 147 */
NOSYS, /* 148 */
NOSYS, /* 149 */
NOSYS, /* 150 */
NOSYS, /* 151 */
NOSYS, /* 152 */
NOSYS, /* 153 */
- NOSYS, /* 154 */
+ EMULATE(s10_utimes, 2 | RV_DEFAULT), /* 154 */
NOSYS, /* 155 */
NOSYS, /* 156 */
NOSYS, /* 157 */
@@ -2134,14 +2146,14 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 163 */
NOSYS, /* 164 */
NOSYS, /* 165 */
-#ifdef __x86
+#if defined(__x86)
EMULATE(s10_lwp_private, 3 | RV_DEFAULT), /* 166 */
-#else /* !__x86 */
+#else
NOSYS, /* 166 */
-#endif /* !__x86 */
+#endif
NOSYS, /* 167 */
NOSYS, /* 168 */
- NOSYS, /* 169 */
+ EMULATE(s10_lwp_mutex_lock, 1 | RV_DEFAULT), /* 169 */
NOSYS, /* 170 */
NOSYS, /* 171 */
NOSYS, /* 172 */
@@ -2182,30 +2194,38 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 207 */
NOSYS, /* 208 */
NOSYS, /* 209 */
- EMULATE(s10_lwp_mutex_timedlock, 2 | RV_DEFAULT), /* 210 */
+ EMULATE(s10_lwp_mutex_timedlock, 2 | RV_DEFAULT), /* 210 */
NOSYS, /* 211 */
NOSYS, /* 212 */
-#ifdef _LP64
+#if defined(_LP64)
NOSYS, /* 213 */
-#else /* !_LP64 */
+#else
EMULATE(s10_getdents64, 3 | RV_DEFAULT), /* 213 */
-#endif /* !_LP64 */
+#endif
NOSYS, /* 214 */
+#if defined(_LP64)
NOSYS, /* 215 */
NOSYS, /* 216 */
NOSYS, /* 217 */
+#else
+ EMULATE(s10_stat64, 2 | RV_DEFAULT), /* 215 */
+ EMULATE(s10_lstat64, 2 | RV_DEFAULT), /* 216 */
+ EMULATE(s10_fstat64, 2 | RV_DEFAULT), /* 217 */
+#endif
NOSYS, /* 218 */
NOSYS, /* 219 */
NOSYS, /* 220 */
NOSYS, /* 221 */
NOSYS, /* 222 */
-#ifdef _LP64
+#if defined(_LP64)
NOSYS, /* 223 */
-#else /* !_LP64 */
- EMULATE(s10_pwrite64, 5 | RV_DEFAULT), /* 223 */
-#endif /* !_LP64 */
NOSYS, /* 224 */
NOSYS, /* 225 */
+#else
+ EMULATE(s10_pwrite64, 5 | RV_DEFAULT), /* 223 */
+ EMULATE(s10_creat64, 2 | RV_DEFAULT), /* 224 */
+ EMULATE(s10_open64, 3 | RV_DEFAULT), /* 225 */
+#endif
NOSYS, /* 226 */
EMULATE(s10_zone, 5 | RV_DEFAULT), /* 227 */
NOSYS, /* 228 */
@@ -2231,7 +2251,7 @@ s10_sysent_table_t s10_sysent_table[] = {
NOSYS, /* 248 */
NOSYS, /* 249 */
NOSYS, /* 250 */
- EMULATE(s10_lwp_mutex_trylock, 1 | RV_DEFAULT), /* 251 */
+ EMULATE(s10_lwp_mutex_trylock, 1 | RV_DEFAULT), /* 251 */
NOSYS, /* 252 */
NOSYS, /* 253 */
NOSYS, /* 254 */
diff --git a/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c b/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c
new file mode 100644
index 0000000000..fd8f6e4543
--- /dev/null
+++ b/usr/src/lib/brand/solaris10/s10_brand/common/s10_deleted.c
@@ -0,0 +1,529 @@
+/*
+ * 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 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <utime.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/siginfo.h>
+#include <sys/time.h>
+#include <sys/poll.h>
+#include <sys/wait.h>
+#include <sys/file.h>
+#include <sys/syscall.h>
+
+#include <s10_brand.h>
+#include <s10_misc.h>
+
+/*
+ * This file contains the emulation functions for all of the
+ * obsolete system call traps that existed in Solaris 10 but
+ * that have been deleted in the current version of Solaris.
+ */
+
+static int
+s10_fstatat(sysret_t *rval,
+ int fd, const char *path, struct stat *sb, int flags)
+{
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ fd, path, sb, flags));
+}
+
+int
+s10_stat(sysret_t *rval, const char *path, struct stat *sb)
+{
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ AT_FDCWD, path, sb, 0));
+}
+
+int
+s10_lstat(sysret_t *rval, const char *path, struct stat *sb)
+{
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW));
+}
+
+int
+s10_fstat(sysret_t *rval, int filedes, struct stat *sb)
+{
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ filedes, NULL, sb, 0));
+}
+
+#if !defined(_LP64)
+
+static int
+s10_fstatat64(sysret_t *rval,
+ int fd, const char *path, struct stat64 *sb, int flags)
+{
+ return (__systemcall(rval, SYS_fstatat64 + 1024,
+ fd, path, sb, flags));
+}
+
+int
+s10_stat64(sysret_t *rval, const char *path, struct stat64 *sb)
+{
+ return (__systemcall(rval, SYS_fstatat64 + 1024,
+ AT_FDCWD, path, sb, 0));
+}
+
+int
+s10_lstat64(sysret_t *rval, const char *path, struct stat64 *sb)
+{
+ return (__systemcall(rval, SYS_fstatat64 + 1024,
+ AT_FDCWD, path, sb, AT_SYMLINK_NOFOLLOW));
+}
+
+int
+s10_fstat64(sysret_t *rval, int filedes, struct stat64 *sb)
+{
+ return (__systemcall(rval, SYS_fstatat64 + 1024,
+ filedes, NULL, sb, 0));
+}
+
+#endif /* !_LP64 */
+
+static int
+s10_openat(sysret_t *rval, int fd, const char *path, int oflag, mode_t mode)
+{
+ return (__systemcall(rval, SYS_openat + 1024,
+ fd, path, oflag, mode));
+}
+
+int
+s10_open(sysret_t *rval, char *path, int oflag, mode_t mode)
+{
+ return (__systemcall(rval, SYS_openat + 1024,
+ AT_FDCWD, path, oflag, mode));
+}
+
+int
+s10_creat(sysret_t *rval, char *path, mode_t mode)
+{
+ return (__systemcall(rval, SYS_openat + 1024,
+ AT_FDCWD, path, O_WRONLY | O_CREAT | O_TRUNC, mode));
+}
+
+#if !defined(_LP64)
+
+static int
+s10_openat64(sysret_t *rval, int fd, const char *path, int oflag, mode_t mode)
+{
+ return (__systemcall(rval, SYS_openat64 + 1024,
+ fd, path, oflag, mode));
+}
+
+int
+s10_open64(sysret_t *rval, char *path, int oflag, mode_t mode)
+{
+ return (__systemcall(rval, SYS_openat64 + 1024,
+ AT_FDCWD, path, oflag, mode));
+}
+
+int
+s10_creat64(sysret_t *rval, char *path, mode_t mode)
+{
+ return (__systemcall(rval, SYS_openat64 + 1024,
+ AT_FDCWD, path, O_WRONLY | O_CREAT | O_TRUNC, mode));
+}
+
+#endif /* !_LP64 */
+
+int
+s10_fork1(sysret_t *rval)
+{
+ return (__systemcall(rval, SYS_forksys + 1024, 0, 0));
+}
+
+int
+s10_forkall(sysret_t *rval)
+{
+ return (__systemcall(rval, SYS_forksys + 1024, 1, 0));
+}
+
+int
+s10_dup(sysret_t *rval, int fd)
+{
+ return (__systemcall(rval, SYS_fcntl + 1024, fd, F_DUPFD, 0));
+}
+
+int
+s10_poll(sysret_t *rval, struct pollfd *fds, nfds_t nfd, int timeout)
+{
+ timespec_t ts;
+ timespec_t *tsp;
+
+ if (timeout < 0)
+ tsp = NULL;
+ else {
+ ts.tv_sec = timeout / MILLISEC;
+ ts.tv_nsec = (timeout % MILLISEC) * MICROSEC;
+ tsp = &ts;
+ }
+
+ return (__systemcall(rval, SYS_pollsys + 1024,
+ fds, nfd, tsp, NULL));
+}
+
+int
+s10_lwp_mutex_lock(sysret_t *rval, void *mp)
+{
+ return (__systemcall(rval, SYS_lwp_mutex_timedlock + 1024,
+ mp, NULL, 0));
+}
+
+int
+s10_lwp_sema_wait(sysret_t *rval, void *sp)
+{
+ return (__systemcall(rval, SYS_lwp_sema_timedwait + 1024,
+ sp, NULL, 0));
+}
+
+static int
+s10_fchownat(sysret_t *rval,
+ int fd, const char *name, uid_t uid, gid_t gid, int flags)
+{
+ return (__systemcall(rval, SYS_fchownat + 1024,
+ fd, name, uid, gid, flags));
+}
+
+int
+s10_chown(sysret_t *rval, const char *name, uid_t uid, gid_t gid)
+{
+ return (__systemcall(rval, SYS_fchownat + 1024,
+ AT_FDCWD, name, uid, gid, 0));
+}
+
+int
+s10_lchown(sysret_t *rval, const char *name, uid_t uid, gid_t gid)
+{
+ return (__systemcall(rval, SYS_fchownat + 1024,
+ AT_FDCWD, name, uid, gid, AT_SYMLINK_NOFOLLOW));
+}
+
+int
+s10_fchown(sysret_t *rval, int filedes, uid_t uid, gid_t gid)
+{
+ return (__systemcall(rval, SYS_fchownat + 1024,
+ filedes, NULL, uid, gid, 0));
+}
+
+static int
+s10_unlinkat(sysret_t *rval, int fd, const char *name, int flags)
+{
+ return (__systemcall(rval, SYS_unlinkat + 1024,
+ fd, name, flags));
+}
+
+int
+s10_unlink(sysret_t *rval, const char *name)
+{
+ return (__systemcall(rval, SYS_unlinkat + 1024,
+ AT_FDCWD, name, 0));
+}
+
+int
+s10_rmdir(sysret_t *rval, const char *name)
+{
+ return (__systemcall(rval, SYS_unlinkat + 1024,
+ AT_FDCWD, name, AT_REMOVEDIR));
+}
+
+static int
+s10_renameat(sysret_t *rval,
+ int oldfd, const char *oldname, int newfd, const char *newname)
+{
+ return (__systemcall(rval, SYS_renameat + 1024,
+ oldfd, oldname, newfd, newname));
+}
+
+int
+s10_rename(sysret_t *rval, const char *oldname, const char *newname)
+{
+ return (__systemcall(rval, SYS_renameat + 1024,
+ AT_FDCWD, oldname, AT_FDCWD, newname));
+}
+
+static int
+s10_faccessat(sysret_t *rval, int fd, const char *fname, int amode, int flag)
+{
+ return (__systemcall(rval, SYS_faccessat + 1024,
+ fd, fname, amode, flag));
+}
+
+int
+s10_access(sysret_t *rval, const char *fname, int amode)
+{
+ return (__systemcall(rval, SYS_faccessat + 1024,
+ AT_FDCWD, fname, amode, 0));
+}
+
+int
+s10_utime(sysret_t *rval, const char *path, const struct utimbuf *times)
+{
+ struct utimbuf ltimes;
+ timespec_t ts[2];
+ timespec_t *tsp;
+
+ if (times == NULL) {
+ tsp = NULL;
+ } else {
+ if (s10_uucopy(times, &ltimes, sizeof (ltimes)) != 0)
+ return (EFAULT);
+ ts[0].tv_sec = ltimes.actime;
+ ts[0].tv_nsec = 0;
+ ts[1].tv_sec = ltimes.modtime;
+ ts[1].tv_nsec = 0;
+ tsp = ts;
+ }
+
+ return (__systemcall(rval, SYS_utimesys + 1024, 1,
+ AT_FDCWD, path, tsp, 0));
+}
+
+int
+s10_utimes(sysret_t *rval, const char *path, const struct timeval times[2])
+{
+ struct timeval ltimes[2];
+ timespec_t ts[2];
+ timespec_t *tsp;
+
+ if (times == NULL) {
+ tsp = NULL;
+ } else {
+ if (s10_uucopy(times, ltimes, sizeof (ltimes)) != 0)
+ return (EFAULT);
+ ts[0].tv_sec = ltimes[0].tv_sec;
+ ts[0].tv_nsec = ltimes[0].tv_usec * 1000;
+ ts[1].tv_sec = ltimes[1].tv_sec;
+ ts[1].tv_nsec = ltimes[1].tv_usec * 1000;
+ tsp = ts;
+ }
+
+ return (__systemcall(rval, SYS_utimesys + 1024, 1,
+ AT_FDCWD, path, tsp, 0));
+}
+
+static int
+s10_futimesat(sysret_t *rval,
+ int fd, const char *path, const struct timeval times[2])
+{
+ struct timeval ltimes[2];
+ timespec_t ts[2];
+ timespec_t *tsp;
+
+ if (times == NULL) {
+ tsp = NULL;
+ } else {
+ if (s10_uucopy(times, ltimes, sizeof (ltimes)) != 0)
+ return (EFAULT);
+ ts[0].tv_sec = ltimes[0].tv_sec;
+ ts[0].tv_nsec = ltimes[0].tv_usec * 1000;
+ ts[1].tv_sec = ltimes[1].tv_sec;
+ ts[1].tv_nsec = ltimes[1].tv_usec * 1000;
+ tsp = ts;
+ }
+
+ if (path == NULL)
+ return (__systemcall(rval, SYS_utimesys + 1024, 0, fd, tsp));
+
+ return (__systemcall(rval, SYS_utimesys + 1024, 1, fd, path, tsp, 0));
+}
+
+#if defined(__x86)
+
+/* ARGSUSED */
+int
+s10_xstat(sysret_t *rval, int version, const char *path, struct stat *statb)
+{
+#if defined(__amd64)
+ return (EINVAL);
+#else
+ if (version != _STAT_VER)
+ return (EINVAL);
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ AT_FDCWD, path, statb, 0));
+#endif
+}
+
+/* ARGSUSED */
+int
+s10_lxstat(sysret_t *rval, int version, const char *path, struct stat *statb)
+{
+#if defined(__amd64)
+ return (EINVAL);
+#else
+ if (version != _STAT_VER)
+ return (EINVAL);
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ AT_FDCWD, path, statb, AT_SYMLINK_NOFOLLOW));
+#endif
+}
+
+/* ARGSUSED */
+int
+s10_fxstat(sysret_t *rval, int version, int fd, struct stat *statb)
+{
+#if defined(__amd64)
+ return (EINVAL);
+#else
+ if (version != _STAT_VER)
+ return (EINVAL);
+ return (__systemcall(rval, SYS_fstatat + 1024,
+ fd, NULL, statb, 0));
+#endif
+}
+
+/* ARGSUSED */
+int
+s10_xmknod(sysret_t *rval, int version, const char *path,
+ mode_t mode, dev_t dev)
+{
+#if defined(__amd64)
+ return (EINVAL);
+#else
+ if (version != _MKNOD_VER)
+ return (EINVAL);
+ return (__systemcall(rval, SYS_mknod + 1024, path, mode, dev));
+#endif
+}
+
+#endif /* __x86 */
+
+/*
+ * This is the fsat() system call trap in s10.
+ * It has been removed in the current system.
+ */
+int
+s10_fsat(sysret_t *rval,
+ int code, uintptr_t arg1, uintptr_t arg2,
+ uintptr_t arg3, uintptr_t arg4, uintptr_t arg5)
+{
+ switch (code) {
+ case 0: /* openat */
+ return (s10_openat(rval, (int)arg1,
+ (const char *)arg2, (int)arg3, (mode_t)arg4));
+ case 1: /* openat64 */
+#if defined(_LP64)
+ return (EINVAL);
+#else
+ return (s10_openat64(rval, (int)arg1,
+ (const char *)arg2, (int)arg3, (mode_t)arg4));
+#endif
+ case 2: /* fstatat64 */
+#if defined(_LP64)
+ return (EINVAL);
+#else
+ return (s10_fstatat64(rval, (int)arg1,
+ (const char *)arg2, (struct stat64 *)arg3, (int)arg4));
+#endif
+ case 3: /* fstatat */
+ return (s10_fstatat(rval, (int)arg1,
+ (const char *)arg2, (struct stat *)arg3, (int)arg4));
+ case 4: /* fchownat */
+ return (s10_fchownat(rval, (int)arg1, (char *)arg2,
+ (uid_t)arg3, (gid_t)arg4, (int)arg5));
+ case 5: /* unlinkat */
+ return (s10_unlinkat(rval, (int)arg1, (char *)arg2,
+ (int)arg3));
+ case 6: /* futimesat */
+ return (s10_futimesat(rval, (int)arg1,
+ (const char *)arg2, (const struct timeval *)arg3));
+ case 7: /* renameat */
+ return (s10_renameat(rval, (int)arg1, (char *)arg2,
+ (int)arg3, (char *)arg4));
+ case 8: /* faccessat */
+ return (s10_faccessat(rval, (int)arg1, (char *)arg2,
+ (int)arg3, (int)arg4));
+ case 9: /* openattrdirat */
+ return (s10_openat(rval, (int)arg1,
+ (const char *)arg2, FXATTRDIROPEN, 0));
+ }
+ return (EINVAL);
+}
+
+/*
+ * Interposition upon SYS_umount
+ */
+int
+s10_umount(sysret_t *rval, const char *path)
+{
+ return (__systemcall(rval, SYS_umount2 + 1024, path, 0));
+}
+
+/*
+ * Convert the siginfo_t code and status fields to an old style
+ * wait status for s10_wait(), below.
+ */
+static int
+wstat(int code, int status)
+{
+ int stat = (status & 0377);
+
+ switch (code) {
+ case CLD_EXITED:
+ stat <<= 8;
+ break;
+ case CLD_DUMPED:
+ stat |= WCOREFLG;
+ break;
+ case CLD_KILLED:
+ break;
+ case CLD_TRAPPED:
+ case CLD_STOPPED:
+ stat <<= 8;
+ stat |= WSTOPFLG;
+ break;
+ case CLD_CONTINUED:
+ stat = WCONTFLG;
+ break;
+ }
+ return (stat);
+}
+
+/*
+ * Interposition upon SYS_wait
+ */
+int
+s10_wait(sysret_t *rval)
+{
+ int err;
+ siginfo_t info;
+
+ err = __systemcall(rval, SYS_waitid + 1024,
+ P_ALL, 0, &info, WEXITED | WTRAPPED);
+ if (err != 0)
+ return (err);
+
+ rval->sys_rval1 = info.si_pid;
+ rval->sys_rval2 = wstat(info.si_code, info.si_status);
+
+ return (0);
+}
diff --git a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h
index 926873347f..35874b4c9d 100644
--- a/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h
+++ b/usr/src/lib/brand/solaris10/s10_brand/sys/s10_misc.h
@@ -190,6 +190,44 @@ extern void s10_success(void);
* From s10_brand.c
*/
extern void _s10_abort(int, const char *, const char *, int);
+extern int s10_uucopy(const void *, void *, size_t);
+extern int s10_uucopystr(const void *, void *, size_t);
+
+/*
+ * From s10_deleted.c
+ */
+extern int s10_stat();
+extern int s10_lstat();
+extern int s10_fstat();
+extern int s10_stat64();
+extern int s10_lstat64();
+extern int s10_fstat64();
+extern int s10_open();
+extern int s10_open64();
+extern int s10_chown();
+extern int s10_lchown();
+extern int s10_fchown();
+extern int s10_unlink();
+extern int s10_rmdir();
+extern int s10_rename();
+extern int s10_access();
+extern int s10_creat();
+extern int s10_creat64();
+extern int s10_fork1();
+extern int s10_forkall();
+extern int s10_dup();
+extern int s10_poll();
+extern int s10_lwp_mutex_lock();
+extern int s10_lwp_sema_wait();
+extern int s10_utime();
+extern int s10_utimes();
+extern int s10_xstat();
+extern int s10_lxstat();
+extern int s10_fxstat();
+extern int s10_xmknod();
+extern int s10_fsat();
+extern int s10_umount();
+extern int s10_wait();
#endif /* !_ASM */
diff --git a/usr/src/lib/libbc/inc/include/sys/fcntlcom.h b/usr/src/lib/libbc/inc/include/sys/fcntlcom.h
index a1e41ac9c7..8a843c900f 100644
--- a/usr/src/lib/libbc/inc/include/sys/fcntlcom.h
+++ b/usr/src/lib/libbc/inc/include/sys/fcntlcom.h
@@ -1,6 +1,27 @@
/*
- * Copyright (c) 1998,2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * 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 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
/*
@@ -12,8 +33,6 @@
#ifndef __SYS_FCNTLCOM_H
#define __SYS_FCNTLCOM_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -123,6 +142,11 @@ extern "C" {
#define F_UNLKSYS 4 /* remove remote locks for a given system */
#endif /* !_POSIX_SOURCE */
+/* needed for _syscall(SYS_openat, AT_FDCWD, ...) */
+#define AT_FDCWD 0xffd19553
+#define AT_SYMLINK_NOFOLLOW 0x1000
+#define AT_REMOVEDIR 0x1
+
#include <sys/stdtypes.h>
/* file segment locking set data type - information passed to system by user */
diff --git a/usr/src/lib/libbc/libc/gen/common/ttyslot.c b/usr/src/lib/libbc/libc/gen/common/ttyslot.c
index a52c786938..24a132f4f1 100644
--- a/usr/src/lib/libbc/libc/gen/common/ttyslot.c
+++ b/usr/src/lib/libbc/libc/gen/common/ttyslot.c
@@ -1,5 +1,26 @@
/*
- * Copyright 1991 Sun Microsystems, Inc. All rights reserved.
+ * 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -9,8 +30,6 @@
* specifies the terms and conditions for redistribution.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Return the number of the slot in the utmp file
* corresponding to the current user: try for file 0, 1, 2.
@@ -39,23 +58,24 @@ ttyslot(void)
if ((tp = ttyname(0)) == NULL &&
(tp = ttyname(1)) == NULL &&
(tp = ttyname(2)) == NULL)
- return(0);
+ return (0);
if ((p = rindex(tp, '/')) == NULL)
p = tp;
else
p++;
- if ((fd = _syscall(SYS_open, "/etc/utmpx", O_RDONLY)) == -1) {
+ if ((fd = _syscall(SYS_openat,
+ AT_FDCWD, "/etc/utmpx", O_RDONLY)) == -1) {
perror("ttyslot: open of /etc/utmpx failed:");
- return(0);
+ return (0);
}
s = 0;
- while (_read(fd, &utx, sizeof(struct utmpx)) > 0) {
+ while (_read(fd, &utx, sizeof (struct utmpx)) > 0) {
s++;
- if (strncmp(utx.ut_line, p, sizeof(utx.ut_line)) == 0) {
+ if (strncmp(utx.ut_line, p, sizeof (utx.ut_line)) == 0) {
_syscall(SYS_close, fd);
- return(s);
+ return (s);
}
}
_syscall(SYS_close, fd);
diff --git a/usr/src/lib/libbc/libc/sys/4.2/chown.c b/usr/src/lib/libbc/libc/sys/4.2/chown.c
index 7294a433f4..4071372779 100644
--- a/usr/src/lib/libbc/libc/sys/4.2/chown.c
+++ b/usr/src/lib/libbc/libc/sys/4.2/chown.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,18 +18,19 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "chkpath.h"
+#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
chown(char *s, int u, int g)
{
CHKNULL(s);
- return (_syscall(SYS_lchown, s, u, g));
+ return (_syscall(SYS_fchownat, AT_FDCWD, s, u, g, AT_SYMLINK_NOFOLLOW));
}
diff --git a/usr/src/lib/libbc/libc/sys/4.2/execve.c b/usr/src/lib/libbc/libc/sys/4.2/execve.c
index ff971dac7a..8851439266 100644
--- a/usr/src/lib/libbc/libc/sys/4.2/execve.c
+++ b/usr/src/lib/libbc/libc/sys/4.2/execve.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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "chkpath.h"
#include <string.h>
#include <sys/file.h>
@@ -40,7 +38,7 @@ execve(char *file, char **argv, char **arge)
CHKNULL(file);
if (strncmp(file, "/usr/ucb", strlen("/usr/ucb")) == 0) {
- if (_syscall(SYS_access, file, F_OK) == -1) {
+ if (_syscall(SYS_faccessat, AT_FDCWD, file, F_OK, 0) == -1) {
strcpy(path, "/usr/bin");
strcat(path, strrchr(file, '/'));
file = path;
@@ -50,18 +48,19 @@ execve(char *file, char **argv, char **arge)
strncmp(file, "/usr/bin", strlen("/usr/bin")) == 0) {
strcpy(path, "/usr/ucb");
strcat(path, strrchr(file, '/'));
- if (_syscall(SYS_access, path, F_OK) == 0)
+ if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0)
file = path;
}
else if (strncmp(file, "/usr/5bin", strlen("/usr/5bin")) == 0) {
strcpy(path, "/usr/bin");
strcat(path, strrchr(file, '/'));
- if (_syscall(SYS_access, path, F_OK) == 0)
+ if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0)
file = path;
else {
strcpy(path, "/usr/ucb");
strcat(path, strrchr(file, '/'));
- if (_syscall(SYS_access, path, F_OK) == 0)
+ if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0)
+ == 0)
file = path;
}
}
diff --git a/usr/src/lib/libbc/libc/sys/4.2/rename.c b/usr/src/lib/libbc/libc/sys/4.2/rename.c
index bb381e3d13..222765f133 100644
--- a/usr/src/lib/libbc/libc/sys/4.2/rename.c
+++ b/usr/src/lib/libbc/libc/sys/4.2/rename.c
@@ -20,14 +20,13 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "chkpath.h"
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
rename(char *path1, char *path2)
@@ -55,5 +54,5 @@ rename(char *path1, char *path2)
path2 = buf2;
}
- return (_syscall(SYS_rename, path1, path2));
+ return (_syscall(SYS_renameat, AT_FDCWD, path1, AT_FDCWD, path2));
}
diff --git a/usr/src/lib/libbc/libc/sys/4.2/rmdir.c b/usr/src/lib/libbc/libc/sys/4.2/rmdir.c
index 6872b4dcb5..620d8a3d35 100644
--- a/usr/src/lib/libbc/libc/sys/4.2/rmdir.c
+++ b/usr/src/lib/libbc/libc/sys/4.2/rmdir.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,14 +18,14 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "chkpath.h"
+#include <sys/fcntl.h>
int
rmdir(char *d)
@@ -34,7 +33,7 @@ rmdir(char *d)
int ret;
CHKNULL(d);
- ret = _syscall(SYS_rmdir, d);
+ ret = _syscall(SYS_unlinkat, AT_FDCWD, d, AT_REMOVEDIR);
if (errno == EEXIST)
errno = ENOTEMPTY;
return (ret);
diff --git a/usr/src/lib/libbc/libc/sys/4.2/stat.c b/usr/src/lib/libbc/libc/sys/4.2/stat.c
index dc930d2c16..b546568f8c 100644
--- a/usr/src/lib/libbc/libc/sys/4.2/stat.c
+++ b/usr/src/lib/libbc/libc/sys/4.2/stat.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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "chkpath.h"
#include <sys/stat.h>
@@ -51,7 +49,7 @@ struct stat *buf;
errno = EFAULT;
return (-1);
}
- return(stat_com(SYS_stat, path, buf));
+ return(stat_com(0, path, buf));
}
@@ -67,6 +65,6 @@ char *path;
struct stat *buf;
{
CHKNULL(path);
- return(stat_com(SYS_lstat, path, buf));
+ return(stat_com(1, path, buf));
}
diff --git a/usr/src/lib/libbc/libc/sys/4.2/unlink.c b/usr/src/lib/libbc/libc/sys/4.2/unlink.c
index 0a8d8a694c..9825d5e502 100644
--- a/usr/src/lib/libbc/libc/sys/4.2/unlink.c
+++ b/usr/src/lib/libbc/libc/sys/4.2/unlink.c
@@ -20,17 +20,16 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "chkpath.h"
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
-unlink(char *path)
+unlink(const char *path)
{
CHKNULL(path);
@@ -40,5 +39,5 @@ unlink(char *path)
else if (strcmp(path, "/var/adm/wtmp") == 0)
path = "/var/adm/wtmpx";
- return (_syscall(SYS_unlink, path));
+ return (_syscall(SYS_unlinkat, AT_FDCWD, path, 0));
}
diff --git a/usr/src/lib/libbc/libc/sys/common/_access.c b/usr/src/lib/libbc/libc/sys/common/_access.c
index 28737c88c0..5adea56e64 100644
--- a/usr/src/lib/libbc/libc/sys/common/_access.c
+++ b/usr/src/lib/libbc/libc/sys/common/_access.c
@@ -20,13 +20,12 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
+#include <sys/fcntl.h>
#include <unistd.h>
#include <sys/param.h>
@@ -47,5 +46,5 @@ access_com(char *path, int mode)
else if (strcmp(path, "/var/adm/wtmp") == 0)
path = "/var/adm/wtmpx";
- return (_syscall(SYS_access, path, mode));
+ return (_syscall(SYS_faccessat, AT_FDCWD, path, mode, 0));
}
diff --git a/usr/src/lib/libbc/libc/sys/common/_creat.c b/usr/src/lib/libbc/libc/sys/common/_creat.c
index 3a91013eb4..54477b35bf 100644
--- a/usr/src/lib/libbc/libc/sys/common/_creat.c
+++ b/usr/src/lib/libbc/libc/sys/common/_creat.c
@@ -20,18 +20,19 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
#include <unistd.h>
+#include <fcntl.h>
#include <errno.h>
#include <sys/param.h>
#include "compat.h" /* for UTMPX_MAGIC_FLAG */
+#define CREATFLAGS (O_WRONLY | O_CREAT | O_TRUNC)
+
int
creat_com(char *path, int mode)
{
@@ -43,15 +44,17 @@ creat_com(char *path, int mode)
return (-1);
}
if (strcmp(path, "/var/adm/wtmp") == 0) {
- if ((fd = _syscall(SYS_creat, "/var/adm/wtmpx", mode)) >= 0)
+ if ((fd = _syscall(SYS_openat, AT_FDCWD,
+ "/var/adm/wtmpx", CREATFLAGS, mode)) >= 0)
fd_add(fd, UTMPX_MAGIC_FLAG);
return (fd);
}
if (strcmp(path, "/etc/utmp") == 0 ||
strcmp(path, "/var/adm/utmp") == 0) {
- if ((fd = _syscall(SYS_creat, "/var/adm/utmpx", mode)) >= 0)
+ if ((fd = _syscall(SYS_openat, AT_FDCWD,
+ "/var/adm/utmpx", CREATFLAGS, mode)) >= 0)
fd_add(fd, UTMPX_MAGIC_FLAG);
return (fd);
}
- return (_syscall(SYS_creat, path, mode));
+ return (_syscall(SYS_openat, AT_FDCWD, path, CREATFLAGS, mode));
}
diff --git a/usr/src/lib/libbc/libc/sys/common/_open.c b/usr/src/lib/libbc/libc/sys/common/_open.c
index 139135e32a..5cde96fb2b 100644
--- a/usr/src/lib/libbc/libc/sys/common/_open.c
+++ b/usr/src/lib/libbc/libc/sys/common/_open.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
@@ -104,7 +102,7 @@ open_com(char *path, int flags, int mode)
locbuf[inspt] = '\0'; /* make it a string */
strcat(locbuf, "old"); /* add "old" */
strcat(locbuf, loct+5); /* add remainer of path */
- return (_syscall(SYS_open, locbuf, nflags, mode));
+ return (_syscall(SYS_openat, AT_FDCWD, locbuf, nflags, mode));
}
if (strcmp(path, "/etc/mtab") == 0)
@@ -114,27 +112,30 @@ open_com(char *path, int flags, int mode)
return (open_mnt("/etc/vfstab", "fstab", nflags, mode));
if (strcmp(path, "/etc/printcap") == 0) {
- if ((fd = _syscall(SYS_open, path, nflags, mode)) >= 0)
+ if ((fd = _syscall(SYS_openat, AT_FDCWD, path, nflags, mode))
+ >= 0)
return (fd);
return (open_printcap());
}
if (strcmp(path, "/etc/utmp") == 0 ||
strcmp(path, "/var/adm/utmp") == 0) {
- fd = _syscall(SYS_open, "/var/adm/utmpx", nflags, mode);
+ fd = _syscall(SYS_openat,
+ AT_FDCWD, "/var/adm/utmpx", nflags, mode);
if (fd >= 0)
fd_add(fd, UTMPX_MAGIC_FLAG);
return (fd);
}
if (strcmp(path, "/var/adm/wtmp") == 0) {
- fd = _syscall(SYS_open, "/var/adm/wtmpx", nflags, mode);
+ fd = _syscall(SYS_openat,
+ AT_FDCWD, "/var/adm/wtmpx", nflags, mode);
if (fd >= 0)
fd_add(fd, UTMPX_MAGIC_FLAG);
return (fd);
}
- return (_syscall(SYS_open, path, nflags, mode));
+ return (_syscall(SYS_openat, AT_FDCWD, path, nflags, mode));
}
int
@@ -177,7 +178,7 @@ open_mnt(char *fname, char *tname, int flags, int mode)
fclose(fd_in);
fclose(fd_out);
- fd = _syscall(SYS_open, tmp_name, O_RDONLY);
+ fd = _syscall(SYS_openat, AT_FDCWD, tmp_name, O_RDONLY);
if (fd == -1 || unlink(tmp_name) == -1)
return (-1);
@@ -318,7 +319,7 @@ _fopen(char *file, char *mode)
default:
return (NULL);
}
- if ((fd = _syscall(SYS_open, file, oflag, 0666)) < 0)
+ if ((fd = _syscall(SYS_openat, AT_FDCWD, file, oflag, 0666)) < 0)
return (NULL);
iop->_cnt = 0;
iop->_file = fd;
@@ -357,7 +358,7 @@ open_printcap(void)
}
fclose(fd);
- tmp_file = _syscall(SYS_open, tmp_name, O_RDONLY);
+ tmp_file = _syscall(SYS_openat, AT_FDCWD, tmp_name, O_RDONLY);
if (tmp_file == -1 || unlink(tmp_name) == -1)
return (-1);
@@ -380,7 +381,8 @@ getPrinterInfo(char *printerName, FILE *fd)
strcat(fullPath, printerName);
strcat(fullPath, PRINTER_CONFIG_FILE);
- if ((config_fd = _syscall(SYS_open, fullPath, O_RDONLY)) == -1) {
+ if ((config_fd = _syscall(SYS_openat, AT_FDCWD, fullPath, O_RDONLY))
+ == -1) {
free(fullPath);
return;
}
diff --git a/usr/src/lib/libbc/libc/sys/common/_stat.c b/usr/src/lib/libbc/libc/sys/common/_stat.c
index b9c1ab3580..b3d88cccfb 100644
--- a/usr/src/lib/libbc/libc/sys/common/_stat.c
+++ b/usr/src/lib/libbc/libc/sys/common/_stat.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/errno.h>
#include <sys/syscall.h>
#include <sys/fcntl.h>
@@ -83,7 +81,7 @@ bc_fstat(int fd, struct stat *buf)
return (-1);
}
- if ((ret = _syscall(SYS_fstat, fd, &nb)) == -1)
+ if ((ret = _syscall(SYS_fstatat, fd, NULL, &nb, 0)) == -1)
return (ret);
cpstatbuf(buf, &nb);
@@ -96,10 +94,11 @@ bc_fstat(int fd, struct stat *buf)
}
int
-stat_com(int sysnum, char *path, struct stat *buf)
+stat_com(int lstat, char *path, struct stat *buf)
{
int fd, ret;
struct n_stat nb;
+ int follow = lstat? AT_SYMLINK_NOFOLLOW : 0;
if (strcmp(path, "/etc/mtab") == 0) {
/*
@@ -115,7 +114,7 @@ stat_com(int sysnum, char *path, struct stat *buf)
* close(fd);
* return(ret);
*/
- ret = stat_com(sysnum, "/etc/mnttab", buf);
+ ret = stat_com(lstat, "/etc/mnttab", buf);
return(ret);
}
if (strcmp(path, "/etc/fstab") == 0) {
@@ -130,7 +129,8 @@ stat_com(int sysnum, char *path, struct stat *buf)
}
if (strcmp(path, "/etc/utmp") == 0 ||
strcmp(path, "/var/adm/utmp") == 0) {
- if ((ret = _syscall(sysnum, "/var/adm/utmpx", &nb)) != -1) {
+ if ((ret = _syscall(SYS_fstatat, AT_FDCWD,
+ "/var/adm/utmpx", &nb, follow)) != -1) {
cpstatbuf(buf, &nb);
buf->st_size = getmodsize(buf->st_size,
sizeof(struct utmpx), sizeof(struct compat_utmp));
@@ -138,7 +138,8 @@ stat_com(int sysnum, char *path, struct stat *buf)
return(ret);
}
if (strcmp(path, "/var/adm/wtmp") == 0) {
- if ((ret = _syscall(sysnum, "/var/adm/wtmpx", &nb)) != -1) {
+ if ((ret = _syscall(SYS_fstatat, AT_FDCWD,
+ "/var/adm/wtmpx", &nb, follow)) != -1) {
cpstatbuf(buf, &nb);
buf->st_size = getmodsize(buf->st_size,
sizeof(struct utmpx), sizeof(struct compat_utmp));
@@ -156,7 +157,7 @@ stat_com(int sysnum, char *path, struct stat *buf)
return(ret);
}
- if ((ret = _syscall(sysnum, path, &nb)) != -1)
+ if ((ret = _syscall(SYS_fstatat, AT_FDCWD, path, &nb, follow)) != -1)
cpstatbuf(buf, &nb);
return(ret);
}
diff --git a/usr/src/lib/libbc/libc/sys/common/dup.c b/usr/src/lib/libbc/libc/sys/common/dup.c
index 3445f278b2..1f7a5dddc1 100644
--- a/usr/src/lib/libbc/libc/sys/common/dup.c
+++ b/usr/src/lib/libbc/libc/sys/common/dup.c
@@ -20,20 +20,19 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
dup(int fd)
{
int ret, fds;
- if ((ret = _syscall(SYS_dup, fd)) == -1)
+ if ((ret = _syscall(SYS_fcntl, fd, F_DUPFD, 0)) == -1)
return (-1);
if ((fds = fd_get(fd)) != -1)
diff --git a/usr/src/lib/libbc/libc/sys/common/syscall.c b/usr/src/lib/libbc/libc/sys/common/syscall.c
index 79b67e7e03..83079878f8 100644
--- a/usr/src/lib/libbc/libc/sys/common/syscall.c
+++ b/usr/src/lib/libbc/libc/sys/common/syscall.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
@@ -37,22 +35,22 @@
* to their SVR4/5.0 equivalents before trapping into the kernel.
*/
-int syscallnum[190] = { SYS_syscall, SYS_exit, SYS_fork1,
- SYS_read, SYS_write, SYS_open, SYS_close,
- -1, SYS_creat, SYS_link, SYS_unlink,
+int syscallnum[190] = { SYS_syscall, SYS_exit, -1 /*fork1*/,
+ SYS_read, SYS_write, -1 /*open*/, SYS_close,
+ -1, -1 /*creat*/, SYS_link, -1 /*unlink*/,
-1, SYS_chdir, 0, SYS_mknod,
- SYS_chmod, SYS_lchown, 0, 0,
+ SYS_chmod, -1 /*lchown*/, 0, 0,
SYS_lseek, SYS_getpid, 0, 0,
0, SYS_getuid, 0, 0,
0, 0, 0, 0,
- 0, 0, SYS_access, 0,
- 0, SYS_sync, SYS_kill, SYS_stat,
- 0, SYS_lstat, SYS_dup, SYS_pipe,
+ 0, 0, -1 /*access*/, 0,
+ 0, SYS_sync, SYS_kill, -1 /*stat*/,
+ 0, -1 /*lstat*/, -1 /*dup*/, SYS_pipe,
0, SYS_profil, 0, 0,
SYS_getgid, 0, 0, 0,
SYS_acct, 0, -1, SYS_ioctl,
-1 /*reboot*/, 0, SYS_symlink, SYS_readlink,
- SYS_execve, SYS_umask, SYS_chroot, SYS_fstat,
+ SYS_execve, SYS_umask, SYS_chroot, -1 /*fstat*/,
0, -1/*getpagesize*/,-1, 0,
0, 0, -1, -1,
SYS_mmap, -1, SYS_munmap, SYS_mprotect,
@@ -68,16 +66,16 @@ int syscallnum[190] = { SYS_syscall, SYS_exit, SYS_fork1,
-1 /*sigpause*/, -1 /*sigstack*/, -1 /*recvmsg*/, -1 /*sendmsg*/,
-1 /*vtrace*/, SYS_gettimeofday, -1 /*getrusage*/, -1 /*getsockopt*/,
0, SYS_readv, SYS_writev, -1 /*settimeofday*/,
- SYS_fchown, SYS_fchmod, -1 /*recvfrom*/, -1 /*setreuid*/,
- -1 /*getregid*/, SYS_rename, -1 /*truncate*/, -1 /*ftruncate*/,
+ -1 /*fchown*/, SYS_fchmod, -1 /*recvfrom*/, -1 /*setreuid*/,
+ -1 /*getregid*/, -1 /*rename*/, -1 /*truncate*/, -1 /*ftruncate*/,
-1 /*flock*/, 0, -1 /*sendto*/, -1 /*shutdown*/,
- -1 /*socketpair*/,SYS_mkdir, SYS_rmdir, SYS_utimes,
+ -1 /*socketpair*/,SYS_mkdir, -1 /*rmdir*/, -1 /*utimes*/,
0, SYS_adjtime, -1 /*getpeername*/,-1 /*gethostid*/,
0, SYS_getrlimit, SYS_setrlimit, -1 /*killpg*/,
0, 0, 0, -1/*getsockname*/,
- SYS_getmsg, SYS_putmsg, SYS_poll, 0,
+ SYS_getmsg, SYS_putmsg, -1 /*poll*/, 0,
-1/*nfssvc*/, -1 /*getdirentries*/, SYS_statfs, SYS_fstatfs,
- SYS_umount, -1 /*async_daemmon*/ -1 /*getfh*/, -1/*getdomain*/,
+ -1/*SYS_umount*/, -1 /*async_daemmon*/ -1 /*getfh*/, -1/*getdomain*/,
-1/*setdomain*/, 0, -1 /*quotactl*/, -1 /*exportfs*/,
SYS_mount, -1/*ustat*/, SYS_semsys, SYS_msgsys,
SYS_shmsys, -1 /*auditsys*/, -1 /*rfsys*/, SYS_getdents,
@@ -258,7 +256,7 @@ syscall(int sysnum, ...)
i1 = va_arg(ap, int);
i2 = va_arg(ap, int);
va_end(ap);
- return (dup(i1, i2));
+ return (dup2(i1, i2));
case XSYS_pipe:
c1 = (char *)va_arg(ap, int *);
va_end(ap);
@@ -465,6 +463,26 @@ syscall(int sysnum, ...)
i2 = va_arg(ap, int);
va_end(ap);
return (flock(i1, i2));
+ case XSYS_utimes:
+ c1 = va_arg(ap, char *);
+ c2 = va_arg(ap, char *);
+ va_end(ap);
+ return (utimes(c1, c2));
+ case XSYS_poll:
+ c1 = va_arg(ap, char *);
+ i2 = va_arg(ap, int);
+ i3 = va_arg(ap, int);
+ va_end(ap);
+ return (poll(c1, i2, i3));
+ case XSYS_fchown:
+ i1 = va_arg(ap, int);
+ i2 = va_arg(ap, int);
+ i3 = va_arg(ap, int);
+ va_end(ap);
+ return (fchown(i1, i2, i3));
+ case XSYS_fork:
+ va_end(ap);
+ return (fork1());
/* the following system calls are now implemented in
* libsocket */
@@ -599,9 +617,7 @@ syscall(int sysnum, ...)
case XSYS_exit:
case XSYS_fchdir:
case XSYS_fchmod:
- case XSYS_fchown:
case XSYS_fchroot:
- case XSYS_fork:
case XSYS_getgid:
case XSYS_getitimer:
case XSYS_getmsg:
@@ -611,12 +627,10 @@ syscall(int sysnum, ...)
case XSYS_mprotect:
case XSYS_munmap:
case XSYS_putmsg:
- case XSYS_poll:
case XSYS_profil:
case XSYS_setitimer:
case XSYS_sync:
case XSYS_umask:
- case XSYS_utimes:
case XSYS_semsys:
case XSYS_msgsys:
case XSYS_shmsys:
diff --git a/usr/src/lib/libbc/libc/sys/sys5/chown.c b/usr/src/lib/libbc/libc/sys/sys5/chown.c
index ec2daf5b05..7367a37871 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/chown.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/chown.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,17 +18,17 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
chown(char *s, int u, int g)
{
- return (_syscall(SYS_lchown, s, u, g));
+ return (_syscall(SYS_fchownat, AT_FDCWD, s, u, g, AT_SYMLINK_NOFOLLOW));
}
diff --git a/usr/src/lib/libbc/libc/sys/sys5/execve.c b/usr/src/lib/libbc/libc/sys/sys5/execve.c
index 476505107b..1ade79a2d4 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/execve.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/execve.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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <string.h>
#include <sys/file.h>
#include <sys/syscall.h>
@@ -38,7 +36,7 @@ execve(char *file, char **argv, char **arge)
if (strncmp(file, "/usr/bin", strlen("/usr/bin")) == 0 ||
strncmp(file, "/bin", strlen("/bin")) == 0) {
- if (_syscall(SYS_access, file, F_OK) == -1) {
+ if (_syscall(SYS_faccessat, AT_FDCWD, file, F_OK, 0) == -1) {
strcpy(path, "/usr/ucb");
strcat(path, strrchr(file, '/'));
file = path;
@@ -47,18 +45,19 @@ execve(char *file, char **argv, char **arge)
else if (strncmp(file, "/usr/ucb", strlen("/usr/ucb")) == 0) {
strcpy(path, "/usr/bin");
strcat(path, strrchr(file, '/'));
- if (_syscall(SYS_access, path, F_OK) == 0)
+ if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0)
file = path;
}
else if (strncmp(file, "/usr/5bin", strlen("/usr/5bin")) == 0) {
strcpy(path, "/usr/bin");
strcat(path, strrchr(file, '/'));
- if (_syscall(SYS_access, path, F_OK) == 0)
+ if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0) == 0)
file = path;
else {
strcpy(path, "/usr/ucb");
strcat(path, strrchr(file, '/'));
- if (_syscall(SYS_access, path, F_OK) == 0)
+ if (_syscall(SYS_faccessat, AT_FDCWD, path, F_OK, 0)
+ == 0)
file = path;
}
}
diff --git a/usr/src/lib/libbc/libc/sys/sys5/rename.c b/usr/src/lib/libbc/libc/sys/sys5/rename.c
index 79b975f975..4a534c0653 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/rename.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/rename.c
@@ -20,13 +20,12 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
rename(char *path1, char *path2)
@@ -46,5 +45,5 @@ rename(char *path1, char *path2)
path2 = buf2;
}
- return (_syscall(SYS_rename, path1, path2));
+ return (_syscall(SYS_renameat, AT_FDCWD, path1, AT_FDCWD, path2));
}
diff --git a/usr/src/lib/libbc/libc/sys/sys5/rmdir.c b/usr/src/lib/libbc/libc/sys/sys5/rmdir.c
index 8c6d49e47e..61b12ef42a 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/rmdir.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/rmdir.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,18 +18,18 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1990 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
rmdir(char *d)
{
- return (_syscall(SYS_rmdir, d));
+ return (_syscall(SYS_unlinkat, AT_FDCWD, d, AT_REMOVEDIR));
}
diff --git a/usr/src/lib/libbc/libc/sys/sys5/stat.c b/usr/src/lib/libbc/libc/sys/sys5/stat.c
index ebd07f1cd6..13d0726a41 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/stat.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/stat.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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 1992 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/stat.h>
@@ -52,7 +50,7 @@ struct stat *buf;
errno = EFAULT;
return (-1);
}
- return(stat_com(SYS_stat, path, buf));
+ return(stat_com(0, path, buf));
}
@@ -67,6 +65,6 @@ int bc_lstat(path, buf)
char *path;
struct stat *buf;
{
- return(stat_com(SYS_lstat, path, buf));
+ return(stat_com(1, path, buf));
}
diff --git a/usr/src/lib/libbc/libc/sys/sys5/unlink.c b/usr/src/lib/libbc/libc/sys/sys5/unlink.c
index 36dc087d9f..7c30c45f0d 100644
--- a/usr/src/lib/libbc/libc/sys/sys5/unlink.c
+++ b/usr/src/lib/libbc/libc/sys/sys5/unlink.c
@@ -20,16 +20,15 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/syscall.h>
+#include <sys/fcntl.h>
int
-unlink(char *path)
+unlink(const char *path)
{
if (strcmp(path, "/etc/utmp") == 0 ||
strcmp(path, "/var/adm/utmp") == 0)
@@ -37,5 +36,5 @@ unlink(char *path)
else if (strcmp(path, "/var/adm/wtmp") == 0)
path = "/var/adm/wtmpx";
- return (_syscall(SYS_unlink, path));
+ return (_syscall(SYS_unlinkat, AT_FDCWD, path, 0));
}
diff --git a/usr/src/lib/libbc/sparc/Makefile b/usr/src/lib/libbc/sparc/Makefile
index e005d01ed6..b36c5a35ab 100644
--- a/usr/src/lib/libbc/sparc/Makefile
+++ b/usr/src/lib/libbc/sparc/Makefile
@@ -19,11 +19,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.
#
-# ident "%Z%%M% %I% %E% SMI"
-#
#
# This builds all objects needed for libbc.
@@ -128,15 +126,15 @@ sprintf.o vfprintf.o vprintf.o vsprintf.o
SYSCOM=\
_access.o acct.o adjtime.o close.o _creat.o dup.o dup2.o \
-fchdir.o fchmod.o fchown.o fchroot.o \
+fchdir.o fchmod.o fchroot.o \
fdlist.o flock.o fpathconf.o fsync.o ftruncate.o getdents.o \
getdtablesize.o getgid.o getitimer.o getpid.o gettimeofday.o \
getuid.o ioctl.o kill.o lseek.o mincore.o mprotect.o munmap.o\
-_open.o poll.o profil.o setitimer.o \
+_open.o profil.o setitimer.o \
rlimit.o _statfs.o sync.o umask.o uname.o\
execl.o execle.o execv.o mkfifo.o msgsys.o\
pathconf.o semsys.o shmsys.o unmount.o wait.o setuid.o\
-setgid.o _stat.o seteuid.o setegid.o signalmap.o utimes.o syscall.o \
+setgid.o _stat.o seteuid.o setegid.o signalmap.o syscall.o \
maperror.o sigsetjmp.o accept.o bind.o connect.o getpeername.o \
getsockname.o getsockopt.o listen.o recv.o send.o \
setsockopt.o shutdown.o socket.o socketpair.o setsid.o sigaction.o
@@ -185,13 +183,12 @@ YP= yp_bind.o
YP= yp_bind.o
PSEUDO_SRCS= adjtime.s fchdir.s \
-fchmod.s fchown.s fchroot.s \
+fchmod.s fchroot.s \
fpathconf.s getitimer.s getpid.s \
mincore.s mprotect.s munmap.s \
profil.s setitimer.s \
sync.s sysconf.s umask.s ustat.s \
-acct.s stime.s \
-utimes.s poll.s
+acct.s stime.s
#
# libbc build rules
diff --git a/usr/src/lib/libbsm/audit_event.txt b/usr/src/lib/libbsm/audit_event.txt
index 64453e4998..8ee50ca320 100644
--- a/usr/src/lib/libbsm/audit_event.txt
+++ b/usr/src/lib/libbsm/audit_event.txt
@@ -68,10 +68,10 @@
2:AUE_FORKALL:forkall(2):ps
# AUE_OPEN is a placeholder and will not be generated
3:AUE_OPEN:open(2) - place holder:no
-4:AUE_CREAT:creat(2):fc
+4:AUE_CREAT:creat(2):no
5:AUE_LINK:link(2):fc
6:AUE_UNLINK:unlink(2):fd
-7:AUE_EXEC:exec(2):ps,ex
+7:AUE_EXEC:exec(2):no
8:AUE_CHDIR:chdir(2):pm
9:AUE_MKNOD:mknod(2):fc
10:AUE_CHMOD:chmod(2):fm
@@ -236,7 +236,7 @@
199:AUE_OSTAT:old stat(2):no
200:AUE_SETUID:setuid(2):pm
201:AUE_STIME:old stime(2):as
-202:AUE_UTIME:old utime(2):fm
+202:AUE_UTIME:old utime(2):no
203:AUE_NICE:old nice(2):pm
204:AUE_OSETPGRP:old setpgrp(2):no
205:AUE_SETGID:old setgid(2):pm
@@ -309,26 +309,25 @@
266:AUE_SETAUDIT_ADDR:setaudit_addr(2):aa
267:AUE_GETAUDIT_ADDR:getaudit_addr(2):aa
268:AUE_UMOUNT2:umount2(2):as
-# AUE_FSAT is a placeholder and will not be generated
+# AUE_FSAT and all AUE_OPENAT_* codes are obsolete and will not be generated
269:AUE_FSAT:fsat(2) - place holder:no
-270:AUE_OPENAT_R:openat(2) - read:fr
-271:AUE_OPENAT_RC:openat(2) - read,creat:fc,fr
-272:AUE_OPENAT_RT:openat(2) - read,trunc:fd,fr
-273:AUE_OPENAT_RTC:openat(2) - read,creat,trunc:fc,fd,fr
-274:AUE_OPENAT_W:openat(2) - write:fw
-275:AUE_OPENAT_WC:openat(2) - write,creat:fc,fw
-276:AUE_OPENAT_WT:openat(2) - write,trunc:fd,fw
-277:AUE_OPENAT_WTC:openat(2) - write,creat,trunc:fc,fd,fw
-278:AUE_OPENAT_RW:openat(2) - read,write:fr,fw
-279:AUE_OPENAT_RWC:openat(2) - read,write,creat:fc,fw,fr
-280:AUE_OPENAT_RWT:openat(2) - read,write,trunc:fd,fr,fw
-281:AUE_OPENAT_RWTC:openat(2) - read,write,creat,trunc:fc,fd,fw,fr
-282:AUE_RENAMEAT:renameat(2):fc,fd
-# AUE_FSTATAT is a potentially very high-volume event, use with caution
+270:AUE_OPENAT_R:openat(2) - read:no
+271:AUE_OPENAT_RC:openat(2) - read,creat:no
+272:AUE_OPENAT_RT:openat(2) - read,trunc:no
+273:AUE_OPENAT_RTC:openat(2) - read,creat,trunc:no
+274:AUE_OPENAT_W:openat(2) - write:no
+275:AUE_OPENAT_WC:openat(2) - write,creat:no
+276:AUE_OPENAT_WT:openat(2) - write,trunc:no
+277:AUE_OPENAT_WTC:openat(2) - write,creat,trunc:no
+278:AUE_OPENAT_RW:openat(2) - read,write:no
+279:AUE_OPENAT_RWC:openat(2) - read,write,creat:no
+280:AUE_OPENAT_RWT:openat(2) - read,write,trunc:no
+281:AUE_OPENAT_RWTC:openat(2) - read,write,creat,trunc:no
+282:AUE_RENAMEAT:renameat(2):no
283:AUE_FSTATAT:fstatat(2):no
-284:AUE_FCHOWNAT:fchownat(2):fm
-285:AUE_FUTIMESAT:futimesat(2):fm
-286:AUE_UNLINKAT:unlinkat(2):fd
+284:AUE_FCHOWNAT:fchownat(2):no
+285:AUE_FUTIMESAT:futimesat(2):no
+286:AUE_UNLINKAT:unlinkat(2):no
287:AUE_CLOCK_SETTIME:clock_settime(3RT):as
288:AUE_NTP_ADJTIME:ntp_adjtime(2):as
289:AUE_SETPPRIV:setppriv(2):pm
@@ -355,7 +354,7 @@
#
307:AUE_SETSID:setsid(2):pm
308:AUE_SETPGID:setpgid(2):pm
-309:AUE_FACCESSAT:faccessat(2):fa
+309:AUE_FACCESSAT:faccessat(2):no
#
# user level audit events
# 2048 - 6143 Reserved
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 85527634fb..856a8c1b91 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -168,7 +168,6 @@ COMSYSOBJS= \
_so_socket.o \
_so_socketpair.o \
_sockconfig.o \
- access.o \
acct.o \
acl.o \
adjtime.o \
@@ -176,23 +175,17 @@ COMSYSOBJS= \
brk.o \
chdir.o \
chmod.o \
- chown.o \
chroot.o \
cladm.o \
close.o \
- creat.o \
- dup.o \
execve.o \
exit.o \
facl.o \
fchdir.o \
fchmod.o \
- fchown.o \
fchroot.o \
- fcntl.o \
fdsync.o \
fpathconf.o \
- fstat.o \
fstatfs.o \
fstatvfs.o \
getcpuid.o \
@@ -214,11 +207,9 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- lchown.o \
link.o \
llseek.o \
lseek.o \
- lstat.o \
mmapobjsys.o \
memcntl.o \
mincore.o \
@@ -232,7 +223,6 @@ COMSYSOBJS= \
nice.o \
ntp_adjtime.o \
ntp_gettime.o \
- open.o \
p_online.o \
pathconf.o \
pause.o \
@@ -249,9 +239,7 @@ COMSYSOBJS= \
read.o \
readlink.o \
readv.o \
- rename.o \
resolvepath.o \
- rmdir.o \
seteguid.o \
setgid.o \
setgroups.o \
@@ -263,7 +251,6 @@ COMSYSOBJS= \
sigprocmsk.o \
sigsendset.o \
sigsuspend.o \
- stat.o \
statfs.o \
statvfs.o \
stty.o \
@@ -277,7 +264,6 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
- unlink.o \
utssys.o \
uucopy.o \
vhangup.o \
@@ -295,11 +281,9 @@ SYSOBJS= \
door.o \
forkx.o \
forkallx.o \
- fxstat.o \
getcontext.o \
gettimeofday.o \
lwp_private.o \
- lxstat.o \
nuname.o \
pipe.o \
syscall.o \
@@ -308,9 +292,7 @@ SYSOBJS= \
uadmin.o \
umount.o \
uname.o \
- vforkx.o \
- xmknod.o \
- xstat.o
+ vforkx.o
# Preserved solely to ease maintenance of 32-bit and 64-bit library builds
# This macro should ALWAYS be empty; native APIs are already 'large file'.
@@ -384,7 +366,7 @@ PORTGEN= \
dirname.o \
div.o \
drand48.o \
- dup2.o \
+ dup.o \
env_data.o \
err.o \
errno.o \
@@ -786,23 +768,22 @@ PORTSYS64=
PORTSYS= \
_autofssys.o \
+ access.o \
acctctl.o \
bsd_signal.o \
+ chown.o \
corectl.o \
exacctsys.o \
execl.o \
execle.o \
execv.o \
- fsmisc.o \
- fstatat.o \
+ fcntl.o \
getpagesizes.o \
getpeerucred.o \
inst_sync.o \
issetugid.o \
label.o \
- libc_fcntl.o \
libc_link.o \
- libc_open.o \
lockf.o \
lwp.o \
lwp_cond.o \
@@ -811,12 +792,13 @@ PORTSYS= \
meminfosys.o \
msgsys.o \
nfssys.o \
- openat.o \
+ open.o \
pgrpsys.o \
posix_sigwait.o \
ppriv.o \
psetsys.o \
rctlsys.o \
+ rename.o \
sbrk.o \
semsys.o \
set_errno.o \
@@ -827,10 +809,12 @@ PORTSYS= \
signal.o \
sigpending.o \
sigstack.o \
+ stat.o \
tasksys.o \
time.o \
time_util.o \
ucontext.o \
+ unlink.o \
ustat.o \
utimesys.o \
zone.o
@@ -935,6 +919,11 @@ CPPFLAGS= -D_REENTRANT -D$(MACH64) -D__$(MACH64) $(THREAD_DEBUG) \
ASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) \
$(amd64_AS_XARCH)
+# As a favor to the dtrace syscall provider, libc still calls the
+# old syscall traps that have been obsoleted by the *at() interfaces.
+# Delete this to compile libc using only the new *at() system call traps
+CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
+
# Conditionally add support for making |wordexp()| check whether
# /usr/bin/ksh is ksh93 or not
include ../../../Makefile.ksh93switch
diff --git a/usr/src/lib/libc/amd64/crt/_rtld.c b/usr/src/lib/libc/amd64/crt/_rtld.c
deleted file mode 100644
index 55d209a4fd..0000000000
--- a/usr/src/lib/libc/amd64/crt/_rtld.c
+++ /dev/null
@@ -1,330 +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
- */
-/*
- * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used
- * to redirect aliases for ld.so to the real one.
- */
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Import data structures
- */
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/fcntl.h>
-#include <sys/stat.h>
-#include <sys/sysconfig.h>
-#include <sys/auxv.h>
-#include <elf.h>
-#include <link.h>
-#include <string.h>
-#include "alias_boot.h"
-
-/*
- * Local manifest constants and macros.
- */
-#define ALIGN(x, a) ((int)(x) & ~((int)(a) - 1))
-#define ROUND(x, a) (((int)(x) + ((int)(a) - 1)) & \
- ~((int)(a) - 1))
-
-#define EMPTY strings[EMPTY_S]
-#define LDSO strings[LDSO_S]
-#define ZERO strings[ZERO_S]
-#define CLOSE (*(funcs[CLOSE_F]))
-#define FSTAT (*(funcs[FSTAT_F]))
-#define MMAP (*(funcs[MMAP_F]))
-#define MUNMAP (*(funcs[MUNMAP_F]))
-#define OPEN (*(funcs[OPEN_F]))
-#define PANIC (*(funcs[PANIC_F]))
-#define SYSCONFIG (*(funcs[SYSCONFIG_F]))
-
-#include <link.h>
-
-/*
- * Alias ld.so entry point -- receives a bootstrap structure and a vector
- * of strings. The vector is "well-known" to us, and consists of pointers
- * to string constants. This aliasing bootstrap requires no relocation in
- * order to run, save for the pointers of constant strings. This second
- * parameter provides this. Note that this program is carefully coded in
- * order to maintain the "no bootstrapping" requirement -- it calls only
- * local functions, uses no intrinsics, etc.
- */
-void *
-__rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])())
-{
- int i, j, p; /* working */
- int page_size = 0; /* size of a page */
- const char *program_name = EMPTY; /* our name */
- int ldfd; /* fd assigned to ld.so */
- int dzfd = 0; /* fd assigned to /dev/zero */
- Elf32_Ehdr *ehdr; /* ELF header of ld.so */
- Elf32_Phdr *phdr; /* first Phdr in file */
- Elf32_Phdr *pptr; /* working Phdr */
- Elf32_Phdr *lph; /* last loadable Phdr */
- Elf32_Phdr *fph = 0; /* first loadable Phdr */
- caddr_t maddr; /* pointer to mapping claim */
- Elf32_Off mlen; /* total mapping claim */
- caddr_t faddr; /* first program mapping of ld.so */
- Elf32_Off foff; /* file offset for segment mapping */
- Elf32_Off flen; /* file length for segment mapping */
- caddr_t addr; /* working mapping address */
- caddr_t zaddr; /* /dev/zero working mapping addr */
- struct stat sb; /* stat buffer for sizing */
- auxv_t *ap; /* working aux pointer */
-
- /*
- * Discover things about our environment: auxiliary vector (if
- * any), arguments, program name, and the like.
- */
- while (ebp->eb_tag != NULL) {
- switch (ebp->eb_tag) {
- case EB_ARGV:
- program_name = *((char **)ebp->eb_un.eb_ptr);
- break;
- case EB_AUXV:
- for (ap = (auxv_t *)ebp->eb_un.eb_ptr;
- ap->a_type != AT_NULL; ap++)
- if (ap->a_type == AT_PAGESZ) {
- page_size = ap->a_un.a_val;
- break;
- }
- break;
- }
- ebp++;
- }
-
- /*
- * If we didn't get a page size from looking in the auxiliary
- * vector, we need to get one now.
- */
- if (page_size == 0) {
- page_size = SYSCONFIG(_CONFIG_PAGESIZE);
- ebp->eb_tag = EB_PAGESIZE, (ebp++)->eb_un.eb_val =
- (Elf32_Word)page_size;
- }
-
- /*
- * Map in the real ld.so. Note that we're mapping it as
- * an ELF database, not as a program -- we just want to walk it's
- * data structures. Further mappings will actually establish the
- * program in the address space.
- */
- if ((ldfd = OPEN(LDSO, O_RDONLY)) == -1)
- PANIC(program_name);
-/* NEEDSWORK (temp kludge to use xstat so we can run on G6) */
- if (FSTAT(2, ldfd, &sb) == -1)
- PANIC(program_name);
- ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC,
- MAP_SHARED, ldfd, 0);
- if (ehdr == (Elf32_Ehdr *)-1)
- PANIC(program_name);
-
- /*
- * Validate the file we're looking at, ensure it has the correct
- * ELF structures, such as: ELF magic numbers, coded for 386,
- * is a ".so", etc.
- */
- if (ehdr->e_ident[EI_MAG0] != ELFMAG0 ||
- ehdr->e_ident[EI_MAG1] != ELFMAG1 ||
- ehdr->e_ident[EI_MAG2] != ELFMAG2 ||
- ehdr->e_ident[EI_MAG3] != ELFMAG3)
- PANIC(program_name);
- if (ehdr->e_ident[EI_CLASS] != ELFCLASS32 ||
- ehdr->e_ident[EI_DATA] != ELFDATA2LSB)
- PANIC(program_name);
- if (ehdr->e_type != ET_DYN)
- PANIC(program_name);
- if (ehdr->e_machine != EM_386)
- PANIC(program_name);
- if (ehdr->e_version > EV_CURRENT)
- PANIC(program_name);
-
- /*
- * Point at program headers and start figuring out what to load.
- */
- phdr = (Elf32_Phdr *)((caddr_t)ehdr + ehdr->e_phoff);
- for (p = 0, pptr = phdr; p < (int)ehdr->e_phnum; p++,
- pptr = (Elf32_Phdr *)((caddr_t)pptr + ehdr->e_phentsize))
- if (pptr->p_type == PT_LOAD) {
- if (fph == 0) {
- fph = pptr;
- } else if (pptr->p_vaddr <= lph->p_vaddr)
- PANIC(program_name);
- lph = pptr;
- }
-
- /*
- * We'd better have at least one loadable segment.
- */
- if (fph == 0)
- PANIC(program_name);
-
- /*
- * Map enough address space to hold the program (as opposed to the
- * file) represented by ld.so. The amount to be assigned is the
- * range between the end of the last loadable segment and the
- * beginning of the first PLUS the alignment of the first segment.
- * mmap() can assign us any page-aligned address, but the relocations
- * assume the alignments included in the program header. As an
- * optimization, however, let's assume that mmap() will actually
- * give us an aligned address -- since if it does, we can save
- * an munmap() later on. If it doesn't -- then go try it again.
- */
- mlen = ROUND((lph->p_vaddr + lph->p_memsz) -
- ALIGN(fph->p_vaddr, page_size), page_size);
- maddr = (caddr_t)MMAP(0, mlen, PROT_READ | PROT_EXEC,
- MAP_SHARED, ldfd, 0);
- if (maddr == (caddr_t)-1)
- PANIC(program_name);
- faddr = (caddr_t)ROUND(maddr, fph->p_align);
-
- /*
- * Check to see whether alignment skew was really needed.
- */
- if (faddr != maddr) {
- (void) MUNMAP(maddr, mlen);
- mlen = ROUND((lph->p_vaddr + lph->p_memsz) -
- ALIGN(fph->p_vaddr, fph->p_align) + fph->p_align,
- page_size);
- maddr = (caddr_t)MMAP(0, mlen, PROT_READ | PROT_EXEC,
- MAP_SHARED, ldfd, 0);
- if (maddr == (caddr_t)-1)
- PANIC(program_name);
- faddr = (caddr_t)ROUND(maddr, fph->p_align);
- }
-
- /*
- * We have the address space reserved, so map each loadable segment.
- */
- for (p = 0, pptr = phdr; p < (int)ehdr->e_phnum; p++,
- pptr = (Elf32_Phdr *)((caddr_t)pptr + ehdr->e_phentsize)) {
-
- /*
- * Skip non-loadable segments or segments that don't occupy
- * any memory.
- */
- if ((pptr->p_type != PT_LOAD) || (pptr->p_memsz == 0))
- continue;
-
- /*
- * Determine the file offset to which the mapping will
- * directed (must be aligned) and how much to map (might
- * be more than the file in the case of .bss.)
- */
- foff = ALIGN(pptr->p_offset, page_size);
- flen = pptr->p_memsz + (pptr->p_offset - foff);
-
- /*
- * Set address of this segment relative to our base.
- */
- addr = (caddr_t)ALIGN(faddr + pptr->p_vaddr, page_size);
-
- /*
- * If this is the first program header, record our base
- * address for later use.
- */
- if (pptr == phdr) {
- ebp->eb_tag = EB_LDSO_BASE;
- (ebp++)->eb_un.eb_ptr = (Elf32_Addr)addr;
- }
-
- /*
- * Unmap anything from the last mapping address to this
- * one.
- */
- if (addr - maddr) {
- (void) MUNMAP(maddr, addr - maddr);
- mlen -= addr - maddr;
- }
-
- /*
- * Determine the mapping protection from the section
- * attributes.
- */
- i = 0;
- if (pptr->p_flags & PF_R)
- i |= PROT_READ;
- if (pptr->p_flags & PF_W)
- i |= PROT_WRITE;
- if (pptr->p_flags & PF_X)
- i |= PROT_EXEC;
- if ((caddr_t)MMAP((caddr_t)addr, flen, i,
- MAP_FIXED | MAP_PRIVATE, ldfd, foff) == (caddr_t)-1)
- PANIC(program_name);
-
- /*
- * If the memory occupancy of the segment overflows the
- * definition in the file, we need to "zero out" the
- * end of the mapping we've established, and if necessary,
- * map some more space from /dev/zero.
- */
- if (pptr->p_memsz > pptr->p_filesz) {
- foff = (int)faddr + pptr->p_vaddr + pptr->p_filesz;
- zaddr = (caddr_t)ROUND(foff, page_size);
- for (j = 0; j < (int)(zaddr - foff); j++)
- *((char *)foff + j) = 0;
- j = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr;
- if (j > 0) {
- if (dzfd == 0) {
- dzfd = OPEN(ZERO, O_RDWR);
- if (dzfd == -1)
- PANIC(program_name);
- }
- if ((caddr_t)MMAP((caddr_t)zaddr, j, i,
- MAP_FIXED | MAP_PRIVATE, dzfd,
- 0) == (caddr_t)-1)
- PANIC(program_name);
- }
- }
-
- /*
- * Update the mapping claim pointer.
- */
- maddr = addr + ROUND(flen, page_size);
- mlen -= maddr - addr;
- }
-
- /*
- * Unmap any final reservation.
- */
- if (mlen > 0)
- (void) MUNMAP(maddr, mlen);
-
- /*
- * Clean up file descriptor space we've consumed. Pass along
- * the /dev/zero file descriptor we got -- every cycle counts.
- */
- (void) CLOSE(ldfd);
- if (dzfd != 0)
- ebp->eb_tag = EB_DEVZERO, (ebp++)->eb_un.eb_val = dzfd;
-
- ebp->eb_tag = EB_NULL, ebp->eb_un.eb_val = 0;
-
- /* The two bytes before _rt_boot is for the alias entry point */
- return (void *) (ehdr->e_entry + faddr - 2);
-}
diff --git a/usr/src/lib/libc/amd64/crt/alias_boot.h b/usr/src/lib/libc/amd64/crt/alias_boot.h
deleted file mode 100644
index 5b12462808..0000000000
--- a/usr/src/lib/libc/amd64/crt/alias_boot.h
+++ /dev/null
@@ -1,52 +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 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef _ALIAS_BOOT_H
-#define _ALIAS_BOOT_H
-
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-/*
- * Offsets for string constants used in alias bootstrap.
- */
-#define LDSO_S 0 /* "/usr/lib/ld.so.n" */
-#define ZERO_S 1 /* "/dev/zero" */
-#define EMPTY_S 2 /* "(null)" */
-#define S_MAX 3 /* count of strings */
-
-/*
- * Offsets for function pointers used in alias bootstrap.
- */
-#define PANIC_F 0 /* panic() */
-#define OPEN_F 1 /* open() */
-#define MMAP_F 2 /* mmap() */
-#define FSTAT_F 3 /* fstat() */
-#define SYSCONFIG_F 4 /* sysconfig() */
-#define CLOSE_F 5 /* close() */
-#define MUNMAP_F 6 /* munmap() */
-#define F_MAX 7 /* count of functions */
-
-#endif /* _ALIAS_BOOT_H */
diff --git a/usr/src/lib/libc/common/sys/access.s b/usr/src/lib/libc/common/sys/access.s
deleted file mode 100644
index e39e7e549c..0000000000
--- a/usr/src/lib/libc/common/sys/access.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "access.s"
-
-/* C library -- access */
-/* int access(char *path, int amode) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(access,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(access)
- RET
- SET_SIZE(access)
diff --git a/usr/src/lib/libc/common/sys/chown.s b/usr/src/lib/libc/common/sys/chown.s
deleted file mode 100644
index d77e23b346..0000000000
--- a/usr/src/lib/libc/common/sys/chown.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "chown.s"
-
-/* C library -- chown */
-/* int chown(char *path, uid_t owner, gid_t group) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(chown,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(chown)
- RETC
- SET_SIZE(chown)
diff --git a/usr/src/lib/libc/common/sys/dup.s b/usr/src/lib/libc/common/sys/dup.s
deleted file mode 100644
index 84b89d0170..0000000000
--- a/usr/src/lib/libc/common/sys/dup.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "dup.s"
-
-/* C library -- dup */
-/* int dup(int fildes) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(dup,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(dup)
- RET
- SET_SIZE(dup)
diff --git a/usr/src/lib/libc/common/sys/fchown.s b/usr/src/lib/libc/common/sys/fchown.s
deleted file mode 100644
index 2cc7d35093..0000000000
--- a/usr/src/lib/libc/common/sys/fchown.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "fchown.s"
-
-/* C library -- fchown */
-/* int fchown(int fildes, uid_t owner, gid_t group) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(fchown,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(fchown)
- RETC
- SET_SIZE(fchown)
diff --git a/usr/src/lib/libc/common/sys/fcntl.s b/usr/src/lib/libc/common/sys/fcntl.s
deleted file mode 100644
index 3e44b4546d..0000000000
--- a/usr/src/lib/libc/common/sys/fcntl.s
+++ /dev/null
@@ -1,37 +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 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "fcntl.s"
-
-/*
- * int __fcntl_syscall(int fildes, int cmd [, arg])
- */
-
-#include "SYS.h"
-
- SYSCALL2_RESTART_RVAL1(__fcntl_syscall,fcntl)
- RET
- SET_SIZE(__fcntl_syscall)
diff --git a/usr/src/lib/libc/common/sys/fstat.s b/usr/src/lib/libc/common/sys/fstat.s
deleted file mode 100644
index 54a8e83558..0000000000
--- a/usr/src/lib/libc/common/sys/fstat.s
+++ /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 (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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "fstat.s"
-
-/* C library -- fstat */
-/* int fstat (int fildes, struct stat *buf) */
-
-#include <sys/asm_linkage.h>
-
-#if !defined(_LARGEFILE_SOURCE)
- ANSI_PRAGMA_WEAK(fstat,function)
-#else
- ANSI_PRAGMA_WEAK(fstat64,function)
-#endif
-
-#include "SYS.h"
-
-#if !defined(_LARGEFILE_SOURCE)
-
- SYSCALL_RVAL1(fstat)
- RETC
- SET_SIZE(fstat)
-
-#else
-
-/* C library -- fstat64 transitional large file API */
-/* int fstat64 (int fildes, struct stat64 *buf) */
-
- SYSCALL_RVAL1(fstat64)
- RETC
- SET_SIZE(fstat64)
-
-#endif
diff --git a/usr/src/lib/libc/common/sys/lchown.s b/usr/src/lib/libc/common/sys/lchown.s
deleted file mode 100644
index 5055f53ff4..0000000000
--- a/usr/src/lib/libc/common/sys/lchown.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "lchown.s"
-
-/* C library -- lchown */
-/* int lchown(const char *path, uid_t owner, gid_t group) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(lchown,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(lchown)
- RETC
- SET_SIZE(lchown)
diff --git a/usr/src/lib/libc/common/sys/lstat.s b/usr/src/lib/libc/common/sys/lstat.s
deleted file mode 100644
index fa5c0fdc36..0000000000
--- a/usr/src/lib/libc/common/sys/lstat.s
+++ /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 (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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "lstat.s"
-
-/* C library -- lstat */
-/* error = lstat(const char *path, struct lstat *buf) */
-
-#include <sys/asm_linkage.h>
-
-#if !defined(_LARGEFILE_SOURCE)
- ANSI_PRAGMA_WEAK(lstat,function)
-#else
- ANSI_PRAGMA_WEAK(lstat64,function)
-#endif
-
-#include "SYS.h"
-
-#if !defined(_LARGEFILE_SOURCE)
-
- SYSCALL_RVAL1(lstat)
- RETC
- SET_SIZE(lstat)
-
-#else
-
-/* C library -- lstat64 - transitional large file API */
-/* error = lstat64(const char *path, struct stat64 *buf) */
-
- SYSCALL_RVAL1(lstat64)
- RETC
- SET_SIZE(lstat64)
-
-#endif
diff --git a/usr/src/lib/libc/common/sys/open.s b/usr/src/lib/libc/common/sys/open.s
deleted file mode 100644
index 90c375629b..0000000000
--- a/usr/src/lib/libc/common/sys/open.s
+++ /dev/null
@@ -1,52 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "open.s"
-
-#include "SYS.h"
-
-#if !defined(_LARGEFILE_SOURCE)
-/* C library -- open */
-/* int open (const char *path, int oflag, [ mode_t mode ] ) */
-
- SYSCALL2_RVAL1(__open_syscall,open)
- RET
- SET_SIZE(__open_syscall)
-
-#else
-/*
- * C library -- open64 - transitional API
- * int open64 (const char *path, int oflag, [ mode_t mode ] )
- */
-
- SYSCALL2_RVAL1(__open64_syscall,open64)
- RET
- SET_SIZE(__open64_syscall)
-
-#endif
diff --git a/usr/src/lib/libc/common/sys/rename.s b/usr/src/lib/libc/common/sys/rename.s
deleted file mode 100644
index b76767a976..0000000000
--- a/usr/src/lib/libc/common/sys/rename.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "rename.s"
-
-/* C library -- rename */
-/* int rename(const char *old, const char *new); */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(rename,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(rename)
- RETC
- SET_SIZE(rename)
diff --git a/usr/src/lib/libc/common/sys/rmdir.s b/usr/src/lib/libc/common/sys/rmdir.s
deleted file mode 100644
index 9e0aeda3d7..0000000000
--- a/usr/src/lib/libc/common/sys/rmdir.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "rmdir.s"
-
-/* C library -- rmdir */
-/* int rmdir (const char *path); */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(rmdir,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(rmdir)
- RET
- SET_SIZE(rmdir)
diff --git a/usr/src/lib/libc/common/sys/stat.s b/usr/src/lib/libc/common/sys/stat.s
deleted file mode 100644
index db60595cf6..0000000000
--- a/usr/src/lib/libc/common/sys/stat.s
+++ /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 (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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "stat.s"
-
-/* C library -- stat */
-/* int stat (const char *path, struct stat *buf); */
-
-#include <sys/asm_linkage.h>
-
-#if !defined(_LARGEFILE_SOURCE)
- ANSI_PRAGMA_WEAK(stat,function)
-#else
- ANSI_PRAGMA_WEAK(stat64,function)
-#endif
-
-#include "SYS.h"
-
-#if !defined(_LARGEFILE_SOURCE)
-
- SYSCALL_RVAL1(stat)
- RETC
- SET_SIZE(stat)
-
-#else
-
-/* C library -- stat64 - transitional API */
-/* int stat64 (const char *path, struct stat64 *buf); */
-
- SYSCALL_RVAL1(stat64)
- RETC
- SET_SIZE(stat64)
-
-#endif
diff --git a/usr/src/lib/libc/common/sys/unlink.s b/usr/src/lib/libc/common/sys/unlink.s
deleted file mode 100644
index 427ed54c15..0000000000
--- a/usr/src/lib/libc/common/sys/unlink.s
+++ /dev/null
@@ -1,43 +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 (c) 1988 AT&T */
-/* All Rights Reserved */
-
-
-/*
- * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "unlink.s"
-
-/* C library -- unlink */
-/* int unlink (const char *path); */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(unlink,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(unlink)
- RETC
- SET_SIZE(unlink)
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index b4e26c8f67..cf40cf18d2 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -145,19 +145,14 @@ GENOBJS= \
# sysobjs that contain large-file interfaces
COMSYSOBJS64= \
- creat64.o \
- fstat64.o \
fstatvfs64.o \
getdents64.o \
getrlimit64.o \
lseek64.o \
- lstat64.o \
mmap64.o \
- open64.o \
pread64.o \
pwrite64.o \
setrlimit64.o \
- stat64.o \
statvfs64.o
SYSOBJS64=
@@ -194,7 +189,6 @@ COMSYSOBJS= \
_so_socket.o \
_so_socketpair.o \
_sockconfig.o \
- access.o \
acct.o \
acl.o \
adjtime.o \
@@ -202,23 +196,17 @@ COMSYSOBJS= \
brk.o \
chdir.o \
chmod.o \
- chown.o \
chroot.o \
cladm.o \
close.o \
- creat.o \
- dup.o \
execve.o \
exit.o \
facl.o \
fchdir.o \
fchmod.o \
- fchown.o \
fchroot.o \
- fcntl.o \
fdsync.o \
fpathconf.o \
- fstat.o \
fstatfs.o \
fstatvfs.o \
getcpuid.o \
@@ -240,11 +228,9 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- lchown.o \
link.o \
llseek.o \
lseek.o \
- lstat.o \
mmapobjsys.o \
memcntl.o \
mincore.o \
@@ -258,7 +244,6 @@ COMSYSOBJS= \
nice.o \
ntp_adjtime.o \
ntp_gettime.o \
- open.o \
p_online.o \
pathconf.o \
pause.o \
@@ -275,9 +260,7 @@ COMSYSOBJS= \
read.o \
readlink.o \
readv.o \
- rename.o \
resolvepath.o \
- rmdir.o \
seteguid.o \
setgid.o \
setgroups.o \
@@ -289,7 +272,6 @@ COMSYSOBJS= \
sigprocmsk.o \
sigsendset.o \
sigsuspend.o \
- stat.o \
statfs.o \
statvfs.o \
stty.o \
@@ -303,7 +285,6 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
- unlink.o \
utssys.o \
uucopy.o \
vhangup.o \
@@ -321,11 +302,9 @@ SYSOBJS= \
door.o \
forkx.o \
forkallx.o \
- fxstat.o \
getcontext.o \
gettimeofday.o \
lwp_private.o \
- lxstat.o \
nuname.o \
pipe.o \
ptrace.o \
@@ -336,7 +315,6 @@ SYSOBJS= \
umount.o \
uname.o \
vforkx.o \
- xmknod.o \
xstat.o
# objects under ../port which contain transitional large file interfaces
@@ -418,7 +396,7 @@ PORTGEN= \
dirname.o \
div.o \
drand48.o \
- dup2.o \
+ dup.o \
env_data.o \
err.o \
errno.o \
@@ -822,29 +800,27 @@ UNWINDASMOBJS= \
# objects that implement the transitional large file API
PORTSYS64= \
- fstatat64.o \
lockf64.o \
- openat64.o
+ stat64.o
PORTSYS= \
_autofssys.o \
+ access.o \
acctctl.o \
bsd_signal.o \
+ chown.o \
corectl.o \
exacctsys.o \
execl.o \
execle.o \
execv.o \
- fsmisc.o \
- fstatat.o \
+ fcntl.o \
getpagesizes.o \
getpeerucred.o \
inst_sync.o \
issetugid.o \
label.o \
- libc_fcntl.o \
libc_link.o \
- libc_open.o \
lockf.o \
lwp.o \
lwp_cond.o \
@@ -853,12 +829,13 @@ PORTSYS= \
meminfosys.o \
msgsys.o \
nfssys.o \
- openat.o \
+ open.o \
pgrpsys.o \
posix_sigwait.o \
ppriv.o \
psetsys.o \
rctlsys.o \
+ rename.o \
sbrk.o \
semsys.o \
set_errno.o \
@@ -869,10 +846,12 @@ PORTSYS= \
signal.o \
sigpending.o \
sigstack.o \
+ stat.o \
tasksys.o \
time.o \
time_util.o \
ucontext.o \
+ unlink.o \
ustat.o \
utimesys.o \
zone.o
@@ -985,6 +964,11 @@ CPPFLAGS= -D_REENTRANT -Di386 $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
-I$(LIBCBASE)/inc -I../inc $(CPPFLAGS.master)
ASFLAGS= $(AS_PICFLAGS) -P -D__STDC__ -D_ASM $(CPPFLAGS) $(i386_AS_XARCH)
+# As a favor to the dtrace syscall provider, libc still calls the
+# old syscall traps that have been obsoleted by the *at() interfaces.
+# Delete this to compile libc using only the new *at() system call traps
+CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
+
# Conditionally add support for making |wordexp()| check whether
# /usr/bin/ksh is ksh93 or not
include ../../../Makefile.ksh93switch
diff --git a/usr/src/lib/libc/i386/crt/_rtboot.s b/usr/src/lib/libc/i386/crt/_rtboot.s
index e21c5cb956..fa928906e9 100644
--- a/usr/src/lib/libc/i386/crt/_rtboot.s
+++ b/usr/src/lib/libc/i386/crt/_rtboot.s
@@ -18,8 +18,9 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -112,11 +113,11 @@ __rtboot:
pushl %eax
leal f.SYSCONFIG - .L01(%ebx),%eax
pushl %eax
- leal f.FSTAT - .L01(%ebx),%eax
+ leal f.FSTATAT - .L01(%ebx),%eax
pushl %eax
leal f.MMAP - .L01(%ebx),%eax
pushl %eax
- leal f.OPEN - .L01(%ebx),%eax
+ leal f.OPENAT - .L01(%ebx),%eax
pushl %eax
leal f.PANIC - .L01(%ebx),%eax
pushl %eax
@@ -151,8 +152,8 @@ f.PANIC:
jmp f.EXIT
/ Not reached
-f.OPEN:
- movl $SYS_open,%eax
+f.OPENAT:
+ movl $SYS_openat,%eax
jmp __syscall
f.MMAP:
movl $SYS_mmap,%eax
@@ -172,8 +173,8 @@ f.LSEEK:
f.CLOSE:
movl $SYS_close,%eax
jmp __syscall
-f.FSTAT:
- movl $SYS_fxstat,%eax / NEEDSWORK: temp kludge for G6
+f.FSTATAT:
+ movl $SYS_fstatat,%eax
jmp __syscall
f.SYSCONFIG:
movl $SYS_sysconfig,%eax
diff --git a/usr/src/lib/libc/i386/crt/_rtld.c b/usr/src/lib/libc/i386/crt/_rtld.c
index d7eaa323b8..92c9e53c55 100644
--- a/usr/src/lib/libc/i386/crt/_rtld.c
+++ b/usr/src/lib/libc/i386/crt/_rtld.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,16 +18,15 @@
*
* CDDL HEADER END
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
/*
- * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used
- * to redirect aliases for ld.so to the real one.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
/*
- * Copyright (c) 1990, 1991, 2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Redirection ld.so. Based on the 4.x binary compatibility ld.so, used
+ * to redirect aliases for ld.so to the real one.
*/
/*
@@ -56,10 +54,10 @@
#define LDSO strings[LDSO_S]
#define ZERO strings[ZERO_S]
#define CLOSE (*(funcs[CLOSE_F]))
-#define FSTAT (*(funcs[FSTAT_F]))
+#define FSTATAT (*(funcs[FSTATAT_F]))
#define MMAP (*(funcs[MMAP_F]))
#define MUNMAP (*(funcs[MUNMAP_F]))
-#define OPEN (*(funcs[OPEN_F]))
+#define OPENAT (*(funcs[OPENAT_F]))
#define PANIC (*(funcs[PANIC_F]))
#define SYSCONFIG (*(funcs[SYSCONFIG_F]))
@@ -134,10 +132,9 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])())
* data structures. Further mappings will actually establish the
* program in the address space.
*/
- if ((ldfd = OPEN(LDSO, O_RDONLY)) == -1)
+ if ((ldfd = OPENAT(AT_FDCWD, LDSO, O_RDONLY)) == -1)
PANIC(program_name);
-/* NEEDSWORK (temp kludge to use xstat so we can run on G6) */
- if (FSTAT(2, ldfd, &sb) == -1)
+ if (FSTATAT(ldfd, NULL, &sb, 0) == -1)
PANIC(program_name);
ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC,
MAP_SHARED, ldfd, 0);
@@ -291,7 +288,7 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])())
j = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr;
if (j > 0) {
if (dzfd == 0) {
- dzfd = OPEN(ZERO, O_RDWR);
+ dzfd = OPENAT(AT_FDCWD, ZERO, O_RDWR);
if (dzfd == -1)
PANIC(program_name);
}
diff --git a/usr/src/lib/libc/i386/crt/alias_boot.h b/usr/src/lib/libc/i386/crt/alias_boot.h
index d6828f6fc8..e2a96f933a 100644
--- a/usr/src/lib/libc/i386/crt/alias_boot.h
+++ b/usr/src/lib/libc/i386/crt/alias_boot.h
@@ -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,15 +18,15 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1991 Sun Microsystems, Inc.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
#ifndef _ALIAS_BOOT_H
#define _ALIAS_BOOT_H
-#ident "%W% %E% SMI"
-
/*
* Offsets for string constants used in alias bootstrap.
*/
@@ -40,9 +39,9 @@
* Offsets for function pointers used in alias bootstrap.
*/
#define PANIC_F 0 /* panic() */
-#define OPEN_F 1 /* open() */
+#define OPENAT_F 1 /* openat() */
#define MMAP_F 2 /* mmap() */
-#define FSTAT_F 3 /* fstat() */
+#define FSTATAT_F 3 /* fstatat() */
#define SYSCONFIG_F 4 /* sysconfig() */
#define CLOSE_F 5 /* close() */
#define MUNMAP_F 6 /* munmap() */
diff --git a/usr/src/lib/libc/i386/sys/fxstat.s b/usr/src/lib/libc/i386/sys/fxstat.s
deleted file mode 100644
index da3eb8f5c0..0000000000
--- a/usr/src/lib/libc/i386/sys/fxstat.s
+++ /dev/null
@@ -1,37 +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 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "fxstat.s"
-
-#include "SYS.h"
-
-/ error = _fxstat(file, statbuf);
-/ char statbuf[34]
-
- ENTRY(_fxstat)
- SYSTRAP_RVAL1(fxstat)
- SYSCERROR
- RETC
- SET_SIZE(_fxstat)
diff --git a/usr/src/lib/libc/i386/sys/lxstat.s b/usr/src/lib/libc/i386/sys/lxstat.s
deleted file mode 100644
index 9e9d3af63c..0000000000
--- a/usr/src/lib/libc/i386/sys/lxstat.s
+++ /dev/null
@@ -1,37 +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 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "lxstat.s"
-
-/ int
-/ _lxstat(_STAT_VER, _path, _buf);
-
-#include "SYS.h"
-
- ENTRY(_lxstat)
- SYSTRAP_RVAL1(lxstat)
- SYSCERROR
- RETC
- SET_SIZE(_lxstat)
diff --git a/usr/src/lib/libc/i386/sys/xmknod.s b/usr/src/lib/libc/i386/sys/xmknod.s
deleted file mode 100644
index e8a9421dcc..0000000000
--- a/usr/src/lib/libc/i386/sys/xmknod.s
+++ /dev/null
@@ -1,38 +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 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "xmknod.s"
-
-/ OS library -- _xmknod
-
-/ error = _xmknod(version, string, mode, dev)
-
-#include "SYS.h"
-
- ENTRY(_xmknod)
- SYSTRAP_RVAL1(xmknod)
- SYSCERROR
- RETC
- SET_SIZE(_xmknod)
diff --git a/usr/src/lib/libc/i386/sys/xstat.c b/usr/src/lib/libc/i386/sys/xstat.c
new file mode 100644
index 0000000000..69637eccfb
--- /dev/null
+++ b/usr/src/lib/libc/i386/sys/xstat.c
@@ -0,0 +1,80 @@
+/*
+ * 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 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
+ * Wrapper functions to intercept calls to the obsolete
+ * _xstat(), _lxstat(), _fxstat() and _xmknod() functions
+ * and redirect them to the proper direct system calls.
+ */
+
+#include "lint.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+int
+_xstat(int version, const char *path, struct stat *statb)
+{
+ if (version != _STAT_VER) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (stat(path, statb));
+}
+
+int
+_lxstat(int version, const char *path, struct stat *statb)
+{
+ if (version != _STAT_VER) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (lstat(path, statb));
+}
+
+int
+_fxstat(int version, int fd, struct stat *statb)
+{
+ if (version != _STAT_VER) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (fstat(fd, statb));
+}
+
+int
+_xmknod(int version, const char *path, mode_t mode, dev_t dev)
+{
+ if (version != _MKNOD_VER) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (mknod(path, mode, dev));
+}
diff --git a/usr/src/lib/libc/i386/sys/xstat.s b/usr/src/lib/libc/i386/sys/xstat.s
deleted file mode 100644
index 8581a5f2af..0000000000
--- a/usr/src/lib/libc/i386/sys/xstat.s
+++ /dev/null
@@ -1,38 +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 2004 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
- */
-
- .file "xstat.s"
-
-/ OS library -- _xstat
-
-/ error = _xstat(version, string, statbuf)
-
-#include "SYS.h"
-
- ENTRY(_xstat)
- SYSTRAP_RVAL1(xstat)
- SYSCERROR
- RETC
- SET_SIZE(_xstat)
diff --git a/usr/src/lib/libc/inc/libc.h b/usr/src/lib/libc/inc/libc.h
index 4059d08d8e..5feca8b80f 100644
--- a/usr/src/lib/libc/inc/libc.h
+++ b/usr/src/lib/libc/inc/libc.h
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -32,8 +32,6 @@
#ifndef _LIBC_H
#define _LIBC_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <thread.h>
#include <stdio.h>
#include <dirent.h>
@@ -118,6 +116,13 @@ extern enum fp_direction_type _QgetRD(void);
#error Unknown architecture!
#endif
+/*
+ * defined in open.c
+ */
+extern int __open(const char *, int, mode_t);
+extern int __open64(const char *, int, mode_t);
+extern int __openat(int, const char *, int, mode_t);
+extern int __openat64(int, const char *, int, mode_t);
/*
* defined in hex_bin.c
diff --git a/usr/src/lib/libc/inc/thr_uberdata.h b/usr/src/lib/libc/inc/thr_uberdata.h
index 4d1272105c..ac14038787 100644
--- a/usr/src/lib/libc/inc/thr_uberdata.h
+++ b/usr/src/lib/libc/inc/thr_uberdata.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.
*/
@@ -1354,7 +1354,10 @@ extern void _thrp_unwind(void *);
extern pid_t __forkx(int);
extern pid_t __forkallx(int);
-extern int __open(const char *, int, ...);
+extern int __open(const char *, int, mode_t);
+extern int __open64(const char *, int, mode_t);
+extern int __openat(int, const char *, int, mode_t);
+extern int __openat64(int, const char *, int, mode_t);
extern int __close(int);
extern ssize_t __read(int, void *, size_t);
extern ssize_t __write(int, const void *, size_t);
diff --git a/usr/src/lib/libc/port/gen/attrat.c b/usr/src/lib/libc/port/gen/attrat.c
index 725bdd9b12..89163a3909 100644
--- a/usr/src/lib/libc/port/gen/attrat.c
+++ b/usr/src/lib/libc/port/gen/attrat.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.
*/
@@ -33,7 +34,7 @@
#include <sys/types.h>
#include <sys/syscall.h>
#include <sys/stat.h>
-#include <sys/filio.h>
+#include <sys/file.h>
#include <unistd.h>
#include <dlfcn.h>
#include <stdio.h>
@@ -47,13 +48,18 @@ static int (*nvlookupint64)(nvlist_t *, const char *, uint64_t *);
static mutex_t attrlock = DEFAULTMUTEX;
static int initialized;
-extern int __openattrdirat(int basefd, const char *name);
static char *xattr_view_name[XATTR_VIEW_LAST] = {
VIEW_READONLY,
VIEW_READWRITE
};
+int
+__openattrdirat(int fd, const char *name)
+{
+ return (syscall(SYS_openat, fd, name, FXATTRDIROPEN, 0));
+}
+
static int
attrat_init()
{
diff --git a/usr/src/lib/libc/port/gen/dup2.c b/usr/src/lib/libc/port/gen/dup.c
index 9708d3afb3..8b5db30b19 100644
--- a/usr/src/lib/libc/port/gen/dup2.c
+++ b/usr/src/lib/libc/port/gen/dup.c
@@ -20,21 +20,25 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#pragma weak _dup2 = dup2
-
#include "lint.h"
#include <sys/types.h>
#include <fcntl.h>
+#pragma weak _dup = dup
+int
+dup(int fildes)
+{
+ return (fcntl(fildes, F_DUPFD, 0));
+}
+
+#pragma weak _dup2 = dup2
int
dup2(int fildes, int fildes2)
{
diff --git a/usr/src/lib/libc/common/sys/creat.s b/usr/src/lib/libc/port/sys/access.c
index a2922eb974..0bf92311b6 100644
--- a/usr/src/lib/libc/common/sys/creat.s
+++ b/usr/src/lib/libc/port/sys/access.c
@@ -19,32 +19,29 @@
* CDDL HEADER END
*/
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
- .file "creat.s"
-
-#include "SYS.h"
-
-#if !defined(_LARGEFILE_SOURCE)
-/* C library -- creat */
-/* int __creat(char *path, mode_t mode) */
-
- SYSCALL2_RVAL1(__creat,creat)
- RET
- SET_SIZE(__creat)
-
+#include "lint.h"
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <sys/fcntl.h>
+
+int
+faccessat(int fd, const char *fname, int amode, int flag)
+{
+ return (syscall(SYS_faccessat, fd, fname, amode, flag));
+}
+
+#pragma weak _access = access
+int
+access(const char *fname, int amode)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_access, fname, amode));
#else
-/* C library -- creat64 */
-/* int __creat64(char *path, mode_t mode) */
-
- SYSCALL2_RVAL1(__creat64,creat64)
- RET
- SET_SIZE(__creat64)
-
+ return (faccessat(AT_FDCWD, fname, amode, 0));
#endif
+}
diff --git a/usr/src/lib/libc/port/sys/fsmisc.c b/usr/src/lib/libc/port/sys/chown.c
index 5ca207adaf..5ea62e12ce 100644
--- a/usr/src/lib/libc/port/sys/fsmisc.c
+++ b/usr/src/lib/libc/port/sys/chown.c
@@ -20,44 +20,53 @@
*/
/*
- * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma weak _fchownat = fchownat
-#pragma weak _unlinkat = unlinkat
-
#include "lint.h"
+#include <stdio.h>
+#include <unistd.h>
#include <sys/types.h>
#include <sys/syscall.h>
-#include <sys/stat.h>
+#include <sys/fcntl.h>
+#pragma weak _fchownat = fchownat
int
fchownat(int fd, const char *name, uid_t uid, gid_t gid, int flags)
{
- return (syscall(SYS_fsat, 4, fd, name, uid, gid, flags));
-}
-
-int
-unlinkat(int fd, const char *name, int flags)
-{
- return (syscall(SYS_fsat, 5, fd, name, flags));
+ return (syscall(SYS_fchownat, fd, name, uid, gid, flags));
}
+#pragma weak _chown = chown
int
-renameat(int fromfd, const char *fromname, int tofd, const char *toname)
+chown(const char *name, uid_t uid, gid_t gid)
{
- return (syscall(SYS_fsat, 7, fromfd, fromname, tofd, toname));
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_chown, name, uid, gid));
+#else
+ return (fchownat(AT_FDCWD, name, uid, gid, 0));
+#endif
}
+#pragma weak _lchown = lchown
int
-faccessat(int fd, const char *fname, int amode, int flag)
+lchown(const char *name, uid_t uid, gid_t gid)
{
- return (syscall(SYS_fsat, 8, fd, fname, amode, flag));
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_lchown, name, uid, gid));
+#else
+ return (fchownat(AT_FDCWD, name, uid, gid, AT_SYMLINK_NOFOLLOW));
+#endif
}
+#pragma weak _fchown = fchown
int
-__openattrdirat(int fd, const char *name)
+fchown(int filedes, uid_t uid, gid_t gid)
{
- return (syscall(SYS_fsat, 9, fd, name));
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_fchown, filedes, uid, gid));
+#else
+ return (fchownat(filedes, NULL, uid, gid, 0));
+#endif
}
diff --git a/usr/src/lib/libc/port/sys/libc_fcntl.c b/usr/src/lib/libc/port/sys/fcntl.c
index beab99f74c..cea7e79dd2 100644
--- a/usr/src/lib/libc/port/sys/libc_fcntl.c
+++ b/usr/src/lib/libc/port/sys/fcntl.c
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <sys/param.h>
#include <sys/sockio.h>
@@ -52,8 +50,6 @@
#include <stdlib.h>
#include "libc.h"
-extern int __fcntl_syscall(int fd, int cmd, ...);
-
#if !defined(_LP64)
/*
* XXX these hacks are needed for X.25 which assumes that s_fcntl and
@@ -92,6 +88,6 @@ __fcntl(int fd, int cmd, ...)
return (res);
default:
- return (__fcntl_syscall(fd, cmd, arg));
+ return (syscall(SYS_fcntl, fd, cmd, arg));
}
}
diff --git a/usr/src/lib/libc/port/sys/libc_open.c b/usr/src/lib/libc/port/sys/open.c
index ad9d07d7fd..067bb72d69 100644
--- a/usr/src/lib/libc/port/sys/libc_open.c
+++ b/usr/src/lib/libc/port/sys/open.c
@@ -20,15 +20,13 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <sys/mkdev.h>
#include <limits.h>
@@ -37,72 +35,71 @@
#include <strings.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/fcntl.h>
#include <sys/stropts.h>
#include <sys/stream.h>
#include <sys/ptms.h>
+#include <sys/syscall.h>
#include "libc.h"
-#if !defined(_LP64)
-extern int __open64_syscall(const char *fname, int oflag, mode_t mode);
-#endif
-
-extern int __open_syscall(const char *fname, int oflag, mode_t mode);
-
+static int xpg4_fixup(int fd);
static void push_module(int fd);
static int isptsfd(int fd);
static void itoa(int i, char *ptr);
int
-__open(const char *fname, int oflag, ...)
+__openat(int dfd, const char *path, int oflag, mode_t mode)
{
- mode_t mode;
- int fd;
- va_list ap;
-
- va_start(ap, oflag);
- mode = va_arg(ap, mode_t);
- va_end(ap);
-
- /*
- * XPG4v2 requires that open of a slave pseudo terminal device
- * provides the process with an interface that is identical to
- * the terminal interface. For a more detailed discussion,
- * see bugid 4025044.
- */
- fd = __open_syscall(fname, oflag, mode);
- if (libc__xpg4 != 0 && fd >= 0 && isptsfd(fd))
- push_module(fd);
- return (fd);
+ int fd = syscall(SYS_openat, dfd, path, oflag, mode);
+ return (xpg4_fixup(fd));
+}
+
+int
+__open(const char *path, int oflag, mode_t mode)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ int fd = syscall(SYS_open, path, oflag, mode);
+ return (xpg4_fixup(fd));
+#else
+ return (__openat(AT_FDCWD, path, oflag, mode));
+#endif
}
#if !defined(_LP64)
+
+int
+__openat64(int dfd, const char *path, int oflag, mode_t mode)
+{
+ int fd = syscall(SYS_openat64, dfd, path, oflag, mode);
+ return (xpg4_fixup(fd));
+}
+
+int
+__open64(const char *path, int oflag, mode_t mode)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ int fd = syscall(SYS_open64, path, oflag, mode);
+ return (xpg4_fixup(fd));
+#else
+ return (__openat64(AT_FDCWD, path, oflag, mode));
+#endif
+}
+
+#endif /* !_LP64 */
+
/*
- * The 32-bit APIs to large files require this interposition.
- * The 64-bit APIs just fall back to __open() above.
+ * XPG4v2 requires that open of a slave pseudo terminal device
+ * provides the process with an interface that is identical to
+ * the terminal interface. For a more detailed discussion,
+ * see bugid 4025044.
*/
-int
-__open64(const char *fname, int oflag, ...)
+static int
+xpg4_fixup(int fd)
{
- mode_t mode;
- int fd;
- va_list ap;
-
- va_start(ap, oflag);
- mode = va_arg(ap, mode_t);
- va_end(ap);
-
- /*
- * XPG4v2 requires that open of a slave pseudo terminal device
- * provides the process with an interface that is identical to
- * the terminal interface. For a more detailed discussion,
- * see bugid 4025044.
- */
- fd = __open64_syscall(fname, oflag, mode);
if (libc__xpg4 != 0 && fd >= 0 && isptsfd(fd))
push_module(fd);
return (fd);
}
-#endif /* !_LP64 */
/*
* Check if the file matches an entry in the /dev/pts directory.
diff --git a/usr/src/lib/libc/port/sys/fstatat.c b/usr/src/lib/libc/port/sys/rename.c
index 15c9d3b0cb..7f321e091c 100644
--- a/usr/src/lib/libc/port/sys/fstatat.c
+++ b/usr/src/lib/libc/port/sys/rename.c
@@ -20,37 +20,29 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
-#pragma weak _fstatat64 = fstatat64
-#else
-#pragma weak _fstatat = fstatat
-#endif
-
#include "lint.h"
-#include <sys/types.h>
+#include <stdio.h>
+#include <unistd.h>
#include <sys/syscall.h>
-#include <sys/stat.h>
-
-#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
+#include <sys/fcntl.h>
int
-fstatat64(int fd, const char *name, struct stat64 *sb, int flags)
+renameat(int oldfd, const char *oldname, int newfd, const char *newname)
{
- return (syscall(SYS_fsat, 2, fd, name, sb, flags));
+ return (syscall(SYS_renameat, oldfd, oldname, newfd, newname));
}
-#else
-
+#pragma weak _rename = rename
int
-fstatat(int fd, const char *name, struct stat *sb, int flags)
+rename(const char *oldname, const char *newname)
{
- return (syscall(SYS_fsat, 3, fd, name, sb, flags));
-}
-
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_rename, oldname, newname));
+#else
+ return (renameat(AT_FDCWD, oldname, AT_FDCWD, newname));
#endif
+}
diff --git a/usr/src/lib/libc/port/sys/stat.c b/usr/src/lib/libc/port/sys/stat.c
new file mode 100644
index 0000000000..f09c7ed1a8
--- /dev/null
+++ b/usr/src/lib/libc/port/sys/stat.c
@@ -0,0 +1,117 @@
+/*
+ * 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 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#include "lint.h"
+#include <sys/types.h>
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
+
+#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
+
+#pragma weak _fstatat64 = fstatat64
+int
+fstatat64(int fd, const char *name, struct stat64 *sb, int flags)
+{
+ return (syscall(SYS_fstatat64, fd, name, sb, flags));
+}
+
+#pragma weak _stat64 = stat64
+int
+stat64(const char *name, struct stat64 *sb)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_stat64, name, sb));
+#else
+ return (fstatat64(AT_FDCWD, name, sb, 0));
+#endif
+}
+
+#pragma weak _lstat64 = lstat64
+int
+lstat64(const char *name, struct stat64 *sb)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_lstat64, name, sb));
+#else
+ return (fstatat64(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW));
+#endif
+}
+
+#pragma weak _fstat64 = fstat64
+int
+fstat64(int fd, struct stat64 *sb)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_fstat64, fd, sb));
+#else
+ return (fstatat64(fd, NULL, sb, 0));
+#endif
+}
+
+#else /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */
+
+#pragma weak _fstatat = fstatat
+int
+fstatat(int fd, const char *name, struct stat *sb, int flags)
+{
+ return (syscall(SYS_fstatat, fd, name, sb, flags));
+}
+
+#pragma weak _stat = stat
+int
+stat(const char *name, struct stat *sb)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_stat, name, sb));
+#else
+ return (fstatat(AT_FDCWD, name, sb, 0));
+#endif
+}
+
+#pragma weak _lstat = lstat
+int
+lstat(const char *name, struct stat *sb)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_lstat, name, sb));
+#else
+ return (fstatat(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW));
+#endif
+}
+
+#pragma weak _fstat = fstat
+int
+fstat(int fd, struct stat *sb)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_fstat, fd, sb));
+#else
+ return (fstatat(fd, NULL, sb, 0));
+#endif
+}
+
+#endif /* !defined(_LP64) && _FILE_OFFSET_BITS == 64 */
diff --git a/usr/src/lib/libc/port/sys/openat.c b/usr/src/lib/libc/port/sys/unlink.c
index 0a15a8746d..209eb4ad56 100644
--- a/usr/src/lib/libc/port/sys/openat.c
+++ b/usr/src/lib/libc/port/sys/unlink.c
@@ -20,43 +20,40 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
-#include <stdarg.h>
-#include <sys/types.h>
+#include <unistd.h>
#include <sys/syscall.h>
+#include <sys/fcntl.h>
-#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
-
+#pragma weak _unlinkat = unlinkat
int
-__openat64(int fd, const char *name, int oflag, ...)
+unlinkat(int fd, const char *name, int flags)
{
- va_list ap;
- mode_t mode;
-
- va_start(ap, oflag);
- mode = va_arg(ap, mode_t);
- va_end(ap);
- return (syscall(SYS_fsat, 1, fd, name, oflag, mode));
+ return (syscall(SYS_unlinkat, fd, name, flags));
}
-#else
-
+#pragma weak _unlink = unlink
int
-__openat(int fd, const char *name, int oflag, ...)
+unlink(const char *name)
{
- va_list ap;
- mode_t mode;
-
- va_start(ap, oflag);
- mode = va_arg(ap, mode_t);
- va_end(ap);
- return (syscall(SYS_fsat, 0, fd, name, oflag, mode));
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_unlink, name));
+#else
+ return (unlinkat(AT_FDCWD, name, 0));
+#endif
}
+#pragma weak _rmdir = rmdir
+int
+rmdir(const char *name)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_rmdir, name));
+#else
+ return (unlinkat(AT_FDCWD, name, AT_REMOVEDIR));
#endif
+}
diff --git a/usr/src/lib/libc/port/threads/scalls.c b/usr/src/lib/libc/port/threads/scalls.c
index 337ed35554..368b864d3f 100644
--- a/usr/src/lib/libc/port/threads/scalls.c
+++ b/usr/src/lib/libc/port/threads/scalls.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.
*/
@@ -727,26 +727,6 @@ close(int fildes)
}
int
-creat(const char *path, mode_t mode)
-{
- extern int __creat(const char *, mode_t);
- int rv;
-
- PERFORM(__creat(path, mode))
-}
-
-#if !defined(_LP64)
-int
-creat64(const char *path, mode_t mode)
-{
- extern int __creat64(const char *, mode_t);
- int rv;
-
- PERFORM(__creat64(path, mode))
-}
-#endif /* !_LP64 */
-
-int
door_call(int d, door_arg_t *params)
{
extern int __door_call(int, door_arg_t *);
@@ -837,9 +817,8 @@ msync(caddr_t addr, size_t len, int flags)
}
int
-open(const char *path, int oflag, ...)
+openat(int fd, const char *path, int oflag, ...)
{
- extern int __open(const char *, int, ...);
mode_t mode;
int rv;
va_list ap;
@@ -847,13 +826,12 @@ open(const char *path, int oflag, ...)
va_start(ap, oflag);
mode = va_arg(ap, mode_t);
va_end(ap);
- PERFORM(__open(path, oflag, mode))
+ PERFORM(__openat(fd, path, oflag, mode))
}
int
-openat(int fd, const char *path, int oflag, ...)
+open(const char *path, int oflag, ...)
{
- extern int __openat(int, const char *, int, ...);
mode_t mode;
int rv;
va_list ap;
@@ -861,14 +839,19 @@ openat(int fd, const char *path, int oflag, ...)
va_start(ap, oflag);
mode = va_arg(ap, mode_t);
va_end(ap);
- PERFORM(__openat(fd, path, oflag, mode))
+ PERFORM(__open(path, oflag, mode))
+}
+
+int
+creat(const char *path, mode_t mode)
+{
+ return (open(path, O_WRONLY | O_CREAT | O_TRUNC, mode));
}
#if !defined(_LP64)
int
-open64(const char *path, int oflag, ...)
+openat64(int fd, const char *path, int oflag, ...)
{
- extern int __open64(const char *, int, ...);
mode_t mode;
int rv;
va_list ap;
@@ -876,13 +859,12 @@ open64(const char *path, int oflag, ...)
va_start(ap, oflag);
mode = va_arg(ap, mode_t);
va_end(ap);
- PERFORM(__open64(path, oflag, mode))
+ PERFORM(__openat64(fd, path, oflag, mode))
}
int
-openat64(int fd, const char *path, int oflag, ...)
+open64(const char *path, int oflag, ...)
{
- extern int __openat64(int, const char *, int, ...);
mode_t mode;
int rv;
va_list ap;
@@ -890,7 +872,13 @@ openat64(int fd, const char *path, int oflag, ...)
va_start(ap, oflag);
mode = va_arg(ap, mode_t);
va_end(ap);
- PERFORM(__openat64(fd, path, oflag, mode))
+ PERFORM(__open64(path, oflag, mode))
+}
+
+int
+creat64(const char *path, mode_t mode)
+{
+ return (open64(path, O_WRONLY | O_CREAT | O_TRUNC, mode));
}
#endif /* !_LP64 */
diff --git a/usr/src/lib/libc/port/threads/spawn.c b/usr/src/lib/libc/port/threads/spawn.c
index 8228a25b64..fd91cf44cd 100644
--- a/usr/src/lib/libc/port/threads/spawn.c
+++ b/usr/src/lib/libc/port/threads/spawn.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.
*/
@@ -76,7 +76,6 @@ extern int __sigaction(int, const struct sigaction *, struct sigaction *);
#define getdents64 getdents
#define dirent64_t dirent_t
#else
-extern int __open64(const char *, int, ...);
extern int getdents64(int, dirent64_t *, size_t);
#endif
@@ -198,8 +197,7 @@ perform_file_actions(file_attr_t *fap, void *dirbuf)
do {
switch (fap->fa_type) {
case FA_OPEN:
- fd = __open(fap->fa_path,
- fap->fa_oflag, fap->fa_mode);
+ fd = __open(fap->fa_path, fap->fa_oflag, fap->fa_mode);
if (fd < 0)
return (errno);
if (fd != fap->fa_filedes) {
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index a7d66be272..67d166fa7c 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -155,19 +155,14 @@ GENOBJS= \
# sysobjs that contain large-file interfaces
COMSYSOBJS64= \
- creat64.o \
- fstat64.o \
fstatvfs64.o \
getdents64.o \
getrlimit64.o \
lseek64.o \
- lstat64.o \
mmap64.o \
- open64.o \
pread64.o \
pwrite64.o \
setrlimit64.o \
- stat64.o \
statvfs64.o
SYSOBJS64=
@@ -204,7 +199,6 @@ COMSYSOBJS= \
_so_socket.o \
_so_socketpair.o \
_sockconfig.o \
- access.o \
acct.o \
acl.o \
adjtime.o \
@@ -212,23 +206,17 @@ COMSYSOBJS= \
brk.o \
chdir.o \
chmod.o \
- chown.o \
chroot.o \
cladm.o \
close.o \
- creat.o \
- dup.o \
execve.o \
exit.o \
facl.o \
fchdir.o \
fchmod.o \
- fchown.o \
fchroot.o \
- fcntl.o \
fdsync.o \
fpathconf.o \
- fstat.o \
fstatfs.o \
fstatvfs.o \
getcpuid.o \
@@ -250,11 +238,9 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- lchown.o \
link.o \
llseek.o \
lseek.o \
- lstat.o \
memcntl.o \
mincore.o \
mkdir.o \
@@ -268,7 +254,6 @@ COMSYSOBJS= \
nice.o \
ntp_adjtime.o \
ntp_gettime.o \
- open.o \
p_online.o \
pathconf.o \
pause.o \
@@ -285,9 +270,7 @@ COMSYSOBJS= \
read.o \
readlink.o \
readv.o \
- rename.o \
resolvepath.o \
- rmdir.o \
seteguid.o \
setgid.o \
setgroups.o \
@@ -299,7 +282,6 @@ COMSYSOBJS= \
sigprocmsk.o \
sigsendset.o \
sigsuspend.o \
- stat.o \
statfs.o \
statvfs.o \
stty.o \
@@ -313,7 +295,6 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
- unlink.o \
utssys.o \
uucopy.o \
vhangup.o \
@@ -435,7 +416,7 @@ PORTGEN= \
dirname.o \
div.o \
drand48.o \
- dup2.o \
+ dup.o \
env_data.o \
err.o \
errno.o \
@@ -841,29 +822,27 @@ UNWINDASMOBJS= \
# objects that implement the transitional large file API
PORTSYS64= \
- fstatat64.o \
lockf64.o \
- openat64.o
+ stat64.o
PORTSYS= \
_autofssys.o \
+ access.o \
acctctl.o \
bsd_signal.o \
+ chown.o \
corectl.o \
exacctsys.o \
execl.o \
execle.o \
execv.o \
- fsmisc.o \
- fstatat.o \
+ fcntl.o \
getpagesizes.o \
getpeerucred.o \
inst_sync.o \
issetugid.o \
label.o \
- libc_fcntl.o \
libc_link.o \
- libc_open.o \
lockf.o \
lwp.o \
lwp_cond.o \
@@ -872,12 +851,13 @@ PORTSYS= \
meminfosys.o \
msgsys.o \
nfssys.o \
- openat.o \
+ open.o \
pgrpsys.o \
posix_sigwait.o \
ppriv.o \
psetsys.o \
rctlsys.o \
+ rename.o \
sbrk.o \
semsys.o \
set_errno.o \
@@ -888,10 +868,12 @@ PORTSYS= \
signal.o \
sigpending.o \
sigstack.o \
+ stat.o \
tasksys.o \
time.o \
time_util.o \
ucontext.o \
+ unlink.o \
ustat.o \
utimesys.o \
zone.o
@@ -1002,6 +984,11 @@ CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
-I$(LIBCBASE)/inc -I$(LIBCDIR)/inc $(CPPFLAGS.master)
ASFLAGS= $(EXTN_ASFLAGS) -K pic -P -D__STDC__ -D_ASM $(CPPFLAGS) $(sparc_AS_XARCH)
+# As a favor to the dtrace syscall provider, libc still calls the
+# old syscall traps that have been obsoleted by the *at() interfaces.
+# Delete this to compile libc using only the new *at() system call traps
+CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
+
# Conditionally add support for making |wordexp()| check whether
# /usr/bin/ksh is ksh93 or not
include $(LIBCDIR)/../../Makefile.ksh93switch
diff --git a/usr/src/lib/libc/sparc/crt/_rtboot.s b/usr/src/lib/libc/sparc/crt/_rtboot.s
index 5ae8505d9a..7764d40507 100644
--- a/usr/src/lib/libc/sparc/crt/_rtboot.s
+++ b/usr/src/lib/libc/sparc/crt/_rtboot.s
@@ -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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#ident "%Z%%M% %I% %E% SMI"
-
.file "_rtboot.s"
! Bootstrap routine for alias ld.so. Control arrives here either directly
@@ -78,8 +76,8 @@
.global __rtboot
.local __rtld
.local s.LDSO, s.ZERO
- .local f.PANIC, f.OPEN, f.MMAP, f.FSTAT, f.SYSCONFIG, f.CLOSE, f.EXIT
- .local f.MUNMAP
+ .local f.PANIC, f.OPENAT, f.MMAP, f.FSTATAT, f.SYSCONFIG
+ .local f.CLOSE, f.EXIT, f.MUNMAP
.type __rtboot, #function
.align 4
@@ -138,9 +136,9 @@ __rtboot:
SI(ZERO)
SI(EMPTY)
FI(PANIC)
- FI(OPEN)
+ FI(OPENAT)
FI(MMAP)
- FI(FSTAT)
+ FI(FSTATAT)
FI(SYSCONFIG)
FI(CLOSE)
FI(MUNMAP)
@@ -179,9 +177,9 @@ f.PANIC:
ba f.EXIT ! leave
nop
-f.OPEN:
+f.OPENAT:
ba __syscall
- mov SYS_open, %g1
+ mov SYS_openat, %g1
f.MMAP:
sethi %hi(0x80000000), %g1 ! MAP_NEW
@@ -209,9 +207,9 @@ f.CLOSE:
ba __syscall
mov SYS_close, %g1
-f.FSTAT:
+f.FSTATAT:
ba __syscall
- mov SYS_fstat, %g1
+ mov SYS_fstatat, %g1
f.SYSCONFIG:
ba __syscall
diff --git a/usr/src/lib/libc/sparc/crt/_rtld.c b/usr/src/lib/libc/sparc/crt/_rtld.c
index 50647dd10c..132aad09c0 100644
--- a/usr/src/lib/libc/sparc/crt/_rtld.c
+++ b/usr/src/lib/libc/sparc/crt/_rtld.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Redirection ld.so. Based on the 4.x binary compatibility ld.so, used
* to redirect aliases for ld.so to the real one.
@@ -56,10 +54,10 @@
#define LDSO strings[LDSO_S]
#define ZERO strings[ZERO_S]
#define CLOSE (*(funcs[CLOSE_F]))
-#define FSTAT (*(funcs[FSTAT_F]))
+#define FSTATAT (*(funcs[FSTATAT_F]))
#define MMAP (*(funcs[MMAP_F]))
#define MUNMAP (*(funcs[MUNMAP_F]))
-#define OPEN (*(funcs[OPEN_F]))
+#define OPENAT (*(funcs[OPENAT_F]))
#define PANIC (*(funcs[PANIC_F]))
#define SYSCONFIG (*(funcs[SYSCONFIG_F]))
@@ -133,9 +131,9 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])())
* data structures. Further mappings will actually establish the
* program in the address space.
*/
- if ((ldfd = OPEN(LDSO, O_RDONLY)) == -1)
+ if ((ldfd = OPENAT(AT_FDCWD, LDSO, O_RDONLY)) == -1)
PANIC(program_name);
- if (FSTAT(ldfd, &sb) == -1)
+ if (FSTATAT(ldfd, NULL, &sb, 0) == -1)
PANIC(program_name);
ehdr = (Elf32_Ehdr *)MMAP(0, sb.st_size, PROT_READ | PROT_EXEC,
MAP_SHARED, ldfd, 0);
@@ -291,7 +289,7 @@ __rtld(Elf32_Boot *ebp, const char *strings[], int (*funcs[])())
j = (faddr + pptr->p_vaddr + pptr->p_memsz) - zaddr;
if (j > 0) {
if (dzfd == 0) {
- dzfd = OPEN(ZERO, O_RDWR);
+ dzfd = OPENAT(AT_FDCWD, ZERO, O_RDWR);
if (dzfd == -1)
PANIC(program_name);
}
diff --git a/usr/src/lib/libc/sparc/crt/alias_boot.h b/usr/src/lib/libc/sparc/crt/alias_boot.h
index 754d480841..e2a96f933a 100644
--- a/usr/src/lib/libc/sparc/crt/alias_boot.h
+++ b/usr/src/lib/libc/sparc/crt/alias_boot.h
@@ -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,15 +18,15 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1991 Sun Microsystems, Inc.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
#ifndef _ALIAS_BOOT_H
#define _ALIAS_BOOT_H
-#ident "%Z%%M% %I% %E% SMI"
-
/*
* Offsets for string constants used in alias bootstrap.
*/
@@ -40,9 +39,9 @@
* Offsets for function pointers used in alias bootstrap.
*/
#define PANIC_F 0 /* panic() */
-#define OPEN_F 1 /* open() */
+#define OPENAT_F 1 /* openat() */
#define MMAP_F 2 /* mmap() */
-#define FSTAT_F 3 /* fstat() */
+#define FSTATAT_F 3 /* fstatat() */
#define SYSCONFIG_F 4 /* sysconfig() */
#define CLOSE_F 5 /* close() */
#define MUNMAP_F 6 /* munmap() */
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index b88e9ba202..d3a3e2e63d 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -186,7 +186,6 @@ COMSYSOBJS= \
_so_socket.o \
_so_socketpair.o \
_sockconfig.o \
- access.o \
acct.o \
acl.o \
adjtime.o \
@@ -194,23 +193,17 @@ COMSYSOBJS= \
brk.o \
chdir.o \
chmod.o \
- chown.o \
chroot.o \
cladm.o \
close.o \
- creat.o \
- dup.o \
execve.o \
exit.o \
facl.o \
fchdir.o \
fchmod.o \
- fchown.o \
fchroot.o \
- fcntl.o \
fdsync.o \
fpathconf.o \
- fstat.o \
fstatfs.o \
fstatvfs.o \
getcpuid.o \
@@ -232,11 +225,9 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- lchown.o \
link.o \
llseek.o \
lseek.o \
- lstat.o \
memcntl.o \
mincore.o \
mkdir.o \
@@ -250,7 +241,6 @@ COMSYSOBJS= \
nice.o \
ntp_adjtime.o \
ntp_gettime.o \
- open.o \
p_online.o \
pathconf.o \
pause.o \
@@ -267,9 +257,7 @@ COMSYSOBJS= \
read.o \
readlink.o \
readv.o \
- rename.o \
resolvepath.o \
- rmdir.o \
seteguid.o \
setgid.o \
setgroups.o \
@@ -281,7 +269,6 @@ COMSYSOBJS= \
sigprocmsk.o \
sigsendset.o \
sigsuspend.o \
- stat.o \
statfs.o \
statvfs.o \
stty.o \
@@ -295,7 +282,6 @@ COMSYSOBJS= \
ulimit.o \
umask.o \
umount2.o \
- unlink.o \
utssys.o \
uucopy.o \
vhangup.o \
@@ -396,7 +382,7 @@ PORTGEN= \
dirname.o \
div.o \
drand48.o \
- dup2.o \
+ dup.o \
env_data.o \
err.o \
errno.o \
@@ -791,23 +777,22 @@ PORTSYS64=
PORTSYS= \
_autofssys.o \
+ access.o \
acctctl.o \
bsd_signal.o \
+ chown.o \
corectl.o \
exacctsys.o \
execl.o \
execle.o \
execv.o \
- fsmisc.o \
- fstatat.o \
+ fcntl.o \
getpagesizes.o \
getpeerucred.o \
inst_sync.o \
issetugid.o \
label.o \
- libc_fcntl.o \
libc_link.o \
- libc_open.o \
lockf.o \
lwp.o \
lwp_cond.o \
@@ -816,12 +801,13 @@ PORTSYS= \
meminfosys.o \
msgsys.o \
nfssys.o \
- openat.o \
+ open.o \
pgrpsys.o \
posix_sigwait.o \
ppriv.o \
psetsys.o \
rctlsys.o \
+ rename.o \
sbrk.o \
semsys.o \
set_errno.o \
@@ -832,10 +818,12 @@ PORTSYS= \
signal.o \
sigpending.o \
sigstack.o \
+ stat.o \
tasksys.o \
time.o \
time_util.o \
ucontext.o \
+ unlink.o \
ustat.o \
utimesys.o \
zone.o
@@ -947,6 +935,11 @@ CPPFLAGS= -D_REENTRANT -Dsparc $(EXTN_CPPFLAGS) $(THREAD_DEBUG) \
ASFLAGS= $(EXTN_ASFLAGS) -K PIC -P -D__STDC__ -D_ASM -D__sparcv9 $(CPPFLAGS) \
$(sparcv9_AS_XARCH)
+# As a favor to the dtrace syscall provider, libc still calls the
+# old syscall traps that have been obsoleted by the *at() interfaces.
+# Delete this to compile libc using only the new *at() system call traps
+CPPFLAGS += -D_RETAIN_OLD_SYSCALLS
+
# Conditionally add support for making |wordexp()| check whether
# /usr/bin/ksh is ksh93 or not
include $(LIBCDIR)/../../Makefile.ksh93switch
diff --git a/usr/src/lib/libdtrace/common/dt_proc.c b/usr/src/lib/libdtrace/common/dt_proc.c
index 001534163b..96e85f1bdb 100644
--- a/usr/src/lib/libdtrace/common/dt_proc.c
+++ b/usr/src/lib/libdtrace/common/dt_proc.c
@@ -87,9 +87,8 @@
#include <dt_pid.h>
#include <dt_impl.h>
-#define IS_SYS_EXEC(w) (w == SYS_exec || w == SYS_execve)
-#define IS_SYS_FORK(w) (w == SYS_vfork || w == SYS_fork1 || \
- w == SYS_forkall || w == SYS_forksys)
+#define IS_SYS_EXEC(w) (w == SYS_execve)
+#define IS_SYS_FORK(w) (w == SYS_vfork || w == SYS_forksys)
static dt_bkpt_t *
dt_proc_bpcreate(dt_proc_t *dpr, uintptr_t addr, dt_bkpt_f *func, void *data)
@@ -496,7 +495,6 @@ dt_proc_control(void *arg)
* We must trace exit from exec() system calls so that if the exec is
* successful, we can reset our breakpoints and re-initialize libproc.
*/
- (void) Psysexit(P, SYS_exec, B_TRUE);
(void) Psysexit(P, SYS_execve, B_TRUE);
/*
@@ -507,10 +505,6 @@ dt_proc_control(void *arg)
*/
(void) Psysentry(P, SYS_vfork, B_TRUE);
(void) Psysexit(P, SYS_vfork, B_TRUE);
- (void) Psysentry(P, SYS_fork1, B_TRUE);
- (void) Psysexit(P, SYS_fork1, B_TRUE);
- (void) Psysentry(P, SYS_forkall, B_TRUE);
- (void) Psysexit(P, SYS_forkall, B_TRUE);
(void) Psysentry(P, SYS_forksys, B_TRUE);
(void) Psysexit(P, SYS_forksys, B_TRUE);
diff --git a/usr/src/lib/libpctx/common/libpctx.c b/usr/src/lib/libpctx/common/libpctx.c
index f17e238322..ec10bbcb69 100644
--- a/usr/src/lib/libpctx/common/libpctx.c
+++ b/usr/src/lib/libpctx/common/libpctx.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.
*/
@@ -316,16 +316,12 @@ pctx_set_events(pctx_t *pctx, ...)
pctx->lwp_exit = (pctx_sysc_lwp_exitfn_t *)default_int;
if (pctx->fork != (pctx_sysc_forkfn_t *)default_void) {
- (void) Psysexit(pctx->Pr, SYS_forkall, 1);
(void) Psysexit(pctx->Pr, SYS_vfork, 1);
- (void) Psysexit(pctx->Pr, SYS_fork1, 1);
(void) Psysexit(pctx->Pr, SYS_forksys, 1);
if (Psetflags(pctx->Pr, PR_FORK) == -1)
error = -1;
} else {
- (void) Psysexit(pctx->Pr, SYS_forkall, 0);
(void) Psysexit(pctx->Pr, SYS_vfork, 0);
- (void) Psysexit(pctx->Pr, SYS_fork1, 0);
(void) Psysexit(pctx->Pr, SYS_forksys, 0);
if (Punsetflags(pctx->Pr, PR_FORK) == -1)
error = -1;
@@ -338,14 +334,10 @@ pctx_set_events(pctx_t *pctx, ...)
if (pctx->exec != (pctx_sysc_execfn_t *)default_int ||
pctx->fini_lwp != (pctx_fini_lwpfn_t *)default_int ||
pctx->init_lwp != (pctx_init_lwpfn_t *)default_int) {
- (void) Psysexit(pctx->Pr, SYS_exec, 1);
(void) Psysexit(pctx->Pr, SYS_execve, 1);
- (void) Psysentry(pctx->Pr, SYS_exec, 1);
(void) Psysentry(pctx->Pr, SYS_execve, 1);
} else {
- (void) Psysexit(pctx->Pr, SYS_exec, 0);
(void) Psysexit(pctx->Pr, SYS_execve, 0);
- (void) Psysentry(pctx->Pr, SYS_exec, 0);
(void) Psysentry(pctx->Pr, SYS_execve, 0);
}
@@ -704,7 +696,6 @@ checkstate:
if (running == 1)
running = 0;
break;
- case SYS_exec:
case SYS_execve:
(void) pctx_lwpiterate(pctx, pctx->fini_lwp);
break;
@@ -717,7 +708,6 @@ checkstate:
break;
case PR_SYSEXIT:
switch (pstatus->pr_lwp.pr_what) {
- case SYS_exec:
case SYS_execve:
if (pstatus->pr_lwp.pr_errno) {
/*
@@ -762,9 +752,7 @@ checkstate:
running = -1;
pctx_end_syscalls(pctx);
break;
- case SYS_forkall:
case SYS_vfork:
- case SYS_fork1:
case SYS_forksys:
if (pstatus->pr_lwp.pr_errno)
break;
diff --git a/usr/src/lib/libproc/common/Pcontrol.c b/usr/src/lib/libproc/common/Pcontrol.c
index deccb122c3..2a32522e0c 100644
--- a/usr/src/lib/libproc/common/Pcontrol.c
+++ b/usr/src/lib/libproc/common/Pcontrol.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.
*
* Portions Copyright 2007 Chad Mynhier
@@ -335,7 +335,6 @@ Pxcreate(const char *file, /* executable file name */
* it again on entry to exec() or exit().
*/
(void) Psysentry(P, SYS_exit, 1);
- (void) Psysentry(P, SYS_exec, 1);
(void) Psysentry(P, SYS_execve, 1);
if (Psetrun(P, 0, PRSABORT) == -1) {
dprintf("Pcreate: Psetrun failed: %s\n", strerror(errno));
@@ -353,13 +352,11 @@ Pxcreate(const char *file, /* executable file name */
* Move the process through instances of failed exec()s
* to reach the point of stopped on successful exec().
*/
- (void) Psysexit(P, SYS_exec, TRUE);
(void) Psysexit(P, SYS_execve, TRUE);
while (P->state == PS_STOP &&
P->status.pr_lwp.pr_why == PR_SYSENTRY &&
- (P->status.pr_lwp.pr_what == SYS_execve ||
- P->status.pr_lwp.pr_what == SYS_exec)) {
+ P->status.pr_lwp.pr_what == SYS_execve) {
/*
* Fetch the exec path name now, before we complete
* the exec(). We may lose the process and be unable
@@ -388,8 +385,7 @@ Pxcreate(const char *file, /* executable file name */
*/
if (P->state == PS_STOP &&
P->status.pr_lwp.pr_why == PR_SYSEXIT &&
- (P->status.pr_lwp.pr_what == SYS_execve ||
- P->status.pr_lwp.pr_what == SYS_exec) &&
+ P->status.pr_lwp.pr_what == SYS_execve &&
(lasterrno = P->status.pr_lwp.pr_errno) != 0) {
/*
* The exec() failed. Set the process running and
@@ -405,8 +401,7 @@ Pxcreate(const char *file, /* executable file name */
if (P->state == PS_STOP &&
P->status.pr_lwp.pr_why == PR_SYSEXIT &&
- (P->status.pr_lwp.pr_what == SYS_execve ||
- P->status.pr_lwp.pr_what == SYS_exec) &&
+ P->status.pr_lwp.pr_what == SYS_execve &&
P->status.pr_lwp.pr_errno == 0) {
/*
* The process is stopped on successful exec() or execve().
@@ -1371,8 +1366,7 @@ Preopen(struct ps_prochandle *P)
if (P->state == PS_STOP &&
(P->status.pr_lwp.pr_why == PR_REQUESTED ||
(P->status.pr_lwp.pr_why == PR_SYSEXIT &&
- (P->status.pr_lwp.pr_what == SYS_exec ||
- P->status.pr_lwp.pr_what == SYS_execve)))) {
+ P->status.pr_lwp.pr_what == SYS_execve))) {
/* fake up stop-on-exit-from-execve */
if (P->status.pr_lwp.pr_why == PR_REQUESTED) {
P->status.pr_lwp.pr_why = PR_SYSEXIT;
diff --git a/usr/src/lib/libproc/common/pr_open.c b/usr/src/lib/libproc/common/pr_open.c
index 5ea4ea1393..9c6d463c95 100644
--- a/usr/src/lib/libproc/common/pr_open.c
+++ b/usr/src/lib/libproc/common/pr_open.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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1997-2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -39,15 +37,22 @@
int
pr_open(struct ps_prochandle *Pr, const char *filename, int flags, mode_t mode)
{
- sysret_t rval; /* return value from open() */
- argdes_t argd[3]; /* arg descriptors for open() */
+ sysret_t rval; /* return value from openat() */
+ argdes_t argd[4]; /* arg descriptors for openat() */
argdes_t *adp;
int error;
if (Pr == NULL) /* no subject process */
return (open(filename, flags, mode));
- adp = &argd[0]; /* filename argument */
+ adp = &argd[0]; /* AT_FDCWD argument */
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ adp++; /* filename argument */
adp->arg_value = 0;
adp->arg_object = (void *)filename;
adp->arg_type = AT_BYREF;
@@ -68,7 +73,7 @@ pr_open(struct ps_prochandle *Pr, const char *filename, int flags, mode_t mode)
adp->arg_inout = AI_INPUT;
adp->arg_size = 0;
- error = Psyscall(Pr, &rval, SYS_open, 3, &argd[0]);
+ error = Psyscall(Pr, &rval, SYS_openat, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -83,21 +88,35 @@ pr_open(struct ps_prochandle *Pr, const char *filename, int flags, mode_t mode)
int
pr_creat(struct ps_prochandle *Pr, const char *filename, mode_t mode)
{
- sysret_t rval; /* return value from creat() */
- argdes_t argd[2]; /* arg descriptors for creat() */
+ sysret_t rval; /* return value from openat() */
+ argdes_t argd[4]; /* arg descriptors for openat() */
argdes_t *adp;
int error;
if (Pr == NULL) /* no subject process */
return (creat(filename, mode));
- adp = &argd[0]; /* filename argument */
+ adp = &argd[0]; /* AT_FDCWD argument */
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ adp++; /* filename argument */
adp->arg_value = 0;
adp->arg_object = (void *)filename;
adp->arg_type = AT_BYREF;
adp->arg_inout = AI_INPUT;
adp->arg_size = strlen(filename)+1;
+ adp++; /* flags argument */
+ adp->arg_value = (O_WRONLY | O_CREAT | O_TRUNC);
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
adp++; /* mode argument */
adp->arg_value = (long)mode;
adp->arg_object = NULL;
@@ -105,7 +124,7 @@ pr_creat(struct ps_prochandle *Pr, const char *filename, mode_t mode)
adp->arg_inout = AI_INPUT;
adp->arg_size = 0;
- error = Psyscall(Pr, &rval, SYS_creat, 2, &argd[0]);
+ error = Psyscall(Pr, &rval, SYS_openat, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -151,14 +170,21 @@ int
pr_access(struct ps_prochandle *Pr, const char *path, int amode)
{
sysret_t rval; /* return from access() */
- argdes_t argd[2]; /* arg descriptors for access() */
+ argdes_t argd[4]; /* arg descriptors for access() */
argdes_t *adp;
int err;
if (Pr == NULL) /* no subject process */
return (access(path, amode));
- adp = &argd[0]; /* path argument */
+ adp = &argd[0]; /* directory fd argument */
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ adp++; /* path argument */
adp->arg_value = 0;
adp->arg_object = (void *)path;
adp->arg_type = AT_BYREF;
@@ -172,7 +198,14 @@ pr_access(struct ps_prochandle *Pr, const char *path, int amode)
adp->arg_inout = AI_INPUT;
adp->arg_size = 0;
- err = Psyscall(Pr, &rval, SYS_access, 2, &argd[0]);
+ adp++; /* flag argument */
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ err = Psyscall(Pr, &rval, SYS_faccessat, 4, &argd[0]);
if (err) {
errno = (err > 0) ? err : ENOSYS;
diff --git a/usr/src/lib/libproc/common/pr_rename.c b/usr/src/lib/libproc/common/pr_rename.c
index e6c5074eea..7696188111 100644
--- a/usr/src/lib/libproc/common/pr_rename.c
+++ b/usr/src/lib/libproc/common/pr_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,13 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1998-2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
@@ -39,28 +37,42 @@ int
pr_rename(struct ps_prochandle *Pr, const char *old, const char *new)
{
sysret_t rval;
- argdes_t argd[2];
+ argdes_t argd[4];
argdes_t *adp;
int error;
if (Pr == NULL)
return (rename(old, new));
- adp = &argd[0]; /* old argument */
+ adp = &argd[0]; /* old fd argument */
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ adp++; /* move to old argument */
adp->arg_value = 0;
adp->arg_object = (void *)old;
adp->arg_type = AT_BYREF;
adp->arg_inout = AI_INPUT;
adp->arg_size = strlen(old) + 1;
- adp++; /* new argument */
+ adp++; /* move to new fd argument */
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ adp++; /* move to new argument */
adp->arg_value = 0;
adp->arg_object = (void *)new;
adp->arg_type = AT_BYREF;
adp->arg_inout = AI_INPUT;
adp->arg_size = strlen(new) + 1;
- error = Psyscall(Pr, &rval, SYS_rename, 2, &argd[0]);
+ error = Psyscall(Pr, &rval, SYS_renameat, 4, &argd[0]);
if (error) {
errno = (error > 0) ? error : ENOSYS;
@@ -113,21 +125,35 @@ int
pr_unlink(struct ps_prochandle *Pr, const char *path)
{
sysret_t rval;
- argdes_t argd[1];
+ argdes_t argd[3];
argdes_t *adp;
int error;
if (Pr == NULL)
return (unlink(path));
- adp = &argd[0]; /* path argument */
+ adp = &argd[0]; /* directory fd argument */
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+ adp++; /* move to path argument */
+
adp->arg_value = 0;
adp->arg_object = (void *)path;
adp->arg_type = AT_BYREF;
adp->arg_inout = AI_INPUT;
adp->arg_size = strlen(path) + 1;
+ adp++; /* move to flags argument */
+
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
- error = Psyscall(Pr, &rval, SYS_unlink, 1, &argd[0]);
+ error = Psyscall(Pr, &rval, SYS_unlinkat, 3, &argd[0]);
if (error) {
errno = (error > 0) ? error : ENOSYS;
diff --git a/usr/src/lib/libproc/common/pr_stat.c b/usr/src/lib/libproc/common/pr_stat.c
index cac5bf9c88..98bda13de5 100644
--- a/usr/src/lib/libproc/common/pr_stat.c
+++ b/usr/src/lib/libproc/common/pr_stat.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,21 +18,20 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1997-2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/isa_defs.h>
-
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/fcntl.h>
#include <sys/sysmacros.h>
#include "libproc.h"
@@ -71,10 +69,9 @@ int
pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
{
sysret_t rval; /* return value from stat() */
- argdes_t argd[3]; /* arg descriptors for stat() */
+ argdes_t argd[4]; /* arg descriptors for fstatat() */
argdes_t *adp = &argd[0]; /* first argument */
- int syscall; /* stat, xstat or stat64 */
- int nargs = 2; /* number of actual arguments */
+ int syscall; /* SYS_fstatat or SYS_fstatat64 */
int error;
#ifdef _LP64
struct stat64_32 statb64_32;
@@ -83,29 +80,19 @@ pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
if (Pr == NULL) /* no subject process */
return (stat(path, buf));
- /*
- * This is filthy, but /proc reveals everything about the
- * system call interfaces, despite what the architects of the
- * header files may desire. We have to know here whether we
- * are calling stat() or xstat() in the subject.
- */
-#if defined(_STAT_VER)
- syscall = SYS_xstat;
- nargs = 3;
- adp->arg_value = _STAT_VER;
- adp->arg_object = NULL;
- adp->arg_type = AT_BYVAL;
- adp->arg_inout = AI_INPUT;
- adp->arg_size = 0;
- adp++; /* move to pathname argument */
-#else
if (Pstatus(Pr)->pr_dmodel != PR_MODEL_NATIVE) {
/* 64-bit process controls 32-bit subject process */
- syscall = SYS_stat64;
+ syscall = SYS_fstatat64;
} else {
- syscall = SYS_stat;
+ syscall = SYS_fstatat;
}
-#endif
+
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+ adp++; /* move to path argument */
adp->arg_value = 0;
adp->arg_object = (void *)path;
@@ -129,8 +116,15 @@ pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
adp->arg_object = buf;
adp->arg_size = sizeof (*buf);
#endif /* _LP64 */
+ adp++; /* move to flags argument */
- error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]);
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ error = Psyscall(Pr, &rval, syscall, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -149,11 +143,10 @@ pr_stat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
int
pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
{
- sysret_t rval; /* return value from lstat() */
- argdes_t argd[3]; /* arg descriptors for lstat() */
+ sysret_t rval; /* return value from stat() */
+ argdes_t argd[4]; /* arg descriptors for fstatat() */
argdes_t *adp = &argd[0]; /* first argument */
- int syscall; /* lstat, lxstat or lstat64 */
- int nargs = 2; /* number of actual arguments */
+ int syscall; /* SYS_fstatat or SYS_fstatat64 */
int error;
#ifdef _LP64
struct stat64_32 statb64_32;
@@ -162,29 +155,19 @@ pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
if (Pr == NULL) /* no subject process */
return (lstat(path, buf));
- /*
- * This is filthy, but /proc reveals everything about the
- * system call interfaces, despite what the architects of the
- * header files may desire. We have to know here whether we
- * are calling lstat() or lxstat() in the subject.
- */
-#if defined(_STAT_VER)
- syscall = SYS_lxstat;
- nargs = 3;
- adp->arg_value = _STAT_VER;
- adp->arg_object = NULL;
- adp->arg_type = AT_BYVAL;
- adp->arg_inout = AI_INPUT;
- adp->arg_size = 0;
- adp++; /* move to pathname argument */
-#else
if (Pstatus(Pr)->pr_dmodel != PR_MODEL_NATIVE) {
/* 64-bit process controls 32-bit subject process */
- syscall = SYS_lstat64;
+ syscall = SYS_fstatat64;
} else {
- syscall = SYS_lstat;
+ syscall = SYS_fstatat;
}
-#endif
+
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+ adp++; /* move to path argument */
adp->arg_value = 0;
adp->arg_object = (void *)path;
@@ -208,8 +191,15 @@ pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
adp->arg_object = buf;
adp->arg_size = sizeof (*buf);
#endif /* _LP64 */
+ adp++; /* move to flags argument */
+
+ adp->arg_value = AT_SYMLINK_NOFOLLOW;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
- error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]);
+ error = Psyscall(Pr, &rval, syscall, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -228,11 +218,10 @@ pr_lstat(struct ps_prochandle *Pr, const char *path, struct stat *buf)
int
pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf)
{
- sysret_t rval; /* return value from fstat() */
- argdes_t argd[3]; /* arg descriptors for fstat() */
+ sysret_t rval; /* return value from stat() */
+ argdes_t argd[4]; /* arg descriptors for fstatat() */
argdes_t *adp = &argd[0]; /* first argument */
- int syscall; /* fstat, fxstat or fstat64 */
- int nargs = 2; /* number of actual arguments */
+ int syscall; /* SYS_fstatat or SYS_fstatat64 */
int error;
#ifdef _LP64
struct stat64_32 statb64_32;
@@ -241,35 +230,25 @@ pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf)
if (Pr == NULL) /* no subject process */
return (fstat(fd, buf));
- /*
- * This is filthy, but /proc reveals everything about the
- * system call interfaces, despite what the architects of the
- * header files may desire. We have to know here whether we
- * are calling fstat() or fxstat() in the subject.
- */
-#if defined(_STAT_VER)
- syscall = SYS_fxstat;
- nargs = 3;
- adp->arg_value = _STAT_VER;
- adp->arg_object = NULL;
- adp->arg_type = AT_BYVAL;
- adp->arg_inout = AI_INPUT;
- adp->arg_size = 0;
- adp++; /* move to fd argument */
-#else
if (Pstatus(Pr)->pr_dmodel != PR_MODEL_NATIVE) {
/* 64-bit process controls 32-bit subject process */
- syscall = SYS_fstat64;
+ syscall = SYS_fstatat64;
} else {
- syscall = SYS_fstat;
+ syscall = SYS_fstatat;
}
-#endif
adp->arg_value = fd;
adp->arg_object = NULL;
adp->arg_type = AT_BYVAL;
adp->arg_inout = AI_INPUT;
adp->arg_size = 0;
+ adp++; /* move to path argument */
+
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
adp++; /* move to buffer argument */
adp->arg_value = 0;
@@ -287,8 +266,15 @@ pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf)
adp->arg_object = buf;
adp->arg_size = sizeof (*buf);
#endif /* _LP64 */
+ adp++; /* move to flags argument */
- error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]);
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ error = Psyscall(Pr, &rval, syscall, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -307,11 +293,10 @@ pr_fstat(struct ps_prochandle *Pr, int fd, struct stat *buf)
int
pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
{
- sysret_t rval; /* return value from stat64() */
- argdes_t argd[2]; /* arg descriptors for stat64() */
+ sysret_t rval; /* return value from stat() */
+ argdes_t argd[4]; /* arg descriptors for fstatat() */
argdes_t *adp = &argd[0]; /* first argument */
- int syscall; /* stat or stat64 */
- int nargs = 2; /* number of actual arguments */
+ int syscall; /* SYS_fstatat or SYS_fstatat64 */
int error;
#ifdef _LP64
struct stat64_32 statb64_32;
@@ -325,12 +310,19 @@ pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
* 32-bit native and
* 64-bit process controls 32-bit subject process
*/
- syscall = SYS_stat64;
+ syscall = SYS_fstatat64;
} else {
/* 64-bit native */
- syscall = SYS_stat;
+ syscall = SYS_fstatat;
}
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+ adp++; /* move to path argument */
+
adp->arg_value = 0;
adp->arg_object = (void *)path;
adp->arg_type = AT_BYREF;
@@ -353,8 +345,15 @@ pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
adp->arg_object = buf;
adp->arg_size = sizeof (*buf);
#endif /* _LP64 */
+ adp++; /* move to flags argument */
- error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]);
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ error = Psyscall(Pr, &rval, syscall, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -373,11 +372,10 @@ pr_stat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
int
pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
{
- sysret_t rval; /* return value from lstat64() */
- argdes_t argd[2]; /* arg descriptors for lstat64() */
+ sysret_t rval; /* return value from stat() */
+ argdes_t argd[4]; /* arg descriptors for fstatat() */
argdes_t *adp = &argd[0]; /* first argument */
- int syscall; /* lstat or lstat64 */
- int nargs = 2; /* number of actual arguments */
+ int syscall; /* SYS_fstatat or SYS_fstatat64 */
int error;
#ifdef _LP64
struct stat64_32 statb64_32;
@@ -391,12 +389,19 @@ pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
* 32-bit native and
* 64-bit process controls 32-bit subject process
*/
- syscall = SYS_lstat64;
+ syscall = SYS_fstatat64;
} else {
/* 64-bit native */
- syscall = SYS_lstat;
+ syscall = SYS_fstatat;
}
+ adp->arg_value = AT_FDCWD;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+ adp++; /* move to path argument */
+
adp->arg_value = 0;
adp->arg_object = (void *)path;
adp->arg_type = AT_BYREF;
@@ -419,8 +424,15 @@ pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
adp->arg_object = buf;
adp->arg_size = sizeof (*buf);
#endif /* _LP64 */
+ adp++; /* move to flags argument */
- error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]);
+ adp->arg_value = AT_SYMLINK_NOFOLLOW;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
+
+ error = Psyscall(Pr, &rval, syscall, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
@@ -439,11 +451,10 @@ pr_lstat64(struct ps_prochandle *Pr, const char *path, struct stat64 *buf)
int
pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf)
{
- sysret_t rval; /* return value from fstat64() */
- argdes_t argd[2]; /* arg descriptors for fstat64() */
+ sysret_t rval; /* return value from stat() */
+ argdes_t argd[4]; /* arg descriptors for fstatat() */
argdes_t *adp = &argd[0]; /* first argument */
- int syscall; /* fstat or fstat64 */
- int nargs = 2; /* number of actual arguments */
+ int syscall; /* SYS_fstatat or SYS_fstatat64 */
int error;
#ifdef _LP64
struct stat64_32 statb64_32;
@@ -457,10 +468,10 @@ pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf)
* 32-bit native and
* 64-bit process controls 32-bit subject process
*/
- syscall = SYS_fstat64;
+ syscall = SYS_fstatat64;
} else {
/* 64-bit native */
- syscall = SYS_fstat;
+ syscall = SYS_fstatat;
}
adp->arg_value = fd;
@@ -468,6 +479,13 @@ pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf)
adp->arg_type = AT_BYVAL;
adp->arg_inout = AI_INPUT;
adp->arg_size = 0;
+ adp++; /* move to path argument */
+
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
adp++; /* move to buffer argument */
adp->arg_value = 0;
@@ -485,8 +503,15 @@ pr_fstat64(struct ps_prochandle *Pr, int fd, struct stat64 *buf)
adp->arg_object = buf;
adp->arg_size = sizeof (*buf);
#endif /* _LP64 */
+ adp++; /* move to flags argument */
+
+ adp->arg_value = 0;
+ adp->arg_object = NULL;
+ adp->arg_type = AT_BYVAL;
+ adp->arg_inout = AI_INPUT;
+ adp->arg_size = 0;
- error = Psyscall(Pr, &rval, syscall, nargs, &argd[0]);
+ error = Psyscall(Pr, &rval, syscall, 4, &argd[0]);
if (error) {
errno = (error > 0)? error : ENOSYS;
diff --git a/usr/src/lib/libproc/common/proc_names.c b/usr/src/lib/libproc/common/proc_names.c
index 80fc114a97..96f58363c5 100644
--- a/usr/src/lib/libproc/common/proc_names.c
+++ b/usr/src/lib/libproc/common/proc_names.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.
*/
@@ -115,16 +116,16 @@ proc_signame(int sig, char *buf, size_t bufsz)
static const char *const systable[] = {
NULL, /* 0 */
"_exit", /* 1 */
- "forkall", /* 2 */
+ NULL, /* 2 */
"read", /* 3 */
"write", /* 4 */
"open", /* 5 */
"close", /* 6 */
- "wait", /* 7 */
- "creat", /* 8 */
+ NULL, /* 7 */
+ NULL, /* 8 */
"link", /* 9 */
"unlink", /* 10 */
- "exec", /* 11 */
+ NULL, /* 11 */
"chdir", /* 12 */
"time", /* 13 */
"mknod", /* 14 */
@@ -135,7 +136,7 @@ static const char *const systable[] = {
"lseek", /* 19 */
"getpid", /* 20 */
"mount", /* 21 */
- "umount", /* 22 */
+ NULL, /* 22 */
"setuid", /* 23 */
"getuid", /* 24 */
"stime", /* 25 */
@@ -143,7 +144,7 @@ static const char *const systable[] = {
"alarm", /* 27 */
"fstat", /* 28 */
"pause", /* 29 */
- "utime", /* 30 */
+ NULL, /* 30 */
"stty", /* 31 */
"gtty", /* 32 */
"access", /* 33 */
@@ -154,11 +155,11 @@ static const char *const systable[] = {
"fstatfs", /* 38 */
"pgrpsys", /* 39 */
"uucopystr", /* 40 */
- "dup", /* 41 */
+ NULL, /* 41 */
"pipe", /* 42 */
"times", /* 43 */
"profil", /* 44 */
- "plock", /* 45 */
+ "faccessat", /* 45 */
"setgid", /* 46 */
"getgid", /* 47 */
"signal", /* 48 */
@@ -169,7 +170,7 @@ static const char *const systable[] = {
"semsys", /* 53 */
"ioctl", /* 54 */
"uadmin", /* 55 */
- NULL, /* 56 */
+ "fchownat", /* 56 */
"utssys", /* 57 */
"fdsync", /* 58 */
"execve", /* 59 */
@@ -177,15 +178,12 @@ static const char *const systable[] = {
"chroot", /* 61 */
"fcntl", /* 62 */
"ulimit", /* 63 */
-
- /* The following 6 entries were reserved for the UNIX PC */
- NULL, /* 64 */
- NULL, /* 65 */
- NULL, /* 66 */
- NULL, /* 67 */
- NULL, /* 68 */
- NULL, /* 69 */
-
+ "renameat", /* 64 */
+ "unlinkat", /* 65 */
+ "fstatat", /* 66 */
+ "fstatat64", /* 67 */
+ "openat", /* 68 */
+ "openat64", /* 69 */
"tasksys", /* 70 */
"acctctl", /* 71 */
"exacctsys", /* 72 */
@@ -203,7 +201,7 @@ static const char *const systable[] = {
"sysfs", /* 84 */
"getmsg", /* 85 */
"putmsg", /* 86 */
- "poll", /* 87 */
+ NULL, /* 87 */
"lstat", /* 88 */
"symlink", /* 89 */
"readlink", /* 90 */
@@ -217,8 +215,8 @@ static const char *const systable[] = {
"sigaction", /* 98 */
"sigpending", /* 99 */
"context", /* 100 */
- "evsys", /* 101 */
- "evtrapret", /* 102 */
+ NULL, /* 101 */
+ NULL, /* 102 */
"statvfs", /* 103 */
"fstatvfs", /* 104 */
"getloadavg", /* 105 */
@@ -239,10 +237,10 @@ static const char *const systable[] = {
"fchdir", /* 120 */
"readv", /* 121 */
"writev", /* 122 */
- "xstat", /* 123 */
- "lxstat", /* 124 */
- "fxstat", /* 125 */
- "xmknod", /* 126 */
+ NULL, /* 123 */
+ NULL, /* 124 */
+ NULL, /* 125 */
+ NULL, /* 126 */
"mmapobj", /* 127 */
"setrlimit", /* 128 */
"getrlimit", /* 129 */
@@ -259,18 +257,18 @@ static const char *const systable[] = {
"sharefs", /* 140 */
"seteuid", /* 141 */
"forksys", /* 142 */
- "fork1", /* 143 */
+ NULL, /* 143 */
"sigtimedwait", /* 144 */
"lwp_info", /* 145 */
"yield", /* 146 */
- "lwp_sema_wait", /* 147 */
+ NULL, /* 147 */
"lwp_sema_post", /* 148 */
"lwp_sema_trywait", /* 149 */
"lwp_detatch", /* 150 */
"corectl", /* 151 */
"modctl", /* 152 */
"fchroot", /* 153 */
- "utimes", /* 154 */
+ NULL, /* 154 */
"vhangup", /* 155 */
"gettimeofday", /* 156 */
"getitimer", /* 157 */
@@ -285,7 +283,7 @@ static const char *const systable[] = {
"lwp_private", /* 166 */
"lwp_wait", /* 167 */
"lwp_mutex_wakeup", /* 168 */
- "lwp_mutex_lock", /* 169 */
+ NULL, /* 169 */
"lwp_cond_wait", /* 170 */
"lwp_cond_signal", /* 171 */
"lwp_cond_broadcast", /* 172 */
@@ -300,7 +298,7 @@ static const char *const systable[] = {
"rusagesys", /* 181 */
"portfs", /* 182 */
"pollsys", /* 183 */
- NULL, /* 184 */
+ "labelsys", /* 184 */
"acl", /* 185 */
"auditsys", /* 186 */
"processor_bind", /* 187 */
@@ -340,7 +338,7 @@ static const char *const systable[] = {
"getrlimit64", /* 221 */
"pread64", /* 222 */
"pwrite64", /* 223 */
- "creat64", /* 224 */
+ NULL, /* 224 */
"open64", /* 225 */
"rpcmod", /* 226 */
"zone", /* 227 */
diff --git a/usr/src/lib/libsocket/socket/_soutil.c b/usr/src/lib/libsocket/socket/_soutil.c
index d91e549cff..ac5ee929d8 100644
--- a/usr/src/lib/libsocket/socket/_soutil.c
+++ b/usr/src/lib/libsocket/socket/_soutil.c
@@ -20,7 +20,7 @@
*/
/*
- * Copyright 2008 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/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
@@ -139,11 +137,7 @@ _s_netconfig_path(int family, int type, int protocol,
*prototype = protocol;
retry:
-#if defined(i386)
- if (_xstat(_STAT_VER, net->nc_device, &stats) < 0) {
-#else
if (stat(net->nc_device, &stats) < 0) {
-#endif
switch (errno) {
case EINTR:
goto retry;
diff --git a/usr/src/lib/libtnfctl/continue.c b/usr/src/lib/libtnfctl/continue.c
index ab9f5d5701..cc4ef319d3 100644
--- a/usr/src/lib/libtnfctl/continue.c
+++ b/usr/src/lib/libtnfctl/continue.c
@@ -20,12 +20,10 @@
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* interface to continue a target process (DIRECT_MODE) and helper
* functions needed by this routine.
@@ -237,7 +235,6 @@ again:
} else
if (state.ps_issysentry) {
switch (state.ps_syscallnum) {
- case SYS_exec:
case SYS_execve:
*evt = TNFCTL_EVENT_EXEC;
ret_prexstat = TNFCTL_ERR_INTERNAL;
@@ -250,9 +247,7 @@ again:
}
} else if (state.ps_issysexit) {
switch (state.ps_syscallnum) {
- case SYS_forkall:
case SYS_vfork:
- case SYS_fork1:
case SYS_forksys:
*evt = TNFCTL_EVENT_FORK;
break;
@@ -287,27 +282,16 @@ enable_target_state(tnfctl_handle_t *hndl, boolean_t watch_forks)
prbstat = prb_proc_entry(proc_p, SYS_execve, PRB_SYS_ADD);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- prbstat = prb_proc_entry(proc_p, SYS_exec, PRB_SYS_ADD);
- if (prbstat)
- return (_tnfctl_map_to_errcode(prbstat));
/* trace exit */
prbstat = prb_proc_entry(proc_p, SYS_exit, PRB_SYS_ADD);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
/* trace fork if the caller requests */
if (watch_forks) {
- prbstat = prb_proc_exit(proc_p, SYS_forkall, PRB_SYS_ADD);
- if (prbstat)
- return (_tnfctl_map_to_errcode(prbstat));
-
prbstat = prb_proc_exit(proc_p, SYS_vfork, PRB_SYS_ADD);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- prbstat = prb_proc_exit(proc_p, SYS_fork1, PRB_SYS_ADD);
- if (prbstat)
- return (_tnfctl_map_to_errcode(prbstat));
-
prbstat = prb_proc_exit(proc_p, SYS_forksys, PRB_SYS_ADD);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
@@ -346,21 +330,12 @@ disable_target_state(tnfctl_handle_t *hndl)
prbstat = prb_proc_entry(proc_p, SYS_execve, PRB_SYS_DEL);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- prbstat = prb_proc_entry(proc_p, SYS_exec, PRB_SYS_DEL);
- if (prbstat)
- return (_tnfctl_map_to_errcode(prbstat));
prbstat = prb_proc_entry(proc_p, SYS_exit, PRB_SYS_DEL);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- prbstat = prb_proc_exit(proc_p, SYS_forkall, PRB_SYS_DEL);
- if (prbstat)
- return (_tnfctl_map_to_errcode(prbstat));
prbstat = prb_proc_exit(proc_p, SYS_vfork, PRB_SYS_DEL);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- prbstat = prb_proc_exit(proc_p, SYS_fork1, PRB_SYS_DEL);
- if (prbstat)
- return (_tnfctl_map_to_errcode(prbstat));
prbstat = prb_proc_exit(proc_p, SYS_forksys, PRB_SYS_DEL);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
diff --git a/usr/src/lib/libtnfctl/open.c b/usr/src/lib/libtnfctl/open.c
index 641ef808b1..e36fe67db4 100644
--- a/usr/src/lib/libtnfctl/open.c
+++ b/usr/src/lib/libtnfctl/open.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,12 +18,12 @@
*
* CDDL HEADER END
*/
+
/*
- * Copyright (c) 1994, by Sun Microsytems, Inc.
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Interfaces that return a tnfctl handle back to client (except for
* tnfctl_internal_open()) and helper functions for these interfaces.
@@ -62,7 +61,7 @@ tnfctl_exec_open(const char *pgm_name, char * const *args, char * const *envp,
tnfctl_errcode_t prexstat;
prbstat = prb_child_create(pgm_name, args, ld_preload, libtnfprobe_path,
- envp, &proc_p);
+ envp, &proc_p);
if (prbstat) {
return (_tnfctl_map_to_errcode(prbstat));
}
@@ -244,8 +243,8 @@ tnfctl_indirect_open(void *prochandle, tnfctl_ind_config_t *config,
/* set state in target indicating we're tracing externally */
prexstat = _tnfctl_external_getlock(hdl);
if (prexstat) {
- free(hdl);
- return (prexstat);
+ free(hdl);
+ return (prexstat);
}
*ret_val = hdl;
return (TNFCTL_ERR_NONE);
@@ -277,7 +276,7 @@ tnfctl_kernel_open(tnfctl_handle_t **ret_val)
/* initialize function pointers that can be stuffed into a probe */
_tnfctl_prbk_get_other_funcs(&hdl->allocfunc, &hdl->commitfunc,
- &hdl->rollbackfunc, &hdl->endfunc);
+ &hdl->rollbackfunc, &hdl->endfunc);
_tnfctl_prbk_test_func(&hdl->testfunc);
/* find the probes in the kernel */
@@ -343,7 +342,7 @@ tnfctl_buffer_alloc(tnfctl_handle_t *hdl, const char *trace_file_name,
}
prexstat = _tnfctl_create_tracefile(hdl, trace_file_name,
- trace_file_size);
+ trace_file_size);
if (prexstat) {
return (prexstat);
}
@@ -436,15 +435,13 @@ step_to_end_of_exec(tnfctl_handle_t *hndl)
prbstat = prb_proc_state(proc_p, &pstate);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- if (!(pstate.ps_issysentry && (pstate.ps_syscallnum == SYS_exec ||
- pstate.ps_syscallnum == SYS_execve))) {
+ if (!(pstate.ps_issysentry && pstate.ps_syscallnum == SYS_execve)) {
/* not stopped at beginning of exec system call */
return (TNFCTL_ERR_NONE);
}
/* we are stopped at beginning of exec system call */
- /* REMIND: do we have to wait on SYS_exec also ? */
prbstat = prb_proc_exit(proc_p, SYS_execve, PRB_SYS_ADD);
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
@@ -482,7 +479,7 @@ step_to_end_of_exec(tnfctl_handle_t *hndl)
if (prbstat)
return (_tnfctl_map_to_errcode(prbstat));
- if (!(pstate.ps_issysexit && (pstate.ps_syscallnum == SYS_execve))) {
+ if (!(pstate.ps_issysexit && pstate.ps_syscallnum == SYS_execve)) {
/* unexpected condition */
return (tnfctl_status_map(ENOENT));
}
@@ -505,13 +502,13 @@ _tnfctl_external_getlock(tnfctl_handle_t *hdl)
int internal_tracing_on;
prexstat = _tnfctl_sym_find(hdl, TNFCTL_INTERNAL_TRACEFLAG,
- &targ_symbol_ptr);
+ &targ_symbol_ptr);
if (prexstat) {
/* no libtnfctl in target: success */
return (TNFCTL_ERR_NONE);
}
prbstat = hdl->p_read(hdl->proc_p, targ_symbol_ptr,
- &internal_tracing_on, sizeof (internal_tracing_on));
+ &internal_tracing_on, sizeof (internal_tracing_on));
if (prbstat) {
prexstat = _tnfctl_map_to_errcode(prbstat);
@@ -523,20 +520,20 @@ _tnfctl_external_getlock(tnfctl_handle_t *hdl)
goto failure_ret;
}
prexstat = _tnfctl_sym_find(hdl, TNFCTL_EXTERNAL_TRACEDPID,
- &targ_symbol_ptr);
+ &targ_symbol_ptr);
if (prexstat) {
/* this shouldn't happen. we know we have libtnfctl */
goto failure_ret;
}
prbstat = hdl->p_write(hdl->proc_p, targ_symbol_ptr,
- &(hdl->targ_pid), sizeof (hdl->targ_pid));
+ &(hdl->targ_pid), sizeof (hdl->targ_pid));
if (prbstat) {
prexstat = _tnfctl_map_to_errcode(prbstat);
goto failure_ret;
}
/* success */
DBG((void) fprintf(stderr, "_tnfctl_external_getlock: ok to trace %d\n",
- hdl->targ_pid));
+ hdl->targ_pid));
return (TNFCTL_ERR_NONE);
failure_ret: