Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
b65734ac
Commit
b65734ac
authored
Feb 29, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall: Fill out GNU/Linux support.
From-SVN: r184669
parent
3f675741
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
269 additions
and
47 deletions
+269
-47
libgo/Makefile.am
+8
-0
libgo/Makefile.in
+5
-0
libgo/config.h.in
+21
-0
libgo/configure
+2
-2
libgo/configure.ac
+2
-2
libgo/go/syscall/libcall_linux.go
+72
-29
libgo/go/syscall/libcall_posix.go
+20
-12
libgo/go/syscall/lsf_linux.go
+2
-2
libgo/mksysinfo.sh
+116
-0
libgo/runtime/go-nosys.c
+21
-0
No files found.
libgo/Makefile.am
View file @
b65734ac
...
@@ -1489,6 +1489,13 @@ else
...
@@ -1489,6 +1489,13 @@ else
syscall_netlink_file
=
syscall_netlink_file
=
endif
endif
# GNU/Linux specific socket filters.
if
LIBGO_IS_LINUX
syscall_lsf_file
=
go/syscall/lsf_linux.go
else
syscall_lsf_file
=
endif
go_base_syscall_files
=
\
go_base_syscall_files
=
\
go/syscall/env_unix.go
\
go/syscall/env_unix.go
\
go/syscall/syscall_errno.go
\
go/syscall/syscall_errno.go
\
...
@@ -1509,6 +1516,7 @@ go_base_syscall_files = \
...
@@ -1509,6 +1516,7 @@ go_base_syscall_files = \
$(syscall_socket_file)
\
$(syscall_socket_file)
\
$(syscall_uname_file)
\
$(syscall_uname_file)
\
$(syscall_netlink_file)
\
$(syscall_netlink_file)
\
$(syscall_lsf_file)
\
$(GO_LIBCALL_OS_FILE)
\
$(GO_LIBCALL_OS_FILE)
\
$(GO_LIBCALL_OS_ARCH_FILE)
\
$(GO_LIBCALL_OS_ARCH_FILE)
\
$(GO_SYSCALL_OS_FILE)
\
$(GO_SYSCALL_OS_FILE)
\
...
...
libgo/Makefile.in
View file @
b65734ac
...
@@ -1795,6 +1795,10 @@ go_unicode_utf8_files = \
...
@@ -1795,6 +1795,10 @@ go_unicode_utf8_files = \
# Support for netlink sockets and messages.
# Support for netlink sockets and messages.
@LIBGO_IS_LINUX_TRUE@
syscall_netlink_file
=
go/syscall/netlink_linux.go
@LIBGO_IS_LINUX_TRUE@
syscall_netlink_file
=
go/syscall/netlink_linux.go
@LIBGO_IS_LINUX_FALSE@
syscall_lsf_file
=
# GNU/Linux specific socket filters.
@LIBGO_IS_LINUX_TRUE@
syscall_lsf_file
=
go/syscall/lsf_linux.go
go_base_syscall_files
=
\
go_base_syscall_files
=
\
go/syscall/env_unix.go
\
go/syscall/env_unix.go
\
go/syscall/syscall_errno.go
\
go/syscall/syscall_errno.go
\
...
@@ -1815,6 +1819,7 @@ go_base_syscall_files = \
...
@@ -1815,6 +1819,7 @@ go_base_syscall_files = \
$(syscall_socket_file)
\
$(syscall_socket_file)
\
$(syscall_uname_file)
\
$(syscall_uname_file)
\
$(syscall_netlink_file)
\
$(syscall_netlink_file)
\
$(syscall_lsf_file)
\
$(GO_LIBCALL_OS_FILE)
\
$(GO_LIBCALL_OS_FILE)
\
$(GO_LIBCALL_OS_ARCH_FILE)
\
$(GO_LIBCALL_OS_ARCH_FILE)
\
$(GO_SYSCALL_OS_FILE)
\
$(GO_SYSCALL_OS_FILE)
\
...
...
libgo/config.h.in
View file @
b65734ac
...
@@ -33,6 +33,9 @@
...
@@ -33,6 +33,9 @@
/* Define to 1 if you have the `inotify_init' function. */
/* Define to 1 if you have the `inotify_init' function. */
#undef HAVE_INOTIFY_INIT
#undef HAVE_INOTIFY_INIT
/* Define to 1 if you have the `inotify_init1' function. */
#undef HAVE_INOTIFY_INIT1
/* Define to 1 if you have the `inotify_rm_watch' function. */
/* Define to 1 if you have the `inotify_rm_watch' function. */
#undef HAVE_INOTIFY_RM_WATCH
#undef HAVE_INOTIFY_RM_WATCH
...
@@ -45,6 +48,9 @@
...
@@ -45,6 +48,9 @@
/* Define to 1 if you have the <linux/netlink.h> header file. */
/* Define to 1 if you have the <linux/netlink.h> header file. */
#undef HAVE_LINUX_NETLINK_H
#undef HAVE_LINUX_NETLINK_H
/* Define to 1 if you have the <linux/reboot.h> header file. */
#undef HAVE_LINUX_REBOOT_H
/* Define to 1 if you have the <linux/rtnetlink.h> header file. */
/* Define to 1 if you have the <linux/rtnetlink.h> header file. */
#undef HAVE_LINUX_RTNETLINK_H
#undef HAVE_LINUX_RTNETLINK_H
...
@@ -124,6 +130,9 @@
...
@@ -124,6 +130,9 @@
uint32 */
uint32 */
#undef HAVE_SYNC_FETCH_AND_ADD_4
#undef HAVE_SYNC_FETCH_AND_ADD_4
/* Define to 1 if you have the `sync_file_range' function. */
#undef HAVE_SYNC_FILE_RANGE
/* Define to 1 if you have the <syscall.h> header file. */
/* Define to 1 if you have the <syscall.h> header file. */
#undef HAVE_SYSCALL_H
#undef HAVE_SYSCALL_H
...
@@ -157,6 +166,12 @@
...
@@ -157,6 +166,12 @@
/* Define to 1 if you have the <sys/syscall.h> header file. */
/* Define to 1 if you have the <sys/syscall.h> header file. */
#undef HAVE_SYS_SYSCALL_H
#undef HAVE_SYS_SYSCALL_H
/* Define to 1 if you have the <sys/sysinfo.h> header file. */
#undef HAVE_SYS_SYSINFO_H
/* Define to 1 if you have the <sys/timex.h> header file. */
#undef HAVE_SYS_TIMEX_H
/* Define to 1 if you have the <sys/types.h> header file. */
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
#undef HAVE_SYS_TYPES_H
...
@@ -181,6 +196,12 @@
...
@@ -181,6 +196,12 @@
/* Define to 1 if you have the `unshare' function. */
/* Define to 1 if you have the `unshare' function. */
#undef HAVE_UNSHARE
#undef HAVE_UNSHARE
/* Define to 1 if you have the <ustat.h> header file. */
#undef HAVE_USTAT_H
/* Define to 1 if you have the <utime.h> header file. */
#undef HAVE_UTIME_H
/* Define to 1 if you have the `wait4' function. */
/* Define to 1 if you have the `wait4' function. */
#undef HAVE_WAIT4
#undef HAVE_WAIT4
...
...
libgo/configure
View file @
b65734ac
...
@@ -14508,7 +14508,7 @@ no)
...
@@ -14508,7 +14508,7 @@ no)
;;
;;
esac
esac
for
ac_header
in
sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h
for
ac_header
in
sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h
sys/timex.h sys/sysinfo.h ustat.h utime.h linux/reboot.h
do
:
do
:
as_ac_Header
=
`
$as_echo
"ac_cv_header_
$ac_header
"
|
$as_tr_sh
`
as_ac_Header
=
`
$as_echo
"ac_cv_header_
$ac_header
"
|
$as_tr_sh
`
ac_fn_c_check_header_mongrel
"
$LINENO
"
"
$ac_header
"
"
$as_ac_Header
"
"
$ac_includes_default
"
ac_fn_c_check_header_mongrel
"
$LINENO
"
"
$ac_header
"
"
$as_ac_Header
"
"
$ac_includes_default
"
...
@@ -14581,7 +14581,7 @@ else
...
@@ -14581,7 +14581,7 @@ else
fi
fi
for
ac_func
in
epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_
rm_watch mkdirat mknodat openat renameat
splice tee unlinkat unshare
for
ac_func
in
epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_
init1 inotify_rm_watch mkdirat mknodat openat renameat sync_file_range
splice tee unlinkat unshare
do
:
do
:
as_ac_var
=
`
$as_echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
as_ac_var
=
`
$as_echo
"ac_cv_func_
$ac_func
"
|
$as_tr_sh
`
ac_fn_c_check_func
"
$LINENO
"
"
$ac_func
"
"
$as_ac_var
"
ac_fn_c_check_func
"
$LINENO
"
"
$ac_func
"
"
$as_ac_var
"
...
...
libgo/configure.ac
View file @
b65734ac
...
@@ -453,7 +453,7 @@ no)
...
@@ -453,7 +453,7 @@ no)
;;
;;
esac
esac
AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h)
AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h
sys/timex.h sys/sysinfo.h ustat.h utime.h linux/reboot.h
)
AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
AC_CHECK_HEADERS([linux/filter.h linux/netlink.h linux/rtnetlink.h], [], [],
[#ifdef HAVE_SYS_SOCKET_H
[#ifdef HAVE_SYS_SOCKET_H
...
@@ -467,7 +467,7 @@ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv)
...
@@ -467,7 +467,7 @@ AC_CHECK_FUNCS(strerror_r strsignal wait4 mincore setenv)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_STRERROR_R, test "$ac_cv_func_strerror_r" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
AM_CONDITIONAL(HAVE_WAIT4, test "$ac_cv_func_wait4" = yes)
AC_CHECK_FUNCS(epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_
rm_watch mkdirat mknodat openat renameat
splice tee unlinkat unshare)
AC_CHECK_FUNCS(epoll_create1 faccessat fallocate fchmodat fchownat futimesat inotify_add_watch inotify_init inotify_
init1 inotify_rm_watch mkdirat mknodat openat renameat sync_file_range
splice tee unlinkat unshare)
AC_TYPE_OFF_T
AC_TYPE_OFF_T
AC_CHECK_TYPES([loff_t])
AC_CHECK_TYPES([loff_t])
...
...
libgo/go/syscall/libcall_linux.go
View file @
b65734ac
...
@@ -160,20 +160,17 @@ func PtraceAttach(pid int) (err error) { return ptrace(PTRACE_ATTACH, pid, 0, 0)
...
@@ -160,20 +160,17 @@ func PtraceAttach(pid int) (err error) { return ptrace(PTRACE_ATTACH, pid, 0, 0)
func
PtraceDetach
(
pid
int
)
(
err
error
)
{
return
ptrace
(
PTRACE_DETACH
,
pid
,
0
,
0
)
}
func
PtraceDetach
(
pid
int
)
(
err
error
)
{
return
ptrace
(
PTRACE_DETACH
,
pid
,
0
,
0
)
}
// FIXME: mksysinfo needs to produce LINUX_REBOOT_MAGIC[12].
//sys reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error)
//reboot(magic1 uint, magic2 uint, cmd int, arg *byte) int
// //sys reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error)
func
Reboot
(
cmd
int
)
(
err
error
)
{
// //reboot(magic1 uint, magic2 uint, cmd int, arg *byte) int
return
reboot
(
LINUX_REBOOT_MAGIC1
,
LINUX_REBOOT_MAGIC2
,
cmd
,
""
)
// func Reboot(cmd int) (err error) {
}
// return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "")
// }
//sys Acct(path string) (err error)
//sys Acct(path string) (err error)
//acct(path *byte) int
//acct(path *byte) int
// FIXME: mksysinfo Timex
//sys Adjtimex(buf *Timex) (state int, err error)
// //sys Adjtimex(buf *Timex) (state int, err error)
//adjtimex(buf *Timex) int
// //adjtimex(buf *Timex) int
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
//sys Faccessat(dirfd int, path string, mode uint32, flags int) (err error)
//faccessat(dirfd int, pathname *byte, mode int, flags int) int
//faccessat(dirfd int, pathname *byte, mode int, flags int) int
...
@@ -198,10 +195,56 @@ func Gettid() (tid int) {
...
@@ -198,10 +195,56 @@ func Gettid() (tid int) {
return
int
(
r1
)
return
int
(
r1
)
}
}
// FIXME: mksysinfo linux_dirent
func
Getdents
(
fd
int
,
buf
[]
byte
)
(
n
int
,
err
error
)
{
// Or just abandon this function.
var
p
*
byte
// //sys Getdents(fd int, buf []byte) (n int, err error)
if
len
(
buf
)
>
0
{
// //getdents64(fd int, buf *byte, count uint)
p
=
&
buf
[
0
]
}
else
{
p
=
(
*
byte
)(
unsafe
.
Pointer
(
&
_zero
))
}
entersyscall
()
r1
,
_
,
errno
:=
Syscall
(
SYS_GETDENTS64
,
uintptr
(
fd
),
uintptr
(
unsafe
.
Pointer
(
p
)),
uintptr
(
len
(
buf
)))
n
=
int
(
r1
)
if
n
<
0
{
err
=
errno
}
exitsyscall
()
return
}
func
clen
(
n
[]
byte
)
int
{
for
i
:=
0
;
i
<
len
(
n
);
i
++
{
if
n
[
i
]
==
0
{
return
i
}
}
return
len
(
n
)
}
func
ReadDirent
(
fd
int
,
buf
[]
byte
)
(
n
int
,
err
error
)
{
return
Getdents
(
fd
,
buf
)
}
func
ParseDirent
(
buf
[]
byte
,
max
int
,
names
[]
string
)
(
consumed
int
,
count
int
,
newnames
[]
string
)
{
origlen
:=
len
(
buf
)
count
=
0
for
max
!=
0
&&
len
(
buf
)
>
0
{
dirent
:=
(
*
Dirent
)(
unsafe
.
Pointer
(
&
buf
[
0
]))
buf
=
buf
[
dirent
.
Reclen
:
]
if
dirent
.
Ino
==
0
{
// File absent in directory.
continue
}
bytes
:=
(
*
[
10000
]
byte
)(
unsafe
.
Pointer
(
&
dirent
.
Name
[
0
]))
var
name
=
string
(
bytes
[
0
:
clen
(
bytes
[
:
])])
if
name
==
"."
||
name
==
".."
{
// Useless names
continue
}
max
--
count
++
names
=
append
(
names
,
name
)
}
return
origlen
-
len
(
buf
),
count
,
names
}
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
//sys InotifyAddWatch(fd int, pathname string, mask uint32) (watchdesc int, err error)
//inotify_add_watch(fd int, pathname *byte, mask uint32) int
//inotify_add_watch(fd int, pathname *byte, mask uint32) int
...
@@ -209,9 +252,8 @@ func Gettid() (tid int) {
...
@@ -209,9 +252,8 @@ func Gettid() (tid int) {
//sysnb InotifyInit() (fd int, err error)
//sysnb InotifyInit() (fd int, err error)
//inotify_init() int
//inotify_init() int
// FIXME: Only in glibc 2.9 and later.
//sysnb InotifyInit1(flags int) (fd int, err error)
// //sysnb InotifyInit1(flags int) (fd int, err error)
//inotify_init1(flags int) int
// //inotify_init1(flags int) int
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
//sysnb InotifyRmWatch(fd int, watchdesc uint32) (success int, err error)
//inotify_rm_watch(fd int, wd uint32) int
//inotify_rm_watch(fd int, wd uint32) int
...
@@ -284,20 +326,22 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i
...
@@ -284,20 +326,22 @@ func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n i
//sys Statfs(path string, buf *Statfs_t) (err error)
//sys Statfs(path string, buf *Statfs_t) (err error)
//statfs(path *byte, buf *Statfs_t) int
//statfs(path *byte, buf *Statfs_t) int
// FIXME: Only in glibc 2.6 and later.
//sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
// //sys SyncFileRange(fd int, off int64, n int64, flags int) (err error)
//sync_file_range(fd int, off Offset_t, n Offset_t, flags uint) int
// //sync_file_range(fd int, off Offset_t, n Offset_t, flags uint) int
// FIXME: mksysinfo Sysinfo_t
//sysnb Sysinfo(info *Sysinfo_t) (err error)
// //sysnb Sysinfo(info *Sysinfo_t) (err error)
//sysinfo(info *Sysinfo_t) int
// //sysinfo(info *Sysinfo_t) int
//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
//sys Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
//tee(rfd int, wfd int, len Size_t, flags uint) Ssize_t
//tee(rfd int, wfd int, len Size_t, flags uint) Ssize_t
// FIXME: Only available as a syscall.
func
Tgkill
(
tgid
,
tid
,
sig
int
)
error
{
// //sysnb Tgkill(tgid int, tid int, sig int) (err error)
r1
,
_
,
errno
:=
Syscall
(
SYS_TGKILL
,
uintptr
(
tgid
),
uintptr
(
tid
),
uintptr
(
sig
))
// //tgkill(tgid int, tid int, sig int) int
if
r1
<
0
{
return
errno
}
return
nil
}
//sys unlinkat(dirfd int, path string, flags int) (err error)
//sys unlinkat(dirfd int, path string, flags int) (err error)
//unlinkat(dirfd int, path *byte, flags int) int
//unlinkat(dirfd int, path *byte, flags int) int
...
@@ -312,6 +356,5 @@ func Unlinkat(dirfd int, path string) (err error) {
...
@@ -312,6 +356,5 @@ func Unlinkat(dirfd int, path string) (err error) {
//sys Unshare(flags int) (err error)
//sys Unshare(flags int) (err error)
//unshare(flags int) int
//unshare(flags int) int
// FIXME: mksysinfo Ustat_t
//sys Ustat(dev int, ubuf *Ustat_t) (err error)
// //sys Ustat(dev int, ubuf *Ustat_t) (err error)
//ustat(dev _dev_t, ubuf *Ustat_t) int
// //ustat(dev _dev_t, ubuf *Ustat_t) int
libgo/go/syscall/libcall_posix.go
View file @
b65734ac
...
@@ -61,6 +61,18 @@ func Getwd() (ret string, err error) {
...
@@ -61,6 +61,18 @@ func Getwd() (ret string, err error) {
}
}
}
}
func
Getcwd
(
buf
[]
byte
)
(
n
int
,
err
error
)
{
err
=
getcwd
(
&
buf
[
0
],
Size_t
(
len
(
buf
)))
if
err
==
nil
{
i
:=
0
for
buf
[
i
]
!=
0
{
i
++
}
n
=
i
+
1
}
return
}
//sysnb getgroups(size int, list *Gid_t) (nn int, err error)
//sysnb getgroups(size int, list *Gid_t) (nn int, err error)
//getgroups(size int, list *Gid_t) int
//getgroups(size int, list *Gid_t) int
...
@@ -226,9 +238,8 @@ func FDZero(set *FdSet) {
...
@@ -226,9 +238,8 @@ func FDZero(set *FdSet) {
//sysnb Getppid() (ppid int)
//sysnb Getppid() (ppid int)
//getppid() Pid_t
//getppid() Pid_t
// FIXME: mksysinfo Rlimit
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
// //sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
//getrlimit(resource int, rlim *Rlimit) int
// //getrlimit(resource int, rlim *Rlimit) int
//sysnb Getrusage(who int, rusage *Rusage) (err error)
//sysnb Getrusage(who int, rusage *Rusage) (err error)
//getrusage(who int, rusage *Rusage) int
//getrusage(who int, rusage *Rusage) int
...
@@ -296,9 +307,8 @@ func Gettimeofday(tv *Timeval) (err error) {
...
@@ -296,9 +307,8 @@ func Gettimeofday(tv *Timeval) (err error) {
//sysnb Setreuid(ruid int, euid int) (err error)
//sysnb Setreuid(ruid int, euid int) (err error)
//setreuid(ruid Uid_t, euid Uid_t) int
//setreuid(ruid Uid_t, euid Uid_t) int
// FIXME: mksysinfo Rlimit
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
// //sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
//setrlimit(resource int, rlim *Rlimit) int
// //setrlimit(resource int, rlim *Rlimit) int
//sysnb Setsid() (pid int, err error)
//sysnb Setsid() (pid int, err error)
//setsid() Pid_t
//setsid() Pid_t
...
@@ -319,9 +329,8 @@ func Settimeofday(tv *Timeval) (err error) {
...
@@ -319,9 +329,8 @@ func Settimeofday(tv *Timeval) (err error) {
//sys Sync()
//sys Sync()
//sync()
//sync()
// FIXME: mksysinfo Time_t
//sysnb Time(t *Time_t) (tt Time_t, err error)
// //sysnb Time(t *Time_t) (tt Time_t, err error)
//time(t *Time_t) Time_t
// //time(t *Time_t) Time_t
//sysnb Times(tms *Tms) (ticks uintptr, err error)
//sysnb Times(tms *Tms) (ticks uintptr, err error)
//times(tms *Tms) _clock_t
//times(tms *Tms) _clock_t
...
@@ -332,9 +341,8 @@ func Settimeofday(tv *Timeval) (err error) {
...
@@ -332,9 +341,8 @@ func Settimeofday(tv *Timeval) (err error) {
//sys Unlink(path string) (err error)
//sys Unlink(path string) (err error)
//unlink(path *byte) int
//unlink(path *byte) int
// FIXME: mksysinfo Utimbuf
//sys Utime(path string, buf *Utimbuf) (err error)
// //sys Utime(path string, buf *Utimbuf) (err error)
//utime(path *byte, buf *Utimbuf) int
// //utime(path *byte, buf *Utimbuf) int
//sys Write(fd int, p []byte) (n int, err error)
//sys Write(fd int, p []byte) (n int, err error)
//write(fd int, buf *byte, count Size_t) Ssize_t
//write(fd int, buf *byte, count Size_t) Ssize_t
...
...
libgo/go/syscall/lsf_linux.go
View file @
b65734ac
...
@@ -69,10 +69,10 @@ func AttachLsf(fd int, i []SockFilter) error {
...
@@ -69,10 +69,10 @@ func AttachLsf(fd int, i []SockFilter) error {
var
p
SockFprog
var
p
SockFprog
p
.
Len
=
uint16
(
len
(
i
))
p
.
Len
=
uint16
(
len
(
i
))
p
.
Filter
=
(
*
SockFilter
)(
unsafe
.
Pointer
(
&
i
[
0
]))
p
.
Filter
=
(
*
SockFilter
)(
unsafe
.
Pointer
(
&
i
[
0
]))
return
setsockopt
(
fd
,
SOL_SOCKET
,
SO_ATTACH_FILTER
,
uintptr
(
unsafe
.
Pointer
(
&
p
)),
unsafe
.
Sizeof
(
p
))
return
setsockopt
(
fd
,
SOL_SOCKET
,
SO_ATTACH_FILTER
,
(
*
byte
)(
unsafe
.
Pointer
(
&
p
)),
Socklen_t
(
unsafe
.
Sizeof
(
p
)
))
}
}
func
DetachLsf
(
fd
int
)
error
{
func
DetachLsf
(
fd
int
)
error
{
var
dummy
int
var
dummy
int
return
setsockopt
(
fd
,
SOL_SOCKET
,
SO_DETACH_FILTER
,
uintptr
(
unsafe
.
Pointer
(
&
dummy
)),
unsafe
.
Sizeof
(
dummy
))
return
setsockopt
(
fd
,
SOL_SOCKET
,
SO_DETACH_FILTER
,
(
*
byte
)(
unsafe
.
Pointer
(
&
dummy
)),
Socklen_t
(
unsafe
.
Sizeof
(
dummy
)
))
}
}
libgo/mksysinfo.sh
View file @
b65734ac
...
@@ -78,6 +78,7 @@ cat > sysinfo.c <<EOF
...
@@ -78,6 +78,7 @@ cat > sysinfo.c <<EOF
#if defined(HAVE_SYS_SELECT_H)
#if defined(HAVE_SYS_SELECT_H)
#include <sys/select.h>
#include <sys/select.h>
#endif
#endif
#include <time.h>
#include <unistd.h>
#include <unistd.h>
#include <netdb.h>
#include <netdb.h>
#include <pwd.h>
#include <pwd.h>
...
@@ -102,6 +103,21 @@ cat > sysinfo.c <<EOF
...
@@ -102,6 +103,21 @@ cat > sysinfo.c <<EOF
#if defined(HAVE_STATFS_H)
#if defined(HAVE_STATFS_H)
#include <sys/statfs.h>
#include <sys/statfs.h>
#endif
#endif
#if defined(HAVE_SYS_TIMEX_H)
#include <sys/timex.h>
#endif
#if defined(HAVE_SYS_SYSINFO_H)
#include <sys/sysinfo.h>
#endif
#if defined(HAVE_USTAT_H)
#include <ustat.h>
#endif
#if defined(HAVE_UTIME_H)
#include <utime.h>
#endif
#if defined(HAVE_LINUX_REBOOT_H)
#include <linux/reboot.h>
#endif
/* Constants that may only be defined as expressions on some systems,
/* Constants that may only be defined as expressions on some systems,
expressions too complex for -fdump-go-spec to handle. These are
expressions too complex for -fdump-go-spec to handle. These are
...
@@ -339,6 +355,11 @@ if grep "^// type _upad128_t" gen-sysinfo.go > /dev/null 2>&1; then
...
@@ -339,6 +355,11 @@ if grep "^// type _upad128_t" gen-sysinfo.go > /dev/null 2>&1; then
echo
"type _upad128_t struct { _l [4]uint32; }"
>>
${
OUT
}
echo
"type _upad128_t struct { _l [4]uint32; }"
>>
${
OUT
}
fi
fi
# The time_t type.
if
grep
'^type _time_t '
gen-sysinfo.go
>
/dev/null 2>&1
;
then
echo
'type Time_t _time_t'
>>
${
OUT
}
fi
# The time structures need special handling: we need to name the
# The time structures need special handling: we need to name the
# types, so that we can cast integers to the right types when
# types, so that we can cast integers to the right types when
# assigning to the structures.
# assigning to the structures.
...
@@ -712,6 +733,10 @@ grep '^const _IFLA' gen-sysinfo.go | \
...
@@ -712,6 +733,10 @@ grep '^const _IFLA' gen-sysinfo.go | \
sed
-e
's/^\(const \)_\(IFLA[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
sed
-e
's/^\(const \)_\(IFLA[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
grep
'^const _IFF'
gen-sysinfo.go |
\
grep
'^const _IFF'
gen-sysinfo.go |
\
sed
-e
's/^\(const \)_\(IFF[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
sed
-e
's/^\(const \)_\(IFF[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
grep
'^const _IFNAMSIZ'
gen-sysinfo.go |
\
sed
-e
's/^\(const \)_\(IFNAMSIZ[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
grep
'^const _SIOC'
gen-sysinfo.go |
sed
-e
's/^\(const \)_\(SIOC[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
# The size of the ifinfomsg struct.
# The size of the ifinfomsg struct.
if
grep
'type IfInfomsg '
${
OUT
}
>
/dev/null 2>&1
;
then
if
grep
'type IfInfomsg '
${
OUT
}
>
/dev/null 2>&1
;
then
...
@@ -806,4 +831,95 @@ fi | sed -e 's/type _statfs64/type Statfs_t/' \
...
@@ -806,4 +831,95 @@ fi | sed -e 's/type _statfs64/type Statfs_t/' \
-e
's/f_spare/Spare/'
\
-e
's/f_spare/Spare/'
\
>>
${
OUT
}
>>
${
OUT
}
# The timex struct.
grep
'^type _timex '
gen-sysinfo.go |
\
sed
-e
's/_timex/Timex/'
\
-e
's/modes/Modes/'
\
-e
's/offset/Offset/'
\
-e
's/freq/Freq/'
\
-e
's/maxerror/Maxerror/'
\
-e
's/esterror/Esterror/'
\
-e
's/status/Status/'
\
-e
's/constant/Constant/'
\
-e
's/precision/Precision/'
\
-e
's/tolerance/Tolerance/'
\
-e
's/ time / Time /'
\
-e
's/tick/Tick/'
\
-e
's/ppsfreq/Ppsfreq/'
\
-e
's/jitter/Jitter/'
\
-e
's/shift/Shift/'
\
-e
's/stabil/Stabil/'
\
-e
's/jitcnt/Jitcnt/'
\
-e
's/calcnt/Calcnt/'
\
-e
's/errcnt/Errcnt/'
\
-e
's/stbcnt/Stbcnt/'
\
-e
's/tai/Tai/'
\
-e
's/_timeval/Timeval/'
\
>>
${
OUT
}
# The rlimit struct.
grep
'^type _rlimit '
gen-sysinfo.go |
\
sed
-e
's/_rlimit/Rlimit/'
\
-e
's/rlim_cur/Cur/'
\
-e
's/rlim_max/Max/'
\
>>
${
OUT
}
# The RLIMIT constants.
grep
'^const _RLIMIT_'
gen-sysinfo.go |
sed
-e
's/^\(const \)_\(RLIMIT_[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
# The sysinfo struct.
grep
'^type _sysinfo '
gen-sysinfo.go |
\
sed
-e
's/_sysinfo/Sysinfo_t/'
\
-e
's/uptime/Uptime/'
\
-e
's/loads/Loads/'
\
-e
's/totalram/Totalram/'
\
-e
's/freeram/Freeram/'
\
-e
's/sharedram/Sharedram/'
\
-e
's/bufferram/Bufferram/'
\
-e
's/totalswap/Totalswap/'
\
-e
's/freeswap/Freeswap/'
\
-e
's/procs/Procs/'
\
-e
's/totalhigh/Totalhigh/'
\
-e
's/freehigh/Freehigh/'
\
-e
's/mem_unit/Unit/'
\
>>
${
OUT
}
# The ustat struct.
grep
'^type _ustat '
gen-sysinfo.go |
\
sed
-e
's/_ustat/Ustat_t/'
\
-e
's/f_tfree/Tfree/'
\
-e
's/f_tinode/Tinoe/'
\
-e
's/f_fname/Fname/'
\
-e
's/f_fpack/Fpack/'
\
>>
${
OUT
}
# The utimbuf struct.
grep
'^type _utimbuf '
gen-sysinfo.go |
\
sed
-e
's/_utimbuf/Utimbuf/'
\
-e
's/actime/Actime/'
\
-e
's/modtime/Modtime/'
\
>>
${
OUT
}
# The GNU/Linux LINUX_REBOOT flags.
grep
'^const _LINUX_REBOOT_'
gen-sysinfo.go |
sed
-e
's/^\(const \)_\(LINUX_REBOOT_[^= ]*\)\(.*\)$/\1\2 = _\2/'
>>
${
OUT
}
# The GNU/Linux sock_filter struct.
grep
'^type _sock_filter '
gen-sysinfo.go |
\
sed
-e
's/_sock_filter/SockFilter/'
\
-e
's/code/Code/'
\
-e
's/jt/Jt/'
\
-e
's/jf/Jf/'
\
-e
's/k /K /'
\
>>
${
OUT
}
# The GNU/Linux sock_fprog struct.
grep
'^type _sock_fprog '
gen-sysinfo.go |
\
sed
-e
's/_sock_fprog/SockFprog/'
\
-e
's/len/Len/'
\
-e
's/filter/Filter/'
\
-e
's/_sock_filter/SockFilter/'
\
>>
${
OUT
}
exit
$?
exit
$?
libgo/runtime/go-nosys.c
View file @
b65734ac
...
@@ -116,6 +116,15 @@ inotify_init (void)
...
@@ -116,6 +116,15 @@ inotify_init (void)
}
}
#endif
#endif
#ifndef HAVE_INOTIFY_INIT1
int
inotify_init1
(
int
flags
__attribute__
((
unused
)))
{
errno
=
ENOSYS
;
return
-
1
;
}
#endif
#ifndef HAVE_INOTIFY_RM_WATCH
#ifndef HAVE_INOTIFY_RM_WATCH
int
int
inotify_rm_watch
(
int
fd
__attribute__
((
unused
)),
inotify_rm_watch
(
int
fd
__attribute__
((
unused
)),
...
@@ -187,6 +196,18 @@ splice (int fd __attribute__ ((unused)),
...
@@ -187,6 +196,18 @@ splice (int fd __attribute__ ((unused)),
}
}
#endif
#endif
#ifndef HAVE_SYNC_FILE_RANGE
int
sync_file_range
(
int
fd
__attribute__
((
unused
)),
off64_t
offset
__attribute__
((
unused
)),
off64_t
nbytes
__attribute__
((
unused
)),
unsigned
int
flags
__attribute__
((
unused
)))
{
errno
=
ENOSYS
;
return
-
1
;
}
#endif
#ifndef HAVE_TEE
#ifndef HAVE_TEE
int
int
tee
(
int
fd_in
__attribute__
((
unused
)),
tee
(
int
fd_in
__attribute__
((
unused
)),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment