vendor/golang.org/x/sys/unix/syscall_illumos.go
changeset 260 445e01aede7e
parent 256 6d9efbef00a9
child 265 05c40b36d3b2
equal deleted inserted replaced
259:db4911b0c721 260:445e01aede7e
    18 func bytes2iovec(bs [][]byte) []Iovec {
    18 func bytes2iovec(bs [][]byte) []Iovec {
    19 	iovecs := make([]Iovec, len(bs))
    19 	iovecs := make([]Iovec, len(bs))
    20 	for i, b := range bs {
    20 	for i, b := range bs {
    21 		iovecs[i].SetLen(len(b))
    21 		iovecs[i].SetLen(len(b))
    22 		if len(b) > 0 {
    22 		if len(b) > 0 {
    23 			// somehow Iovec.Base on illumos is (*int8), not (*byte)
    23 			iovecs[i].Base = &b[0]
    24 			iovecs[i].Base = (*int8)(unsafe.Pointer(&b[0]))
       
    25 		} else {
    24 		} else {
    26 			iovecs[i].Base = (*int8)(unsafe.Pointer(&_zero))
    25 			iovecs[i].Base = (*byte)(unsafe.Pointer(&_zero))
    27 		}
    26 		}
    28 	}
    27 	}
    29 	return iovecs
    28 	return iovecs
    30 }
    29 }
    31 
    30 
   160 
   159 
   161 func (l *Lifreq) GetLifruInt() int {
   160 func (l *Lifreq) GetLifruInt() int {
   162 	return *(*int)(unsafe.Pointer(&l.Lifru[0]))
   161 	return *(*int)(unsafe.Pointer(&l.Lifru[0]))
   163 }
   162 }
   164 
   163 
       
   164 func (l *Lifreq) SetLifruUint(d uint) {
       
   165 	*(*uint)(unsafe.Pointer(&l.Lifru[0])) = d
       
   166 }
       
   167 
       
   168 func (l *Lifreq) GetLifruUint() uint {
       
   169 	return *(*uint)(unsafe.Pointer(&l.Lifru[0]))
       
   170 }
       
   171 
   165 func IoctlLifreq(fd int, req uint, l *Lifreq) error {
   172 func IoctlLifreq(fd int, req uint, l *Lifreq) error {
   166 	return ioctl(fd, req, uintptr(unsafe.Pointer(l)))
   173 	return ioctl(fd, req, uintptr(unsafe.Pointer(l)))
   167 }
   174 }
   168 
   175 
   169 // Strioctl Helpers
   176 // Strioctl Helpers