LEFT | RIGHT |
(no file at all) | |
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 // This package contains an interface to the low-level operating system | 5 // This package contains an interface to the low-level operating system |
6 // primitives. The details vary depending on the underlying system. | 6 // primitives. The details vary depending on the underlying system. |
7 // Its primary use is inside other packages that provide a more portable | 7 // Its primary use is inside other packages that provide a more portable |
8 // interface to the system, such as "os", "time" and "net". Use those | 8 // interface to the system, such as "os", "time" and "net". Use those |
9 // packages rather than this one if you can. | 9 // packages rather than this one if you can. |
10 // For details of the functions and data types in this package consult | 10 // For details of the functions and data types in this package consult |
11 // the manuals for the appropriate operating system. | 11 // the manuals for the appropriate operating system. |
12 // These calls return errno == 0 to indicate success; otherwise | 12 // These calls return errno == 0 to indicate success; otherwise |
13 // errno is an operating system error number describing the failure. | 13 // errno is an operating system error number describing the failure. |
14 package syscall | 14 package syscall |
15 | 15 |
16 // StringByteSlice returns a NUL-terminated slice of bytes | 16 // StringByteSlice returns a NUL-terminated slice of bytes |
17 // containing the text of s. | 17 // containing the text of s. |
18 func StringByteSlice(s string) []byte { | 18 func StringByteSlice(s string) []byte { |
19 a := make([]byte, len(s)+1) | 19 a := make([]byte, len(s)+1) |
20 copy(a, s) | 20 copy(a, s) |
21 return a | 21 return a |
22 } | 22 } |
23 | 23 |
24 // StringBytePtr returns a pointer to a NUL-terminated array of bytes | 24 // StringBytePtr returns a pointer to a NUL-terminated array of bytes |
25 // containing the text of s. | 25 // containing the text of s. |
26 func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] } | 26 func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] } |
| 27 |
| 28 // Single-word zero for use when we need a valid pointer to 0 bytes. |
| 29 // See mksyscall.sh. |
| 30 var _zero uintptr |
LEFT | RIGHT |