From patchwork Fri Nov 2 23:39:40 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 196775 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E13E72C0093 for ; Sat, 3 Nov 2012 10:39:57 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1352504398; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=81tv5fe 4ICqsglS5qtRO9A3ZqEg=; b=N5jsk17CP3F5NfdQB1YMHnm8RuAczrhaU753vtE LABxFNO/QlEpI7IkWukLJ7nabYS/IGDToyl9atYErrIalmOFQXfKwl9LWcTDPgz6 uuvMAU6R56aHdbYxncAPq5x92SFxv0w911ERXYqcCbNeNBpwq7qjzVLvR58c7xMy KVmM= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=QCMyrBXWPPOimdMa3fhuuJ+GuojuECPIvV/BnNCFyiAd8BGeEBApQMcLjhtnCo V9bQ+TJYQ8Ia4LsrIVDkXTpJJvtLvzQnsquRXblWqKTDXCozWD90M3TtmrOJyGt8 4nDKkc2+MPiz56p4xCF5xAJOPETZNb01ZAUWzY+qsrtdM=; Received: (qmail 9784 invoked by alias); 2 Nov 2012 23:39:52 -0000 Received: (qmail 9775 invoked by uid 22791); 2 Nov 2012 23:39:52 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, TW_CV, TW_FD, TW_RG, TW_VF, TW_WF, T_FRT_STOCK2, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-da0-f47.google.com (HELO mail-da0-f47.google.com) (209.85.210.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Nov 2012 23:39:44 +0000 Received: by mail-da0-f47.google.com with SMTP id s35so1762785dak.20 for ; Fri, 02 Nov 2012 16:39:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=Gg/HapmHOaEN3mpg2YvCiYLURbSE5THi3bf9OPhLIVc=; b=dTpyHLxGF9xEFtkqNPwZ4wtOMalSK8gNoTDxagb22HovvA8Sic0ObNPjQmV87KDhp3 PctSiniq694ciB2LebVgAcaS6fpEHeEHXx9RNSuxIXuV6JtymfPA6SMDTpJcCtGJLx7T D9Z0+lx78KnBtignKoVWMPLgHVgDOCkOxVpQuysDtdnODiaA5IlzW+UL/OMC8aPDe5AH u1NYP4nNsNVPfSC+CF+EIvfGjxqb/Ei4VbbmjccATioB0a2wAd/6ED0XToPPj5COR7mN KggLUJ8PtLiCJK+gommF5bx7CMhqq9TDsZzgdYUJdjNURujhnAmopO7NzRGNfzZlh+ai 2jIw== Received: by 10.66.84.163 with SMTP id a3mr9634270paz.2.1351899583644; Fri, 02 Nov 2012 16:39:43 -0700 (PDT) Received: from coign.google.com ([207.198.105.20]) by mx.google.com with ESMTPS id vi9sm6439972pbc.41.2012.11.02.16.39.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Nov 2012 16:39:43 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: libgo patch committed: Prepare syscall for 64-bit int Date: Fri, 02 Nov 2012 16:39:40 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkL9K1DWrW0tYxbmjAzGd2qYH7oDnSFKQ2uZBrFQ8vytJGDsS9XAApVPQC8Qim+wJY6hILyXv2ZAFZUv72rOctc8rulfp3hG2NRBHpXtiZBHnq2rHnh/cbe3Hxjw1FQtNmE7hl02V1cNdYUSoveFdxDNnqFgU/gy/ZXqfDdHGQOl9gP0UJBqx89TUVWKiTZUgtTq1SS X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch prepares the syscall package for the change to 64-bit int on x86_64. This introduces a new type _C_int to the syscall package for the C type int, and uses it for libc calls as needed. The Pipe and Socketpair functions had to be adjusted. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian diff -r ac3d4ff96d58 libgo/go/syscall/errstr.go --- a/libgo/go/syscall/errstr.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/errstr.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 { diff -r ac3d4ff96d58 libgo/go/syscall/errstr_linux.go --- a/libgo/go/syscall/errstr_linux.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/errstr_linux.go Fri Nov 02 16:34:28 2012 -0700 @@ -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) diff -r ac3d4ff96d58 libgo/go/syscall/errstr_nor.go --- a/libgo/go/syscall/errstr_nor.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/errstr_nor.go Fri Nov 02 16:34:28 2012 -0700 @@ -12,7 +12,7 @@ ) //sysnb strerror(errnum int) (buf *byte) -//strerror(errnum int) *byte +//strerror(errnum _C_int) *byte var errstr_lock sync.Mutex diff -r ac3d4ff96d58 libgo/go/syscall/exec_linux.go --- a/libgo/go/syscall/exec_linux.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/exec_linux.go Fri Nov 02 16:34:28 2012 -0700 @@ -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. diff -r ac3d4ff96d58 libgo/go/syscall/exec_unix.go --- a/libgo/go/syscall/exec_unix.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/exec_unix.go Fri Nov 02 16:34:28 2012 -0700 @@ -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. // diff -r ac3d4ff96d58 libgo/go/syscall/libcall_posix.go --- a/libgo/go/syscall/libcall_posix.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/libcall_posix.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 diff -r ac3d4ff96d58 libgo/go/syscall/libcall_posix_largefile.go --- a/libgo/go/syscall/libcall_posix_largefile.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/libcall_posix_largefile.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 diff -r ac3d4ff96d58 libgo/go/syscall/libcall_posix_regfile.go --- a/libgo/go/syscall/libcall_posix_regfile.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/libcall_posix_regfile.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 diff -r ac3d4ff96d58 libgo/go/syscall/libcall_uname.go --- a/libgo/go/syscall/libcall_uname.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/libcall_uname.go Fri Nov 02 16:34:28 2012 -0700 @@ -5,4 +5,4 @@ package syscall //sysnb Uname(buf *Utsname) (err error) -//uname(buf *Utsname) int +//uname(buf *Utsname) _C_int diff -r ac3d4ff96d58 libgo/go/syscall/libcall_wait4.go --- a/libgo/go/syscall/libcall_wait4.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/libcall_wait4.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 { diff -r ac3d4ff96d58 libgo/go/syscall/libcall_waitpid.go --- a/libgo/go/syscall/libcall_waitpid.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/libcall_waitpid.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 { diff -r ac3d4ff96d58 libgo/go/syscall/socket.go --- a/libgo/go/syscall/socket.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/socket.go Fri Nov 02 16:34:28 2012 -0700 @@ -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) diff -r ac3d4ff96d58 libgo/go/syscall/socket_linux.go --- a/libgo/go/syscall/socket_linux.go Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/go/syscall/socket_linux.go Fri Nov 02 16:34:28 2012 -0700 @@ -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 diff -r ac3d4ff96d58 libgo/mksysinfo.sh --- a/libgo/mksysinfo.sh Fri Nov 02 16:16:00 2012 -0700 +++ b/libgo/mksysinfo.sh Fri Nov 02 16:34:28 2012 -0700 @@ -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}