mirror of
https://github.com/opencontainers/runc.git
synced 2025-10-23 07:29:27 +08:00
Introduce and use internal/linux
This package is to provide unix.* wrappers to ensure that: - they retry on EINTR; - a "rich" error is returned on failure. A first such wrapper, Sendmsg, is introduced. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
15
internal/linux/linux.go
Normal file
15
internal/linux/linux.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package linux
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
// Sendmsg wraps [unix.Sendmsg].
|
||||
func Sendmsg(fd int, p, oob []byte, to unix.Sockaddr, flags int) error {
|
||||
err := retryOnEINTR(func() error {
|
||||
return unix.Sendmsg(fd, p, oob, to, flags)
|
||||
})
|
||||
return os.NewSyscallError("sendmsg", err)
|
||||
}
|
Reference in New Issue
Block a user