42 |
45 |
43 func (msghdr *Msghdr) SetControllen(length int) { |
46 func (msghdr *Msghdr) SetControllen(length int) { |
44 msghdr.Controllen = uint32(length) |
47 msghdr.Controllen = uint32(length) |
45 } |
48 } |
46 |
49 |
|
50 func (msghdr *Msghdr) SetIovlen(length int) { |
|
51 msghdr.Iovlen = int32(length) |
|
52 } |
|
53 |
47 func (cmsg *Cmsghdr) SetLen(length int) { |
54 func (cmsg *Cmsghdr) SetLen(length int) { |
48 cmsg.Len = uint32(length) |
55 cmsg.Len = uint32(length) |
49 } |
|
50 |
|
51 func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { |
|
52 var length = uint64(count) |
|
53 |
|
54 _, _, e1 := Syscall6(SYS_SENDFILE, uintptr(infd), uintptr(outfd), uintptr(*offset), uintptr(unsafe.Pointer(&length)), 0, 0) |
|
55 |
|
56 written = int(length) |
|
57 |
|
58 if e1 != 0 { |
|
59 err = e1 |
|
60 } |
|
61 return |
|
62 } |
56 } |
63 |
57 |
64 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic |
58 func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2 uintptr, err syscall.Errno) // sic |
65 |
59 |
66 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions |
60 // SYS___SYSCTL is used by syscall_bsd.go for all BSDs, but in modern versions |
67 // of darwin/arm64 the syscall is called sysctl instead of __sysctl. |
61 // of darwin/arm64 the syscall is called sysctl instead of __sysctl. |
68 const SYS___SYSCTL = SYS_SYSCTL |
62 const SYS___SYSCTL = SYS_SYSCTL |
|
63 |
|
64 //sys Fstat(fd int, stat *Stat_t) (err error) |
|
65 //sys Fstatat(fd int, path string, stat *Stat_t, flags int) (err error) |
|
66 //sys Fstatfs(fd int, stat *Statfs_t) (err error) |
|
67 //sys getfsstat(buf unsafe.Pointer, size uintptr, flags int) (n int, err error) = SYS_GETFSSTAT |
|
68 //sys Lstat(path string, stat *Stat_t) (err error) |
|
69 //sys Stat(path string, stat *Stat_t) (err error) |
|
70 //sys Statfs(path string, stat *Statfs_t) (err error) |