diff --git a/unix/linux/types.go b/unix/linux/types.go index ef138cf5..321cb8f6 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -84,6 +84,7 @@ struct termios2 { #include #include #include +#include #include #include #include @@ -3648,3 +3649,9 @@ type ( HIDRawReportDescriptor C.struct_hidraw_report_descriptor HIDRawDevInfo C.struct_hidraw_devinfo ) + +// close_range +const ( + CLOSE_RANGE_UNSHARE = C.CLOSE_RANGE_UNSHARE + CLOSE_RANGE_CLOEXEC = C.CLOSE_RANGE_CLOEXEC +) diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index 0a48548e..44ea96e3 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go @@ -1877,6 +1877,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e //sys ClockGettime(clockid int32, time *Timespec) (err error) //sys ClockNanosleep(clockid int32, flags int, request *Timespec, remain *Timespec) (err error) //sys Close(fd int) (err error) +//sys CloseRange(first uint, last uint, flags uint) (err error) //sys CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) //sys DeleteModule(name string, flags int) (err error) //sys Dup(oldfd int) (fd int, err error) diff --git a/unix/zsyscall_linux.go b/unix/zsyscall_linux.go index 3ee26f4a..7305cc91 100644 --- a/unix/zsyscall_linux.go +++ b/unix/zsyscall_linux.go @@ -532,6 +532,16 @@ func Close(fd int) (err error) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func CloseRange(first uint, last uint, flags uint) (err error) { + _, _, e1 := Syscall(SYS_CLOSE_RANGE, uintptr(first), uintptr(last), uintptr(flags)) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func CopyFileRange(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_COPY_FILE_RANGE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index d3a18713..33ca5034 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -3709,3 +3709,8 @@ type ( Product int16 } ) + +const ( + CLOSE_RANGE_UNSHARE = 0x2 + CLOSE_RANGE_CLOEXEC = 0x4 +)