syscall: Add Dup3, {Get,List,Remove,Set}xattr, {Get,Set}priority.

From-SVN: r203788
This commit is contained in:
Ian Lance Taylor 2013-10-17 18:41:12 +00:00
parent 82e3389090
commit d5b18b0b13
7 changed files with 99 additions and 2 deletions

View File

@ -39,6 +39,9 @@
/* Define to 1 if you have the `dl_iterate_phdr' function. */
#undef HAVE_DL_ITERATE_PHDR
/* Define to 1 if you have the `dup3' function. */
#undef HAVE_DUP3
/* Define to 1 if you have the `epoll_create1' function. */
#undef HAVE_EPOLL_CREATE1
@ -66,6 +69,9 @@
/* Define if _Unwind_GetIPInfo is available. */
#undef HAVE_GETIPINFO
/* Define to 1 if you have the `getxattr' function. */
#undef HAVE_GETXATTR
/* Define to 1 if you have the `inotify_add_watch' function. */
#undef HAVE_INOTIFY_ADD_WATCH
@ -111,6 +117,9 @@
/* Define to 1 if you have the <linux/rtnetlink.h> header file. */
#undef HAVE_LINUX_RTNETLINK_H
/* Define to 1 if you have the `listxattr' function. */
#undef HAVE_LISTXATTR
/* Define to 1 if the system has the type `loff_t'. */
#undef HAVE_LOFF_T
@ -171,6 +180,9 @@
/* Define to 1 if you have the `pipe2' function. */
#undef HAVE_PIPE2
/* Define to 1 if you have the `removexattr' function. */
#undef HAVE_REMOVEXATTR
/* Define to 1 if you have the `renameat' function. */
#undef HAVE_RENAMEAT
@ -180,6 +192,9 @@
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setxattr' function. */
#undef HAVE_SETXATTR
/* Define to 1 if you have the `sinl' function. */
#undef HAVE_SINL

2
libgo/configure vendored
View File

@ -14706,7 +14706,7 @@ else
fi
for ac_func in accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat
for ac_func in accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"

View File

@ -503,7 +503,7 @@ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv dl_iterate_phdr)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
AC_CHECK_FUNCS(accept4 epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_init1 inotify_rm_watch mkdirat mknodat openat pipe2 renameat sync_file_range splice tee unlinkat unshare utimensat)
AC_CHECK_FUNCS(accept4 dup3 epoll_create1 faccessat fallocate fchmodat fchownat futimesat getxattr inotify_add_watch inotify_init inotify_init1 inotify_rm_watch listxattr mkdirat mknodat openat pipe2 removexattr renameat setxattr sync_file_range splice tee unlinkat unshare utimensat)
AC_TYPE_OFF_T
AC_CHECK_TYPES([loff_t])

View File

