1 // Copyright 2009 The Go Authors. All rights reserved. |
1 // Copyright 2009 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 // TODO(rsc): Rewrite all nn(SP) references into name+(nn-8)(FP) |
5 //go:build 386 && linux |
6 // so that go vet can check that they are correct. |
|
7 |
|
8 // +build 386,linux |
6 // +build 386,linux |
9 |
7 |
10 package unix |
8 package unix |
11 |
9 |
12 import ( |
10 import ( |
47 return |
45 return |
48 } |
46 } |
49 |
47 |
50 // 64-bit file system and 32-bit uid calls |
48 // 64-bit file system and 32-bit uid calls |
51 // (386 default is 32-bit file system and 16-bit uid). |
49 // (386 default is 32-bit file system and 16-bit uid). |
52 //sys Dup2(oldfd int, newfd int) (err error) |
50 //sys dup2(oldfd int, newfd int) (err error) |
53 //sysnb EpollCreate(size int) (fd int, err error) |
51 //sysnb EpollCreate(size int) (fd int, err error) |
54 //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) |
52 //sys EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) |
55 //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64 |
53 //sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_FADVISE64_64 |
56 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 |
54 //sys Fchown(fd int, uid int, gid int) (err error) = SYS_FCHOWN32 |
57 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 |
55 //sys Fstat(fd int, stat *Stat_t) (err error) = SYS_FSTAT64 |
99 type rlimit32 struct { |
97 type rlimit32 struct { |
100 Cur uint32 |
98 Cur uint32 |
101 Max uint32 |
99 Max uint32 |
102 } |
100 } |
103 |
101 |
104 //sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT |
102 //sysnb getrlimit(resource int, rlim *rlimit32) (err error) = SYS_GETRLIMIT |
105 |
103 |
106 const rlimInf32 = ^uint32(0) |
104 const rlimInf32 = ^uint32(0) |
107 const rlimInf64 = ^uint64(0) |
105 const rlimInf64 = ^uint64(0) |
108 |
106 |
109 func Getrlimit(resource int, rlim *Rlimit) (err error) { |
107 func Getrlimit(resource int, rlim *Rlimit) (err error) { |
130 rlim.Max = uint64(rl.Max) |
128 rlim.Max = uint64(rl.Max) |
131 } |
129 } |
132 return |
130 return |
133 } |
131 } |
134 |
132 |
135 //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT |
133 //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT |
136 |
134 |
137 func Setrlimit(resource int, rlim *Rlimit) (err error) { |
135 func Setrlimit(resource int, rlim *Rlimit) (err error) { |
138 err = prlimit(0, resource, rlim, nil) |
136 err = prlimit(0, resource, rlim, nil) |
139 if err != ENOSYS { |
137 if err != ENOSYS { |
140 return err |
138 return err |
378 |
376 |
379 func (cmsg *Cmsghdr) SetLen(length int) { |
377 func (cmsg *Cmsghdr) SetLen(length int) { |
380 cmsg.Len = uint32(length) |
378 cmsg.Len = uint32(length) |
381 } |
379 } |
382 |
380 |
|
381 func (rsa *RawSockaddrNFCLLCP) SetServiceNameLen(length int) { |
|
382 rsa.Service_name_len = uint32(length) |
|
383 } |
|
384 |
383 //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) |
385 //sys poll(fds *PollFd, nfds int, timeout int) (n int, err error) |
384 |
386 |
385 func Poll(fds []PollFd, timeout int) (n int, err error) { |
387 func Poll(fds []PollFd, timeout int) (n int, err error) { |
386 if len(fds) == 0 { |
388 if len(fds) == 0 { |
387 return poll(nil, 0, timeout) |
389 return poll(nil, 0, timeout) |