Skip to content

Commit 2adae60

Browse files
authored
Merge pull request containerd#10060 from dcantah/unix-waitid
Replace direct waitid syscall with unix.Waitid
2 parents 27dfb0d + ad584eb commit 2adae60

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

core/mount/mount_idmapped_linux.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,13 @@ func getUsernsFD(uidMaps, gidMaps []syscall.SysProcIDMap) (_usernsFD *os.File, r
190190
}
191191

192192
func pidfdWaitid(pidFD *os.File) error {
193-
// https://elixir.bootlin.com/linux/v5.4.258/source/include/uapi/linux/wait.h#L20
194-
const PPidFD = 3
195-
196-
var e syscall.Errno
197193
for {
198-
_, _, e = syscall.Syscall6(syscall.SYS_WAITID, PPidFD, pidFD.Fd(), 0, syscall.WEXITED, 0, 0)
199-
if e != syscall.EINTR {
200-
break
194+
err := unix.Waitid(unix.P_PIDFD, int(pidFD.Fd()), nil, unix.WEXITED, nil)
195+
if err == unix.EINTR {
196+
continue
201197
}
198+
return err
202199
}
203-
return e
204200
}
205201

206202
var (

0 commit comments

Comments
 (0)