Source file
src/runtime/os_js.go
Documentation: runtime
1
2
3
4
5
6
7
8 package runtime
9
10 import (
11 "unsafe"
12 )
13
14 func exit(code int32)
15
16 func write1(fd uintptr, p unsafe.Pointer, n int32) int32 {
17 if fd > 2 {
18 throw("runtime.write to fd > 2 is unsupported")
19 }
20 wasmWrite(fd, p, n)
21 return n
22 }
23
24
25 func open(name *byte, mode, perm int32) int32 { panic("not implemented") }
26 func closefd(fd int32) int32 { panic("not implemented") }
27 func read(fd int32, p unsafe.Pointer, n int32) int32 { panic("not implemented") }
28
29
30 func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)
31
32 func usleep(usec uint32)
33
34
35 func usleep_no_g(usec uint32) {
36 usleep(usec)
37 }
38
39 func exitThread(wait *uint32)
40
41 type mOS struct{}
42
43 func osyield()
44
45
46 func osyield_no_g() {
47 osyield()
48 }
49
50 const _SIGSEGV = 0xb
51
52 func sigpanic() {
53 g := getg()
54 if !canpanic(g) {
55 throw("unexpected signal during runtime execution")
56 }
57
58
59 g.sig = _SIGSEGV
60 panicmem()
61 }
62
63 type sigset struct{}
64
65
66
67 func mpreinit(mp *m) {
68 mp.gsignal = malg(32 * 1024)
69 mp.gsignal.m = mp
70 }
71
72
73 func sigsave(p *sigset) {
74 }
75
76
77 func msigrestore(sigmask sigset) {
78 }
79
80
81
82 func clearSignalHandlers() {
83 }
84
85
86 func sigblock(exiting bool) {
87 }
88
89
90
91 func minit() {
92 }
93
94
95 func unminit() {
96 }
97
98
99
100 func mdestroy(mp *m) {
101 }
102
103 func osinit() {
104 ncpu = 1
105 getg().m.procid = 2
106 physPageSize = 64 * 1024
107 }
108
109
110 const _NSIG = 0
111
112 func signame(sig uint32) string {
113 return ""
114 }
115
116 func crash() {
117 *(*int32)(nil) = 0
118 }
119
120 func getRandomData(r []byte)
121
122 func goenvs() {
123 goenvs_unix()
124 }
125
126 func initsig(preinit bool) {
127 }
128
129
130
131 func newosproc(mp *m) {
132 panic("newosproc: not implemented")
133 }
134
135 func setProcessCPUProfiler(hz int32) {}
136 func setThreadCPUProfiler(hz int32) {}
137 func sigdisable(uint32) {}
138 func sigenable(uint32) {}
139 func sigignore(uint32) {}
140
141
142 func os_sigpipe() {
143 throw("too many writes on closed pipe")
144 }
145
146
147 func cputicks() int64 {
148
149
150 return nanotime()
151 }
152
153
154 func syscall_now() (sec int64, nsec int32) {
155 sec, nsec, _ = time_now()
156 return
157 }
158
159
160 type gsignalStack struct{}
161
162 const preemptMSupported = false
163
164 func preemptM(mp *m) {
165
166 }
167
View as plain text