vendor/golang.org/x/sys/unix/syscall_linux_s390x.go
changeset 256 6d9efbef00a9
parent 251 1c52a0eeb952
child 260 445e01aede7e
equal deleted inserted replaced
255:4f153a23adab 256:6d9efbef00a9
     1 // Copyright 2016 The Go Authors. All rights reserved.
     1 // Copyright 2016 The Go Authors. All rights reserved.
     2 // Use of this source code is governed by a BSD-style
     2 // Use of this source code is governed by a BSD-style
     3 // license that can be found in the LICENSE file.
     3 // license that can be found in the LICENSE file.
     4 
     4 
       
     5 //go:build s390x && linux
     5 // +build s390x,linux
     6 // +build s390x,linux
     6 
     7 
     7 package unix
     8 package unix
     8 
     9 
     9 import (
    10 import (
    10 	"unsafe"
    11 	"unsafe"
    11 )
    12 )
    12 
    13 
    13 //sys	Dup2(oldfd int, newfd int) (err error)
    14 //sys	dup2(oldfd int, newfd int) (err error)
    14 //sysnb	EpollCreate(size int) (fd int, err error)
    15 //sysnb	EpollCreate(size int) (fd int, err error)
    15 //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
    16 //sys	EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error)
    16 //sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
    17 //sys	Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64
    17 //sys	Fchown(fd int, uid int, gid int) (err error)
    18 //sys	Fchown(fd int, uid int, gid int) (err error)
    18 //sys	Fstat(fd int, stat *Stat_t) (err error)
    19 //sys	Fstat(fd int, stat *Stat_t) (err error)
    74 
    75 
    75 func setTimeval(sec, usec int64) Timeval {
    76 func setTimeval(sec, usec int64) Timeval {
    76 	return Timeval{Sec: sec, Usec: usec}
    77 	return Timeval{Sec: sec, Usec: usec}
    77 }
    78 }
    78 
    79 
    79 //sysnb pipe2(p *[2]_C_int, flags int) (err error)
    80 //sysnb	pipe2(p *[2]_C_int, flags int) (err error)
    80 
    81 
    81 func Pipe(p []int) (err error) {
    82 func Pipe(p []int) (err error) {
    82 	if len(p) != 2 {
    83 	if len(p) != 2 {
    83 		return EINVAL
    84 		return EINVAL
    84 	}
    85 	}
   124 	msghdr.Iovlen = uint64(length)
   125 	msghdr.Iovlen = uint64(length)
   125 }
   126 }
   126 
   127 
   127 func (cmsg *Cmsghdr) SetLen(length int) {
   128 func (cmsg *Cmsghdr) SetLen(length int) {
   128 	cmsg.Len = uint64(length)
   129 	cmsg.Len = uint64(length)
       
   130 }
       
   131 
       
   132 func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) {
       
   133 	rsa.Service_name_len = uint64(length)
   129 }
   134 }
   130 
   135 
   131 // Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
   136 // Linux on s390x uses the old mmap interface, which requires arguments to be passed in a struct.
   132 // mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
   137 // mmap2 also requires arguments to be passed in a struct; it is currently not exposed in <asm/unistd.h>.
   133 func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
   138 func mmap(addr uintptr, length uintptr, prot int, flags int, fd int, offset int64) (xaddr uintptr, err error) {
   247 	}
   252 	}
   248 	return nil
   253 	return nil
   249 }
   254 }
   250 
   255 
   251 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error {
   256 func setsockopt(s int, level int, name int, val unsafe.Pointer, vallen uintptr) error {
   252 	args := [4]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val)}
   257 	args := [5]uintptr{uintptr(s), uintptr(level), uintptr(name), uintptr(val), vallen}
   253 	_, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
   258 	_, _, err := Syscall(SYS_SOCKETCALL, netSetSockOpt, uintptr(unsafe.Pointer(&args)), 0)
   254 	if err != 0 {
   259 	if err != 0 {
   255 		return err
   260 		return err
   256 	}
   261 	}
   257 	return nil
   262 	return nil