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