VOL-4028: Add support for ANI-G Test Response and Result
Change-Id: Iae61554c426937a4ce5e78a0499195f6c3975b78
diff --git a/vendor/golang.org/x/sys/unix/syscall_linux.go b/vendor/golang.org/x/sys/unix/syscall_linux.go
index 95f7a15..558f07b 100644
--- a/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -13,6 +13,7 @@
import (
"encoding/binary"
+ "net"
"runtime"
"syscall"
"unsafe"
@@ -71,17 +72,6 @@
// ioctl itself should not be exposed directly, but additional get/set
// functions for specific types are permissible.
-// IoctlRetInt performs an ioctl operation specified by req on a device
-// associated with opened file descriptor fd, and returns a non-negative
-// integer that is returned by the ioctl syscall.
-func IoctlRetInt(fd int, req uint) (int, error) {
- ret, _, err := Syscall(SYS_IOCTL, uintptr(fd), uintptr(req), 0)
- if err != 0 {
- return 0, err
- }
- return int(ret), nil
-}
-
// IoctlSetPointerInt performs an ioctl operation which sets an
// integer value on fd, using the specified request number. The ioctl
// argument is called with a pointer to the integer value, rather than
@@ -91,18 +81,46 @@
return ioctl(fd, req, uintptr(unsafe.Pointer(&v)))
}
+// IoctlSetInt performs an ioctl operation which sets an integer value
+// on fd, using the specified request number.
+func IoctlSetInt(fd int, req uint, value int) error {
+ return ioctl(fd, req, uintptr(value))
+}
+
+func ioctlSetWinsize(fd int, req uint, value *Winsize) error {
+ return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
+}
+
+func ioctlSetTermios(fd int, req uint, value *Termios) error {
+ return ioctl(fd, req, uintptr(unsafe.Pointer(value)))
+}
+
func IoctlSetRTCTime(fd int, value *RTCTime) error {
err := ioctl(fd, RTC_SET_TIME, uintptr(unsafe.Pointer(value)))
runtime.KeepAlive(value)
return err
}
-func IoctlGetUint32(fd int, req uint) (uint32, error) {
- var value uint32
+// IoctlGetInt performs an ioctl operation which gets an integer value
+// from fd, using the specified request number.
+func IoctlGetInt(fd int, req uint) (int, error) {
+ var value int
err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
return value, err
}
+func IoctlGetWinsize(fd int, req uint) (*Winsize, error) {
+ var value Winsize
+ err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
+ return &value, err
+}
+
+func IoctlGetTermios(fd int, req uint) (*Termios, error) {
+ var value Termios
+ err := ioctl(fd, req, uintptr(unsafe.Pointer(&value)))
+ return &value, err
+}
+
func IoctlGetRTCTime(fd int) (*RTCTime, error) {
var value RTCTime
err := ioctl(fd, RTC_RD_TIME, uintptr(unsafe.Pointer(&value)))
@@ -741,7 +759,7 @@
type SockaddrPPPoE struct {
SID uint16
- Remote []byte
+ Remote net.HardwareAddr
Dev string
raw RawSockaddrPPPoX
}
@@ -775,70 +793,6 @@
return unsafe.Pointer(&sa.raw), SizeofSockaddrPPPoX, nil
}
-// SockaddrTIPC implements the Sockaddr interface for AF_TIPC type sockets.
-// For more information on TIPC, see: http://tipc.sourceforge.net/.
-type SockaddrTIPC struct {
- // Scope is the publication scopes when binding service/service range.
- // Should be set to TIPC_CLUSTER_SCOPE or TIPC_NODE_SCOPE.
- Scope int
-
- // Addr is the type of address used to manipulate a socket. Addr must be
- // one of:
- // - *TIPCSocketAddr: "id" variant in the C addr union
- // - *TIPCServiceRange: "nameseq" variant in the C addr union
- // - *TIPCServiceName: "name" variant in the C addr union
- //
- // If nil, EINVAL will be returned when the structure is used.
- Addr TIPCAddr
-
- raw RawSockaddrTIPC
-}
-
-// TIPCAddr is implemented by types that can be used as an address for
-// SockaddrTIPC. It is only implemented by *TIPCSocketAddr, *TIPCServiceRange,
-// and *TIPCServiceName.
-type TIPCAddr interface {
- tipcAddrtype() uint8
- tipcAddr() [12]byte
-}
-
-func (sa *TIPCSocketAddr) tipcAddr() [12]byte {
- var out [12]byte
- copy(out[:], (*(*[unsafe.Sizeof(TIPCSocketAddr{})]byte)(unsafe.Pointer(sa)))[:])
- return out
-}
-
-func (sa *TIPCSocketAddr) tipcAddrtype() uint8 { return TIPC_SOCKET_ADDR }
-
-func (sa *TIPCServiceRange) tipcAddr() [12]byte {
- var out [12]byte
- copy(out[:], (*(*[unsafe.Sizeof(TIPCServiceRange{})]byte)(unsafe.Pointer(sa)))[:])
- return out
-}
-
-func (sa *TIPCServiceRange) tipcAddrtype() uint8 { return TIPC_SERVICE_RANGE }
-
-func (sa *TIPCServiceName) tipcAddr() [12]byte {
- var out [12]byte
- copy(out[:], (*(*[unsafe.Sizeof(TIPCServiceName{})]byte)(unsafe.Pointer(sa)))[:])
- return out
-}
-
-func (sa *TIPCServiceName) tipcAddrtype() uint8 { return TIPC_SERVICE_ADDR }
-
-func (sa *SockaddrTIPC) sockaddr() (unsafe.Pointer, _Socklen, error) {
- if sa.Addr == nil {
- return nil, 0, EINVAL
- }
-
- sa.raw.Family = AF_TIPC
- sa.raw.Scope = int8(sa.Scope)
- sa.raw.Addrtype = sa.Addr.tipcAddrtype()
- sa.raw.Addr = sa.Addr.tipcAddr()
-
- return unsafe.Pointer(&sa.raw), SizeofSockaddrTIPC, nil
-}
-
func anyToSockaddr(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
switch rsa.Addr.Family {
case AF_NETLINK:
@@ -884,7 +838,7 @@
for n < len(pp.Path) && pp.Path[n] != 0 {
n++
}
- bytes := (*[len(pp.Path)]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
+ bytes := (*[10000]byte)(unsafe.Pointer(&pp.Path[0]))[0:n]
sa.Name = string(bytes)
return sa, nil
@@ -956,7 +910,7 @@
}
sa := &SockaddrPPPoE{
SID: binary.BigEndian.Uint16(pp[6:8]),
- Remote: pp[8:14],
+ Remote: net.HardwareAddr(pp[8:14]),
}
for i := 14; i < 14+IFNAMSIZ; i++ {
if pp[i] == 0 {
@@ -965,27 +919,6 @@
}
}
return sa, nil
- case AF_TIPC:
- pp := (*RawSockaddrTIPC)(unsafe.Pointer(rsa))
-
- sa := &SockaddrTIPC{
- Scope: int(pp.Scope),
- }
-
- // Determine which union variant is present in pp.Addr by checking
- // pp.Addrtype.
- switch pp.Addrtype {
- case TIPC_SERVICE_RANGE:
- sa.Addr = (*TIPCServiceRange)(unsafe.Pointer(&pp.Addr))
- case TIPC_SERVICE_ADDR:
- sa.Addr = (*TIPCServiceName)(unsafe.Pointer(&pp.Addr))
- case TIPC_SOCKET_ADDR:
- sa.Addr = (*TIPCSocketAddr)(unsafe.Pointer(&pp.Addr))
- default:
- return nil, EINVAL
- }
-
- return sa, nil
}
return nil, EAFNOSUPPORT
}
@@ -1222,34 +1155,6 @@
return keyctlDH(KEYCTL_DH_COMPUTE, params, buffer)
}
-// KeyctlRestrictKeyring implements the KEYCTL_RESTRICT_KEYRING command. This
-// command limits the set of keys that can be linked to the keyring, regardless
-// of keyring permissions. The command requires the "setattr" permission.
-//
-// When called with an empty keyType the command locks the keyring, preventing
-// any further keys from being linked to the keyring.
-//
-// The "asymmetric" keyType defines restrictions requiring key payloads to be
-// DER encoded X.509 certificates signed by keys in another keyring. Restrictions
-// for "asymmetric" include "builtin_trusted", "builtin_and_secondary_trusted",
-// "key_or_keyring:<key>", and "key_or_keyring:<key>:chain".
-//
-// As of Linux 4.12, only the "asymmetric" keyType defines type-specific
-// restrictions.
-//
-// See the full documentation at:
-// http://man7.org/linux/man-pages/man3/keyctl_restrict_keyring.3.html
-// http://man7.org/linux/man-pages/man2/keyctl.2.html
-func KeyctlRestrictKeyring(ringid int, keyType string, restriction string) error {
- if keyType == "" {
- return keyctlRestrictKeyring(KEYCTL_RESTRICT_KEYRING, ringid)
- }
- return keyctlRestrictKeyringByType(KEYCTL_RESTRICT_KEYRING, ringid, keyType, restriction)
-}
-
-//sys keyctlRestrictKeyringByType(cmd int, arg2 int, keyType string, restriction string) (err error) = SYS_KEYCTL
-//sys keyctlRestrictKeyring(cmd int, arg2 int) (err error) = SYS_KEYCTL
-
func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, err error) {
var msg Msghdr
var rsa RawSockaddrAny
@@ -1493,12 +1398,8 @@
func PtraceSingleStep(pid int) (err error) { return ptrace(PTRACE_SINGLESTEP, pid, 0, 0) }
-func PtraceInterrupt(pid int) (err error) { return ptrace(PTRACE_INTERRUPT, pid, 0, 0) }
-
func PtraceAttach(pid int) (err error) { return ptrace(PTRACE_ATTACH, pid, 0, 0) }
-func PtraceSeize(pid int) (err error) { return ptrace(PTRACE_SEIZE, pid, 0, 0) }
-
func PtraceDetach(pid int) (err error) { return ptrace(PTRACE_DETACH, pid, 0, 0) }
//sys reboot(magic1 uint, magic2 uint, cmd int, arg string) (err error)
@@ -1507,20 +1408,8 @@
return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "")
}
-func direntIno(buf []byte) (uint64, bool) {
- return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
-}
-
-func direntReclen(buf []byte) (uint64, bool) {
- return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
-}
-
-func direntNamlen(buf []byte) (uint64, bool) {
- reclen, ok := direntReclen(buf)
- if !ok {
- return 0, false
- }
- return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
+func ReadDirent(fd int, buf []byte) (n int, err error) {
+ return Getdents(fd, buf)
}
//sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error)
@@ -1555,8 +1444,6 @@
//sys Acct(path string) (err error)
//sys AddKey(keyType string, description string, payload []byte, ringid int) (id int, err error)
//sys Adjtimex(buf *Timex) (state int, err error)
-//sysnb Capget(hdr *CapUserHeader, data *CapUserData) (err error)
-//sysnb Capset(hdr *CapUserHeader, data *CapUserData) (err error)
//sys Chdir(path string) (err error)
//sys Chroot(path string) (err error)
//sys ClockGetres(clockid int32, res *Timespec) (err error)
@@ -1575,6 +1462,7 @@
//sys Fchdir(fd int) (err error)
//sys Fchmod(fd int, mode uint32) (err error)
//sys Fchownat(dirfd int, path string, uid int, gid int, flags int) (err error)
+//sys fcntl(fd int, cmd int, arg int) (val int, err error)
//sys Fdatasync(fd int) (err error)
//sys Fgetxattr(fd int, attr string, dest []byte) (sz int, err error)
//sys FinitModule(fd int, params string, flags int) (err error)
@@ -1630,17 +1518,6 @@
//sysnb Settimeofday(tv *Timeval) (err error)
//sys Setns(fd int, nstype int) (err error)
-// PrctlRetInt performs a prctl operation specified by option and further
-// optional arguments arg2 through arg5 depending on option. It returns a
-// non-negative integer that is returned by the prctl syscall.
-func PrctlRetInt(option int, arg2 uintptr, arg3 uintptr, arg4 uintptr, arg5 uintptr) (int, error) {
- ret, _, err := Syscall6(SYS_PRCTL, uintptr(option), uintptr(arg2), uintptr(arg3), uintptr(arg4), uintptr(arg5), 0)
- if err != 0 {
- return 0, err
- }
- return int(ret), nil
-}
-
// issue 1435.
// On linux Setuid and Setgid only affects the current thread, not the process.
// This does not match what most callers expect so we must return an error
@@ -1654,37 +1531,9 @@
return EOPNOTSUPP
}
-// SetfsgidRetGid sets fsgid for current thread and returns previous fsgid set.
-// setfsgid(2) will return a non-nil error only if its caller lacks CAP_SETUID capability.
-// If the call fails due to other reasons, current fsgid will be returned.
-func SetfsgidRetGid(gid int) (int, error) {
- return setfsgid(gid)
-}
-
-// SetfsuidRetUid sets fsuid for current thread and returns previous fsuid set.
-// setfsgid(2) will return a non-nil error only if its caller lacks CAP_SETUID capability
-// If the call fails due to other reasons, current fsuid will be returned.
-func SetfsuidRetUid(uid int) (int, error) {
- return setfsuid(uid)
-}
-
-func Setfsgid(gid int) error {
- _, err := setfsgid(gid)
- return err
-}
-
-func Setfsuid(uid int) error {
- _, err := setfsuid(uid)
- return err
-}
-
-func Signalfd(fd int, sigmask *Sigset_t, flags int) (newfd int, err error) {
- return signalfd(fd, sigmask, _C__NSIG/8, flags)
-}
-
//sys Setpriority(which int, who int, prio int) (err error)
//sys Setxattr(path string, attr string, data []byte, flags int) (err error)
-//sys signalfd(fd int, sigmask *Sigset_t, maskSize uintptr, flags int) (newfd int, err error) = SYS_SIGNALFD4
+//sys Signalfd(fd int, mask *Sigset_t, flags int) = SYS_SIGNALFD4
//sys Statx(dirfd int, path string, flags int, mask int, stat *Statx_t) (err error)
//sys Sync()
//sys Syncfs(fd int) (err error)
@@ -1700,123 +1549,6 @@
//sys exitThread(code int) (err error) = SYS_EXIT
//sys readlen(fd int, p *byte, np int) (n int, err error) = SYS_READ
//sys writelen(fd int, p *byte, np int) (n int, err error) = SYS_WRITE
-//sys readv(fd int, iovs []Iovec) (n int, err error) = SYS_READV
-//sys writev(fd int, iovs []Iovec) (n int, err error) = SYS_WRITEV
-//sys preadv(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PREADV
-//sys pwritev(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr) (n int, err error) = SYS_PWRITEV
-//sys preadv2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PREADV2
-//sys pwritev2(fd int, iovs []Iovec, offs_l uintptr, offs_h uintptr, flags int) (n int, err error) = SYS_PWRITEV2
-
-func bytes2iovec(bs [][]byte) []Iovec {
- iovecs := make([]Iovec, len(bs))
- for i, b := range bs {
- iovecs[i].SetLen(len(b))
- if len(b) > 0 {
- iovecs[i].Base = &b[0]
- } else {
- iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero))
- }
- }
- return iovecs
-}
-
-// offs2lohi splits offs into its lower and upper unsigned long. On 64-bit
-// systems, hi will always be 0. On 32-bit systems, offs will be split in half.
-// preadv/pwritev chose this calling convention so they don't need to add a
-// padding-register for alignment on ARM.
-func offs2lohi(offs int64) (lo, hi uintptr) {
- return uintptr(offs), uintptr(uint64(offs) >> SizeofLong)
-}
-
-func Readv(fd int, iovs [][]byte) (n int, err error) {
- iovecs := bytes2iovec(iovs)
- n, err = readv(fd, iovecs)
- readvRacedetect(iovecs, n, err)
- return n, err
-}
-
-func Preadv(fd int, iovs [][]byte, offset int64) (n int, err error) {
- iovecs := bytes2iovec(iovs)
- lo, hi := offs2lohi(offset)
- n, err = preadv(fd, iovecs, lo, hi)
- readvRacedetect(iovecs, n, err)
- return n, err
-}
-
-func Preadv2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {
- iovecs := bytes2iovec(iovs)
- lo, hi := offs2lohi(offset)
- n, err = preadv2(fd, iovecs, lo, hi, flags)
- readvRacedetect(iovecs, n, err)
- return n, err
-}
-
-func readvRacedetect(iovecs []Iovec, n int, err error) {
- if !raceenabled {
- return
- }
- for i := 0; n > 0 && i < len(iovecs); i++ {
- m := int(iovecs[i].Len)
- if m > n {
- m = n
- }
- n -= m
- if m > 0 {
- raceWriteRange(unsafe.Pointer(iovecs[i].Base), m)
- }
- }
- if err == nil {
- raceAcquire(unsafe.Pointer(&ioSync))
- }
-}
-
-func Writev(fd int, iovs [][]byte) (n int, err error) {
- iovecs := bytes2iovec(iovs)
- if raceenabled {
- raceReleaseMerge(unsafe.Pointer(&ioSync))
- }
- n, err = writev(fd, iovecs)
- writevRacedetect(iovecs, n)
- return n, err
-}
-
-func Pwritev(fd int, iovs [][]byte, offset int64) (n int, err error) {
- iovecs := bytes2iovec(iovs)
- if raceenabled {
- raceReleaseMerge(unsafe.Pointer(&ioSync))
- }
- lo, hi := offs2lohi(offset)
- n, err = pwritev(fd, iovecs, lo, hi)
- writevRacedetect(iovecs, n)
- return n, err
-}
-
-func Pwritev2(fd int, iovs [][]byte, offset int64, flags int) (n int, err error) {
- iovecs := bytes2iovec(iovs)
- if raceenabled {
- raceReleaseMerge(unsafe.Pointer(&ioSync))
- }
- lo, hi := offs2lohi(offset)
- n, err = pwritev2(fd, iovecs, lo, hi, flags)
- writevRacedetect(iovecs, n)
- return n, err
-}
-
-func writevRacedetect(iovecs []Iovec, n int) {
- if !raceenabled {
- return
- }
- for i := 0; n > 0 && i < len(iovecs); i++ {
- m := int(iovecs[i].Len)
- if m > n {
- m = n
- }
- n -= m
- if m > 0 {
- raceReadRange(unsafe.Pointer(iovecs[i].Base), m)
- }
- }
-}
// mmap varies by architecture; see syscall_linux_*.go.
//sys munmap(addr uintptr, length uintptr) (err error)
@@ -1943,80 +1675,6 @@
Type int32
}
-// FileHandle represents the C struct file_handle used by
-// name_to_handle_at (see NameToHandleAt) and open_by_handle_at (see
-// OpenByHandleAt).
-type FileHandle struct {
- *fileHandle
-}
-
-// NewFileHandle constructs a FileHandle.
-func NewFileHandle(handleType int32, handle []byte) FileHandle {
- const hdrSize = unsafe.Sizeof(fileHandle{})
- buf := make([]byte, hdrSize+uintptr(len(handle)))
- copy(buf[hdrSize:], handle)
- fh := (*fileHandle)(unsafe.Pointer(&buf[0]))
- fh.Type = handleType
- fh.Bytes = uint32(len(handle))
- return FileHandle{fh}
-}
-
-func (fh *FileHandle) Size() int { return int(fh.fileHandle.Bytes) }
-func (fh *FileHandle) Type() int32 { return fh.fileHandle.Type }
-func (fh *FileHandle) Bytes() []byte {
- n := fh.Size()
- if n == 0 {
- return nil
- }
- return (*[1 << 30]byte)(unsafe.Pointer(uintptr(unsafe.Pointer(&fh.fileHandle.Type)) + 4))[:n:n]
-}
-
-// NameToHandleAt wraps the name_to_handle_at system call; it obtains
-// a handle for a path name.
-func NameToHandleAt(dirfd int, path string, flags int) (handle FileHandle, mountID int, err error) {
- var mid _C_int
- // Try first with a small buffer, assuming the handle will
- // only be 32 bytes.
- size := uint32(32 + unsafe.Sizeof(fileHandle{}))
- didResize := false
- for {
- buf := make([]byte, size)
- fh := (*fileHandle)(unsafe.Pointer(&buf[0]))
- fh.Bytes = size - uint32(unsafe.Sizeof(fileHandle{}))
- err = nameToHandleAt(dirfd, path, fh, &mid, flags)
- if err == EOVERFLOW {
- if didResize {
- // We shouldn't need to resize more than once
- return
- }
- didResize = true
- size = fh.Bytes + uint32(unsafe.Sizeof(fileHandle{}))
- continue
- }
- if err != nil {
- return
- }
- return FileHandle{fh}, int(mid), nil
- }
-}
-
-// OpenByHandleAt wraps the open_by_handle_at system call; it opens a
-// file via a handle as previously returned by NameToHandleAt.
-func OpenByHandleAt(mountFD int, handle FileHandle, flags int) (fd int, err error) {
- return openByHandleAt(mountFD, handle.fileHandle, flags)
-}
-
-// Klogset wraps the sys_syslog system call; it sets console_loglevel to
-// the value specified by arg and passes a dummy pointer to bufp.
-func Klogset(typ int, arg int) (err error) {
- var p unsafe.Pointer
- _, _, errno := Syscall(SYS_SYSLOG, uintptr(typ), uintptr(p), uintptr(arg))
- if errno != 0 {
- return errnoErr(errno)
- }
- return nil
-}
-
/*
* Unimplemented
*/
@@ -2024,6 +1682,8 @@
// Alarm
// ArchPrctl
// Brk
+// Capget
+// Capset
// ClockNanosleep
// ClockSettime
// Clone