Commit 23bf408d authored by Russ Cox's avatar Russ Cox

syscall: fix arm build (fix bugs in generator, to add O_LARGEFILE)

R=r
CC=golang-dev
https://golang.org/cl/1021043
parent b3901dc1
......@@ -146,9 +146,9 @@ linux_arm)
ARM="/home/kaib/public/linux-2.6.28"
mksyscall="./mksyscall.sh -l32"
mksysnum="./mksysnum_linux.sh $ARM/arch/arm/include/asm/unistd.h"
// mktypes="godefs -gsyscall -carm-gcc -f-I$ARM/arch/arm/include -f-I$ARM/include -f-D__deprecated='' -f-I$ARM/arch/arm/mach-at91/include -f-DCONFIG_ARCH_AT91SAM9260 "
# mktypes="godefs -gsyscall -carm-gcc -f-I$ARM/arch/arm/include -f-I$ARM/include -f-D__deprecated='' -f-I$ARM/arch/arm/mach-at91/include -f-DCONFIG_ARCH_AT91SAM9260 "
mktypes="godefs -gsyscall -carm-gcc"
mkerrors="./mkerrors.sh"
mkerrors='GORUN="qemu-arm -cpu cortex-a8" ./mkerrors.sh'
;;
windows_386)
mksyscall="./mksyscall_windows.sh -l32"
......
......@@ -86,6 +86,7 @@ done
awk '
$1 != "#define" || $2 ~ /\(/ {next}
$2 ~ /^E([ABCD]X|[BIS]P|[SD]I|S|FL)$/ {next} # 386 registers
$2 ~ /^(SIGEV_|SIGSTKSZ|SIGRT(MIN|MAX))/ {next}
$2 ~ /^E[A-Z0-9_]+$/ ||
......@@ -95,7 +96,7 @@ done
$2 == "NAME_MAX" ||
$2 ~ /^(O|F|FD|NAME|S|PTRACE)_/ ||
$2 ~ /^W[A-Z0-9]+$/ {printf("\t$%s = %s,\n", $2, $2)}
$2 ~ /^__WCOREFLAG$/ {next}
$2 ~ /^__W[A-Z0-9]+$/ {printf("\t$%s = %s,\n", substr($2,3), $2)}
{next}
......@@ -114,7 +115,7 @@ errors=$(
echo '// mkerrors.sh' "$@"
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
echo
godefs "$@" -gsyscall "$@" _const.c
godefs -c $GCC "$@" -gsyscall "$@" _const.c
# Run C program to print error strings.
(
......@@ -167,4 +168,4 @@ main(void)
'
) >_errors.c
gcc $ccflags -o _errors _errors.c && ./_errors && rm -f _errors.c _errors _const.c
$GCC $ccflags -static -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors _const.c
......@@ -24,6 +24,11 @@ func Open(path string, mode int, perm int) (fd int, errno int) {
return open(path, mode|O_LARGEFILE, perm)
}
//sys openat(dirfd int, path string, flags int, mode int) (fd int, errno int)
func Openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
return openat(dirfd, path, flags|O_LARGEFILE, mode)
}
//sys pipe(p *[2]_C_int) (errno int)
func Pipe(p []int) (errno int) {
if len(p) != 2 {
......@@ -581,7 +586,6 @@ func PtraceDetach(pid int) (errno int) { return ptrace(PTRACE_DETACH, pid, 0, 0)
//sys Mknod(path string, mode int, dev int) (errno int)
//sys Mknodat(dirfd int, path string, mode int, dev int) (errno int)
//sys Nanosleep(time *Timespec, leftover *Timespec) (errno int)
//sys Openat(dirfd int, path string, flags int, mode int) (fd int, errno int)
//sys Pause() (errno int)
//sys PivotRoot(newroot string, putold string) (errno int) = SYS_PIVOT_ROOT
//sys Pread(fd int, p []byte, offset int64) (n int, errno int) = SYS_PREAD64
......
......@@ -4,6 +4,15 @@
package syscall
// These seem not to be defined in our gcc's ARM headers
// and are thus missing from zerrors_linux_arm.go.
const (
WSTOPPED = 0x7f
O_CLOEXEC = 0
EPOLLRDHUP = EPOLLHUP
EPOLLONESHOT = 0x40000000
)
func Getpagesize() int { return 4096 }
func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) }
......
// mkerrors.sh -f -m32
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
// godefs -f -m32 -gsyscall -f -m32 _const.c
// godefs -c gcc -f -m32 -gsyscall -f -m32 _const.c
// MACHINE GENERATED - DO NOT EDIT.
......@@ -49,7 +49,6 @@ const (
EAFNOSUPPORT = 0x61
EAGAIN = 0xb
EALREADY = 0x72
EAX = 0x6
EBADE = 0x34
EBADF = 0x9
EBADFD = 0x4d
......@@ -58,9 +57,7 @@ const (
EBADRQC = 0x38
EBADSLT = 0x39
EBFONT = 0x3b
EBP = 0x5
EBUSY = 0x10
EBX = 0
ECANCELED = 0x7d
ECHILD = 0xa
ECHRNG = 0x2c
......@@ -68,19 +65,15 @@ const (
ECONNABORTED = 0x67
ECONNREFUSED = 0x6f
ECONNRESET = 0x68
ECX = 0x1
EDEADLK = 0x23
EDEADLOCK = 0x23
EDESTADDRREQ = 0x59
EDI = 0x4
EDOM = 0x21
EDOTDOT = 0x49
EDQUOT = 0x7a
EDX = 0x2
EEXIST = 0x11
EFAULT = 0xe
EFBIG = 0x1b
EFL = 0xe
EHOSTDOWN = 0x70
EHOSTUNREACH = 0x71
EIDRM = 0x2b
......@@ -89,7 +82,6 @@ const (
EINTR = 0x4
EINVAL = 0x16
EIO = 0x5
EIP = 0xc
EISCONN = 0x6a
EISDIR = 0x15
EISNAM = 0x78
......@@ -180,9 +172,7 @@ const (
EREMOTEIO = 0x79
ERESTART = 0x55
EROFS = 0x1e
ES = 0x8
ESHUTDOWN = 0x6c
ESI = 0x3
ESOCKTNOSUPPORT = 0x5e
ESPIPE = 0x1d
ESRCH = 0x3
......
This diff is collapsed.
......@@ -12,6 +12,13 @@ func open(path string, mode int, perm int) (fd int, errno int) {
return
}
func openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
errno = int(e1)
return
}
func pipe(p *[2]_C_int) (errno int) {
_, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
errno = int(e1)
......@@ -321,13 +328,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (errno int) {
return
}
func Openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
errno = int(e1)
return
}
func Pause() (errno int) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
errno = int(e1)
......
......@@ -12,6 +12,13 @@ func open(path string, mode int, perm int) (fd int, errno int) {
return
}
func openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
errno = int(e1)
return
}
func pipe(p *[2]_C_int) (errno int) {
_, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
errno = int(e1)
......@@ -321,13 +328,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (errno int) {
return
}
func Openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
errno = int(e1)
return
}
func Pause() (errno int) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
errno = int(e1)
......
......@@ -5,6 +5,20 @@ package syscall
import "unsafe"
func open(path string, mode int, perm int) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0)
errno = int(e1)
return
}
func openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
errno = int(e1)
return
}
func pipe(p *[2]_C_int) (errno int) {
_, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
errno = int(e1)
......@@ -314,20 +328,6 @@ func Nanosleep(time *Timespec, leftover *Timespec) (errno int) {
return
}
func Open(path string, mode int, perm int) (fd int, errno int) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0)
errno = int(e1)
return
}
func Openat(dirfd int, path string, flags int, mode int) (fd int, errno int) {
r0, _, e1 := Syscall6(SYS_OPENAT, uintptr(dirfd), uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(flags), uintptr(mode), 0, 0)
fd = int(r0)
errno = int(e1)
return
}
func Pause() (errno int) {
_, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0)
errno = int(e1)
......
......@@ -12,115 +12,10 @@ const (
sizeofLong = 0x4
sizeofLongLong = 0x8
PathMax = 0x1000
O_RDONLY = 0
O_WRONLY = 0x1
O_RDWR = 0x2
O_APPEND = 0x400
O_ASYNC = 0x2000
O_CREAT = 0x40
O_NOCTTY = 0x100
O_NONBLOCK = 0x800
O_SYNC = 0x1000
O_TRUNC = 0x200
O_CLOEXEC = 0
F_GETFD = 0x1
F_SETFD = 0x2
F_GETFL = 0x3
F_SETFL = 0x4
FD_CLOEXEC = 0x1
NAME_MAX = 0xff
S_IFMT = 0xf000
S_IFIFO = 0x1000
S_IFCHR = 0x2000
S_IFDIR = 0x4000
S_IFBLK = 0x6000
S_IFREG = 0x8000
S_IFLNK = 0xa000
S_IFSOCK = 0xc000
S_ISUID = 0x800
S_ISGID = 0x400
S_ISVTX = 0x200
S_IRUSR = 0x100
S_IWUSR = 0x80
S_IXUSR = 0x40
WNOHANG = 0x1
WUNTRACED = 0x2
WEXITED = 0x4
WSTOPPED = 0x2
WCONTINUED = 0x8
WNOWAIT = 0x1000000
WCLONE = 0x80000000
WALL = 0x40000000
WNOTHREAD = 0x20000000
AF_UNIX = 0x1
AF_INET = 0x2
AF_INET6 = 0xa
SOCK_STREAM = 0x1
SOCK_DGRAM = 0x2
SOCK_RAW = 0x3
SOCK_SEQPACKET = 0x5
SOL_SOCKET = 0x1
SO_REUSEADDR = 0x2
SO_KEEPALIVE = 0x9
SO_DONTROUTE = 0x5
SO_BROADCAST = 0x6
SO_LINGER = 0xd
SO_SNDBUF = 0x7
SO_RCVBUF = 0x8
SO_SNDTIMEO = 0x15
SO_RCVTIMEO = 0x14
IPPROTO_TCP = 0x6
IPPROTO_UDP = 0x11
TCP_NODELAY = 0x1
SOMAXCONN = 0x80
SizeofSockaddrInet4 = 0x10
SizeofSockaddrInet6 = 0x1c
SizeofSockaddrAny = 0x1c
SizeofSockaddrUnix = 0x6e
PTRACE_TRACEME = 0
PTRACE_PEEKTEXT = 0x1
PTRACE_PEEKDATA = 0x2
PTRACE_PEEKUSER = 0x3
PTRACE_POKETEXT = 0x4
PTRACE_POKEDATA = 0x5
PTRACE_POKEUSER = 0x6
PTRACE_CONT = 0x7
PTRACE_KILL = 0x8
PTRACE_SINGLESTEP = 0x9
PTRACE_GETREGS = 0xc
PTRACE_SETREGS = 0xd
PTRACE_GETFPREGS = 0xe
PTRACE_SETFPREGS = 0xf
PTRACE_ATTACH = 0x10
PTRACE_DETACH = 0x11
PTRACE_GETFPXREGS = 0x12
PTRACE_SETFPXREGS = 0x13
PTRACE_SYSCALL = 0x18
PTRACE_SETOPTIONS = 0x4200
PTRACE_GETEVENTMSG = 0x4201
PTRACE_GETSIGINFO = 0x4202
PTRACE_SETSIGINFO = 0x4203
PTRACE_O_TRACESYSGOOD = 0x1
PTRACE_O_TRACEFORK = 0x2
PTRACE_O_TRACEVFORK = 0x4
PTRACE_O_TRACECLONE = 0x8
PTRACE_O_TRACEEXEC = 0x10
PTRACE_O_TRACEVFORKDONE = 0x20
PTRACE_O_TRACEEXIT = 0x40
PTRACE_O_MASK = 0x7f
PTRACE_EVENT_FORK = 0x1
PTRACE_EVENT_VFORK = 0x2
PTRACE_EVENT_CLONE = 0x3
PTRACE_EVENT_EXEC = 0x4
PTRACE_EVENT_VFORK_DONE = 0x5
PTRACE_EVENT_EXIT = 0x6
EPOLLIN = 0x1
EPOLLRDHUP = 0x2000
EPOLLOUT = 0x4
EPOLLONESHOT = 0x40000000
EPOLL_CTL_MOD = 0x3
EPOLL_CTL_ADD = 0x1
EPOLL_CTL_DEL = 0x2
)
// Types
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment