Commit 7b5e0b76 authored by Mikio Hara's avatar Mikio Hara

syscall: add Accept4 and SOCK_{CLOEXEC,NONBLOCK} on dragonfly

This change just picks a few constants from DragonfFly BSD 4.6 kernel
and doesn't synchronize all the existing constants with the latest
DragonFly BSD kernels.

Updates #14222.

Change-Id: Ie107a8bee1a09393b3b42b6f82489532f5d13290
Reviewed-on: https://go-review.googlesource.com/40894Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 245ef3a1
...@@ -92,6 +92,24 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { ...@@ -92,6 +92,24 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
return extpwrite(fd, p, 0, offset) return extpwrite(fd, p, 0, offset)
} }
func Accept4(fd, flags int) (nfd int, sa Sockaddr, err error) {
var rsa RawSockaddrAny
var len _Socklen = SizeofSockaddrAny
nfd, err = accept4(fd, &rsa, &len, flags)
if err != nil {
return
}
if len > SizeofSockaddrAny {
panic("RawSockaddrAny too small")
}
sa, err = anyToSockaddr(&rsa)
if err != nil {
Close(nfd)
nfd = 0
}
return
}
func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
var bufsize uintptr var bufsize uintptr
...@@ -192,6 +210,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) { ...@@ -192,6 +210,7 @@ func Getfsstat(buf []Statfs_t, flags int) (n int, err error) {
//sys munmap(addr uintptr, length uintptr) (err error) //sys munmap(addr uintptr, length uintptr) (err error)
//sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ //sys readlen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_READ
//sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE //sys writelen(fd int, buf *byte, nbuf int) (n int, err error) = SYS_WRITE
//sys accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error)
/* /*
* Unimplemented * Unimplemented
......
...@@ -1094,8 +1094,10 @@ const ( ...@@ -1094,8 +1094,10 @@ const (
SIOCSLIFPHYADDR = 0x8118694a SIOCSLIFPHYADDR = 0x8118694a
SIOCSLOWAT = 0x80047302 SIOCSLOWAT = 0x80047302
SIOCSPGRP = 0x80047308 SIOCSPGRP = 0x80047308
SOCK_CLOEXEC = 0x10000000
SOCK_DGRAM = 0x2 SOCK_DGRAM = 0x2
SOCK_MAXADDRLEN = 0xff SOCK_MAXADDRLEN = 0xff
SOCK_NONBLOCK = 0x20000000
SOCK_RAW = 0x3 SOCK_RAW = 0x3
SOCK_RDM = 0x4 SOCK_RDM = 0x4
SOCK_SEQPACKET = 0x5 SOCK_SEQPACKET = 0x5
......
...@@ -1287,3 +1287,14 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) { ...@@ -1287,3 +1287,14 @@ func writelen(fd int, buf *byte, nbuf int) (n int, err error) {
} }
return return
} }
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func accept4(fd int, rsa *RawSockaddrAny, addrlen *_Socklen, flags int) (nfd int, err error) {
r0, _, e1 := Syscall6(SYS_ACCEPT4, uintptr(fd), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen)), uintptr(flags), 0, 0)
nfd = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
...@@ -301,4 +301,5 @@ const ( ...@@ -301,4 +301,5 @@ const (
SYS_LPATHCONF = 533 // { int lpathconf(char *path, int name); } SYS_LPATHCONF = 533 // { int lpathconf(char *path, int name); }
SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); } SYS_VMM_GUEST_CTL = 534 // { int vmm_guest_ctl(int op, struct vmm_guest_options *options); }
SYS_VMM_GUEST_SYNC_ADDR = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); } SYS_VMM_GUEST_SYNC_ADDR = 535 // { int vmm_guest_sync_addr(long *dstaddr, long *srcaddr); }
SYS_ACCEPT4 = 541 // { int accept4(int s, caddr_t name, int *anamelen, int flags); }
) )
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