Commit a7f1d9ef authored by Tobias Klauser's avatar Tobias Klauser Committed by Ian Lance Taylor

unix: add Msync function on Darwin

Add the Msync function on darwin/amd64 and darwin/386.

Fixes golang/go#8245

Change-Id: I1d234bb97731934c36d926ed2332c93b35b2f641
Reviewed-on: https://go-review.googlesource.com/50892Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent d6d53c0e
...@@ -251,6 +251,7 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig ...@@ -251,6 +251,7 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig
//sys Mlock(b []byte) (err error) //sys Mlock(b []byte) (err error)
//sys Mlockall(flags int) (err error) //sys Mlockall(flags int) (err error)
//sys Mprotect(b []byte, prot int) (err error) //sys Mprotect(b []byte, prot int) (err error)
//sys Msync(b []byte, flags int) (err error)
//sys Munlock(b []byte) (err error) //sys Munlock(b []byte) (err error)
//sys Munlockall() (err error) //sys Munlockall() (err error)
//sys Open(path string, mode int, perm uint32) (fd int, err error) //sys Open(path string, mode int, perm uint32) (fd int, err error)
...@@ -479,7 +480,6 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig ...@@ -479,7 +480,6 @@ func Kill(pid int, signum syscall.Signal) (err error) { return kill(pid, int(sig
// Sendmsg_nocancel // Sendmsg_nocancel
// Recvfrom_nocancel // Recvfrom_nocancel
// Accept_nocancel // Accept_nocancel
// Msync_nocancel
// Fcntl_nocancel // Fcntl_nocancel
// Select_nocancel // Select_nocancel
// Fsync_nocancel // Fsync_nocancel
......
...@@ -144,6 +144,14 @@ const ( ...@@ -144,6 +144,14 @@ const (
BSDLY = 0x8000 BSDLY = 0x8000
CFLUSH = 0xf CFLUSH = 0xf
CLOCAL = 0x8000 CLOCAL = 0x8000
CLOCK_MONOTONIC = 0x6
CLOCK_MONOTONIC_RAW = 0x4
CLOCK_MONOTONIC_RAW_APPROX = 0x5
CLOCK_PROCESS_CPUTIME_ID = 0xc
CLOCK_REALTIME = 0x0
CLOCK_THREAD_CPUTIME_ID = 0x10
CLOCK_UPTIME_RAW = 0x8
CLOCK_UPTIME_RAW_APPROX = 0x9
CR0 = 0x0 CR0 = 0x0
CR1 = 0x1000 CR1 = 0x1000
CR2 = 0x2000 CR2 = 0x2000
...@@ -342,13 +350,14 @@ const ( ...@@ -342,13 +350,14 @@ const (
ECHONL = 0x10 ECHONL = 0x10
ECHOPRT = 0x20 ECHOPRT = 0x20
EVFILT_AIO = -0x3 EVFILT_AIO = -0x3
EVFILT_EXCEPT = -0xf
EVFILT_FS = -0x9 EVFILT_FS = -0x9
EVFILT_MACHPORT = -0x8 EVFILT_MACHPORT = -0x8
EVFILT_PROC = -0x5 EVFILT_PROC = -0x5
EVFILT_READ = -0x1 EVFILT_READ = -0x1
EVFILT_SIGNAL = -0x6 EVFILT_SIGNAL = -0x6
EVFILT_SYSCOUNT = 0xe EVFILT_SYSCOUNT = 0xf
EVFILT_THREADMARKER = 0xe EVFILT_THREADMARKER = 0xf
EVFILT_TIMER = -0x7 EVFILT_TIMER = -0x7
EVFILT_USER = -0xa EVFILT_USER = -0xa
EVFILT_VM = -0xc EVFILT_VM = -0xc
...@@ -359,6 +368,7 @@ const ( ...@@ -359,6 +368,7 @@ const (
EV_DELETE = 0x2 EV_DELETE = 0x2
EV_DISABLE = 0x8 EV_DISABLE = 0x8
EV_DISPATCH = 0x80 EV_DISPATCH = 0x80
EV_DISPATCH2 = 0x180
EV_ENABLE = 0x4 EV_ENABLE = 0x4
EV_EOF = 0x8000 EV_EOF = 0x8000
EV_ERROR = 0x4000 EV_ERROR = 0x4000
...@@ -369,6 +379,8 @@ const ( ...@@ -369,6 +379,8 @@ const (
EV_POLL = 0x1000 EV_POLL = 0x1000
EV_RECEIPT = 0x40 EV_RECEIPT = 0x40
EV_SYSFLAGS = 0xf000 EV_SYSFLAGS = 0xf000
EV_UDATA_SPECIFIC = 0x100
EV_VANISHED = 0x200
EXTA = 0x4b00 EXTA = 0x4b00
EXTB = 0x9600 EXTB = 0x9600
EXTPROC = 0x800 EXTPROC = 0x800
...@@ -379,9 +391,13 @@ const ( ...@@ -379,9 +391,13 @@ const (
FFDLY = 0x4000 FFDLY = 0x4000
FLUSHO = 0x800000 FLUSHO = 0x800000
F_ADDFILESIGS = 0x3d F_ADDFILESIGS = 0x3d
F_ADDFILESIGS_FOR_DYLD_SIM = 0x53
F_ADDFILESIGS_RETURN = 0x61
F_ADDSIGS = 0x3b F_ADDSIGS = 0x3b
F_ALLOCATEALL = 0x4 F_ALLOCATEALL = 0x4
F_ALLOCATECONTIG = 0x2 F_ALLOCATECONTIG = 0x2
F_BARRIERFSYNC = 0x55
F_CHECK_LV = 0x62
F_CHKCLEAN = 0x29 F_CHKCLEAN = 0x29
F_DUPFD = 0x0 F_DUPFD = 0x0
F_DUPFD_CLOEXEC = 0x43 F_DUPFD_CLOEXEC = 0x43
...@@ -783,11 +799,13 @@ const ( ...@@ -783,11 +799,13 @@ const (
MADV_FREE_REUSABLE = 0x7 MADV_FREE_REUSABLE = 0x7
MADV_FREE_REUSE = 0x8 MADV_FREE_REUSE = 0x8
MADV_NORMAL = 0x0 MADV_NORMAL = 0x0
MADV_PAGEOUT = 0xa
MADV_RANDOM = 0x1 MADV_RANDOM = 0x1
MADV_SEQUENTIAL = 0x2 MADV_SEQUENTIAL = 0x2
MADV_WILLNEED = 0x3 MADV_WILLNEED = 0x3
MADV_ZERO_WIRED_PAGES = 0x6 MADV_ZERO_WIRED_PAGES = 0x6
MAP_ANON = 0x1000 MAP_ANON = 0x1000
MAP_ANONYMOUS = 0x1000
MAP_COPY = 0x2 MAP_COPY = 0x2
MAP_FILE = 0x0 MAP_FILE = 0x0
MAP_FIXED = 0x10 MAP_FIXED = 0x10
...@@ -799,6 +817,8 @@ const ( ...@@ -799,6 +817,8 @@ const (
MAP_PRIVATE = 0x2 MAP_PRIVATE = 0x2
MAP_RENAME = 0x20 MAP_RENAME = 0x20
MAP_RESERVED0080 = 0x80 MAP_RESERVED0080 = 0x80
MAP_RESILIENT_CODESIGN = 0x2000
MAP_RESILIENT_MEDIA = 0x4000
MAP_SHARED = 0x1 MAP_SHARED = 0x1
MCL_CURRENT = 0x1 MCL_CURRENT = 0x1
MCL_FUTURE = 0x2 MCL_FUTURE = 0x2
...@@ -862,11 +882,14 @@ const ( ...@@ -862,11 +882,14 @@ const (
NOTE_FFNOP = 0x0 NOTE_FFNOP = 0x0
NOTE_FFOR = 0x80000000 NOTE_FFOR = 0x80000000
NOTE_FORK = 0x40000000 NOTE_FORK = 0x40000000
NOTE_FUNLOCK = 0x100
NOTE_LEEWAY = 0x10 NOTE_LEEWAY = 0x10
NOTE_LINK = 0x10 NOTE_LINK = 0x10
NOTE_LOWAT = 0x1 NOTE_LOWAT = 0x1
NOTE_MACH_CONTINUOUS_TIME = 0x80
NOTE_NONE = 0x80 NOTE_NONE = 0x80
NOTE_NSECONDS = 0x4 NOTE_NSECONDS = 0x4
NOTE_OOB = 0x2
NOTE_PCTRLMASK = -0x100000 NOTE_PCTRLMASK = -0x100000
NOTE_PDATAMASK = 0xfffff NOTE_PDATAMASK = 0xfffff
NOTE_REAP = 0x10000000 NOTE_REAP = 0x10000000
...@@ -900,6 +923,7 @@ const ( ...@@ -900,6 +923,7 @@ const (
O_CREAT = 0x200 O_CREAT = 0x200
O_DIRECTORY = 0x100000 O_DIRECTORY = 0x100000
O_DP_GETRAWENCRYPTED = 0x1 O_DP_GETRAWENCRYPTED = 0x1
O_DP_GETRAWUNENCRYPTED = 0x2
O_DSYNC = 0x400000 O_DSYNC = 0x400000
O_EVTONLY = 0x8000 O_EVTONLY = 0x8000
O_EXCL = 0x800 O_EXCL = 0x800
...@@ -1125,6 +1149,8 @@ const ( ...@@ -1125,6 +1149,8 @@ const (
SO_LABEL = 0x1010 SO_LABEL = 0x1010
SO_LINGER = 0x80 SO_LINGER = 0x80
SO_LINGER_SEC = 0x1080 SO_LINGER_SEC = 0x1080
SO_NETSVC_MARKING_LEVEL = 0x1119
SO_NET_SERVICE_TYPE = 0x1116
SO_NKE = 0x1021 SO_NKE = 0x1021
SO_NOADDRERR = 0x1023 SO_NOADDRERR = 0x1023
SO_NOSIGPIPE = 0x1022 SO_NOSIGPIPE = 0x1022
...@@ -1193,7 +1219,9 @@ const ( ...@@ -1193,7 +1219,9 @@ const (
TCOOFF = 0x1 TCOOFF = 0x1
TCOON = 0x2 TCOON = 0x2
TCP_CONNECTIONTIMEOUT = 0x20 TCP_CONNECTIONTIMEOUT = 0x20
TCP_CONNECTION_INFO = 0x106
TCP_ENABLE_ECN = 0x104 TCP_ENABLE_ECN = 0x104
TCP_FASTOPEN = 0x105
TCP_KEEPALIVE = 0x10 TCP_KEEPALIVE = 0x10
TCP_KEEPCNT = 0x102 TCP_KEEPCNT = 0x102
TCP_KEEPINTVL = 0x101 TCP_KEEPINTVL = 0x101
......
...@@ -937,6 +937,22 @@ func Mprotect(b []byte, prot int) (err error) { ...@@ -937,6 +937,22 @@ func Mprotect(b []byte, prot int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Msync(b []byte, flags int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlock(b []byte) (err error) { func Munlock(b []byte) (err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(b) > 0 { if len(b) > 0 {
......
...@@ -937,6 +937,22 @@ func Mprotect(b []byte, prot int) (err error) { ...@@ -937,6 +937,22 @@ func Mprotect(b []byte, prot int) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Msync(b []byte, flags int) (err error) {
var _p0 unsafe.Pointer
if len(b) > 0 {
_p0 = unsafe.Pointer(&b[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
_, _, e1 := Syscall(SYS_MSYNC, uintptr(_p0), uintptr(len(b)), uintptr(flags))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Munlock(b []byte) (err error) { func Munlock(b []byte) (err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(b) > 0 { if len(b) > 0 {
......
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