1// Copyright 2014 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 !aix && !darwin && !js && !openbsd && !plan9 && !solaris && !wasip1 && !windows
6
7package runtime
8
9import (
10	"internal/runtime/atomic"
11	"unsafe"
12)
13
14// read calls the read system call.
15// It returns a non-negative number of bytes written or a negative errno value.
16func read(fd int32, p unsafe.Pointer, n int32) int32
17
18func closefd(fd int32) int32
19
20func exit(code int32)
21func usleep(usec uint32)
22
23//go:nosplit
24func usleep_no_g(usec uint32) {
25	usleep(usec)
26}
27
28// write1 calls the write system call.
29// It returns a non-negative number of bytes written or a negative errno value.
30//
31//go:noescape
32func write1(fd uintptr, p unsafe.Pointer, n int32) int32
33
34//go:noescape
35func open(name *byte, mode, perm int32) int32
36
37// return value is only set on linux to be used in osinit().
38func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32
39
40// exitThread terminates the current thread, writing *wait = freeMStack when
41// the stack is safe to reclaim.
42//
43//go:noescape
44func exitThread(wait *atomic.Uint32)
45