src/runtime/os_unix.go
raw| 1 | // Copyright 2023 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | //go:build unix |
| 6 | |
| 7 | package runtime |
| 8 | |
| 9 | const ( |
| 10 | // These values are the same on all known Unix systems. |
| 11 | // If we find a discrepancy some day, we can split them out. |
| 12 | _F_SETFD = 2 |
| 13 | _FD_CLOEXEC = 1 |
| 14 | ) |
| 15 | |
| 16 | //go:nosplit |
| 17 | func closeonexec(fd int32) { |
| 18 | fcntl(fd, _F_SETFD, _FD_CLOEXEC) |
| 19 | } |