equal
deleted
inserted
replaced
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 package unix |
5 package unix |
6 |
6 |
7 import ( |
7 import "unsafe" |
8 "unsafe" |
|
9 ) |
|
10 |
8 |
11 // IoctlRetInt performs an ioctl operation specified by req on a device |
9 // IoctlRetInt performs an ioctl operation specified by req on a device |
12 // associated with opened file descriptor fd, and returns a non-negative |
10 // associated with opened file descriptor fd, and returns a non-negative |
13 // integer that is returned by the ioctl syscall. |
11 // integer that is returned by the ioctl syscall. |
14 func IoctlRetInt(fd int, req uint) (int, error) { |
12 func IoctlRetInt(fd int, req uint) (int, error) { |
215 |
213 |
216 // IoctlKCMUnattach unattaches a TCP socket file descriptor from a multiplexor. |
214 // IoctlKCMUnattach unattaches a TCP socket file descriptor from a multiplexor. |
217 func IoctlKCMUnattach(fd int, info KCMUnattach) error { |
215 func IoctlKCMUnattach(fd int, info KCMUnattach) error { |
218 return ioctlPtr(fd, SIOCKCMUNATTACH, unsafe.Pointer(&info)) |
216 return ioctlPtr(fd, SIOCKCMUNATTACH, unsafe.Pointer(&info)) |
219 } |
217 } |
|
218 |
|
219 // IoctlLoopGetStatus64 gets the status of the loop device associated with the |
|
220 // file descriptor fd using the LOOP_GET_STATUS64 operation. |
|
221 func IoctlLoopGetStatus64(fd int) (*LoopInfo64, error) { |
|
222 var value LoopInfo64 |
|
223 if err := ioctlPtr(fd, LOOP_GET_STATUS64, unsafe.Pointer(&value)); err != nil { |
|
224 return nil, err |
|
225 } |
|
226 return &value, nil |
|
227 } |
|
228 |
|
229 // IoctlLoopSetStatus64 sets the status of the loop device associated with the |
|
230 // file descriptor fd using the LOOP_SET_STATUS64 operation. |
|
231 func IoctlLoopSetStatus64(fd int, value *LoopInfo64) error { |
|
232 return ioctlPtr(fd, LOOP_SET_STATUS64, unsafe.Pointer(value)) |
|
233 } |