@ -190,6 +190,9 @@ func Accept4(fd int, flags int) (nfd int, sa Sockaddr, err error) {
//sys Adjtimex(buf *Timex) (state int, err error)
//adjtimex(buf *Timex) _C_int
//sysnb Dup3(oldfd int, newfd int, flags int) (err error)
//dup3(oldfd _C_int, newfd _C_int, flags _C_int) _C_int
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
//faccessat(dirfd _C_int, pathname *byte, mode _C_int, flags _C_int) _C_int
@ -268,6 +271,9 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
return origlen - len(buf), count, names
}
//sys Getxattr(path string, attr string, dest []byte) (sz int, err error)
//getxattr(path *byte, attr *byte, buf *byte, count Size_t) Ssize_t
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
//inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int
@ -283,6 +289,9 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int,
//sys Klogctl(typ int, buf []byte) (n int, err error)
//klogctl(typ _C_int, bufp *byte, len _C_int) _C_int
//sys Listxattr(path string, dest []byte) (sz int, err error)
//listxattr(path *byte, list *byte, size Size_t) Ssize_t
//sys Mkdirat(dirfd int, path string, mode uint32) (err error)
//mkdirat(dirfd _C_int, path *byte, mode Mode_t) _C_int
@ -305,6 +314,9 @@ func Pipe2(p []int, flags int) (err error) {
//sys PivotRoot(newroot string, putold string) (err error)
//pivot_root(newroot *byte, putold *byte) _C_int
//sys Removexattr(path string, attr string) (err error)
//removexattr(path *byte, name *byte) _C_int
//sys Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error)
//renameat(olddirfd _C_int, oldpath *byte, newdirfd _C_int, newpath *byte) _C_int
@ -338,6 +350,9 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sysnb Setresuid(ruid int, eguid int, suid int) (err error)
//setresuid(ruid Uid_t, euid Uid_t, suid Uid_t) _C_int
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
//setxattr(path *byte, name *byte, value *byte, size Size_t, flags _C_int) _C_int
//sys splice(rfd int, roff *_loff_t, wfd int, woff *_loff_t, len int, flags int) (n int64, err error)
//splice(rfd _C_int, roff *_loff_t, wfd _C_int, woff *_loff_t, len Size_t, flags _C_uint) Ssize_t
func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int64, err error) {

View File

@ -238,6 +238,9 @@ func FDZero(set *FdSet) {
//sysnb Getppid() (ppid int)
//getppid() Pid_t
//sys Getpriority(which int, who int) (prio int, err error)
//getpriority(which _C_int, who _C_int) _C_int
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
//getrlimit(resource _C_int, rlim *Rlimit) _C_int
@ -307,6 +310,9 @@ func Gettimeofday(tv *Timeval) (err error) {
//sysnb Setpgid(pid int, pgid int) (err error)
//setpgid(pid Pid_t, pgid Pid_t) _C_int
//sys Setpriority(which int, who int, prio int) (err error)
//setpriority(which _C_int, who _C_int, prio _C_int) _C_int
//sysnb Setreuid(ruid int, euid int) (err error)
//setreuid(ruid Uid_t, euid Uid_t) _C_int

View File

@ -1035,6 +1035,10 @@ grep '^type _utimbuf ' gen-sysinfo.go | \
grep '^const _LOCK_' gen-sysinfo.go |
sed -e 's/^\(const \)_\(LOCK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
# The PRIO constants.
grep '^const _PRIO_' gen-sysinfo.go | \
sed -e 's/^\(const \)_\(PRIO_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
# The GNU/Linux LINUX_REBOOT flags.
grep '^const _LINUX_REBOOT_' gen-sysinfo.go |
sed -e 's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}

View File

@ -43,6 +43,17 @@ accept4 (int sockfd __attribute__ ((unused)),
}
#endif
#ifndef HAVE_DUP3
int
dup3 (int oldfd __attribute__ ((unused)),
int newfd __attribute__ ((unused)),
int flags __attribtue__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_EPOLL_CREATE1
int
epoll_create1 (int flags __attribute__ ((unused)))
@ -112,6 +123,18 @@ futimesat (int dirfd __attribute__ ((unused)),
}
#endif
#ifndef HAVE_GETXATTR
ssize_t
getxattr (const char *path __attribute__ ((unused)),
const char *name __attribute__ ((unused)),
void *value __attribute__ ((unused)),
size_t size __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_INOTIFY_ADD_WATCH
int
inotify_add_watch (int fd __attribute__ ((unused)),
@ -151,6 +174,17 @@ inotify_rm_watch (int fd __attribute__ ((unused)),
}
#endif
#ifndef HAVE_LISTXATTR
ssize_t
listxattr (const char *path __attribute__ ((unused)),
char *list __attribute__ ((unused)),
size_t size __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_MKDIRAT
int
mkdirat (int dirfd __attribute__ ((unused)),
@ -196,6 +230,16 @@ pipe2 (int pipefd[2] __attribute__ ((unused)),
}
#endif
#ifndef HAVE_REMOVEXATTR
int
removexattr (const char *path __attribute__ ((unused)),
const char *name __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_RENAMEAT
int
renameat (int olddirfd __attribute__ ((unused)),
@ -208,6 +252,19 @@ renameat (int olddirfd __attribute__ ((unused)),
}
#endif
#ifndef HAVE_SETXATTR
int
setxattr (const char *path __attribute__ ((unused)),
const char *name __attribute__ ((unused)),
const void *value __attribute__ ((unused)),
size_t size __attribute__ ((unused)),
int flags __attribute__ ((unused)))
{
errno = ENOSYS;
return -1;
}
#endif
#ifndef HAVE_SPLICE
int
splice (int fd __attribute__ ((unused)),