@@ -7,7 +7,7 @@
package syscall
//sysnb strerror_r(errnum int, buf []byte) (err error)
-//strerror_r(errnum int, buf *byte, buflen Size_t) int
+//strerror_r(errnum _C_int, buf *byte, buflen Size_t) _C_int
func Errstr(errnum int) string {
for len := 128; ; len *= 2 {
@@ -9,7 +9,7 @@
import "unsafe"
//sysnb strerror_r(errnum int, b []byte) (errstr *byte)
-//strerror_r(errnum int, b *byte, len Size_t) *byte
+//strerror_r(errnum _C_int, b *byte, len Size_t) *byte
func Errstr(errnum int) string {
a := make([]byte, 128)
@@ -12,7 +12,7 @@
)
//sysnb strerror(errnum int) (buf *byte)
-//strerror(errnum int) *byte
+//strerror(errnum _C_int) *byte
var errstr_lock sync.Mutex
@@ -11,7 +11,7 @@
)
//sysnb raw_prctl(option int, arg2 int, arg3 int, arg4 int, arg5 int) (ret int, err Errno)
-//prctl(option int, arg2 _C_long, arg3 _C_long, arg4 _C_long, arg5 _C_long) int
+//prctl(option _C_int, arg2 _C_long, arg3 _C_long, arg4 _C_long, arg5 _C_long) _C_int
type SysProcAttr struct {
Chroot string // Chroot.
@@ -21,34 +21,34 @@
//setsid() Pid_t
//sysnb raw_setpgid(pid int, pgid int) (err Errno)
-//setpgid(pid Pid_t, pgid Pid_t) int
+//setpgid(pid Pid_t, pgid Pid_t) _C_int
//sysnb raw_chroot(path *byte) (err Errno)
-//chroot(path *byte) int
+//chroot(path *byte) _C_int
//sysnb raw_chdir(path *byte) (err Errno)
-//chdir(path *byte) int
+//chdir(path *byte) _C_int
//sysnb raw_fcntl(fd int, cmd int, arg int) (val int, err Errno)
-//fcntl(fd int, cmd int, arg int) int
+//fcntl(fd _C_int, cmd _C_int, arg _C_int) _C_int
//sysnb raw_close(fd int) (err Errno)
-//close(fd int) int
+//close(fd _C_int) _C_int
//sysnb raw_ioctl(fd int, cmd int, val int) (rval int, err Errno)
-//ioctl(fd int, cmd int, val int) int
+//ioctl(fd _C_int, cmd _C_int, val _C_int) _C_int
//sysnb raw_execve(argv0 *byte, argv **byte, envv **byte) (err Errno)
-//execve(argv0 *byte, argv **byte, envv **byte) int
+//execve(argv0 *byte, argv **byte, envv **byte) _C_int
//sysnb raw_write(fd int, buf *byte, count int) (err Errno)
-//write(fd int, buf *byte, count Size_t) Ssize_t
+//write(fd _C_int, buf *byte, count Size_t) Ssize_t
//sysnb raw_exit(status int)
-//_exit(status int)
+//_exit(status _C_int)
//sysnb raw_dup2(oldfd int, newfd int) (err Errno)
-//dup2(oldfd int, newfd int) int
+//dup2(oldfd _C_int, newfd _C_int) _C_int
// Lock synchronizing creation of new file descriptors with fork.
//
@@ -17,21 +17,21 @@
* Wrapped
*/
-//sysnb pipe(p *[2]int) (err error)
-//pipe(p *[2]int) int
+//sysnb pipe(p *[2]_C_int) (err error)
+//pipe(p *[2]_C_int) _C_int
func Pipe(p []int) (err error) {
if len(p) != 2 {
return EINVAL
}
- var pp [2]int
+ var pp [2]_C_int
err = pipe(&pp)
- p[0] = pp[0]
- p[1] = pp[1]
+ p[0] = int(pp[0])
+ p[1] = int(pp[1])
return
}
//sys utimes(path string, times *[2]Timeval) (err error)
-//utimes(path *byte, times *[2]Timeval) int
+//utimes(path *byte, times *[2]Timeval) _C_int
func Utimes(path string, tv []Timeval) (err error) {
if len(tv) != 2 {
return EINVAL
@@ -74,7 +74,7 @@
}
//sysnb getgroups(size int, list *Gid_t) (nn int, err error)
-//getgroups(size int, list *Gid_t) int
+//getgroups(size int, list *Gid_t) _C_int
func Getgroups() (gids []int, err error) {
n, err := getgroups(0, nil)
@@ -103,7 +103,7 @@
}
//sysnb setgroups(n int, list *Gid_t) (err error)
-//setgroups(n Size_t, list *Gid_t) int
+//setgroups(n Size_t, list *Gid_t) _C_int
func Setgroups(gids []int) (err error) {
if len(gids) == 0 {
@@ -133,10 +133,10 @@
func (w WaitStatus) TrapCause() int
//sys Mkfifo(path string, mode uint32) (err error)
-//mkfifo(path *byte, mode Mode_t) int
+//mkfifo(path *byte, mode Mode_t) _C_int
//sys Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error)
-//select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) int
+//select(nfd _C_int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) _C_int
const nfdbits = int(unsafe.Sizeof(fds_bits_type) * 8)
@@ -167,52 +167,52 @@
}
//sys Access(path string, mode uint32) (err error)
-//access(path *byte, mode int) int
+//access(path *byte, mode _C_int) _C_int
//sys Chdir(path string) (err error)
-//chdir(path *byte) int
+//chdir(path *byte) _C_int
//sys Chmod(path string, mode uint32) (err error)
-//chmod(path *byte, mode Mode_t) int
+//chmod(path *byte, mode Mode_t) _C_int
//sys Chown(path string, uid int, gid int) (err error)
-//chown(path *byte, uid Uid_t, gid Gid_t) int
+//chown(path *byte, uid Uid_t, gid Gid_t) _C_int
//sys Chroot(path string) (err error)
-//chroot(path *byte) int
+//chroot(path *byte) _C_int
//sys Close(fd int) (err error)
-//close(fd int) int
+//close(fd _C_int) _C_int
//sys Creat(path string, mode uint32) (fd int, err error)
-//creat(path *byte, mode Mode_t) int
+//creat(path *byte, mode Mode_t) _C_int
//sysnb Dup(oldfd int) (fd int, err error)
-//dup(oldfd int) int
+//dup(oldfd _C_int) _C_int
//sysnb Dup2(oldfd int, newfd int) (err error)
-//dup2(oldfd int, newfd int) int
+//dup2(oldfd _C_int, newfd _C_int) _C_int
//sys Exit(code int)
-//exit(code int)
+//exit(code _C_int)
//sys Fchdir(fd int) (err error)
-//fchdir(fd int) int
+//fchdir(fd _C_int) _C_int
//sys Fchmod(fd int, mode uint32) (err error)
-//fchmod(fd int, mode Mode_t) int
+//fchmod(fd _C_int, mode Mode_t) _C_int
//sys Fchown(fd int, uid int, gid int) (err error)
-//fchown(fd int, uid Uid_t, gid Gid_t) int
+//fchown(fd _C_int, uid Uid_t, gid Gid_t) _C_int
//sys fcntl(fd int, cmd int, arg int) (val int, err error)
-//fcntl(fd int, cmd int, arg int) int
+//fcntl(fd _C_int, cmd _C_int, arg _C_int) _C_int
//sys Fdatasync(fd int) (err error)
-//fdatasync(fd int) int
+//fdatasync(fd _C_int) _C_int
//sys Fsync(fd int) (err error)
-//fsync(fd int) int
+//fsync(fd _C_int) _C_int
//sysnb Getegid() (egid int)
//getegid() Gid_t
@@ -224,7 +224,7 @@
//getgid() Gid_t
//sysnb Getpagesize() (pagesize int)
-//getpagesize() int
+//getpagesize() _C_int
//sysnb Getpgid(pid int) (pgid int, err error)
//getpgid(pid Pid_t) Pid_t
@@ -239,13 +239,13 @@
//getppid() Pid_t
//sysnb Getrlimit(resource int, rlim *Rlimit) (err error)
-//getrlimit(resource int, rlim *Rlimit) int
+//getrlimit(resource _C_int, rlim *Rlimit) _C_int
//sysnb Getrusage(who int, rusage *Rusage) (err error)
-//getrusage(who int, rusage *Rusage) int
+//getrusage(who _C_int, rusage *Rusage) _C_int
//sysnb gettimeofday(tv *Timeval, tz *byte) (err error)
-//gettimeofday(tv *Timeval, tz *byte) int
+//gettimeofday(tv *Timeval, tz *byte) _C_int
func Gettimeofday(tv *Timeval) (err error) {
return gettimeofday(tv, nil)
}
@@ -254,80 +254,80 @@
//getuid() Uid_t
//sysnb Kill(pid int, sig Signal) (err error)
-//kill(pid Pid_t, sig int) int
+//kill(pid Pid_t, sig _C_int) _C_int
//sys Lchown(path string, uid int, gid int) (err error)
-//lchown(path *byte, uid Uid_t, gid Gid_t) int
+//lchown(path *byte, uid Uid_t, gid Gid_t) _C_int
//sys Link(oldpath string, newpath string) (err error)
-//link(oldpath *byte, newpath *byte) int
+//link(oldpath *byte, newpath *byte) _C_int
//sys Mkdir(path string, mode uint32) (err error)
-//mkdir(path *byte, mode Mode_t) int
+//mkdir(path *byte, mode Mode_t) _C_int
//sys Mknod(path string, mode uint32, dev int) (err error)
-//mknod(path *byte, mode Mode_t, dev _dev_t) int
+//mknod(path *byte, mode Mode_t, dev _dev_t) _C_int
//sys Mount(source string, target string, fstype string, flags uintptr, data string) (err error)
-//mount(source *byte, target *byte, fstype *byte, flags _C_long, data *byte) int
+//mount(source *byte, target *byte, fstype *byte, flags _C_long, data *byte) _C_int
//sys Nanosleep(time *Timespec, leftover *Timespec) (err error)
-//nanosleep(time *Timespec, leftover *Timespec) int
+//nanosleep(time *Timespec, leftover *Timespec) _C_int
//sys Pause() (err error)
-//pause() int
+//pause() _C_int
//sys read(fd int, p []byte) (n int, err error)
-//read(fd int, buf *byte, count Size_t) Ssize_t
+//read(fd _C_int, buf *byte, count Size_t) Ssize_t
//sys readlen(fd int, p *byte, np int) (n int, err error)
-//read(fd int, buf *byte, count Size_t) Ssize_t
+//read(fd _C_int, buf *byte, count Size_t) Ssize_t
//sys Readlink(path string, buf []byte) (n int, err error)
//readlink(path *byte, buf *byte, bufsiz Size_t) Ssize_t
//sys Rename(oldpath string, newpath string) (err error)
-//rename(oldpath *byte, newpath *byte) int
+//rename(oldpath *byte, newpath *byte) _C_int
//sys Rmdir(path string) (err error)
-//rmdir(path *byte) int
+//rmdir(path *byte) _C_int
//sys Setdomainname(p []byte) (err error)
-//setdomainname(name *byte, len Size_t) int
+//setdomainname(name *byte, len Size_t) _C_int
//sys Sethostname(p []byte) (err error)
-//sethostname(name *byte, len Size_t) int
+//sethostname(name *byte, len Size_t) _C_int
//sysnb Setgid(gid int) (err error)
-//setgid(gid Gid_t) int
+//setgid(gid Gid_t) _C_int
//sysnb Setregid(rgid int, egid int) (err error)
-//setregid(rgid Gid_t, egid Gid_t) int
+//setregid(rgid Gid_t, egid Gid_t) _C_int
//sysnb Setpgid(pid int, pgid int) (err error)
-//setpgid(pid Pid_t, pgid Pid_t) int
+//setpgid(pid Pid_t, pgid Pid_t) _C_int
//sysnb Setreuid(ruid int, euid int) (err error)
-//setreuid(ruid Uid_t, euid Uid_t) int
+//setreuid(ruid Uid_t, euid Uid_t) _C_int
//sysnb Setrlimit(resource int, rlim *Rlimit) (err error)
-//setrlimit(resource int, rlim *Rlimit) int
+//setrlimit(resource int, rlim *Rlimit) _C_int
//sysnb Setsid() (pid int, err error)
//setsid() Pid_t
//sysnb settimeofday(tv *Timeval, tz *byte) (err error)
-//settimeofday(tv *Timeval, tz *byte) int
+//settimeofday(tv *Timeval, tz *byte) _C_int
func Settimeofday(tv *Timeval) (err error) {
return settimeofday(tv, nil)
}
//sysnb Setuid(uid int) (err error)
-//setuid(uid Uid_t) int
+//setuid(uid Uid_t) _C_int
//sys Symlink(oldpath string, newpath string) (err error)
-//symlink(oldpath *byte, newpath *byte) int
+//symlink(oldpath *byte, newpath *byte) _C_int
//sys Sync()
//sync()
@@ -342,37 +342,37 @@
//umask(mask Mode_t) Mode_t
//sys Unlink(path string) (err error)
-//unlink(path *byte) int
+//unlink(path *byte) _C_int
//sys Utime(path string, buf *Utimbuf) (err error)
-//utime(path *byte, buf *Utimbuf) int
+//utime(path *byte, buf *Utimbuf) _C_int
//sys write(fd int, p []byte) (n int, err error)
-//write(fd int, buf *byte, count Size_t) Ssize_t
+//write(fd _C_int, buf *byte, count Size_t) Ssize_t
//sys writelen(fd int, p *byte, np int) (n int, err error)
-//write(fd int, buf *byte, count Size_t) Ssize_t
+//write(fd _C_int, buf *byte, count Size_t) Ssize_t
//sys munmap(addr uintptr, length uintptr) (err error)
-//munmap(addr *byte, length Size_t) int
+//munmap(addr *byte, length Size_t) _C_int
//sys Madvise(b []byte, advice int) (err error)
-//madvise(addr *byte, len Size_t, advice int) int
+//madvise(addr *byte, len Size_t, advice _C_int) _C_int
//sys Mprotect(b []byte, prot int) (err error)
-//mprotect(addr *byte, len Size_t, prot int) int
+//mprotect(addr *byte, len Size_t, prot _C_int) _C_int
//sys Mlock(b []byte) (err error)
-//mlock(addr *byte, len Size_t) int
+//mlock(addr *byte, len Size_t) _C_int
//sys Munlock(b []byte) (err error)
-//munlock(addr *byte, len Size_t) int
+//munlock(addr *byte, len Size_t) _C_int
//sys Mlockall(flags int) (err error)
-//mlockall(flags int) int
+//mlockall(flags _C_int) _C_int
//sys Munlockall() (err error)
-//munlockall() int
+//munlockall() _C_int
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
@@ -392,7 +392,7 @@
}
//sysnb Tcgetattr(fd int, p *Termios) (err error)
-//tcgetattr(fd int, p *Termios) int
+//tcgetattr(fd _C_int, p *Termios) _C_int
//sys Tcsetattr(fd int, actions int, p *Termios) (err error)
-//tcsetattr(fd int, actions int, p *Termios) int
+//tcsetattr(fd _C_int, actions _C_int, p *Termios) _C_int
@@ -7,31 +7,31 @@
package syscall
//sys Fstat(fd int, stat *Stat_t) (err error)
-//fstat64(fd int, stat *Stat_t) int
+//fstat64(fd _C_int, stat *Stat_t) _C_int
//sys Ftruncate(fd int, length int64) (err error)
-//ftruncate64(fd int, length Offset_t) int
+//ftruncate64(fd _C_int, length Offset_t) _C_int
//sys Lstat(path string, stat *Stat_t) (err error)
-//lstat64(path *byte, stat *Stat_t) int
+//lstat64(path *byte, stat *Stat_t) _C_int
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-//mmap64(addr *byte, length Size_t, prot int, flags int, fd int, offset Offset_t) *byte
+//mmap64(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//open64(path *byte, mode int, perm Mode_t) int
+//open64(path *byte, mode _C_int, perm Mode_t) _C_int
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//pread64(fd int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pread64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//pwrite64(fd int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pwrite64(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
//sys Seek(fd int, offset int64, whence int) (off int64, err error)
-//lseek64(fd int, offset Offset_t, whence int) Offset_t
+//lseek64(fd _C_int, offset Offset_t, whence _C_int) Offset_t
//sys Stat(path string, stat *Stat_t) (err error)
-//stat64(path *byte, stat *Stat_t) int
+//stat64(path *byte, stat *Stat_t) _C_int
//sys Truncate(path string, length int64) (err error)
-//truncate64(path *byte, length Offset_t) int
+//truncate64(path *byte, length Offset_t) _C_int
@@ -8,31 +8,31 @@
package syscall
//sys Fstat(fd int, stat *Stat_t) (err error)
-//fstat(fd int, stat *Stat_t) int
+//fstat(fd _C_int, stat *Stat_t) _C_int
//sys Ftruncate(fd int, length int64) (err error)
-//ftruncate(fd int, length Offset_t) int
+//ftruncate(fd _C_int, length Offset_t) _C_int
//sys Lstat(path string, stat *Stat_t) (err error)
-//lstat(path *byte, stat *Stat_t) int
+//lstat(path *byte, stat *Stat_t) _C_int
//sys mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error)
-//mmap(addr *byte, length Size_t, prot int, flags int, fd int, offset Offset_t) *byte
+//mmap(addr *byte, length Size_t, prot _C_int, flags _C_int, fd _C_int, offset Offset_t) *byte
//sys Open(path string, mode int, perm uint32) (fd int, err error)
-//open(path *byte, mode int, perm Mode_t) int
+//open(path *byte, mode _C_int, perm Mode_t) _C_int
//sys Pread(fd int, p []byte, offset int64) (n int, err error)
-//pread(fd int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pread(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
//sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
-//pwrite(fd int, buf *byte, count Size_t, offset Offset_t) Ssize_t
+//pwrite(fd _C_int, buf *byte, count Size_t, offset Offset_t) Ssize_t
//sys Seek(fd int, offset int64, whence int) (off int64, err error)
-//lseek(fd int, offset Offset_t, whence int) Offset_t
+//lseek(fd _C_int, offset Offset_t, whence _C_int) Offset_t
//sys Stat(path string, stat *Stat_t) (err error)
-//stat(path *byte, stat *Stat_t) int
+//stat(path *byte, stat *Stat_t) _C_int
//sys Truncate(path string, length int64) (err error)
-//truncate(path *byte, length Offset_t) int
+//truncate(path *byte, length Offset_t) _C_int
@@ -5,4 +5,4 @@
package syscall
//sysnb Uname(buf *Utsname) (err error)
-//uname(buf *Utsname) int
+//uname(buf *Utsname) _C_int
@@ -6,11 +6,11 @@
package syscall
-//sys wait4(pid Pid_t, status *int, options int, rusage *Rusage) (wpid Pid_t, err error)
-//wait4(pid Pid_t, status *int, options int, rusage *Rusage) Pid_t
+//sys wait4(pid Pid_t, status *_C_int, options int, rusage *Rusage) (wpid Pid_t, err error)
+//wait4(pid Pid_t, status *_C_int, options _C_int, rusage *Rusage) Pid_t
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
- var status int
+ var status _C_int
r, err := wait4(Pid_t(pid), &status, options, rusage)
wpid = int(r)
if wstatus != nil {
@@ -6,11 +6,11 @@
package syscall
-//sys waitpid(pid Pid_t, status *int, options int) (wpid Pid_t, err error)
-//waitpid(pid Pid_t, status *int, options int) Pid_t
+//sys waitpid(pid Pid_t, status *_C_int, options int) (wpid Pid_t, err error)
+//waitpid(pid Pid_t, status *_C_int, options _C_int) Pid_t
func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) {
- var status int
+ var status _C_int
r, err := waitpid(Pid_t(pid), &status, options)
wpid = int(r)
if wstatus != nil {
@@ -132,7 +132,7 @@
}
//sys accept(fd int, sa *RawSockaddrAny, len *Socklen_t) (nfd int, err error)
-//accept(fd int, sa *RawSockaddrAny, len *Socklen_t) int
+//accept(fd _C_int, sa *RawSockaddrAny, len *Socklen_t) _C_int
func Accept(fd int) (nfd int, sa Sockaddr, err error) {
var rsa RawSockaddrAny
@@ -150,7 +150,7 @@
}
//sysnb getsockname(fd int, sa *RawSockaddrAny, len *Socklen_t) (err error)
-//getsockname(fd int, sa *RawSockaddrAny, len *Socklen_t) int
+//getsockname(fd _C_int, sa *RawSockaddrAny, len *Socklen_t) _C_int
func Getsockname(fd int) (sa Sockaddr, err error) {
var rsa RawSockaddrAny
@@ -162,7 +162,7 @@
}
//sysnb getpeername(fd int, sa *RawSockaddrAny, len *Socklen_t) (err error)
-//getpeername(fd int, sa *RawSockaddrAny, len *Socklen_t) int
+//getpeername(fd _C_int, sa *RawSockaddrAny, len *Socklen_t) _C_int
func Getpeername(fd int) (sa Sockaddr, err error) {
var rsa RawSockaddrAny
@@ -174,7 +174,7 @@
}
//sys bind(fd int, sa *RawSockaddrAny, len Socklen_t) (err error)
-//bind(fd int, sa *RawSockaddrAny, len Socklen_t) int
+//bind(fd _C_int, sa *RawSockaddrAny, len Socklen_t) _C_int
func Bind(fd int, sa Sockaddr) (err error) {
ptr, n, err := sa.sockaddr()
@@ -185,7 +185,7 @@
}
//sys connect(s int, addr *RawSockaddrAny, addrlen Socklen_t) (err error)
-//connect(s int, addr *RawSockaddrAny, addrlen Socklen_t) int
+//connect(s _C_int, addr *RawSockaddrAny, addrlen Socklen_t) _C_int
func Connect(fd int, sa Sockaddr) (err error) {
ptr, n, err := sa.sockaddr()
@@ -196,7 +196,7 @@
}
//sysnb socket(domain int, typ int, proto int) (fd int, err error)
-//socket(domain int, typ int, protocol int) int
+//socket(domain _C_int, typ _C_int, protocol _C_int) _C_int
func Socket(domain, typ, proto int) (fd int, err error) {
if domain == AF_INET6 && SocketDisableIPv6 {
@@ -206,16 +206,21 @@
return
}
-//sysnb socketpair(domain int, typ int, proto int, fd *[2]int) (err error)
-//socketpair(domain int, typ int, protocol int, fd *[2]int) int
+//sysnb socketpair(domain int, typ int, proto int, fd *[2]_C_int) (err error)
+//socketpair(domain _C_int, typ _C_int, protocol _C_int, fd *[2]_C_int) _C_int
func Socketpair(domain, typ, proto int) (fd [2]int, err error) {
- err = socketpair(domain, typ, proto, &fd)
+ var fdx [2]_C_int
+ err = socketpair(domain, typ, proto, &fdx)
+ if err == nil {
+ fd[0] = int(fdx[0])
+ fd[1] = int(fdx[1])
+ }
return
}
//sys getsockopt(s int, level int, name int, val uintptr, vallen *Socklen_t) (err error)
-//getsockopt(s int, level int, name int, val *byte, vallen *Socklen_t) int
+//getsockopt(s _C_int, level _C_int, name _C_int, val *byte, vallen *Socklen_t) _C_int
func GetsockoptByte(fd, level, opt int) (value byte, err error) {
var n byte
@@ -259,7 +264,7 @@
}
//sys setsockopt(s int, level int, name int, val *byte, vallen Socklen_t) (err error)
-//setsockopt(s int, level int, optname int, val *byte, vallen Socklen_t) int
+//setsockopt(s _C_int, level _C_int, optname _C_int, val *byte, vallen Socklen_t) _C_int
func SetsockoptByte(fd, level, opt int, value byte) (err error) {
var n = byte(value)
@@ -305,7 +310,7 @@
}
//sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *Socklen_t) (n int, err error)
-//recvfrom(fd int, buf *byte, len Size_t, flags int, from *RawSockaddrAny, fromlen *Socklen_t) Ssize_t
+//recvfrom(fd _C_int, buf *byte, len Size_t, flags _C_int, from *RawSockaddrAny, fromlen *Socklen_t) Ssize_t
func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) {
var rsa RawSockaddrAny
@@ -318,7 +323,7 @@
}
//sys sendto(s int, buf []byte, flags int, to *RawSockaddrAny, tolen Socklen_t) (err error)
-//sendto(s int, buf *byte, len Size_t, flags int, to *RawSockaddrAny, tolen Socklen_t) Ssize_t
+//sendto(s _C_int, buf *byte, len Size_t, flags _C_int, to *RawSockaddrAny, tolen Socklen_t) Ssize_t
func Sendto(fd int, p []byte, flags int, to Sockaddr) (err error) {
ptr, n, err := to.sockaddr()
@@ -329,7 +334,7 @@
}
//sys recvmsg(s int, msg *Msghdr, flags int) (n int, err error)
-//recvmsg(s int, msg *Msghdr, flags int) Ssize_t
+//recvmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
var msg Msghdr
@@ -366,7 +371,7 @@
}
//sys sendmsg(s int, msg *Msghdr, flags int) (err error)
-//sendmsg(s int, msg *Msghdr, flags int) Ssize_t
+//sendmsg(s _C_int, msg *Msghdr, flags _C_int) Ssize_t
func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (err error) {
var ptr *RawSockaddrAny
@@ -405,10 +410,10 @@
}
//sys Listen(fd int, n int) (err error)
-//listen(fd int, n int) int
+//listen(fd _C_int, n _C_int) _C_int
//sys Shutdown(fd int, how int) (err error)
-//shutdown(fd int, how int) int
+//shutdown(fd _C_int, how _C_int) _C_int
func (iov *Iovec) SetLen(length int) {
iov.Len = Iovec_len_t(length)
@@ -165,13 +165,13 @@
}
//sysnb EpollCreate(size int) (fd int, err error)
-//epoll_create(size int) int
+//epoll_create(size _C_int) _C_int
//sysnb EpollCreate1(flags int) (fd int, err error)
-//epoll_create1(flags int) int
+//epoll_create1(flags _C_int) _C_int
//sysnb EpollCtl(epfd int, op int, fd int, event *EpollEvent) (err error)
-//epoll_ctl(epfd int, op int, fd int, event *EpollEvent) int
+//epoll_ctl(epfd _C_int, op _C_int, fd _C_int, event *EpollEvent) _C_int
//sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
-//epoll_wait(epfd int, events *EpollEvent, maxevents int, timeout int) int
+//epoll_wait(epfd _C_int, events *EpollEvent, maxevents _C_int, timeout _C_int) _C_int
@@ -414,7 +414,18 @@
echo "type Gid_t _gid_t" >> ${OUT}
echo "type Socklen_t _socklen_t" >> ${OUT}
-# The long type, needed because that is the type that ptrace returns.
+# The C int type.
+sizeof_int=`grep '^const ___SIZEOF_INT__ = ' gen-sysinfo.go | sed -e 's/.*= //'`
+if test "$sizeof_int" = "4"; then
+ echo "type _C_int int32" >> ${OUT}
+elif test "$sizeof_int" = "8"; then
+ echo "type _C_int int64" >> ${OUT}
+else
+ echo 1>&2 "mksysinfo.sh: could not determine size of int (got $sizeof_int)"
+ exit 1
+fi
+
+# The C long type, needed because that is the type that ptrace returns.
sizeof_long=`grep '^const ___SIZEOF_LONG__ = ' gen-sysinfo.go | sed -e 's/.*= //'`
if test "$sizeof_long" = "4"; then
echo "type _C_long int32" >> ${OUT}