summaryrefslogtreecommitdiff
path: root/libgo
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-17 18:41:12 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2013-10-17 18:41:12 +0000
commit51a6dfd0e77c00963c41cdbb5b9551cfc2cb0f03 (patch)
tree81d7fdbd8fba080a94f29216e39e955383aa3246 /libgo
parent66e3f7be49309d0fed9a8bf0e80b8019bc7d7287 (diff)
downloadlinaro-gcc-51a6dfd0e77c00963c41cdbb5b9551cfc2cb0f03.tar.gz
linaro-gcc-51a6dfd0e77c00963c41cdbb5b9551cfc2cb0f03.tar.bz2
linaro-gcc-51a6dfd0e77c00963c41cdbb5b9551cfc2cb0f03.zip
syscall: Add Dup3, {Get,List,Remove,Set}xattr, {Get,Set}priority.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@203788 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo')
-rw-r--r--libgo/config.h.in15
-rwxr-xr-xlibgo/configure2
-rw-r--r--libgo/configure.ac2
-rw-r--r--libgo/go/syscall/libcall_linux.go15
-rw-r--r--libgo/go/syscall/libcall_posix.go6
-rwxr-xr-xlibgo/mksysinfo.sh4
-rw-r--r--libgo/runtime/go-nosys.c57
7 files changed, 99 insertions, 2 deletions
diff --git a/libgo/config.h.in b/libgo/config.h.in
index 1057d9e85e4..f6da8b982c4 100644
--- a/libgo/config.h.in
+++ b/libgo/config.h.in
@@ -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
diff --git a/libgo/configure b/libgo/configure
index 40aeb0db211..90cafb58f1c 100755
--- a/libgo/configure
+++ b/libgo/configure
@@ -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"
diff --git a/libgo/configure.ac b/libgo/configure.ac
index ef5ea8396dd..f7b780be3b3 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -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])
diff --git a/libgo/go/syscall/libcall_linux.go b/libgo/go/syscall/libcall_linux.go
index 79de2f389e9..60eecd9ef89 100644
--- a/libgo/go/syscall/libcall_linux.go
+++ b/libgo/go/syscall/libcall_linux.go
@@ -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) {
diff --git a/libgo/go/syscall/libcall_posix.go b/libgo/go/syscall/libcall_posix.go
index 1e7823b541c..91ff59b6cfa 100644
--- a/libgo/go/syscall/libcall_posix.go
+++ b/libgo/go/syscall/libcall_posix.go
@@ -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
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 11bcb257a94..71c328627a6 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -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}
diff --git a/libgo/runtime/go-nosys.c b/libgo/runtime/go-nosys.c
index 3ab5ea235f2..f389dbe0cbe 100644
--- a/libgo/runtime/go-nosys.c
+++ b/libgo/runtime/go-nosys.c
@@ -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)),