summaryrefslogtreecommitdiff
path: root/usr/src/lib/libc
diff options
context:
space:
mode:
authorRoger A. Faulkner <Roger.Faulkner@Oracle.COM>2010-07-07 17:36:17 -0700
committerRoger A. Faulkner <Roger.Faulkner@Oracle.COM>2010-07-07 17:36:17 -0700
commit794f0adb050e571bbfde4d2a19b9f88b852079dd (patch)
treec1735b3eda175e9096f5b062a73614e73aa5cd9a /usr/src/lib/libc
parent07925104db56e5c3eacc4865b918bd16af5cec59 (diff)
downloadillumos-gate-794f0adb050e571bbfde4d2a19b9f88b852079dd.tar.gz
PSARC 2010/235 POSIX 1003.1-2008 *at(2) syscalls
6910251 need support for all POSIX.1-2008 *at(2) syscalls 6964835 mknod(2) auditing omits the pathname for invalid arguments
Diffstat (limited to 'usr/src/lib/libc')
-rw-r--r--usr/src/lib/libc/amd64/Makefile15
-rw-r--r--usr/src/lib/libc/common/sys/mknod.s43
-rw-r--r--usr/src/lib/libc/common/sys/readlink.s45
-rw-r--r--usr/src/lib/libc/common/sys/symlink.s43
-rw-r--r--usr/src/lib/libc/i386/Makefile.com15
-rw-r--r--usr/src/lib/libc/port/gen/mkfifo.c17
-rw-r--r--usr/src/lib/libc/port/mapfile-vers7
-rw-r--r--usr/src/lib/libc/port/sys/chmod.c (renamed from usr/src/lib/libc/common/sys/mkdir.s)55
-rw-r--r--usr/src/lib/libc/port/sys/link.c (renamed from usr/src/lib/libc/port/sys/libc_link.c)40
-rw-r--r--usr/src/lib/libc/port/sys/mkdir.c (renamed from usr/src/lib/libc/common/sys/chmod.s)41
-rw-r--r--usr/src/lib/libc/port/sys/mknod.c (renamed from usr/src/lib/libc/common/sys/link.s)33
-rw-r--r--usr/src/lib/libc/port/sys/readlink.c58
-rw-r--r--usr/src/lib/libc/port/sys/symlink.c (renamed from usr/src/lib/libc/common/sys/fchmod.s)41
-rw-r--r--usr/src/lib/libc/sparc/Makefile.com17
-rw-r--r--usr/src/lib/libc/sparcv9/Makefile.com17
15 files changed, 220 insertions, 267 deletions
diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile
index 2176c1da01..8ece7c4add 100644
--- a/usr/src/lib/libc/amd64/Makefile
+++ b/usr/src/lib/libc/amd64/Makefile
@@ -18,7 +18,6 @@
#
# CDDL HEADER END
#
-
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
@@ -173,7 +172,6 @@ COMSYSOBJS= \
alarm.o \
brk.o \
chdir.o \
- chmod.o \
chroot.o \
cladm.o \
close.o \
@@ -181,7 +179,6 @@ COMSYSOBJS= \
exit.o \
facl.o \
fchdir.o \
- fchmod.o \
fchroot.o \
fdsync.o \
fpathconf.o \
@@ -206,14 +203,11 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- link.o \
llseek.o \
lseek.o \
mmapobjsys.o \
memcntl.o \
mincore.o \
- mkdir.o \
- mknod.o \
mmap.o \
modctl.o \
mount.o \
@@ -236,7 +230,6 @@ COMSYSOBJS= \
putpmsg.o \
pwrite.o \
read.o \
- readlink.o \
readv.o \
resolvepath.o \
seteguid.o \
@@ -253,7 +246,6 @@ COMSYSOBJS= \
statfs.o \
statvfs.o \
stty.o \
- symlink.o \
sync.o \
sysconfig.o \
sysfs.o \
@@ -770,6 +762,7 @@ PORTSYS= \
access.o \
acctctl.o \
bsd_signal.o \
+ chmod.o \
chown.o \
corectl.o \
exacctsys.o \
@@ -782,13 +775,15 @@ PORTSYS= \
inst_sync.o \
issetugid.o \
label.o \
- libc_link.o \
+ link.o \
lockf.o \
lwp.o \
lwp_cond.o \
lwp_rwlock.o \
lwp_sigmask.o \
meminfosys.o \
+ mkdir.o \
+ mknod.o \
msgsys.o \
nfssys.o \
open.o \
@@ -797,6 +792,7 @@ PORTSYS= \
ppriv.o \
psetsys.o \
rctlsys.o \
+ readlink.o \
rename.o \
sbrk.o \
semsys.o \
@@ -809,6 +805,7 @@ PORTSYS= \
sigpending.o \
sigstack.o \
stat.o \
+ symlink.o \
tasksys.o \
time.o \
time_util.o \
diff --git a/usr/src/lib/libc/common/sys/mknod.s b/usr/src/lib/libc/common/sys/mknod.s
deleted file mode 100644
index 0d7733e7ff..0000000000
--- a/usr/src/lib/libc/common/sys/mknod.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 "mknod.s"
-
-/* C library -- mknod */
-/* int mknod(const char *path, mode_t mode, dev_t dev); */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(mknod,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(mknod)
- RETC
- SET_SIZE(mknod)
diff --git a/usr/src/lib/libc/common/sys/readlink.s b/usr/src/lib/libc/common/sys/readlink.s
deleted file mode 100644
index 2ec6e5a886..0000000000
--- a/usr/src/lib/libc/common/sys/readlink.s
+++ /dev/null
@@ -1,45 +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 "readlink.s"
-
-/*
- * C library -- readlink
- * ssize_t readlink(const char *path, char *buf, size_t bufsize);
- */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(readlink,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(readlink)
- RET
- SET_SIZE(readlink)
diff --git a/usr/src/lib/libc/common/sys/symlink.s b/usr/src/lib/libc/common/sys/symlink.s
deleted file mode 100644
index d46e48f1c4..0000000000
--- a/usr/src/lib/libc/common/sys/symlink.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 "symlink.s"
-
-/* C library -- symlink */
-/* int symlink(const char *name1, const char *name2) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(symlink,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(symlink)
- RETC
- SET_SIZE(symlink)
diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com
index 50d06a4e4f..55a006e315 100644
--- a/usr/src/lib/libc/i386/Makefile.com
+++ b/usr/src/lib/libc/i386/Makefile.com
@@ -18,7 +18,6 @@
#
# CDDL HEADER END
#
-
#
# Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
#
@@ -195,7 +194,6 @@ COMSYSOBJS= \
alarm.o \
brk.o \
chdir.o \
- chmod.o \
chroot.o \
cladm.o \
close.o \
@@ -203,7 +201,6 @@ COMSYSOBJS= \
exit.o \
facl.o \
fchdir.o \
- fchmod.o \
fchroot.o \
fdsync.o \
fpathconf.o \
@@ -228,14 +225,11 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- link.o \
llseek.o \
lseek.o \
mmapobjsys.o \
memcntl.o \
mincore.o \
- mkdir.o \
- mknod.o \
mmap.o \
modctl.o \
mount.o \
@@ -258,7 +252,6 @@ COMSYSOBJS= \
putpmsg.o \
pwrite.o \
read.o \
- readlink.o \
readv.o \
resolvepath.o \
seteguid.o \
@@ -275,7 +268,6 @@ COMSYSOBJS= \
statfs.o \
statvfs.o \
stty.o \
- symlink.o \
sync.o \
sysconfig.o \
sysfs.o \
@@ -808,6 +800,7 @@ PORTSYS= \
access.o \
acctctl.o \
bsd_signal.o \
+ chmod.o \
chown.o \
corectl.o \
exacctsys.o \
@@ -820,13 +813,15 @@ PORTSYS= \
inst_sync.o \
issetugid.o \
label.o \
- libc_link.o \
+ link.o \
lockf.o \
lwp.o \
lwp_cond.o \
lwp_rwlock.o \
lwp_sigmask.o \
meminfosys.o \
+ mkdir.o \
+ mknod.o \
msgsys.o \
nfssys.o \
open.o \
@@ -835,6 +830,7 @@ PORTSYS= \
ppriv.o \
psetsys.o \
rctlsys.o \
+ readlink.o \
rename.o \
sbrk.o \
semsys.o \
@@ -847,6 +843,7 @@ PORTSYS= \
sigpending.o \
sigstack.o \
stat.o \
+ symlink.o \
tasksys.o \
time.o \
time_util.o \
diff --git a/usr/src/lib/libc/port/gen/mkfifo.c b/usr/src/lib/libc/port/gen/mkfifo.c
index eb73e03184..ac2897c92a 100644
--- a/usr/src/lib/libc/port/gen/mkfifo.c
+++ b/usr/src/lib/libc/port/gen/mkfifo.c
@@ -20,28 +20,31 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
*/
/* Copyright (c) 1988 AT&T */
/* All Rights Reserved */
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* mkfifo(3c) - create a named pipe (FIFO). This code provides
* a POSIX mkfifo function.
- *
*/
-#pragma weak _mkfifo = mkfifo
-
#include "lint.h"
#include <sys/types.h>
#include <sys/stat.h>
int
+mkfifoat(int fd, const char *path, mode_t mode)
+{
+ mode &= 0777; /* only allow file access permissions */
+ mode |= S_IFIFO; /* creating a FIFO */
+ return (mknodat(fd, path, mode, 0));
+}
+
+#pragma weak _mkfifo = mkfifo
+int
mkfifo(const char *path, mode_t mode)
{
mode &= 0777; /* only allow file access permissions */
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index a3dae49082..ed3f10dd05 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -146,6 +146,7 @@ $endif
err;
errx;
faccessat;
+ fchmodat;
fdatasync;
fgetattr;
forkallx;
@@ -155,8 +156,12 @@ $endif
htonl;
htonll;
htons;
+ linkat;
lio_listio;
+ mkdirat;
mkdtemp;
+ mkfifoat;
+ mknodat;
mkstemps;
mmapobj;
mq_close;
@@ -187,6 +192,7 @@ $endif
pthread_mutexattr_getrobust;
pthread_mutexattr_setrobust;
pthread_mutex_consistent;
+ readlinkat;
sched_getparam;
sched_get_priority_max;
sched_get_priority_min;
@@ -215,6 +221,7 @@ $endif
sigwaitinfo;
strnlen;
strsep;
+ symlinkat;
thr_keycreate_once;
timer_create;
timer_delete;
diff --git a/usr/src/lib/libc/common/sys/mkdir.s b/usr/src/lib/libc/port/sys/chmod.c
index 1efbfc9081..90266e55b1 100644
--- a/usr/src/lib/libc/common/sys/mkdir.s
+++ b/usr/src/lib/libc/port/sys/chmod.c
@@ -18,26 +18,43 @@
*
* 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.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*/
- .file "mkdir.s"
-
-/* C library -- mkdir */
-/* int mkdir (const char *path, mode_t mode); */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(mkdir,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(mkdir)
- RET
- SET_SIZE(mkdir)
+#include "lint.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/syscall.h>
+#include <sys/fcntl.h>
+
+int
+fchmodat(int fd, const char *path, mode_t mode, int flag)
+{
+ return (syscall(SYS_fchmodat, fd, path, mode, flag));
+}
+
+#pragma weak _chmod = chmod
+int
+chmod(const char *path, mode_t mode)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_chmod, path, mode));
+#else
+ return (fchmodat(AT_FDCWD, path, mode, 0));
+#endif
+}
+
+#pragma weak _fchmod = fchmod
+int
+fchmod(int fd, mode_t mode)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_fchmod, fd, mode));
+#else
+ return (fchmodat(fd, NULL, mode, 0));
+#endif
+}
diff --git a/usr/src/lib/libc/port/sys/libc_link.c b/usr/src/lib/libc/port/sys/link.c
index f0f4356871..dd1d64240e 100644
--- a/usr/src/lib/libc/port/sys/libc_link.c
+++ b/usr/src/lib/libc/port/sys/link.c
@@ -20,30 +20,26 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
-#pragma weak _link = link
-
#include "lint.h"
-#include <stdlib.h>
-#include <errno.h>
#include <unistd.h>
-#include <limits.h>
+#include <fcntl.h>
+#include <sys/syscall.h>
extern int __xpg4; /* defined in port/gen/xpg4.c; 0 if not xpg4/xpg4v2 */
-extern int __link(const char *existing, const char *new);
-
int
-link(const char *existing, const char *new)
+linkat(int fd1, const char *path1, int fd2, const char *path2, int flag)
{
- int sz;
- char linkbuf[PATH_MAX + 1];
+ return (syscall(SYS_linkat, fd1, path1, fd2, path2, flag));
+}
+#pragma weak _link = link
+int
+link(const char *path1, const char *path2)
+{
/*
* XPG4v2 link() requires that the link count of a symbolic
* link target be updated rather than the link itself. This
@@ -56,11 +52,13 @@ link(const char *existing, const char *new)
* non-XPG4 based environments. For a more detailed discussion,
* see bug 1256170.
*/
- if (__xpg4 != 0) {
- if ((sz = resolvepath(existing, linkbuf, PATH_MAX)) == -1)
- return (-1);
- linkbuf[sz] = '\0';
- existing = linkbuf;
- }
- return (__link(existing, new));
+ if (__xpg4 != 0)
+ return (linkat(AT_FDCWD, path1, AT_FDCWD, path2,
+ AT_SYMLINK_FOLLOW));
+
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_link, path1, path2));
+#else
+ return (linkat(AT_FDCWD, path1, AT_FDCWD, path2, 0));
+#endif
}
diff --git a/usr/src/lib/libc/common/sys/chmod.s b/usr/src/lib/libc/port/sys/mkdir.c
index e5175fafcb..49f60111c4 100644
--- a/usr/src/lib/libc/common/sys/chmod.s
+++ b/usr/src/lib/libc/port/sys/mkdir.c
@@ -18,26 +18,29 @@
*
* 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.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*/
- .file "chmod.s"
-
-/* C library -- chmod */
-/* int chmod(char *path, mode_t mode) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(chmod,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(chmod)
- RETC
- SET_SIZE(chmod)
+#include "lint.h"
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
+
+int
+mkdirat(int fd, const char *path, mode_t mode)
+{
+ return (syscall(SYS_mkdirat, fd, path, mode));
+}
+
+#pragma weak _mkdir = mkdir
+int
+mkdir(const char *path, mode_t mode)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_mkdir, path, mode));
+#else
+ return (mkdirat(AT_FDCWD, path, mode));
+#endif
+}
diff --git a/usr/src/lib/libc/common/sys/link.s b/usr/src/lib/libc/port/sys/mknod.c
index cbc03892b5..df179cfec2 100644
--- a/usr/src/lib/libc/common/sys/link.s
+++ b/usr/src/lib/libc/port/sys/mknod.c
@@ -20,20 +20,27 @@
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*/
-/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+#include "lint.h"
+#include <sys/syscall.h>
+#include <sys/stat.h>
+#include <sys/fcntl.h>
- .file "link.s"
+int
+mknodat(int fd, const char *path, mode_t mode, dev_t dev)
+{
+ return (syscall(SYS_mknodat, fd, path, mode, dev));
+}
-/* C library -- link */
-/* int link (const char *path1, const char *path2); */
-
-#include "SYS.h"
-
- SYSCALL2_RVAL1(__link,link)
- RETC
- SET_SIZE(__link)
+#pragma weak _mknod = mknod
+int
+mknod(const char *path, mode_t mode, dev_t dev)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_mknod, path, mode, dev));
+#else
+ return (mknodat(AT_FDCWD, path, mode, dev));
+#endif
+}
diff --git a/usr/src/lib/libc/port/sys/readlink.c b/usr/src/lib/libc/port/sys/readlink.c
new file mode 100644
index 0000000000..fc58441b53
--- /dev/null
+++ b/usr/src/lib/libc/port/sys/readlink.c
@@ -0,0 +1,58 @@
+/*
+ * 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) 2010, Oracle and/or its affiliates. All rights reserved.
+ */
+
+#include "lint.h"
+#include <sys/syscall.h>
+#include <sys/unistd.h>
+#include <sys/fcntl.h>
+
+ssize_t
+readlinkat(int fd, const char *path, char *buf, size_t bufsize)
+{
+ sysret_t rval;
+ int error;
+
+ error = __systemcall(&rval, SYS_readlinkat, fd, path, buf, bufsize);
+ if (error)
+ (void) __set_errno(error);
+ return ((ssize_t)rval.sys_rval1);
+}
+
+#pragma weak _readlink = readlink
+ssize_t
+readlink(const char *path, char *buf, size_t bufsize)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ sysret_t rval;
+ int error;
+
+ error = __systemcall(&rval, SYS_readlink, path, buf, bufsize);
+ if (error)
+ (void) __set_errno(error);
+ return ((ssize_t)rval.sys_rval1);
+#else
+ return (readlinkat(AT_FDCWD, path, buf, bufsize));
+#endif
+}
diff --git a/usr/src/lib/libc/common/sys/fchmod.s b/usr/src/lib/libc/port/sys/symlink.c
index dc40164077..59a6ece2c4 100644
--- a/usr/src/lib/libc/common/sys/fchmod.s
+++ b/usr/src/lib/libc/port/sys/symlink.c
@@ -18,26 +18,29 @@
*
* 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.
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
*/
- .file "fchmod.s"
-
-/* C library -- fchmod */
-/* int fchmod(int fildes, mode_t mode) */
-
-#include <sys/asm_linkage.h>
-
- ANSI_PRAGMA_WEAK(fchmod,function)
-
-#include "SYS.h"
-
- SYSCALL_RVAL1(fchmod)
- RETC
- SET_SIZE(fchmod)
+#include "lint.h"
+#include <sys/syscall.h>
+#include <sys/unistd.h>
+#include <sys/fcntl.h>
+
+int
+symlinkat(const char *path1, int fd, const char *path2)
+{
+ return (syscall(SYS_symlinkat, path1, fd, path2));
+}
+
+#pragma weak _symlink = symlink
+int
+symlink(const char *path1, const char *path2)
+{
+#if defined(_RETAIN_OLD_SYSCALLS)
+ return (syscall(SYS_symlink, path1, path2));
+#else
+ return (symlinkat(path1, AT_FDCWD, path2));
+#endif
+}
diff --git a/usr/src/lib/libc/sparc/Makefile.com b/usr/src/lib/libc/sparc/Makefile.com
index b03c067933..84c888d0fc 100644
--- a/usr/src/lib/libc/sparc/Makefile.com
+++ b/usr/src/lib/libc/sparc/Makefile.com
@@ -18,9 +18,8 @@
#
# CDDL HEADER END
#
-
#
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
#
LIBCDIR= $(SRC)/lib/libc
@@ -213,7 +212,6 @@ COMSYSOBJS= \
alarm.o \
brk.o \
chdir.o \
- chmod.o \
chroot.o \
cladm.o \
close.o \
@@ -221,7 +219,6 @@ COMSYSOBJS= \
exit.o \
facl.o \
fchdir.o \
- fchmod.o \
fchroot.o \
fdsync.o \
fpathconf.o \
@@ -246,13 +243,10 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- link.o \
llseek.o \
lseek.o \
memcntl.o \
mincore.o \
- mkdir.o \
- mknod.o \
mmap.o \
mmapobjsys.o \
modctl.o \
@@ -276,7 +270,6 @@ COMSYSOBJS= \
putpmsg.o \
pwrite.o \
read.o \
- readlink.o \
readv.o \
resolvepath.o \
seteguid.o \
@@ -293,7 +286,6 @@ COMSYSOBJS= \
statfs.o \
statvfs.o \
stty.o \
- symlink.o \
sync.o \
sysconfig.o \
sysfs.o \
@@ -838,6 +830,7 @@ PORTSYS= \
access.o \
acctctl.o \
bsd_signal.o \
+ chmod.o \
chown.o \
corectl.o \
exacctsys.o \
@@ -850,13 +843,15 @@ PORTSYS= \
inst_sync.o \
issetugid.o \
label.o \
- libc_link.o \
+ link.o \
lockf.o \
lwp.o \
lwp_cond.o \
lwp_rwlock.o \
lwp_sigmask.o \
meminfosys.o \
+ mkdir.o \
+ mknod.o \
msgsys.o \
nfssys.o \
open.o \
@@ -865,6 +860,7 @@ PORTSYS= \
ppriv.o \
psetsys.o \
rctlsys.o \
+ readlink.o \
rename.o \
sbrk.o \
semsys.o \
@@ -877,6 +873,7 @@ PORTSYS= \
sigpending.o \
sigstack.o \
stat.o \
+ symlink.o \
tasksys.o \
time.o \
time_util.o \
diff --git a/usr/src/lib/libc/sparcv9/Makefile.com b/usr/src/lib/libc/sparcv9/Makefile.com
index 2144a07e17..897e294342 100644
--- a/usr/src/lib/libc/sparcv9/Makefile.com
+++ b/usr/src/lib/libc/sparcv9/Makefile.com
@@ -18,9 +18,8 @@
#
# CDDL HEADER END
#
-
#
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
#
LIBCDIR= $(SRC)/lib/libc
@@ -200,7 +199,6 @@ COMSYSOBJS= \
alarm.o \
brk.o \
chdir.o \
- chmod.o \
chroot.o \
cladm.o \
close.o \
@@ -208,7 +206,6 @@ COMSYSOBJS= \
exit.o \
facl.o \
fchdir.o \
- fchmod.o \
fchroot.o \
fdsync.o \
fpathconf.o \
@@ -233,13 +230,10 @@ COMSYSOBJS= \
ioctl.o \
kaio.o \
kill.o \
- link.o \
llseek.o \
lseek.o \
memcntl.o \
mincore.o \
- mkdir.o \
- mknod.o \
mmap.o \
mmapobjsys.o \
modctl.o \
@@ -263,7 +257,6 @@ COMSYSOBJS= \
putpmsg.o \
pwrite.o \
read.o \
- readlink.o \
readv.o \
resolvepath.o \
seteguid.o \
@@ -280,7 +273,6 @@ COMSYSOBJS= \
statfs.o \
statvfs.o \
stty.o \
- symlink.o \
sync.o \
sysconfig.o \
sysfs.o \
@@ -788,6 +780,7 @@ PORTSYS= \
access.o \
acctctl.o \
bsd_signal.o \
+ chmod.o \
chown.o \
corectl.o \
exacctsys.o \
@@ -800,13 +793,15 @@ PORTSYS= \
inst_sync.o \
issetugid.o \
label.o \
- libc_link.o \
+ link.o \
lockf.o \
lwp.o \
lwp_cond.o \
lwp_rwlock.o \
lwp_sigmask.o \
meminfosys.o \
+ mkdir.o \
+ mknod.o \
msgsys.o \
nfssys.o \
open.o \
@@ -815,6 +810,7 @@ PORTSYS= \
ppriv.o \
psetsys.o \
rctlsys.o \
+ readlink.o \
rename.o \
sbrk.o \
semsys.o \
@@ -827,6 +823,7 @@ PORTSYS= \
sigpending.o \
sigstack.o \
stat.o \
+ symlink.o \
tasksys.o \
time.o \
time_util.o \