mirror of
https://github.com/golang/go
synced 2024-11-24 23:07:56 -07:00
syscall: force O_LARGEFILE in Linux open system call
Fixes #717. R=adg, PeterGo CC=golang-dev https://golang.org/cl/1032041
This commit is contained in:
parent
4aaddf8a35
commit
7906e31167
@ -100,30 +100,36 @@ _* | *_ | _)
|
||||
exit 1
|
||||
;;
|
||||
freebsd_386)
|
||||
mkerrors="$mkerrors -f -m32"
|
||||
mksyscall="./mksyscall.sh -l32"
|
||||
mksysnum="./mksysnum_freebsd.sh /usr/src/sys/kern/syscalls.master"
|
||||
mktypes="godefs -gsyscall -f-m32"
|
||||
;;
|
||||
freebsd_amd64)
|
||||
mkerrors="$mkerrors -f -m64"
|
||||
mksysnum="./mksysnum_freebsd.sh /usr/src/sys/kern/syscalls.master"
|
||||
mktypes="godefs -gsyscall -f-m64"
|
||||
;;
|
||||
darwin_386)
|
||||
mkerrors="$mkerrors -f -m32"
|
||||
mksyscall="./mksyscall.sh -l32"
|
||||
mksysnum="./mksysnum_darwin.sh /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master"
|
||||
mktypes="godefs -gsyscall -f-m32"
|
||||
;;
|
||||
darwin_amd64)
|
||||
mkerrors="$mkerrors -f -m64"
|
||||
mksysnum="./mksysnum_darwin.sh /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master"
|
||||
mktypes="godefs -gsyscall -f-m64"
|
||||
mkerrors="./mkerrors.sh"
|
||||
;;
|
||||
linux_386)
|
||||
mkerrors="$mkerrors -f -m32"
|
||||
mksyscall="./mksyscall.sh -l32"
|
||||
mksysnum="./mksysnum_linux.sh /usr/include/asm/unistd_32.h"
|
||||
mktypes="godefs -gsyscall -f-m32"
|
||||
;;
|
||||
linux_amd64)
|
||||
mkerrors="$mkerrors -f -m64"
|
||||
mksysnum="./mksysnum_linux.sh /usr/include/asm/unistd_64.h"
|
||||
mktypes="godefs -gsyscall -f-m64"
|
||||
;;
|
||||
|
@ -61,6 +61,18 @@ includes='
|
||||
#include <signal.h>
|
||||
'
|
||||
|
||||
ccflags=""
|
||||
next=false
|
||||
for i
|
||||
do
|
||||
if $next; then
|
||||
ccflags="$ccflags $i"
|
||||
next=false
|
||||
elif [ "$i" = "-f" ]; then
|
||||
next=true
|
||||
fi
|
||||
done
|
||||
|
||||
# Write godefs input.
|
||||
(
|
||||
indirect="includes_$(uname)"
|
||||
@ -70,7 +82,7 @@ includes='
|
||||
|
||||
# The gcc command line prints all the #defines
|
||||
# it encounters while processing the input
|
||||
echo "${!indirect} $includes" | $GCC -x c - -E -dM |
|
||||
echo "${!indirect} $includes" | $GCC -x c - -E -dM $ccflags |
|
||||
awk '
|
||||
$1 != "#define" || $2 ~ /\(/ {next}
|
||||
|
||||
@ -94,7 +106,7 @@ includes='
|
||||
|
||||
# Pull out just the error names for later.
|
||||
errors=$(
|
||||
echo '#include <errno.h>' | $GCC -x c - -E -dM |
|
||||
echo '#include <errno.h>' | $GCC -x c - -E -dM $ccflags |
|
||||
awk '$1=="#define" && $2 ~ /^E[A-Z0-9_]+$/ { print $2 }' |
|
||||
sort
|
||||
)
|
||||
@ -102,7 +114,7 @@ errors=$(
|
||||
echo '// mkerrors.sh' "$@"
|
||||
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
|
||||
echo
|
||||
godefs -gsyscall "$@" _const.c
|
||||
godefs "$@" -gsyscall "$@" _const.c
|
||||
|
||||
# Run C program to print error strings.
|
||||
(
|
||||
@ -155,4 +167,4 @@ main(void)
|
||||
'
|
||||
) >_errors.c
|
||||
|
||||
gcc -o _errors _errors.c && ./_errors && rm -f _errors.c _errors _const.c
|
||||
gcc $ccflags -o _errors _errors.c && ./_errors && rm -f _errors.c _errors _const.c
|
||||
|
@ -19,6 +19,11 @@ const OS = "linux"
|
||||
* Wrapped
|
||||
*/
|
||||
|
||||
//sys open(path string, mode int, perm int) (fd int, errno int)
|
||||
func Open(path string, mode int, perm int) (fd int, errno int) {
|
||||
return open(path, mode|O_LARGEFILE, perm)
|
||||
}
|
||||
|
||||
//sys pipe(p *[2]_C_int) (errno int)
|
||||
func Pipe(p []int) (errno int) {
|
||||
if len(p) != 2 {
|
||||
@ -576,7 +581,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 Open(path string, mode int, perm int) (fd int, 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
// mkerrors.sh
|
||||
// mkerrors.sh -f -m32
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// godefs -gsyscall _const.c
|
||||
// godefs -f -m32 -gsyscall -f -m32 _const.c
|
||||
|
||||
// MACHINE GENERATED - DO NOT EDIT.
|
||||
|
||||
@ -49,6 +49,7 @@ const (
|
||||
EAFNOSUPPORT = 0x61
|
||||
EAGAIN = 0xb
|
||||
EALREADY = 0x72
|
||||
EAX = 0x6
|
||||
EBADE = 0x34
|
||||
EBADF = 0x9
|
||||
EBADFD = 0x4d
|
||||
@ -57,7 +58,9 @@ const (
|
||||
EBADRQC = 0x38
|
||||
EBADSLT = 0x39
|
||||
EBFONT = 0x3b
|
||||
EBP = 0x5
|
||||
EBUSY = 0x10
|
||||
EBX = 0
|
||||
ECANCELED = 0x7d
|
||||
ECHILD = 0xa
|
||||
ECHRNG = 0x2c
|
||||
@ -65,15 +68,19 @@ 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
|
||||
@ -82,6 +89,7 @@ const (
|
||||
EINTR = 0x4
|
||||
EINVAL = 0x16
|
||||
EIO = 0x5
|
||||
EIP = 0xc
|
||||
EISCONN = 0x6a
|
||||
EISDIR = 0x15
|
||||
EISNAM = 0x78
|
||||
@ -172,7 +180,9 @@ const (
|
||||
EREMOTEIO = 0x79
|
||||
ERESTART = 0x55
|
||||
EROFS = 0x1e
|
||||
ES = 0x8
|
||||
ESHUTDOWN = 0x6c
|
||||
ESI = 0x3
|
||||
ESOCKTNOSUPPORT = 0x5e
|
||||
ESPIPE = 0x1d
|
||||
ESRCH = 0x3
|
||||
@ -198,8 +208,8 @@ const (
|
||||
F_GETFD = 0x1
|
||||
F_GETFL = 0x3
|
||||
F_GETLEASE = 0x401
|
||||
F_GETLK = 0x5
|
||||
F_GETLK64 = 0x5
|
||||
F_GETLK = 0xc
|
||||
F_GETLK64 = 0xc
|
||||
F_GETOWN = 0x9
|
||||
F_GETSIG = 0xb
|
||||
F_LOCK = 0x1
|
||||
@ -209,10 +219,10 @@ const (
|
||||
F_SETFD = 0x2
|
||||
F_SETFL = 0x4
|
||||
F_SETLEASE = 0x400
|
||||
F_SETLK = 0x6
|
||||
F_SETLK64 = 0x6
|
||||
F_SETLKW = 0x7
|
||||
F_SETLKW64 = 0x7
|
||||
F_SETLK = 0xd
|
||||
F_SETLK64 = 0xd
|
||||
F_SETLKW = 0xe
|
||||
F_SETLKW64 = 0xe
|
||||
F_SETOWN = 0x8
|
||||
F_SETSIG = 0xa
|
||||
F_SHLCK = 0x8
|
||||
@ -344,7 +354,7 @@ const (
|
||||
O_DSYNC = 0x1000
|
||||
O_EXCL = 0x80
|
||||
O_FSYNC = 0x1000
|
||||
O_LARGEFILE = 0
|
||||
O_LARGEFILE = 0x8000
|
||||
O_NDELAY = 0x800
|
||||
O_NOATIME = 0x40000
|
||||
O_NOCTTY = 0x100
|
||||
@ -356,7 +366,6 @@ const (
|
||||
O_SYNC = 0x1000
|
||||
O_TRUNC = 0x200
|
||||
O_WRONLY = 0x1
|
||||
PTRACE_ARCH_PRCTL = 0x1e
|
||||
PTRACE_ATTACH = 0x10
|
||||
PTRACE_CONT = 0x7
|
||||
PTRACE_DETACH = 0x11
|
||||
@ -396,6 +405,8 @@ const (
|
||||
PTRACE_SET_THREAD_AREA = 0x1a
|
||||
PTRACE_SINGLESTEP = 0x9
|
||||
PTRACE_SYSCALL = 0x18
|
||||
PTRACE_SYSEMU = 0x1f
|
||||
PTRACE_SYSEMU_SINGLESTEP = 0x20
|
||||
PTRACE_TRACEME = 0
|
||||
SHUT_RD = 0
|
||||
SHUT_RDWR = 0x2
|
||||
@ -540,7 +551,7 @@ const (
|
||||
WNOHANG = 0x1
|
||||
WNOTHREAD = 0x20000000
|
||||
WNOWAIT = 0x1000000
|
||||
WORDSIZE = 0x40
|
||||
WORDSIZE = 0x20
|
||||
WSTOPPED = 0x2
|
||||
WUNTRACED = 0x2
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
// mkerrors.sh
|
||||
// mkerrors.sh -f -m64
|
||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||
|
||||
// godefs -gsyscall _const.c
|
||||
// godefs -f -m64 -gsyscall -f -m64 _const.c
|
||||
|
||||
// MACHINE GENERATED - DO NOT EDIT.
|
||||
|
||||
|
@ -5,6 +5,13 @@ 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 pipe(p *[2]_C_int) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||
errno = int(e1)
|
||||
@ -314,13 +321,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)
|
||||
|
@ -5,6 +5,13 @@ 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 pipe(p *[2]_C_int) (errno int) {
|
||||
_, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
|
||||
errno = int(e1)
|
||||
@ -314,13 +321,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)
|
||||
|
Loading…
Reference in New Issue
Block a user