LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 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 |
| 5 // +build darwin freebsd linux openbsd |
4 | 6 |
5 // Socket control messages | 7 // Socket control messages |
6 | 8 |
7 package syscall | 9 package syscall |
8 | 10 |
9 import ( | 11 import ( |
10 "unsafe" | 12 "unsafe" |
11 ) | 13 ) |
12 | 14 |
13 // Round the length of a raw sockaddr up to align it propery. | 15 // Round the length of a raw sockaddr up to align it propery. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 if msg.Header.Type != SCM_RIGHTS { | 106 if msg.Header.Type != SCM_RIGHTS { |
105 return nil, EINVAL | 107 return nil, EINVAL |
106 } | 108 } |
107 fds := make([]int, len(msg.Data)>>2) | 109 fds := make([]int, len(msg.Data)>>2) |
108 for i, j := 0, 0; i < len(msg.Data); i += 4 { | 110 for i, j := 0, 0; i < len(msg.Data); i += 4 { |
109 fds[j] = int(*(*int32)(unsafe.Pointer(&msg.Data[i]))) | 111 fds[j] = int(*(*int32)(unsafe.Pointer(&msg.Data[i]))) |
110 j++ | 112 j++ |
111 } | 113 } |
112 return fds, 0 | 114 return fds, 0 |
113 } | 115 } |
LEFT | RIGHT |