...
Source file src/pkg/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 write(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 func exitThread(wait *uint32)
34
35 type mOS struct{}
36
37 func osyield()
38
39 const _SIGSEGV = 0xb
40
41 func sigpanic() {
42 g := getg()
43 if !canpanic(g) {
44 throw("unexpected signal during runtime execution")
45 }
46
47
48 g.sig = _SIGSEGV
49 panicmem()
50 }
51
52 type sigset struct{}
53
54
55
56 func mpreinit(mp *m) {
57 mp.gsignal = malg(32 * 1024)
58 mp.gsignal.m = mp
59 }
60
61
62 func msigsave(mp *m) {
63 }
64
65
66 func msigrestore(sigmask sigset) {
67 }
68
69
70
71 func clearSignalHandlers() {
72 }
73
74
75 func sigblock() {
76 }
77
78
79
80 func minit() {
81 }
82
83
84 func unminit() {
85 }
86
87 func osinit() {
88 ncpu = 1
89 getg().m.procid = 2
90 physPageSize = 64 * 1024
91 }
92
93
94 const _NSIG = 0
95
96 func signame(sig uint32) string {
97 return ""
98 }
99
100 func crash() {
101 *(*int32)(nil) = 0
102 }
103
104 func getRandomData(r []byte)
105
106 func goenvs() {
107 goenvs_unix()
108 }
109
110 func initsig(preinit bool) {
111 }
112
113
114
115 func newosproc(mp *m) {
116 panic("newosproc: not implemented")
117 }
118
119 func setProcessCPUProfiler(hz int32) {}
120 func setThreadCPUProfiler(hz int32) {}
121 func sigdisable(uint32) {}
122 func sigenable(uint32) {}
123 func sigignore(uint32) {}
124
125
126 func os_sigpipe() {
127 throw("too many writes on closed pipe")
128 }
129
130
131 func cputicks() int64 {
132
133
134
135 return nanotime()
136 }
137
138
139 func syscall_now() (sec int64, nsec int32) {
140 sec, nsec, _ = time_now()
141 return
142 }
143
144
145 type gsignalStack struct{}
146
View as plain text