123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package unix
- func setTimespec(sec, nsec int64) Timespec {
- return Timespec{Sec: sec, Nsec: nsec}
- }
- func setTimeval(sec, usec int64) Timeval {
- return Timeval{Sec: sec, Usec: usec}
- }
- func (r *PtraceRegs) PC() uint64 { return r.Nip }
- func (r *PtraceRegs) SetPC(pc uint64) { r.Nip = pc }
- func (iov *Iovec) SetLen(length int) {
- iov.Len = uint64(length)
- }
- func (msghdr *Msghdr) SetControllen(length int) {
- msghdr.Controllen = uint64(length)
- }
- func (cmsg *Cmsghdr) SetLen(length int) {
- cmsg.Len = uint64(length)
- }
- func Pipe(p []int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe(&pp)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
- }
- func Pipe2(p []int, flags int) (err error) {
- if len(p) != 2 {
- return EINVAL
- }
- var pp [2]_C_int
- err = pipe2(&pp, flags)
- p[0] = int(pp[0])
- p[1] = int(pp[1])
- return
- }
- func Poll(fds []PollFd, timeout int) (n int, err error) {
- if len(fds) == 0 {
- return poll(nil, 0, timeout)
- }
- return poll(&fds[0], len(fds), timeout)
- }
- func SyncFileRange(fd int, off int64, n int64, flags int) error {
-
-
- return syncFileRange2(fd, flags, off, n)
- }
- func KexecFileLoad(kernelFd int, initrdFd int, cmdline string, flags int) error {
- cmdlineLen := len(cmdline)
- if cmdlineLen > 0 {
-
-
-
- cmdlineLen++
- }
- return kexecFileLoad(kernelFd, initrdFd, cmdlineLen, cmdline, flags)
- }
|