Skip to content

Commit 3d795ea

Browse files
rhyshprattmic
authored andcommitted
runtime: add timer_create syscalls for Linux
Updates golang#35057 Change-Id: Id702b502fa4e4005ba1e450a945bc4420a8a8b8c Reviewed-on: https://go-review.googlesource.com/c/go/+/342052 Run-TryBot: Rhys Hiltner <rhys@justin.tv> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> Trust: Than McIntosh <thanm@google.com>
1 parent d4007ae commit 3d795ea

21 files changed

+478
-0
lines changed

src/runtime/defs_linux.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ const (
5858
SA_ONSTACK = C.SA_ONSTACK
5959
SA_SIGINFO = C.SA_SIGINFO
6060

61+
SI_KERNEL = C.SI_KERNEL
62+
SI_TIMER = C.SI_TIMER
63+
6164
SIGHUP = C.SIGHUP
6265
SIGINT = C.SIGINT
6366
SIGQUIT = C.SIGQUIT
@@ -109,6 +112,10 @@ const (
109112
ITIMER_VIRTUAL = C.ITIMER_VIRTUAL
110113
ITIMER_PROF = C.ITIMER_PROF
111114

115+
CLOCK_THREAD_CPUTIME_ID = C.CLOCK_THREAD_CPUTIME_ID
116+
117+
SIGEV_THREAD_ID = C.SIGEV_THREAD_ID
118+
112119
EPOLLIN = C.POLLIN
113120
EPOLLOUT = C.POLLOUT
114121
EPOLLERR = C.POLLERR
@@ -126,5 +133,7 @@ type Timespec C.struct_timespec
126133
type Timeval C.struct_timeval
127134
type Sigaction C.struct_sigaction
128135
type Siginfo C.siginfo_t
136+
type Itimerspec C.struct_itimerspec
129137
type Itimerval C.struct_itimerval
138+
type Sigevent C.struct_sigevent
130139
type EpollEvent C.struct_epoll_event

src/runtime/defs_linux_386.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const (
2828
_SA_RESTORER = 0x4000000
2929
_SA_SIGINFO = 0x4
3030

31+
_SI_KERNEL = 0x80
32+
_SI_TIMER = -0x2
33+
3134
_SIGHUP = 0x1
3235
_SIGINT = 0x2
3336
_SIGQUIT = 0x3
@@ -79,6 +82,10 @@ const (
7982
_ITIMER_VIRTUAL = 0x1
8083
_ITIMER_PROF = 0x2
8184

85+
_CLOCK_THREAD_CPUTIME_ID = 0x3
86+
87+
_SIGEV_THREAD_ID = 0x4
88+
8289
_O_RDONLY = 0x0
8390
_O_NONBLOCK = 0x800
8491
_O_CLOEXEC = 0x80000
@@ -212,11 +219,24 @@ type ucontext struct {
212219
uc_sigmask uint32
213220
}
214221

222+
type itimerspec struct {
223+
it_interval timespec
224+
it_value timespec
225+
}
226+
215227
type itimerval struct {
216228
it_interval timeval
217229
it_value timeval
218230
}
219231

232+
type sigevent struct {
233+
value uintptr
234+
signo int32
235+
notify int32
236+
// below here is a union; sigev_notify_thread_id is the only field we use
237+
sigev_notify_thread_id int32
238+
}
239+
220240
type epollevent struct {
221241
events uint32
222242
data [8]byte // to match amd64

src/runtime/defs_linux_amd64.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const (
2828
_SA_RESTORER = 0x4000000
2929
_SA_SIGINFO = 0x4
3030

31+
_SI_KERNEL = 0x80
32+
_SI_TIMER = -0x2
33+
3134
_SIGHUP = 0x1
3235
_SIGINT = 0x2
3336
_SIGQUIT = 0x3
@@ -79,6 +82,10 @@ const (
7982
_ITIMER_VIRTUAL = 0x1
8083
_ITIMER_PROF = 0x2
8184

85+
_CLOCK_THREAD_CPUTIME_ID = 0x3
86+
87+
_SIGEV_THREAD_ID = 0x4
88+
8289
_EPOLLIN = 0x1
8390
_EPOLLOUT = 0x4
8491
_EPOLLERR = 0x8
@@ -129,11 +136,24 @@ type siginfo struct {
129136
si_addr uint64
130137
}
131138

139+
type itimerspec struct {
140+
it_interval timespec
141+
it_value timespec
142+
}
143+
132144
type itimerval struct {
133145
it_interval timeval
134146
it_value timeval
135147
}
136148

149+
type sigevent struct {
150+
value uintptr
151+
signo int32
152+
notify int32
153+
// below here is a union; sigev_notify_thread_id is the only field we use
154+
sigev_notify_thread_id int32
155+
}
156+
137157
type epollevent struct {
138158
events uint32
139159
data [8]byte // unaligned uintptr

src/runtime/defs_linux_arm.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const (
2929
_SA_ONSTACK = 0x8000000
3030
_SA_RESTORER = 0 // unused on ARM
3131
_SA_SIGINFO = 0x4
32+
_SI_KERNEL = 0x80
33+
_SI_TIMER = -0x2
3234
_SIGHUP = 0x1
3335
_SIGINT = 0x2
3436
_SIGQUIT = 0x3
@@ -79,6 +81,10 @@ const (
7981
_O_NONBLOCK = 0x800
8082
_O_CLOEXEC = 0x80000
8183

84+
_CLOCK_THREAD_CPUTIME_ID = 0x3
85+
86+
_SIGEV_THREAD_ID = 0x4
87+
8288
_EPOLLIN = 0x1
8389
_EPOLLOUT = 0x4
8490
_EPOLLERR = 0x8
@@ -153,11 +159,24 @@ func (tv *timeval) set_usec(x int32) {
153159
tv.tv_usec = x
154160
}
155161

162+
type itimerspec struct {
163+
it_interval timespec
164+
it_value timespec
165+
}
166+
156167
type itimerval struct {
157168
it_interval timeval
158169
it_value timeval
159170
}
160171

172+
type sigevent struct {
173+
value uintptr
174+
signo int32
175+
notify int32
176+
// below here is a union; sigev_notify_thread_id is the only field we use
177+
sigev_notify_thread_id int32
178+
}
179+
161180
type siginfo struct {
162181
si_signo int32
163182
si_errno int32

src/runtime/defs_linux_arm64.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ const (
2828
_SA_RESTORER = 0x0 // Only used on intel
2929
_SA_SIGINFO = 0x4
3030

31+
_SI_KERNEL = 0x80
32+
_SI_TIMER = -0x2
33+
3134
_SIGHUP = 0x1
3235
_SIGINT = 0x2
3336
_SIGQUIT = 0x3
@@ -79,6 +82,10 @@ const (
7982
_ITIMER_VIRTUAL = 0x1
8083
_ITIMER_PROF = 0x2
8184

85+
_CLOCK_THREAD_CPUTIME_ID = 0x3
86+
87+
_SIGEV_THREAD_ID = 0x4
88+
8289
_EPOLLIN = 0x1
8390
_EPOLLOUT = 0x4
8491
_EPOLLERR = 0x8
@@ -129,11 +136,24 @@ type siginfo struct {
129136
si_addr uint64
130137
}
131138

139+
type itimerspec struct {
140+
it_interval timespec
141+
it_value timespec
142+
}
143+
132144
type itimerval struct {
133145
it_interval timeval
134146
it_value timeval
135147
}
136148

149+
type sigevent struct {
150+
value uintptr
151+
signo int32
152+
notify int32
153+
// below here is a union; sigev_notify_thread_id is the only field we use
154+
sigev_notify_thread_id int32
155+
}
156+
137157
type epollevent struct {
138158
events uint32
139159
_pad uint32

src/runtime/defs_linux_mips64x.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const (
3232
_SA_ONSTACK = 0x8000000
3333
_SA_SIGINFO = 0x8
3434

35+
_SI_KERNEL = 0x80
36+
_SI_TIMER = -0x2
37+
3538
_SIGHUP = 0x1
3639
_SIGINT = 0x2
3740
_SIGQUIT = 0x3
@@ -83,6 +86,10 @@ const (
8386
_ITIMER_VIRTUAL = 0x1
8487
_ITIMER_PROF = 0x2
8588

89+
_CLOCK_THREAD_CPUTIME_ID = 0x3
90+
91+
_SIGEV_THREAD_ID = 0x4
92+
8693
_EPOLLIN = 0x1
8794
_EPOLLOUT = 0x4
8895
_EPOLLERR = 0x8
@@ -138,11 +145,24 @@ type siginfo struct {
138145
si_addr uint64
139146
}
140147

148+
type itimerspec struct {
149+
it_interval timespec
150+
it_value timespec
151+
}
152+
141153
type itimerval struct {
142154
it_interval timeval
143155
it_value timeval
144156
}
145157

158+
type sigevent struct {
159+
value uintptr
160+
signo int32
161+
notify int32
162+
// below here is a union; sigev_notify_thread_id is the only field we use
163+
sigev_notify_thread_id int32
164+
}
165+
146166
type epollevent struct {
147167
events uint32
148168
pad_cgo_0 [4]byte

src/runtime/defs_linux_mipsx.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const (
3232
_SA_ONSTACK = 0x8000000
3333
_SA_SIGINFO = 0x8
3434

35+
_SI_KERNEL = 0x80
36+
_SI_TIMER = -0x2
37+
3538
_SIGHUP = 0x1
3639
_SIGINT = 0x2
3740
_SIGQUIT = 0x3
@@ -83,6 +86,10 @@ const (
8386
_ITIMER_VIRTUAL = 0x1
8487
_ITIMER_PROF = 0x2
8588

89+
_CLOCK_THREAD_CPUTIME_ID = 0x3
90+
91+
_SIGEV_THREAD_ID = 0x4
92+
8693
_EPOLLIN = 0x1
8794
_EPOLLOUT = 0x4
8895
_EPOLLERR = 0x8
@@ -132,11 +139,24 @@ type siginfo struct {
132139
si_addr uint32
133140
}
134141

142+
type itimerspec struct {
143+
it_interval timespec
144+
it_value timespec
145+
}
146+
135147
type itimerval struct {
136148
it_interval timeval
137149
it_value timeval
138150
}
139151

152+
type sigevent struct {
153+
value uintptr
154+
signo int32
155+
notify int32
156+
// below here is a union; sigev_notify_thread_id is the only field we use
157+
sigev_notify_thread_id int32
158+
}
159+
140160
type epollevent struct {
141161
events uint32
142162
pad_cgo_0 [4]byte

src/runtime/defs_linux_ppc64.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const (
2727
_SA_ONSTACK = 0x8000000
2828
_SA_SIGINFO = 0x4
2929

30+
_SI_KERNEL = 0x80
31+
_SI_TIMER = -0x2
32+
3033
_SIGHUP = 0x1
3134
_SIGINT = 0x2
3235
_SIGQUIT = 0x3
@@ -78,6 +81,10 @@ const (
7881
_ITIMER_VIRTUAL = 0x1
7982
_ITIMER_PROF = 0x2
8083

84+
_CLOCK_THREAD_CPUTIME_ID = 0x3
85+
86+
_SIGEV_THREAD_ID = 0x4
87+
8188
_EPOLLIN = 0x1
8289
_EPOLLOUT = 0x4
8390
_EPOLLERR = 0x8
@@ -130,11 +137,24 @@ type siginfo struct {
130137
si_addr uint64
131138
}
132139

140+
type itimerspec struct {
141+
it_interval timespec
142+
it_value timespec
143+
}
144+
133145
type itimerval struct {
134146
it_interval timeval
135147
it_value timeval
136148
}
137149

150+
type sigevent struct {
151+
value uintptr
152+
signo int32
153+
notify int32
154+
// below here is a union; sigev_notify_thread_id is the only field we use
155+
sigev_notify_thread_id int32
156+
}
157+
138158
type epollevent struct {
139159
events uint32
140160
pad_cgo_0 [4]byte

src/runtime/defs_linux_ppc64le.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const (
2727
_SA_ONSTACK = 0x8000000
2828
_SA_SIGINFO = 0x4
2929

30+
_SI_KERNEL = 0x80
31+
_SI_TIMER = -0x2
32+
3033
_SIGHUP = 0x1
3134
_SIGINT = 0x2
3235
_SIGQUIT = 0x3
@@ -78,6 +81,10 @@ const (
7881
_ITIMER_VIRTUAL = 0x1
7982
_ITIMER_PROF = 0x2
8083

84+
_CLOCK_THREAD_CPUTIME_ID = 0x3
85+
86+
_SIGEV_THREAD_ID = 0x4
87+
8188
_EPOLLIN = 0x1
8289
_EPOLLOUT = 0x4
8390
_EPOLLERR = 0x8
@@ -130,11 +137,24 @@ type siginfo struct {
130137
si_addr uint64
131138
}
132139

140+
type itimerspec struct {
141+
it_interval timespec
142+
it_value timespec
143+
}
144+
133145
type itimerval struct {
134146
it_interval timeval
135147
it_value timeval
136148
}
137149

150+
type sigevent struct {
151+
value uintptr
152+
signo int32
153+
notify int32
154+
// below here is a union; sigev_notify_thread_id is the only field we use
155+
sigev_notify_thread_id int32
156+
}
157+
138158
type epollevent struct {
139159
events uint32
140160
pad_cgo_0 [4]byte

0 commit comments

Comments
 (0)