Module Name: src
Committed By: bouyer
Date: Sat Sep 17 18:47:48 UTC 2011
Modified Files:
src/distrib/sets/lists/comp [netbsd-5]: mi
src/include [netbsd-5]: limits.h unistd.h
src/lib/libc/sys [netbsd-5]: Makefile.inc link.2
src/sys/kern [netbsd-5]: init_sysent.c syscalls.c syscalls.master
vfs_syscalls.c
src/sys/rump/librump/rumpkern [netbsd-5]: rump_syscalls.c
rump_syscalls.h
src/sys/sys [netbsd-5]: fcntl.h syscall.h syscallargs.h
Log Message:
Pull up following revision(s) (requested by manu in ticket #1658):
sys/rump/include/rump/rump_syscalls.h: revision 1.52 via patch
sys/kern/init_sysent.c: revision 1.257 via patch
sys/rump/include/rump/rumpvnode_if.h: revision 1.12 via patch
lib/libc/sys/Makefile.inc: revision 1.208 via patch
sys/sys/syscallargs.h: revision 1.227 via patch
sys/kern/kern_exec.c: revision 1.317 via patch
sys/rump/librump/rumpkern/rump_syscalls.c: revision 1.74 via patch
include/limits.h: revision 1.30 via patch
sys/kern/syscalls.master: revision 1.251 via patch
sys/sys/vnode_if.h: revision 1.83 via patch
sys/sys/fcntl.h: revision 1.40 via patch
sys/sys/fcntl.h: revision 1.41 via patch
sys/kern/vfs_syscalls.c: revision 1.433 via patch
sys/rump/librump/rumpvfs/rumpvnode_if.c: revision 1.11 via patch
sys/kern/syscalls.c: revision 1.248 via patch
sys/sys/syscall.h: revision 1.244 via patch
lib/libc/sys/link.2: revision 1.25 via patch
include/unistd.h: revision 1.127 via patch
distrib/sets/lists/comp/mi: revision 1.1659 via patch
sys/sys/stat.h: revision 1.61 via patch
First stage of support for Extended API set 2. Most of the think is
unimplemented, except enough of linkat(2) to hardlink to a symlink.
Everything new in headers is guarded #ifdef _INCOMPLETE_XOPEN_C063 since
some software (e.g.: xcvs in our own tree) will assume they can use openat(2)
when AT_FDCWD is defined. _INCOMPLETE_XOPEN_C063 will go away once support
will be completed.
regen
improve comment about AT_* defines: they are not only used by linkat(2)
Add macros to hide OpenGroup extened API set 2 from GNU configure. This
is a temporary workaround until the implementation is completed.
To generate a diff of this commit:
cvs rdiff -u -r1.1201.2.16 -r1.1201.2.17 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.28 -r1.28.4.1 src/include/limits.h
cvs rdiff -u -r1.118.4.1 -r1.118.4.2 src/include/unistd.h
cvs rdiff -u -r1.196.2.2 -r1.196.2.3 src/lib/libc/sys/Makefile.inc
cvs rdiff -u -r1.22 -r1.22.32.1 src/lib/libc/sys/link.2
cvs rdiff -u -r1.229 -r1.229.4.1 src/sys/kern/init_sysent.c
cvs rdiff -u -r1.220 -r1.220.4.1 src/sys/kern/syscalls.c
cvs rdiff -u -r1.211 -r1.211.4.1 src/sys/kern/syscalls.master
cvs rdiff -u -r1.376.4.6 -r1.376.4.7 src/sys/kern/vfs_syscalls.c
cvs rdiff -u -r1.20 -r1.20.4.1 src/sys/rump/librump/rumpkern/rump_syscalls.c \
src/sys/rump/librump/rumpkern/rump_syscalls.h
cvs rdiff -u -r1.34.64.1 -r1.34.64.2 src/sys/sys/fcntl.h
cvs rdiff -u -r1.217 -r1.217.4.1 src/sys/sys/syscall.h
cvs rdiff -u -r1.199 -r1.199.4.1 src/sys/sys/syscallargs.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1201.2.16 src/distrib/sets/lists/comp/mi:1.1201.2.17
--- src/distrib/sets/lists/comp/mi:1.1201.2.16 Sun Jul 17 15:36:00 2011
+++ src/distrib/sets/lists/comp/mi Sat Sep 17 18:47:43 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1201.2.16 2011/07/17 15:36:00 riz Exp $
+# $NetBSD: mi,v 1.1201.2.17 2011/09/17 18:47:43 bouyer Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@@ -3874,6 +3874,7 @@
./usr/share/man/cat2/lfs_segclean.0 comp-c-catman .cat
./usr/share/man/cat2/lfs_segwait.0 comp-c-catman .cat
./usr/share/man/cat2/link.0 comp-c-catman .cat
+./usr/share/man/cat2/linkat.0 comp-c-catman .cat
./usr/share/man/cat2/listen.0 comp-c-catman .cat
./usr/share/man/cat2/lseek.0 comp-c-catman .cat
./usr/share/man/cat2/lstat.0 comp-c-catman .cat
@@ -9284,6 +9285,7 @@
./usr/share/man/html2/lfs_segclean.html comp-c-htmlman html
./usr/share/man/html2/lfs_segwait.html comp-c-htmlman html
./usr/share/man/html2/link.html comp-c-htmlman html
+./usr/share/man/html2/linkat.html comp-c-htmlman html
./usr/share/man/html2/listen.html comp-c-htmlman html
./usr/share/man/html2/lseek.html comp-c-htmlman html
./usr/share/man/html2/lstat.html comp-c-htmlman html
@@ -14472,6 +14474,7 @@
./usr/share/man/man2/lfs_segclean.2 comp-c-man .man
./usr/share/man/man2/lfs_segwait.2 comp-c-man .man
./usr/share/man/man2/link.2 comp-c-man .man
+./usr/share/man/man2/linkat.2 comp-c-man .man
./usr/share/man/man2/listen.2 comp-c-man .man
./usr/share/man/man2/lseek.2 comp-c-man .man
./usr/share/man/man2/lstat.2 comp-c-man .man
Index: src/include/limits.h
diff -u src/include/limits.h:1.28 src/include/limits.h:1.28.4.1
--- src/include/limits.h:1.28 Wed Aug 27 08:53:55 2008
+++ src/include/limits.h Sat Sep 17 18:47:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: limits.h,v 1.28 2008/08/27 08:53:55 christos Exp $ */
+/* $NetBSD: limits.h,v 1.28.4.1 2011/09/17 18:47:43 bouyer Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -108,6 +108,15 @@
#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+/*
+ * X/Open Extended API set 2 (a.k.a. C063)
+ * This hides unimplemented functions from GNU configure until
+ * we are done implementing them.
+ */
+#if !defined(_INCOMPLETE_XOPEN_C063)
+#define __stub_linkat
+#endif
+
#include <machine/limits.h>
#include <sys/syslimits.h>
Index: src/include/unistd.h
diff -u src/include/unistd.h:1.118.4.1 src/include/unistd.h:1.118.4.2
--- src/include/unistd.h:1.118.4.1 Fri Jan 16 01:04:29 2009
+++ src/include/unistd.h Sat Sep 17 18:47:43 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: unistd.h,v 1.118.4.1 2009/01/16 01:04:29 snj Exp $ */
+/* $NetBSD: unistd.h,v 1.118.4.2 2011/09/17 18:47:43 bouyer Exp $ */
/*-
* Copyright (c) 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -282,6 +282,12 @@
ssize_t pwrite(int, const void *, size_t, off_t);
#endif
+/*
+ * X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if defined(_INCOMPLETE_XOPEN_C063)
+int linkat(int, const char *, int, const char *, int);
+#endif
/*
* Implementation-defined extensions
Index: src/lib/libc/sys/Makefile.inc
diff -u src/lib/libc/sys/Makefile.inc:1.196.2.2 src/lib/libc/sys/Makefile.inc:1.196.2.3
--- src/lib/libc/sys/Makefile.inc:1.196.2.2 Sun Jul 17 15:36:03 2011
+++ src/lib/libc/sys/Makefile.inc Sat Sep 17 18:47:42 2011
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.196.2.2 2011/07/17 15:36:03 riz Exp $
+# $NetBSD: Makefile.inc,v 1.196.2.3 2011/09/17 18:47:42 bouyer Exp $
# @(#)Makefile.inc 8.3 (Berkeley) 10/24/94
# sys sources
@@ -89,7 +89,7 @@
_ksem_post.S _ksem_trywait.S _ksem_unlink.S _ksem_wait.S \
_ksem_open.S \
lchflags.S lchmod.S lchown.S lfs_bmapv.S lfs_markv.S lfs_segclean.S \
- lfs_segwait.S link.S listen.S __lstat30.S lutimes.S \
+ lfs_segwait.S link.S linkat.S listen.S __lstat30.S lutimes.S \
_lwp_create.S _lwp_exit.S _lwp_kill.S _lwp_park.S \
_lwp_self.S _lwp_wait.S _lwp_unpark.S _lwp_unpark_all.S \
_lwp_suspend.S _lwp_continue.S _lwp_wakeup.S _lwp_detach.S \
@@ -267,6 +267,7 @@
MLINKS+=kqueue.2 kevent.2
MLINKS+=ktrace.2 fktrace.2
MLINKS+=lseek.2 seek.2
+MLINKS+=link.2 linkat.2
MLINKS+=_lwp_suspend.2 _lwp_continue.2
MLINKS+=_lwp_getprivate.2 _lwp_setprivate.2
MLINKS+=madvise.2 posix_madvise.2
Index: src/lib/libc/sys/link.2
diff -u src/lib/libc/sys/link.2:1.22 src/lib/libc/sys/link.2:1.22.32.1
--- src/lib/libc/sys/link.2:1.22 Thu May 13 10:20:58 2004
+++ src/lib/libc/sys/link.2 Sat Sep 17 18:47:43 2011
@@ -1,6 +1,6 @@
-.\" $NetBSD: link.2,v 1.22 2004/05/13 10:20:58 wiz Exp $
+.\" $NetBSD: link.2,v 1.22.32.1 2011/09/17 18:47:43 bouyer Exp $
.\"
-.\" Copyright (c) 1980, 1991, 1993
+.\" Copyright (c) 1980, 1991, 1993, 2011
.\" The Regents of the University of California. All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -41,6 +41,8 @@
.In unistd.h
.Ft int
.Fn link "const char *name1" "const char *name2"
+.Ft int
+.Fn linkat "int fd1" "const char *name1" "int fd2" "const char *name2" "int flags"
.Sh DESCRIPTION
The
.Fn link
@@ -77,6 +79,26 @@
.Fa name1
may not be a directory unless the caller is the super-user
and the file system containing it supports linking to directories.
+.Pp
+When operating on a symlink,
+.Fn link
+resolves the symlink and creates a hard link on the target.
+.Fn linkat
+will do the same if
+.Dv AT_SYMLINK_FOLLOW
+is set in
+.Fa flags ,
+but it will link on the symlink itself if the flag is clear.
+.Pp
+At the moment,
+.Fn linkat
+is partially implemented. It will return
+.Er ENOSYS for
+.Fa fd1
+and
+.Fa fd2
+values different than
+.Dv AT_FDCWD .
.Sh RETURN VALUES
Upon successful completion, a value of 0 is returned.
Otherwise, a value of \-1 is returned and
@@ -156,6 +178,9 @@
.Sh SEE ALSO
.Xr symlink 2 ,
.Xr unlink 2
+.Sh BUGS
+.Fn linkat
+is partially implemented.
.Sh STANDARDS
The
.Fn link
Index: src/sys/kern/init_sysent.c
diff -u src/sys/kern/init_sysent.c:1.229 src/sys/kern/init_sysent.c:1.229.4.1
--- src/sys/kern/init_sysent.c:1.229 Thu Oct 16 20:12:23 2008
+++ src/sys/kern/init_sysent.c Sat Sep 17 18:47:45 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: init_sysent.c,v 1.229 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: init_sysent.c,v 1.229.4.1 2011/09/17 18:47:45 bouyer Exp $ */
/*
* System call switch table.
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.229 2008/10/16 20:12:23 wrstuden Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_sysent.c,v 1.229.4.1 2011/09/17 18:47:45 bouyer Exp $");
#include "opt_nfsserver.h"
#include "opt_ntp.h"
@@ -1088,115 +1088,115 @@
{ ns(struct sys___posix_fadvise50_args), 0,
(sy_call_t *)sys___posix_fadvise50 },/* 416 = __posix_fadvise50 */
{ 0, 0, 0,
- sys_nosys }, /* 417 = filler */
+ sys_nosys }, /* 417 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 418 = filler */
+ sys_nosys }, /* 418 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 419 = filler */
+ sys_nosys }, /* 419 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 420 = filler */
+ sys_nosys }, /* 420 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 421 = filler */
+ sys_nosys }, /* 421 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 422 = filler */
+ sys_nosys }, /* 422 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 423 = filler */
+ sys_nosys }, /* 423 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 424 = filler */
+ sys_nosys }, /* 424 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 425 = filler */
+ sys_nosys }, /* 425 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 426 = filler */
+ sys_nosys }, /* 426 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 427 = filler */
+ sys_nosys }, /* 427 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 428 = filler */
+ sys_nosys }, /* 428 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 429 = filler */
+ sys_nosys }, /* 429 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 430 = filler */
+ sys_nosys }, /* 430 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 431 = filler */
+ sys_nosys }, /* 431 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 432 = filler */
+ sys_nosys }, /* 432 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 433 = filler */
+ sys_nosys }, /* 433 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 434 = filler */
+ sys_nosys }, /* 434 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 435 = filler */
+ sys_nosys }, /* 435 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 436 = filler */
+ sys_nosys }, /* 436 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 437 = filler */
+ sys_nosys }, /* 437 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 438 = filler */
+ sys_nosys }, /* 438 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 439 = filler */
+ sys_nosys }, /* 439 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 440 = filler */
+ sys_nosys }, /* 440 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 441 = filler */
+ sys_nosys }, /* 441 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 442 = filler */
+ sys_nosys }, /* 442 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 443 = filler */
+ sys_nosys }, /* 443 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 444 = filler */
+ sys_nosys }, /* 444 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 445 = filler */
+ sys_nosys }, /* 445 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 446 = filler */
+ sys_nosys }, /* 446 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 447 = filler */
+ sys_nosys }, /* 447 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 448 = filler */
+ sys_nosys }, /* 448 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 449 = filler */
+ sys_nosys }, /* 449 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 450 = filler */
+ sys_nosys }, /* 450 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 451 = filler */
+ sys_nosys }, /* 451 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 452 = filler */
+ sys_nosys }, /* 452 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 453 = filler */
+ sys_nosys }, /* 453 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 454 = filler */
+ sys_nosys }, /* 454 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 455 = filler */
+ sys_nosys }, /* 455 = unimplemented */
{ 0, 0, 0,
- sys_nosys }, /* 456 = filler */
+ sys_nosys }, /* 456 = unimplemented */
+ { ns(struct sys_linkat_args), 0,
+ (sy_call_t *)sys_linkat }, /* 457 = linkat */
{ 0, 0, 0,
- sys_nosys }, /* 457 = filler */
+ sys_nosys }, /* 458 = unimplemented renameat */
{ 0, 0, 0,
- sys_nosys }, /* 458 = filler */
+ sys_nosys }, /* 459 = unimplemented mkfifoat */
{ 0, 0, 0,
- sys_nosys }, /* 459 = filler */
+ sys_nosys }, /* 460 = unimplemented mknodat */
{ 0, 0, 0,
- sys_nosys }, /* 460 = filler */
+ sys_nosys }, /* 461 = unimplemented mkdirat */
{ 0, 0, 0,
- sys_nosys }, /* 461 = filler */
+ sys_nosys }, /* 462 = unimplemented faccessat */
{ 0, 0, 0,
- sys_nosys }, /* 462 = filler */
+ sys_nosys }, /* 463 = unimplemented fchmodat */
{ 0, 0, 0,
- sys_nosys }, /* 463 = filler */
+ sys_nosys }, /* 464 = unimplemented fchownat */
{ 0, 0, 0,
- sys_nosys }, /* 464 = filler */
+ sys_nosys }, /* 465 = unimplemented fexecve */
{ 0, 0, 0,
- sys_nosys }, /* 465 = filler */
+ sys_nosys }, /* 466 = unimplemented fstatat */
{ 0, 0, 0,
- sys_nosys }, /* 466 = filler */
+ sys_nosys }, /* 467 = unimplemented utimensat */
{ 0, 0, 0,
- sys_nosys }, /* 467 = filler */
+ sys_nosys }, /* 468 = unimplemented openat */
{ 0, 0, 0,
- sys_nosys }, /* 468 = filler */
+ sys_nosys }, /* 469 = unimplemented readlinkat */
{ 0, 0, 0,
- sys_nosys }, /* 469 = filler */
+ sys_nosys }, /* 470 = unimplemented symlinkat */
{ 0, 0, 0,
- sys_nosys }, /* 470 = filler */
- { 0, 0, 0,
- sys_nosys }, /* 471 = filler */
+ sys_nosys }, /* 471 = unimplemented unlinkat */
{ 0, 0, 0,
sys_nosys }, /* 472 = filler */
{ 0, 0, 0,
Index: src/sys/kern/syscalls.c
diff -u src/sys/kern/syscalls.c:1.220 src/sys/kern/syscalls.c:1.220.4.1
--- src/sys/kern/syscalls.c:1.220 Thu Oct 16 20:12:23 2008
+++ src/sys/kern/syscalls.c Sat Sep 17 18:47:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: syscalls.c,v 1.220 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: syscalls.c,v 1.220.4.1 2011/09/17 18:47:46 bouyer Exp $ */
/*
* System call names.
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.220 2008/10/16 20:12:23 wrstuden Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscalls.c,v 1.220.4.1 2011/09/17 18:47:46 bouyer Exp $");
#if defined(_KERNEL_OPT)
#include "opt_nfsserver.h"
@@ -543,4 +543,59 @@
/* 414 */ "pset_assign",
/* 415 */ "_pset_bind",
/* 416 */ "__posix_fadvise50",
+ /* 417 */ "#417 (unimplemented)",
+ /* 418 */ "#418 (unimplemented)",
+ /* 419 */ "#419 (unimplemented)",
+ /* 420 */ "#420 (unimplemented)",
+ /* 421 */ "#421 (unimplemented)",
+ /* 422 */ "#422 (unimplemented)",
+ /* 423 */ "#423 (unimplemented)",
+ /* 424 */ "#424 (unimplemented)",
+ /* 425 */ "#425 (unimplemented)",
+ /* 426 */ "#426 (unimplemented)",
+ /* 427 */ "#427 (unimplemented)",
+ /* 428 */ "#428 (unimplemented)",
+ /* 429 */ "#429 (unimplemented)",
+ /* 430 */ "#430 (unimplemented)",
+ /* 431 */ "#431 (unimplemented)",
+ /* 432 */ "#432 (unimplemented)",
+ /* 433 */ "#433 (unimplemented)",
+ /* 434 */ "#434 (unimplemented)",
+ /* 435 */ "#435 (unimplemented)",
+ /* 436 */ "#436 (unimplemented)",
+ /* 437 */ "#437 (unimplemented)",
+ /* 438 */ "#438 (unimplemented)",
+ /* 439 */ "#439 (unimplemented)",
+ /* 440 */ "#440 (unimplemented)",
+ /* 441 */ "#441 (unimplemented)",
+ /* 442 */ "#442 (unimplemented)",
+ /* 443 */ "#443 (unimplemented)",
+ /* 444 */ "#444 (unimplemented)",
+ /* 445 */ "#445 (unimplemented)",
+ /* 446 */ "#446 (unimplemented)",
+ /* 447 */ "#447 (unimplemented)",
+ /* 448 */ "#448 (unimplemented)",
+ /* 449 */ "#449 (unimplemented)",
+ /* 450 */ "#450 (unimplemented)",
+ /* 451 */ "#451 (unimplemented)",
+ /* 452 */ "#452 (unimplemented)",
+ /* 453 */ "#453 (unimplemented)",
+ /* 454 */ "#454 (unimplemented)",
+ /* 455 */ "#455 (unimplemented)",
+ /* 456 */ "#456 (unimplemented)",
+ /* 457 */ "linkat",
+ /* 458 */ "#458 (unimplemented renameat)",
+ /* 459 */ "#459 (unimplemented mkfifoat)",
+ /* 460 */ "#460 (unimplemented mknodat)",
+ /* 461 */ "#461 (unimplemented mkdirat)",
+ /* 462 */ "#462 (unimplemented faccessat)",
+ /* 463 */ "#463 (unimplemented fchmodat)",
+ /* 464 */ "#464 (unimplemented fchownat)",
+ /* 465 */ "#465 (unimplemented fexecve)",
+ /* 466 */ "#466 (unimplemented fstatat)",
+ /* 467 */ "#467 (unimplemented utimensat)",
+ /* 468 */ "#468 (unimplemented openat)",
+ /* 469 */ "#469 (unimplemented readlinkat)",
+ /* 470 */ "#470 (unimplemented symlinkat)",
+ /* 471 */ "#471 (unimplemented unlinkat)",
};
Index: src/sys/kern/syscalls.master
diff -u src/sys/kern/syscalls.master:1.211 src/sys/kern/syscalls.master:1.211.4.1
--- src/sys/kern/syscalls.master:1.211 Thu Oct 16 19:30:49 2008
+++ src/sys/kern/syscalls.master Sat Sep 17 18:47:46 2011
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.211 2008/10/16 19:30:49 pooka Exp $
+ $NetBSD: syscalls.master,v 1.211.4.1 2011/09/17 18:47:46 bouyer Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -841,3 +841,59 @@
id_t second_id, psetid_t psid, psetid_t *opsid); }
416 STD { int sys___posix_fadvise50(int fd, int pad, \
off_t offset, off_t len, int advice); }
+417 UNIMPL
+418 UNIMPL
+419 UNIMPL
+420 UNIMPL
+421 UNIMPL
+422 UNIMPL
+423 UNIMPL
+424 UNIMPL
+425 UNIMPL
+426 UNIMPL
+427 UNIMPL
+428 UNIMPL
+429 UNIMPL
+430 UNIMPL
+431 UNIMPL
+432 UNIMPL
+433 UNIMPL
+434 UNIMPL
+435 UNIMPL
+436 UNIMPL
+437 UNIMPL
+438 UNIMPL
+439 UNIMPL
+440 UNIMPL
+441 UNIMPL
+442 UNIMPL
+443 UNIMPL
+444 UNIMPL
+445 UNIMPL
+446 UNIMPL
+447 UNIMPL
+448 UNIMPL
+449 UNIMPL
+450 UNIMPL
+451 UNIMPL
+452 UNIMPL
+453 UNIMPL
+454 UNIMPL
+455 UNIMPL
+456 UNIMPL
+457 STD RUMP { int sys_linkat(int fd1, const char *name1, \
+ int fd2, const char *name2, int flags); }
+458 UNIMPL renameat
+459 UNIMPL mkfifoat
+460 UNIMPL mknodat
+461 UNIMPL mkdirat
+462 UNIMPL faccessat
+463 UNIMPL fchmodat
+464 UNIMPL fchownat
+465 UNIMPL fexecve
+466 UNIMPL fstatat
+467 UNIMPL utimensat
+468 UNIMPL openat
+469 UNIMPL readlinkat
+470 UNIMPL symlinkat
+471 UNIMPL unlinkat
Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.376.4.6 src/sys/kern/vfs_syscalls.c:1.376.4.7
--- src/sys/kern/vfs_syscalls.c:1.376.4.6 Sun Mar 20 21:19:57 2011
+++ src/sys/kern/vfs_syscalls.c Sat Sep 17 18:47:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: vfs_syscalls.c,v 1.376.4.6 2011/03/20 21:19:57 bouyer Exp $ */
+/* $NetBSD: vfs_syscalls.c,v 1.376.4.7 2011/09/17 18:47:46 bouyer Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.376.4.6 2011/03/20 21:19:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.376.4.7 2011/09/17 18:47:46 bouyer Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_43.h"
@@ -76,6 +76,7 @@
#include <sys/filedesc.h>
#include <sys/kernel.h>
#include <sys/file.h>
+#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/vnode.h>
#include <sys/mount.h>
@@ -1997,26 +1998,28 @@
/*
* Make a hard file link.
+ * The flag argument can be
*/
/* ARGSUSED */
-int
-sys_link(struct lwp *l, const struct sys_link_args *uap, register_t *retval)
+static int
+do_sys_link(struct lwp *l, const char *path, const char *link,
+ int follow, register_t *retval)
{
- /* {
- syscallarg(const char *) path;
- syscallarg(const char *) link;
- } */
struct vnode *vp;
struct nameidata nd;
+ int namei_flags;
int error;
- NDINIT(&nd, LOOKUP, FOLLOW | TRYEMULROOT, UIO_USERSPACE,
- SCARG(uap, path));
+ if (follow)
+ namei_flags = FOLLOW | TRYEMULROOT;
+ else
+ namei_flags = TRYEMULROOT;
+
+ NDINIT(&nd, LOOKUP, namei_flags, UIO_USERSPACE, path);
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
- NDINIT(&nd, CREATE, LOCKPARENT | TRYEMULROOT, UIO_USERSPACE,
- SCARG(uap, link));
+ NDINIT(&nd, CREATE, LOCKPARENT | TRYEMULROOT, UIO_USERSPACE, link);
if ((error = namei(&nd)) != 0)
goto out;
if (nd.ni_vp) {
@@ -2035,6 +2038,45 @@
return (error);
}
+int
+sys_link(struct lwp *l, const struct sys_link_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(const char *) path;
+ syscallarg(const char *) link;
+ } */
+ const char *path = SCARG(uap, path);
+ const char *link = SCARG(uap, link);
+
+ return do_sys_link(l, path, link, 1, retval);
+}
+
+int
+sys_linkat(struct lwp *l, const struct sys_linkat_args *uap, register_t *retval)
+{
+ /* {
+ syscallarg(int) fd1;
+ syscallarg(const char *) name1;
+ syscallarg(int) fd2;
+ syscallarg(const char *) name2;
+ syscallarg(int) flags;
+ } */
+ const char *name1 = SCARG(uap, name1);
+ const char *name2 = SCARG(uap, name2);
+ int follow;
+
+ /*
+ * Specified fd1 and fd2 are not yet implemented
+ */
+ if ((SCARG(uap, fd1) != AT_FDCWD) || (SCARG(uap, fd2) != AT_FDCWD))
+ return ENOSYS;
+
+ follow = SCARG(uap, flags) & AT_SYMLINK_FOLLOW;
+
+ return do_sys_link(l, name1, name2, follow, retval);
+}
+
+
/*
* Make a symbolic link.
*/
Index: src/sys/rump/librump/rumpkern/rump_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.c:1.20 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.20.4.1
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.20 Thu Oct 16 20:12:23 2008
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c Sat Sep 17 18:47:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.20 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.20.4.1 2011/09/17 18:47:47 bouyer Exp $ */
/*
* System call marshalling for rump.
@@ -8,7 +8,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.20 2008/10/16 20:12:23 wrstuden Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.20.4.1 2011/09/17 18:47:47 bouyer Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -638,3 +638,22 @@
return retval;
}
__weak_alias(sys___socket30,rump_enosys);
+
+int
+rump_sys_linkat(int fd1, const char * name1, int fd2, const char * name2, int flags, int *error)
+{
+ register_t retval = 0;
+ struct sys_linkat_args arg;
+
+ SPARG(&arg, fd1) = fd1;
+ SPARG(&arg, name1) = name1;
+ SPARG(&arg, fd2) = fd2;
+ SPARG(&arg, name2) = name2;
+ SPARG(&arg, flags) = flags;
+
+ *error = sys_linkat(curlwp, &arg, &retval);
+ if (*error)
+ retval = -1;
+ return retval;
+}
+__weak_alias(sys_linkat,rump_enosys);
Index: src/sys/rump/librump/rumpkern/rump_syscalls.h
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.h:1.20 src/sys/rump/librump/rumpkern/rump_syscalls.h:1.20.4.1
--- src/sys/rump/librump/rumpkern/rump_syscalls.h:1.20 Thu Oct 16 20:12:23 2008
+++ src/sys/rump/librump/rumpkern/rump_syscalls.h Sat Sep 17 18:47:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.h,v 1.20 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: rump_syscalls.h,v 1.20.4.1 2011/09/17 18:47:47 bouyer Exp $ */
/*
* System call protos in rump namespace.
@@ -44,3 +44,4 @@
int rump_sys___stat30(const char *, struct stat *, int *);
int rump_sys___lstat30(const char *, struct stat *, int *);
int rump_sys___socket30(int, int, int, int *);
+int rump_sys_linkat(int, const char *, int, const char *, int, int *);
Index: src/sys/sys/fcntl.h
diff -u src/sys/sys/fcntl.h:1.34.64.1 src/sys/sys/fcntl.h:1.34.64.2
--- src/sys/sys/fcntl.h:1.34.64.1 Wed Mar 18 05:33:23 2009
+++ src/sys/sys/fcntl.h Sat Sep 17 18:47:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: fcntl.h,v 1.34.64.1 2009/03/18 05:33:23 snj Exp $ */
+/* $NetBSD: fcntl.h,v 1.34.64.2 2011/09/17 18:47:47 bouyer Exp $ */
/*-
* Copyright (c) 1983, 1990, 1993
@@ -271,6 +271,15 @@
#define POSIX_FADV_DONTNEED 4 /* not be needed in near future */
#define POSIX_FADV_NOREUSE 5 /* be accessed once */
+/*
+ * Constants for X/Open Extended API set 2 (a.k.a. C063)
+ */
+#if defined(_INCOMPLETE_XOPEN_C063) || defined(_KERNEL)
+#define AT_FDCWD -100 /* Use cwd for relative link target */
+#define AT_SYMLINK_FOLLOW 0x400 /* Follow symlinks */
+#endif
+
+
#ifndef _KERNEL
#include <sys/cdefs.h>
Index: src/sys/sys/syscall.h
diff -u src/sys/sys/syscall.h:1.217 src/sys/sys/syscall.h:1.217.4.1
--- src/sys/sys/syscall.h:1.217 Thu Oct 16 20:12:23 2008
+++ src/sys/sys/syscall.h Sat Sep 17 18:47:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: syscall.h,v 1.217 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: syscall.h,v 1.217.4.1 2011/09/17 18:47:47 bouyer Exp $ */
/*
* System call numbers.
@@ -1209,6 +1209,9 @@
/* syscall: "__posix_fadvise50" ret: "int" args: "int" "int" "off_t" "off_t" "int" */
#define SYS___posix_fadvise50 416
-#define SYS_MAXSYSCALL 417
+/* syscall: "linkat" ret: "int" args: "int" "const char *" "int" "const char *" "int" */
+#define SYS_linkat 457
+
+#define SYS_MAXSYSCALL 472
#define SYS_NSYSENT 512
#endif /* _SYS_SYSCALL_H_ */
Index: src/sys/sys/syscallargs.h
diff -u src/sys/sys/syscallargs.h:1.199 src/sys/sys/syscallargs.h:1.199.4.1
--- src/sys/sys/syscallargs.h:1.199 Thu Oct 16 20:12:23 2008
+++ src/sys/sys/syscallargs.h Sat Sep 17 18:47:47 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: syscallargs.h,v 1.199 2008/10/16 20:12:23 wrstuden Exp $ */
+/* $NetBSD: syscallargs.h,v 1.199.4.1 2011/09/17 18:47:47 bouyer Exp $ */
/*
* System call argument lists.
@@ -2288,6 +2288,15 @@
};
check_syscall_args(sys___posix_fadvise50)
+struct sys_linkat_args {
+ syscallarg(int) fd1;
+ syscallarg(const char *) name1;
+ syscallarg(int) fd2;
+ syscallarg(const char *) name2;
+ syscallarg(int) flags;
+};
+check_syscall_args(sys_linkat)
+
/*
* System call prototypes.
*/
@@ -3073,4 +3082,6 @@
int sys___posix_fadvise50(struct lwp *, const struct sys___posix_fadvise50_args *, register_t *);
+int sys_linkat(struct lwp *, const struct sys_linkat_args *, register_t *);
+
#endif /* _SYS_SYSCALLARGS_H_ */