diff options
author | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2010-02-28 18:42:20 -0800 |
---|---|---|
committer | Roger A. Faulkner <Roger.Faulkner@Sun.COM> | 2010-02-28 18:42:20 -0800 |
commit | 8fd04b8338ed5093ec2d1e668fa620b7de44c177 (patch) | |
tree | dc9fcd7d90062fa1e2b53b41a9b6e091194b875a /usr/src/uts/common/syscall | |
parent | e3c57d6a57265f8b9bf3871878cf9b92213e1188 (diff) | |
download | illumos-joyent-8fd04b8338ed5093ec2d1e668fa620b7de44c177.tar.gz |
PSARC 2009/657 delete obsolete system call traps
6906485 delete obsolete system call traps
--HG--
rename : usr/src/cmd/truss/xstat.c => usr/src/cmd/truss/stat.c
rename : usr/src/lib/libc/port/gen/dup2.c => usr/src/lib/libc/port/gen/dup.c
rename : usr/src/lib/libc/port/sys/libc_fcntl.c => usr/src/lib/libc/port/sys/fcntl.c
rename : usr/src/lib/libc/port/sys/libc_open.c => usr/src/lib/libc/port/sys/open.c
Diffstat (limited to 'usr/src/uts/common/syscall')
-rw-r--r-- | usr/src/uts/common/syscall/access.c | 14 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/chown.c | 50 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/fcntl.c | 9 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/fsat.c | 173 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/lwp_sobj.c | 29 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/mknod.c | 16 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/open.c | 73 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/poll.c | 24 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/rename.c | 29 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/rmdir.c | 60 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/stat.c | 258 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/umount.c | 15 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/unlink.c | 30 | ||||
-rw-r--r-- | usr/src/uts/common/syscall/utime.c | 128 |
14 files changed, 176 insertions, 732 deletions
diff --git a/usr/src/uts/common/syscall/access.c b/usr/src/uts/common/syscall/access.c index 2fcdb870e5..bf71b77b8c 100644 --- a/usr/src/uts/common/syscall/access.c +++ b/usr/src/uts/common/syscall/access.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -118,12 +118,6 @@ lookup: } int -access(char *fname, int fmode) -{ - return (caccess(fname, fmode, NULL)); -} - -int faccessat(int fd, char *fname, int fmode, int flag) { file_t *dirfp; @@ -172,3 +166,9 @@ faccessat(int fd, char *fname, int fmode, int flag) return (error); } + +int +access(char *fname, int fmode) +{ + return (faccessat(AT_FDCWD, fname, fmode, 0)); +} diff --git a/usr/src/uts/common/syscall/chown.c b/usr/src/uts/common/syscall/chown.c index 706b3b4f71..04250e1e35 100644 --- a/usr/src/uts/common/syscall/chown.c +++ b/usr/src/uts/common/syscall/chown.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -54,15 +53,10 @@ #include <c2/audit.h> /* - * nmflag has the following values - * - * 1 - Always do lookup. i.e. chown, lchown. - * 2 - Name is optional i.e. fchownat - * 0 - Don't lookup name, vp is in file_p. i.e. fchown - * + * Change ownership of file. */ int -cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) +fchownat(int fd, char *name, uid_t uid, gid_t gid, int flags) { vnode_t *startvp, *vp; file_t *filefp; @@ -87,11 +81,12 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) if (fd == AT_FDCWD && name == NULL) return (set_errno(EFAULT)); - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { + if (name != NULL) { if (copyin(name, &startchar, sizeof (char))) return (set_errno(EFAULT)); - } else + } else { startchar = '\0'; + } if (fd == AT_FDCWD) @@ -100,10 +95,9 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) /* * only get fd if not doing absolute lookup */ - if (startchar != '/' || nmflag == 0) { - if ((filefp = getf(fd)) == NULL) { + if (startchar != '/') { + if ((filefp = getf(fd)) == NULL) return (set_errno(EBADF)); - } startvp = filefp->f_vnode; VN_HOLD(startvp); releasef(fd); @@ -112,13 +106,13 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) } } - if ((nmflag == 2) && audit_active) + if (audit_active) audit_setfsat_path(1); /* - * Do lookups for chown, lchown and fchownat when name not NULL + * Do lookup for fchownat when name not NULL */ - if ((nmflag == 2 && name != NULL) || nmflag == 1) { + if (name != NULL) { if (error = lookupnameat(name, UIO_USERSPACE, (flags == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW, @@ -149,33 +143,21 @@ cfchownat(int fd, char *name, int nmflag, uid_t uid, gid_t gid, int flags) else return (error); } -/* - * Change ownership of file given file name. - */ + int chown(char *fname, uid_t uid, gid_t gid) { - return (cfchownat(AT_FDCWD, fname, 1, uid, gid, 0)); + return (fchownat(AT_FDCWD, fname, uid, gid, 0)); } int lchown(char *fname, uid_t uid, gid_t gid) { - return (cfchownat(AT_FDCWD, fname, 1, uid, gid, AT_SYMLINK_NOFOLLOW)); + return (fchownat(AT_FDCWD, fname, uid, gid, AT_SYMLINK_NOFOLLOW)); } -/* - * Change ownership of file given file descriptor. - */ int fchown(int fd, uid_t uid, uid_t gid) { - return (cfchownat(fd, NULL, 0, uid, gid, 0)); -} - -int -fchownat(int fd, char *name, uid_t uid, gid_t gid, int flags) -{ - return (cfchownat(fd, name, 2, uid, gid, flags)); - + return (fchownat(fd, NULL, uid, gid, 0)); } diff --git a/usr/src/uts/common/syscall/fcntl.c b/usr/src/uts/common/syscall/fcntl.c index 021064d1cd..5ad1497d3b 100644 --- a/usr/src/uts/common/syscall/fcntl.c +++ b/usr/src/uts/common/syscall/fcntl.c @@ -21,7 +21,7 @@ /* ONC_PLUS EXTRACT START */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -33,7 +33,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" /* ONC_PLUS EXTRACT END */ #include <sys/param.h> @@ -687,12 +686,6 @@ out: return (retval); } -int -dup(int fd) -{ - return (fcntl(fd, F_DUPFD, 0)); -} - /* ONC_PLUS EXTRACT START */ int flock_check(vnode_t *vp, flock64_t *flp, offset_t offset, offset_t max) diff --git a/usr/src/uts/common/syscall/fsat.c b/usr/src/uts/common/syscall/fsat.c deleted file mode 100644 index d9b7f4e288..0000000000 --- a/usr/src/uts/common/syscall/fsat.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#include <sys/types.h> -#include <sys/errno.h> -#include <sys/fcntl.h> -#include <sys/stat.h> -#include <sys/vnode.h> -#include <sys/vfs.h> -#include <sys/time.h> -#include <sys/systm.h> -#include <sys/debug.h> - -extern int openat(int, char *, int, int); -extern int renameat(int, char *, int, char *); -extern int unlinkat(int, char *, int); -extern int fchownat(int, char *, uid_t, gid_t, int); -extern int fstatat(int, char *, struct stat *, int); -extern int futimesat(int, char *, struct timeval *); -extern int faccessat(int, char *, int, int); -extern int openattrdirat(int, char *); -#if defined(_SYSCALL32_IMPL) || defined(_ILP32) -extern int fstatat64_32(int, char *, struct stat64_32 *, int); -extern int fstatat32(int, char *, struct stat32 *, int); -extern int openat32(int, char *, int, int); -extern int fstatat64(int, char *, struct stat64 *, int); -extern int openat64(int, char *, int, int); -extern int fstatat64_32(int, char *, struct stat64_32 *, int); -#endif - - -/* - * Handle all of the *at system calls - * - * subcodes: - * 0 - openat - * 1 - openat64 - * 2 - fstatat64 - * 3 - fstatat - * 4 - fchownat - * 5 - unlinkat - * 6 - futimesat - * 7 - renameat - * 8 - faccessat - * 9 - openattrdirat - * - * The code for handling the at functionality exists in the file where the - * base syscall is defined. For example openat is in open.c - */ - -#if defined(_SYSCALL32_IMPL) || defined(_ILP32) - -int -fsat32(int code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, - uintptr_t arg4, uintptr_t arg5) -{ - switch (code) { - - case 0: /* openat */ -#if defined(_LP64) - return (openat32((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); -#else - return (openat((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); -#endif - case 1: /* openat64 */ - return (openat64((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); - case 2: /* fstatat64 */ -#if defined(_LP64) - return (fstatat64_32((int)arg1, (char *)arg2, - (struct stat64_32 *)arg3, (int)arg4)); -#else - return (fstatat64((int)arg1, (char *)arg2, - (struct stat64 *)arg3, (int)arg4)); -#endif - case 3: /* fstatat */ -#if defined(_LP64) - return (fstatat32((int)arg1, (char *)arg2, - (struct stat32 *)arg3, (int)arg4)); -#else - return (fstatat((int)arg1, (char *)arg2, - (struct stat *)arg3, (int)arg4)); -#endif - case 4: /* fchownat */ - return (fchownat((int)arg1, (char *)arg2, - (uid_t)arg3, (gid_t)arg4, (int)arg5)); - case 5: /* unlinkat */ - return (unlinkat((int)arg1, (char *)arg2, (int)arg3)); - case 6: /* futimesat */ - return (futimesat((int)arg1, - (char *)arg2, (struct timeval *)arg3)); - case 7: /* renameat */ - return (renameat((int)arg1, (char *)arg2, (int)arg3, - (char *)arg4)); - case 8: /* faccessat */ - return (faccessat((int)arg1, (char *)arg2, (int)arg3, - (int)arg4)); - case 9: /* openattrdirat */ - return (openattrdirat((int)arg1, (char *)arg2)); - default: - return (set_errno(EINVAL)); - } -} - -#endif - -/* - * For 64 kernels, use fsat64 - */ - -#if defined(_LP64) - -int -fsat64(int code, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, - uintptr_t arg4, uintptr_t arg5) -{ - switch (code) { - - case 0: /* openat */ - return (openat((int)arg1, (char *)arg2, - (int)arg3, (int)arg4)); - case 1: /* openat64 */ - return (set_errno(ENOSYS)); - case 2: /* fstatat64 */ - return (set_errno(ENOSYS)); - case 3: /* fstatat */ - return (fstatat((int)arg1, (char *)arg2, - (struct stat *)arg3, (int)arg4)); - case 4: /* fchownat */ - return (fchownat((int)arg1, (char *)arg2, - (uid_t)arg3, (gid_t)arg4, (int)arg5)); - case 5: /* unlinkat */ - return (unlinkat((int)arg1, (char *)arg2, (int)arg3)); - case 6: /* futimesat */ - return (futimesat((int)arg1, - (char *)arg2, (struct timeval *)arg3)); - case 7: /* renameat */ - return (renameat((int)arg1, (char *)arg2, (int)arg3, - (char *)arg4)); - case 8: /* faccessat */ - return (faccessat((int)arg1, (char *)arg2, (int)arg3, - (int)arg4)); - case 9: /* openattrdirat */ - return (openattrdirat((int)arg1, (char *)arg2)); - default: - return (set_errno(EINVAL)); - } -} -#endif diff --git a/usr/src/uts/common/syscall/lwp_sobj.c b/usr/src/uts/common/syscall/lwp_sobj.c index 3a7e5997c5..94492d64f0 100644 --- a/usr/src/uts/common/syscall/lwp_sobj.c +++ b/usr/src/uts/common/syscall/lwp_sobj.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1358,20 +1358,6 @@ out: return (0); } -/* - * Obsolete lwp_mutex_lock() interface, no longer called from libc. - * libc now calls lwp_mutex_timedlock(lp, NULL, NULL). - * This system call trap continues to exist solely for the benefit - * of old statically-linked binaries from Solaris 9 and before. - * It should be removed from the system when we no longer care - * about such applications. - */ -int -lwp_mutex_lock(lwp_mutex_t *lp) -{ - return (lwp_mutex_timedlock(lp, NULL, NULL)); -} - static int iswanted(kthread_t *t, lwpchan_t *lwpchan) { @@ -2165,19 +2151,6 @@ out: return (0); } -/* - * Obsolete lwp_sema_wait() interface, no longer called from libc. - * libc now calls lwp_sema_timedwait(). - * This system call trap exists solely for the benefit of old - * statically linked applications from Solaris 9 and before. - * It should be removed when we no longer care about such applications. - */ -int -lwp_sema_wait(lwp_sema_t *sp) -{ - return (lwp_sema_timedwait(sp, NULL, 0)); -} - int lwp_sema_post(lwp_sema_t *sp) { diff --git a/usr/src/uts/common/syscall/mknod.c b/usr/src/uts/common/syscall/mknod.c index 2b61dac506..73258f9c2f 100644 --- a/usr/src/uts/common/syscall/mknod.c +++ b/usr/src/uts/common/syscall/mknod.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -94,14 +93,3 @@ mknod(char *fname, mode_t fmode, dev_t dev) VN_RELE(vp); return (0); } - -#if defined(__i386) || defined(__i386_COMPAT) - -/*ARGSUSED*/ -int -xmknod(int version, char *fname, mode_t fmode, dev_t dev) -{ - return (mknod(fname, fmode, dev)); -} - -#endif diff --git a/usr/src/uts/common/syscall/open.c b/usr/src/uts/common/syscall/open.c index a2504bc1c4..e4fc89f3ec 100644 --- a/usr/src/uts/common/syscall/open.c +++ b/usr/src/uts/common/syscall/open.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -50,8 +51,8 @@ #include <sys/cmn_err.h> /* - * Common code for open()/openat() and creat(). Check permissions, allocate - * an open file structure, and call the device open routine (if any). + * Common code for openat(). Check permissions, allocate an open + * file structure, and call the device open routine (if any). */ static int @@ -100,8 +101,8 @@ copen(int startfd, char *fname, int filemode, int createmode) * Handle openattrdirat request */ if (filemode & FXATTRDIROPEN) { - if (audit_active) - audit_setfsat_path(1); + if (audit_active) + audit_setfsat_path(1); if (error = lookupnameat(fname, seg, FOLLOW, NULLVPP, &vp, startvp)) @@ -254,95 +255,61 @@ out: } #define OPENMODE32(fmode) ((int)((fmode)-FOPEN)) -#define CREATMODE32 (FWRITE|FCREAT|FTRUNC) #define OPENMODE64(fmode) (OPENMODE32(fmode) | FOFFMAX) #define OPENMODEATTRDIR FXATTRDIROPEN -#define CREATMODE64 (CREATMODE32 | FOFFMAX) #ifdef _LP64 #define OPENMODE(fmode) OPENMODE64(fmode) -#define CREATMODE CREATMODE64 #else #define OPENMODE OPENMODE32 -#define CREATMODE CREATMODE32 #endif /* * Open a file. */ int -open(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE(fmode), cmode)); -} - -/* - * Create a file. - */ -int -creat(char *fname, int cmode) +openat(int fd, char *path, int fmode, int cmode) { - return (copen(AT_FDCWD, fname, CREATMODE, cmode)); + return (copen(fd, path, OPENMODE(fmode), cmode)); } int -openat(int fd, char *path, int fmode, int cmode) +open(char *path, int fmode, int cmode) { - return (copen(fd, path, OPENMODE(fmode), cmode)); + return (openat(AT_FDCWD, path, fmode, cmode)); } #if defined(_ILP32) || defined(_SYSCALL32_IMPL) /* - * Open and Creat for large files in 32-bit environment. Sets the FOFFMAX flag. + * Open for large files in 32-bit environment. Sets the FOFFMAX flag. */ int -open64(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE64(fmode), cmode)); -} - -int -creat64(char *fname, int cmode) +openat64(int fd, char *path, int fmode, int cmode) { - return (copen(AT_FDCWD, fname, CREATMODE64, cmode)); + return (copen(fd, path, OPENMODE64(fmode), cmode)); } int -openat64(int fd, char *path, int fmode, int cmode) +open64(char *path, int fmode, int cmode) { - return (copen(fd, path, OPENMODE64(fmode), cmode)); + return (openat64(AT_FDCWD, path, fmode, cmode)); } #endif /* _ILP32 || _SYSCALL32_IMPL */ #ifdef _SYSCALL32_IMPL /* - * Open and Creat for 32-bit compatibility on 64-bit kernel + * Open for 32-bit compatibility on 64-bit kernel */ int -open32(char *fname, int fmode, int cmode) -{ - return (copen(AT_FDCWD, fname, OPENMODE32(fmode), cmode)); -} - -int -creat32(char *fname, int cmode) -{ - return (copen(AT_FDCWD, fname, CREATMODE32, cmode)); -} - -int openat32(int fd, char *path, int fmode, int cmode) { return (copen(fd, path, OPENMODE32(fmode), cmode)); } -#endif /* _SYSCALL32_IMPL */ - -/* - * Special interface to open hidden attribute directory. - */ int -openattrdirat(int fd, char *fname) +open32(char *path, int fmode, int cmode) { - return (copen(fd, fname, OPENMODEATTRDIR, 0)); + return (openat32(AT_FDCWD, path, fmode, cmode)); } + +#endif /* _SYSCALL32_IMPL */ diff --git a/usr/src/uts/common/syscall/poll.c b/usr/src/uts/common/syscall/poll.c index bed14f800a..dfcbb6dc9f 100644 --- a/usr/src/uts/common/syscall/poll.c +++ b/usr/src/uts/common/syscall/poll.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -618,28 +618,6 @@ pollout: } /* - * This system call trap exists solely for binary compatibility with - * old statically-linked applications. It is not called from libc. - * It should be removed in the next release. - */ -int -poll(pollfd_t *fds, nfds_t nfds, int time_out) -{ - timespec_t ts; - timespec_t *tsp; - - if (time_out < 0) - tsp = NULL; - else { - ts.tv_sec = time_out / MILLISEC; - ts.tv_nsec = (time_out % MILLISEC) * MICROSEC; - tsp = &ts; - } - - return (poll_common(fds, nfds, tsp, NULL)); -} - -/* * This is the system call trap that poll(), * select() and pselect() are built upon. * It is a private interface between libc and the kernel. diff --git a/usr/src/uts/common/syscall/rename.c b/usr/src/uts/common/syscall/rename.c index 4d8d5270ed..4228ea688a 100644 --- a/usr/src/uts/common/syscall/rename.c +++ b/usr/src/uts/common/syscall/rename.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2001 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -47,19 +45,6 @@ #include <sys/fcntl.h> /* - * Rename or move an existing file. - */ -int -rename(char *from, char *to) -{ - int error; - - if (error = vn_rename(from, to, UIO_USERSPACE)) - return (set_errno(error)); - return (0); -} - -/* * Rename a file relative to a given directory */ int @@ -137,3 +122,9 @@ renameat(int fromfd, char *old, int tofd, char *new) return (set_errno(error)); return (error); } + +int +rename(char *old, char *new) +{ + return (renameat(AT_FDCWD, old, AT_FDCWD, new)); +} diff --git a/usr/src/uts/common/syscall/rmdir.c b/usr/src/uts/common/syscall/rmdir.c deleted file mode 100644 index 0a0ad7e2cd..0000000000 --- a/usr/src/uts/common/syscall/rmdir.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 1989 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ - -/* - * Portions of this source code were derived from Berkeley 4.3 BSD - * under license from the Regents of the University of California. - */ - -#ident "%Z%%M% %I% %E% SMI" - -#include <sys/param.h> -#include <sys/isa_defs.h> -#include <sys/types.h> -#include <sys/sysmacros.h> -#include <sys/systm.h> -#include <sys/errno.h> -#include <sys/vnode.h> -#include <sys/uio.h> -#include <sys/filio.h> - -#include <sys/debug.h> - -/* - * Remove a directory. - */ -int -rmdir(char *dname) -{ - int error; - - if (error = vn_remove(dname, UIO_USERSPACE, RMDIRECTORY)) - return (set_errno(error)); - return (0); -} diff --git a/usr/src/uts/common/syscall/stat.c b/usr/src/uts/common/syscall/stat.c index 8bd03c2454..87ede7fe62 100644 --- a/usr/src/uts/common/syscall/stat.c +++ b/usr/src/uts/common/syscall/stat.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Get file attribute information through a file name or a file descriptor. */ @@ -63,17 +62,8 @@ * to VOP_GETATTR */ -/* - * nmflag has the following values - * - * 1 - Always do lookup. i.e. stat, lstat. - * 2 - Name is optional i.e. fstatat - * 0 - Don't lookup name, vp is in file_p. i.e. fstat - * - */ static int -cstatat_getvp(int fd, char *name, int nmflag, - int follow, vnode_t **vp, cred_t **cred) +cstatat_getvp(int fd, char *name, int follow, vnode_t **vp, cred_t **cred) { vnode_t *startvp; file_t *fp; @@ -88,22 +78,15 @@ cstatat_getvp(int fd, char *name, int nmflag, */ if (fd == AT_FDCWD) { - if (name != NULL || nmflag != 2) { - startvp = NULL; - cr = CRED(); - crhold(cr); - } else - return (EFAULT); + startvp = NULL; + cr = CRED(); + crhold(cr); } else { char startchar; - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { - if (copyin(name, &startchar, sizeof (char))) - return (EFAULT); - } else { - startchar = '\0'; - } - if (startchar != '/' || nmflag == 0) { + if (copyin(name, &startchar, sizeof (char))) + return (EFAULT); + if (startchar != '/') { if ((fp = getf(fd)) == NULL) { return (EBADF); } @@ -123,24 +106,19 @@ cstatat_getvp(int fd, char *name, int nmflag, if (audit_active) audit_setfsat_path(1); - - if (nmflag == 1 || (nmflag == 2 && name != NULL)) { lookup: - if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP, - vp, startvp)) { - if ((error == ESTALE) && - fs_need_estale_retry(estale_retry++)) - goto lookup; - if (startvp != NULL) - VN_RELE(startvp); - crfree(cr); - return (error); - } + if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP, + vp, startvp)) { + if ((error == ESTALE) && + fs_need_estale_retry(estale_retry++)) + goto lookup; if (startvp != NULL) VN_RELE(startvp); - } else { - *vp = startvp; + crfree(cr); + return (error); } + if (startvp != NULL) + VN_RELE(startvp); return (0); } @@ -151,21 +129,9 @@ lookup: * N-bit kernel, N-bit applications, N-bit file offsets */ -static int cstatat(int, char *, int, struct stat *, int, int); +static int cstatat(int, char *, struct stat *, int, int); static int cstat(vnode_t *vp, struct stat *, int, cred_t *); -int -stat(char *fname, struct stat *sb) -{ - return (cstatat(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); -} - -int -lstat(char *fname, struct stat *sb) -{ - return (cstatat(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); -} - /* * fstat can and should be fast, do an inline implementation here. */ @@ -174,6 +140,8 @@ lstat(char *fname, struct stat *sb) file_t *fp; \ int error; \ \ + if (fd == AT_FDCWD) \ + return (set_errno(EFAULT)); \ if ((fp = getf(fd)) == NULL) \ return (set_errno(EBADF)); \ if (audit_active) \ @@ -194,48 +162,32 @@ fstat(int fd, struct stat *sb) int fstatat(int fd, char *name, struct stat *sb, int flags) { - return (cstatat(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); -} + int followflag; + int csflags; -#if defined(__i386) || defined(__i386_COMPAT) + if (name == NULL) + return (fstat(fd, sb)); -/* - * Handle all the "extended" stat operations in the same way; - * validate the version, then call the real handler. - */ - -#define XSTAT_BODY(ver, f, s, fn) \ - return (ver != _STAT_VER ? set_errno(EINVAL) : fn(f, s)); - -#endif /* __i386 || __i386_COMPAT */ + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ -#if defined(__i386) - -/* - * Syscalls for i386 applications that issue {,l,f}xstat() directly - */ -int -xstat(int version, char *fname, struct stat *sb) -{ - XSTAT_BODY(version, fname, sb, stat) + return (cstatat(fd, name, sb, followflag, csflags)); } int -lxstat(int version, char *fname, struct stat *sb) +stat(char *name, struct stat *sb) { - XSTAT_BODY(version, fname, sb, lstat) + return (fstatat(AT_FDCWD, name, sb, 0)); } int -fxstat(int version, int fd, struct stat *sb) +lstat(char *name, struct stat *sb) { - XSTAT_BODY(version, fd, sb, fstat) + return (fstatat(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } -#endif /* __i386 */ - /* * Common code for stat(), lstat(), and fstat(). * (32-bit kernel, 32-bit applications, 32-bit files) @@ -304,7 +256,7 @@ cstat(vnode_t *vp, struct stat *ubp, int flag, cred_t *cr) } static int -cstatat(int fd, char *name, int nmflag, struct stat *sb, int follow, int flags) +cstatat(int fd, char *name, struct stat *sb, int follow, int flags) { vnode_t *vp; int error; @@ -314,16 +266,14 @@ cstatat(int fd, char *name, int nmflag, struct stat *sb, int follow, int flags) link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -335,19 +285,8 @@ out: /* * 64-bit kernel, 32-bit applications, 32-bit file offsets */ -static int cstatat32(int, char *, int, struct stat32 *, int, int); +static int cstatat32(int, char *, struct stat32 *, int, int); static int cstat32(vnode_t *, struct stat32 *, int, cred_t *); -int -stat32(char *fname, struct stat32 *sb) -{ - return (cstatat32(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); -} - -int -lstat32(char *fname, struct stat32 *sb) -{ - return (cstatat32(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); -} int fstat32(int fd, struct stat32 *sb) @@ -358,36 +297,32 @@ fstat32(int fd, struct stat32 *sb) int fstatat32(int fd, char *name, struct stat32 *sb, int flags) { - return (cstatat32(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); -} + int followflag; + int csflags; -#if defined(__i386_COMPAT) + if (name == NULL) + return (fstat32(fd, sb)); -/* - * Syscalls for i386 applications that issue {,l,f}xstat() directly - */ -int -xstat32(int version, char *fname, struct stat32 *sb) -{ - XSTAT_BODY(version, fname, sb, stat32) + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat32(fd, name, sb, followflag, csflags)); } int -lxstat32(int version, char *fname, struct stat32 *sb) +stat32(char *name, struct stat32 *sb) { - XSTAT_BODY(version, fname, sb, lstat32) + return (fstatat32(AT_FDCWD, name, sb, 0)); } int -fxstat32(int version, int fd, struct stat32 *sb) +lstat32(char *name, struct stat32 *sb) { - XSTAT_BODY(version, fd, sb, fstat32) + return (fstatat32(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } -#endif /* __i386_COMPAT */ - static int cstat32(vnode_t *vp, struct stat32 *ubp, int flag, struct cred *cr) { @@ -444,8 +379,7 @@ cstat32(vnode_t *vp, struct stat32 *ubp, int flag, struct cred *cr) } static int -cstatat32(int fd, char *name, int nmflag, struct stat32 *sb, - int follow, int flags) +cstatat32(int fd, char *name, struct stat32 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -455,16 +389,14 @@ cstatat32(int fd, char *name, int nmflag, struct stat32 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat32(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -480,33 +412,42 @@ out: * * These routines are implemented differently on 64-bit kernels. */ -static int cstatat64(int, char *, int, struct stat64 *, int, int); +static int cstatat64(int, char *, struct stat64 *, int, int); static int cstat64(vnode_t *, struct stat64 *, int, cred_t *); int -stat64(char *fname, struct stat64 *sb) +fstat64(int fd, struct stat64 *sb) { - return (cstatat64(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); + FSTAT_BODY(fd, sb, cstat64) } int -lstat64(char *fname, struct stat64 *sb) +fstatat64(int fd, char *name, struct stat64 *sb, int flags) { - return (cstatat64(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); + int followflag; + int csflags; + + if (name == NULL) + return (fstat64(fd, sb)); + + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat64(fd, name, sb, followflag, csflags)); } int -fstat64(int fd, struct stat64 *sb) +stat64(char *name, struct stat64 *sb) { - FSTAT_BODY(fd, sb, cstat64) + return (fstatat64(AT_FDCWD, name, sb, 0)); } int -fstatat64(int fd, char *name, struct stat64 *sb, int flags) +lstat64(char *name, struct stat64 *sb) { - return (cstatat64(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); + return (fstatat64(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } static int @@ -546,8 +487,7 @@ cstat64(vnode_t *vp, struct stat64 *ubp, int flag, cred_t *cr) } static int -cstatat64(int fd, char *name, int nmflag, struct stat64 *sb, - int follow, int flags) +cstatat64(int fd, char *name, struct stat64 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -557,16 +497,14 @@ cstatat64(int fd, char *name, int nmflag, struct stat64 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat64(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } @@ -585,33 +523,42 @@ out: * differently from the way the 32-bit ABI defines it. */ -static int cstatat64_32(int, char *, int, struct stat64_32 *, int, int); +static int cstatat64_32(int, char *, struct stat64_32 *, int, int); static int cstat64_32(vnode_t *, struct stat64_32 *, int, cred_t *); int -stat64_32(char *fname, struct stat64_32 *sb) +fstat64_32(int fd, struct stat64_32 *sb) { - return (cstatat64_32(AT_FDCWD, fname, 1, sb, 0, ATTR_REAL)); + FSTAT_BODY(fd, sb, cstat64_32) } int -lstat64_32(char *fname, struct stat64_32 *sb) +fstatat64_32(int fd, char *name, struct stat64_32 *sb, int flags) { - return (cstatat64_32(AT_FDCWD, fname, 1, sb, AT_SYMLINK_NOFOLLOW, 0)); + int followflag; + int csflags; + + if (name == NULL) + return (fstat64_32(fd, sb)); + + followflag = (flags & AT_SYMLINK_NOFOLLOW); + csflags = (flags & _AT_TRIGGER ? ATTR_TRIGGER : 0); + if (followflag == 0) + csflags |= ATTR_REAL; /* flag for procfs lookups */ + + return (cstatat64_32(fd, name, sb, followflag, csflags)); } int -fstat64_32(int fd, struct stat64_32 *sb) +stat64_32(char *name, struct stat64_32 *sb) { - FSTAT_BODY(fd, sb, cstat64_32) + return (fstatat64_32(AT_FDCWD, name, sb, 0)); } int -fstatat64_32(int fd, char *name, struct stat64_32 *sb, int flags) +lstat64_32(char *name, struct stat64_32 *sb) { - return (cstatat64_32(fd, name, 2, sb, - flags & AT_SYMLINK_NOFOLLOW ? AT_SYMLINK_NOFOLLOW : 0, - flags & _AT_TRIGGER ? ATTR_TRIGGER : 0)); + return (fstatat64_32(AT_FDCWD, name, sb, AT_SYMLINK_NOFOLLOW)); } static int @@ -659,8 +606,7 @@ cstat64_32(vnode_t *vp, struct stat64_32 *ubp, int flag, cred_t *cr) } static int -cstatat64_32(int fd, char *name, int nmflag, struct stat64_32 *sb, - int follow, int flags) +cstatat64_32(int fd, char *name, struct stat64_32 *sb, int follow, int flags) { vnode_t *vp; int error; @@ -670,16 +616,14 @@ cstatat64_32(int fd, char *name, int nmflag, struct stat64_32 *sb, link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW; lookup: - if (error = cstatat_getvp(fd, name, nmflag, link_follow, &vp, &cred)) + if (error = cstatat_getvp(fd, name, link_follow, &vp, &cred)) return (set_errno(error)); error = cstat64_32(vp, sb, flags, cred); crfree(cred); VN_RELE(vp); -out: if (error != 0) { if (error == ESTALE && - fs_need_estale_retry(estale_retry++) && - (nmflag == 1 || (nmflag == 2 && name != NULL))) + fs_need_estale_retry(estale_retry++)) goto lookup; return (set_errno(error)); } diff --git a/usr/src/uts/common/syscall/umount.c b/usr/src/uts/common/syscall/umount.c index 970afd9b2b..a2deedb163 100644 --- a/usr/src/uts/common/syscall/umount.c +++ b/usr/src/uts/common/syscall/umount.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/t_lock.h> #include <sys/param.h> @@ -193,13 +192,3 @@ umount2(char *pathp, int flag) return (umount2_engine(vfsp, flag, CRED(), 1)); } - -/* - * Old umount() system call for compatibility. - * Changes due to support for forced unmount. - */ -int -umount(char *pathp) -{ - return (umount2(pathp, 0)); -} diff --git a/usr/src/uts/common/syscall/unlink.c b/usr/src/uts/common/syscall/unlink.c index cd97f970ca..27546c959a 100644 --- a/usr/src/uts/common/syscall/unlink.c +++ b/usr/src/uts/common/syscall/unlink.c @@ -18,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,8 +32,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -47,19 +46,6 @@ #include <c2/audit.h> /* - * Unlink (i.e. delete) a file. - */ -int -unlink(char *fname) -{ - int error; - - if (error = vn_remove(fname, UIO_USERSPACE, RMFILE)) - return (set_errno(error)); - return (0); -} - -/* * Unlink a file from a directory */ int @@ -106,3 +92,15 @@ unlinkat(int fd, char *name, int flags) return (set_errno(error)); return (0); } + +int +unlink(char *name) +{ + return (unlinkat(AT_FDCWD, name, 0)); +} + +int +rmdir(char *name) +{ + return (unlinkat(AT_FDCWD, name, AT_REMOVEDIR)); +} diff --git a/usr/src/uts/common/syscall/utime.c b/usr/src/uts/common/syscall/utime.c index 38cf6069f7..43cdf1d62b 100644 --- a/usr/src/uts/common/syscall/utime.c +++ b/usr/src/uts/common/syscall/utime.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2009 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,48 +115,6 @@ cfutimesat(int fd, char *fname, int nmflag, vattr_t *vap, int flags, int follow) return (0); } -/* - * Expunge this function when futimesat() and utimes() - * are expunged from the kernel. - */ -static int -get_timeval_vattr(struct timeval *tvptr, struct vattr *vattr, int *flags) -{ - struct timeval tv[2]; - - if (tvptr != NULL) { - if (get_udatamodel() == DATAMODEL_NATIVE) { - if (copyin(tvptr, tv, sizeof (tv))) - return (EFAULT); - } else { - struct timeval32 tv32[2]; - - if (copyin(tvptr, tv32, sizeof (tv32))) - return (EFAULT); - - TIMEVAL32_TO_TIMEVAL(&tv[0], &tv32[0]); - TIMEVAL32_TO_TIMEVAL(&tv[1], &tv32[1]); - } - - if (tv[0].tv_usec < 0 || tv[0].tv_usec >= MICROSEC || - tv[1].tv_usec < 0 || tv[1].tv_usec >= MICROSEC) - return (EINVAL); - - vattr->va_atime.tv_sec = tv[0].tv_sec; - vattr->va_atime.tv_nsec = tv[0].tv_usec * 1000; - vattr->va_mtime.tv_sec = tv[1].tv_sec; - vattr->va_mtime.tv_nsec = tv[1].tv_usec * 1000; - *flags = ATTR_UTIME; - } else { - gethrestime(&vattr->va_atime); - vattr->va_mtime = vattr->va_atime; - *flags = 0; - } - vattr->va_mask = AT_ATIME | AT_MTIME; - - return (0); -} - static int get_timespec_vattr(timespec_t *tsptr, struct vattr *vattr, int *flags) { @@ -212,90 +170,6 @@ get_timespec_vattr(timespec_t *tsptr, struct vattr *vattr, int *flags) return (0); } -/* - * The futimesat() system call is no longer invoked from libc. - * The futimesat() function has been implemented in libc using calls - * to futimens() and utimensat(). The kernel code for futimesat() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - * This includes the calls to futimesat in common/syscall/fsat.c - */ -int -futimesat(int fd, char *fname, struct timeval *tvptr) -{ - struct vattr vattr; - int flags; - int error; - - if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) - return (set_errno(error)); - - return (cfutimesat(fd, fname, 2, &vattr, flags, FOLLOW)); -} - -/* - * The utime() system call is no longer invoked from libc. - * The utime() function has been implemented in libc using - * a call to utimensat(). The kernel code for utime() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - */ -int -utime(char *fname, time_t *tptr) -{ - time_t tv[2]; - struct vattr vattr; - int flags; - - if (tptr != NULL) { - if (get_udatamodel() == DATAMODEL_NATIVE) { - if (copyin(tptr, tv, sizeof (tv))) - return (set_errno(EFAULT)); - } else { - time32_t tv32[2]; - - if (copyin(tptr, &tv32, sizeof (tv32))) - return (set_errno(EFAULT)); - - tv[0] = (time_t)tv32[0]; - tv[1] = (time_t)tv32[1]; - } - - vattr.va_atime.tv_sec = tv[0]; - vattr.va_atime.tv_nsec = 0; - vattr.va_mtime.tv_sec = tv[1]; - vattr.va_mtime.tv_nsec = 0; - flags = ATTR_UTIME; - } else { - gethrestime(&vattr.va_atime); - vattr.va_mtime = vattr.va_atime; - flags = 0; - } - - vattr.va_mask = AT_ATIME|AT_MTIME; - return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); -} - -/* - * The utimes() system call is no longer invoked from libc. - * The utimes() function has been implemented in libc using - * a call to utimensat(). The kernel code for utimes() - * should be expunged as soon as there is no longer a need - * to run Solaris 10 and prior versions of libc on the system. - */ -int -utimes(char *fname, struct timeval *tvptr) -{ - struct vattr vattr; - int flags; - int error; - - if ((error = get_timeval_vattr(tvptr, &vattr, &flags)) != 0) - return (set_errno(error)); - - return (cfutimesat(AT_FDCWD, fname, 1, &vattr, flags, FOLLOW)); -} - int futimens(int fd, timespec_t *tsptr) { |