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