Source file
src/syscall/syscall_linux_riscv64.go
1
2
3
4
5 package syscall
6
7 import "unsafe"
8
9 const (
10 _SYS_setgroups = SYS_SETGROUPS
11 _SYS_clone3 = 435
12 _SYS_faccessat2 = 439
13 _SYS_fchmodat2 = 452
14 )
15
16
17
18
19
20
21 func Fstatat(fd int, path string, stat *Stat_t, flags int) error {
22 return fstatat(fd, path, stat, flags)
23 }
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) {
45 return renameat2(olddirfd, oldpath, newdirfd, newpath, 0)
46 }
47
48 func Stat(path string, stat *Stat_t) (err error) {
49 return fstatat(_AT_FDCWD, path, stat, 0)
50 }
51
52 func Lchown(path string, uid int, gid int) (err error) {
53 return Fchownat(_AT_FDCWD, path, uid, gid, _AT_SYMLINK_NOFOLLOW)
54 }
55
56 func Lstat(path string, stat *Stat_t) (err error) {
57 return fstatat(_AT_FDCWD, path, stat, _AT_SYMLINK_NOFOLLOW)
58 }
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79 type sigset_t struct {
80 X__val [16]uint64
81 }
82
83
84
85 func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) {
86 var ts *Timespec
87 if timeout != nil {
88 ts = &Timespec{Sec: timeout.Sec, Nsec: timeout.Usec * 1000}
89 }
90 return pselect(nfd, r, w, e, ts, nil)
91 }
92
93
94
95 func setTimespec(sec, nsec int64) Timespec {
96 return Timespec{Sec: sec, Nsec: nsec}
97 }
98
99 func setTimeval(sec, usec int64) Timeval {
100 return Timeval{Sec: sec, Usec: usec}
101 }
102
103 func futimesat(dirfd int, path string, tv *[2]Timeval) (err error) {
104 if tv == nil {
105 return utimensat(dirfd, path, nil, 0)
106 }
107
108 ts := []Timespec{
109 NsecToTimespec(TimevalToNsec(tv[0])),
110 NsecToTimespec(TimevalToNsec(tv[1])),
111 }
112 return utimensat(dirfd, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
113 }
114
115 func Time(t *Time_t) (Time_t, error) {
116 var tv Timeval
117 err := Gettimeofday(&tv)
118 if err != nil {
119 return 0, err
120 }
121 if t != nil {
122 *t = Time_t(tv.Sec)
123 }
124 return Time_t(tv.Sec), nil
125 }
126
127 func Utime(path string, buf *Utimbuf) error {
128 tv := []Timeval{
129 {Sec: buf.Actime},
130 {Sec: buf.Modtime},
131 }
132 return Utimes(path, tv)
133 }
134
135 func utimes(path string, tv *[2]Timeval) (err error) {
136 if tv == nil {
137 return utimensat(_AT_FDCWD, path, nil, 0)
138 }
139
140 ts := []Timespec{
141 NsecToTimespec(TimevalToNsec(tv[0])),
142 NsecToTimespec(TimevalToNsec(tv[1])),
143 }
144 return utimensat(_AT_FDCWD, path, (*[2]Timespec)(unsafe.Pointer(&ts[0])), 0)
145 }
146
147
148 func rawSetrlimit(resource int, rlim *Rlimit) Errno {
149 _, _, errno := RawSyscall(SYS_SETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0)
150 return errno
151 }
152
153 func (r *PtraceRegs) PC() uint64 { return r.Pc }
154
155 func (r *PtraceRegs) SetPC(pc uint64) { r.Pc = pc }
156
157 func (iov *Iovec) SetLen(length int) {
158 iov.Len = uint64(length)
159 }
160
161 func (msghdr *Msghdr) SetControllen(length int) {
162 msghdr.Controllen = uint64(length)
163 }
164
165 func (cmsg *Cmsghdr) SetLen(length int) {
166 cmsg.Len = uint64(length)
167 }
168
169 func InotifyInit() (fd int, err error) {
170 return InotifyInit1(0)
171 }
172
173
174
175 func Pause() error {
176 _, err := ppoll(nil, 0, nil, nil)
177 return err
178 }
179
View as plain text