1// Copyright 2020 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 openbsd && mips64
6
7package runtime
8
9import (
10	"internal/runtime/atomic"
11	"unsafe"
12)
13
14//go:noescape
15func sigaction(sig uint32, new, old *sigactiont)
16
17func kqueue() int32
18
19//go:noescape
20func kevent(kq int32, ch *keventt, nch int32, ev *keventt, nev int32, ts *timespec) int32
21
22func raiseproc(sig uint32)
23
24func getthrid() int32
25func thrkill(tid int32, sig int)
26
27// read calls the read system call.
28// It returns a non-negative number of bytes written or a negative errno value.
29func read(fd int32, p unsafe.Pointer, n int32) int32
30
31func closefd(fd int32) int32
32
33func exit(code int32)
34func usleep(usec uint32)
35
36//go:nosplit
37func usleep_no_g(usec uint32) {
38	usleep(usec)
39}
40
41// write1 calls the write system call.
42// It returns a non-negative number of bytes written or a negative errno value.
43//
44//go:noescape
45func write1(fd uintptr, p unsafe.Pointer, n int32) int32
46
47//go:noescape
48func open(name *byte, mode, perm int32) int32
49
50// return value is only set on linux to be used in osinit().
51func madvise(addr unsafe.Pointer, n uintptr, flags int32) int32
52
53// exitThread terminates the current thread, writing *wait = freeMStack when
54// the stack is safe to reclaim.
55//
56//go:noescape
57func exitThread(wait *atomic.Uint32)
58
59//go:noescape
60func obsdsigprocmask(how int32, new sigset) sigset
61
62//go:nosplit
63//go:nowritebarrierrec
64func sigprocmask(how int32, new, old *sigset) {
65	n := sigset(0)
66	if new != nil {
67		n = *new
68	}
69	r := obsdsigprocmask(how, n)
70	if old != nil {
71		*old = r
72	}
73}
74
75func pipe2(flags int32) (r, w int32, errno int32)
76
77//go:noescape
78func setitimer(mode int32, new, old *itimerval)
79
80//go:noescape
81func sysctl(mib *uint32, miblen uint32, out *byte, size *uintptr, dst *byte, ndst uintptr) int32
82
83// mmap calls the mmap system call. It is implemented in assembly.
84// We only pass the lower 32 bits of file offset to the
85// assembly routine; the higher bits (if required), should be provided
86// by the assembly routine as 0.
87// The err result is an OS error code such as ENOMEM.
88func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (p unsafe.Pointer, err int)
89
90// munmap calls the munmap system call. It is implemented in assembly.
91func munmap(addr unsafe.Pointer, n uintptr)
92
93func nanotime1() int64
94
95//go:noescape
96func sigaltstack(new, old *stackt)
97
98func fcntl(fd, cmd, arg int32) (ret int32, errno int32)
99
100func walltime() (sec int64, nsec int32)
101
102func issetugid() int32
103