blob: 3587749917b93c0ff3cba6793090cb5020d41c6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
//go:build nintendoswitch
package syscall
import (
"internal/itoa"
)
// A Signal is a number describing a process signal.
// It implements the os.Signal interface.
type Signal int
const (
_ Signal = iota
SIGCHLD
SIGINT
SIGKILL
SIGTRAP
SIGQUIT
SIGTERM
)
func (s Signal) Signal() {}
func (s Signal) String() string {
if 0 <= s && int(s) < len(signals) {
str := signals[s]
if str != "" {
return str
}
}
return "signal " + itoa.Itoa(int(s))
}
var signals = [...]string{}
// File system
const (
Stdin = 0
Stdout = 1
Stderr = 2
)
const (
O_RDONLY = 0
O_WRONLY = 1
O_RDWR = 2
O_CREAT = 0100
O_TRUNC = 01000
O_APPEND = 02000
O_EXCL = 0200
O_SYNC = 010000
O_CLOEXEC = 0
)
//go:extern errno
var libcErrno uintptr
func getErrno() error {
return Errno(libcErrno)
}
func Pipe2(p []int, flags int) (err error) {
return ENOSYS // TODO
}
func Getpagesize() int {
return 4096 // TODO
}
type RawSockaddrInet4 struct {
// stub
}
type RawSockaddrInet6 struct {
// stub
}
func Chmod(path string, mode uint32) (err error) {
data := cstring(path)
fail := int(libc_chmod(&data[0], mode))
if fail < 0 {
err = getErrno()
}
return
}
// int open(const char *pathname, int flags, mode_t mode);
//
//export open
func libc_open(pathname *byte, flags int32, mode uint32) int32
|