mirror of
https://github.com/opencontainers/runc.git
synced 2026-04-22 23:17:17 +08:00
ca509e76ff
These helpers all make more sense as a self-contained package and moving them has the added benefit of removing an unneeded libpathrs dependency (from libcontainer/utils's import of pathrs-lite) from several test binaries. Signed-off-by: Aleksa Sarai <aleksa@amutable.com>
36 lines
1.2 KiB
Go
36 lines
1.2 KiB
Go
package utils
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/opencontainers/runc/internal/cmsg"
|
|
)
|
|
|
|
// RecvFile waits for a file descriptor to be sent over the given AF_UNIX
|
|
// socket. The file name of the remote file descriptor will be recreated
|
|
// locally (it is sent as non-auxiliary data in the same payload).
|
|
//
|
|
// Deprecated: This method is deprecated and has been moved to an internal
|
|
// package (see [cmsg.RecvFile]). It will be removed in runc 1.6.
|
|
func RecvFile(socket *os.File) (*os.File, error) {
|
|
return cmsg.RecvFile(socket)
|
|
}
|
|
|
|
// SendFile sends a file over the given AF_UNIX socket. file.Name() is also
|
|
// included so that if the other end uses RecvFile, the file will have the same
|
|
// name information.
|
|
//
|
|
// Deprecated: This method is deprecated and has been moved to an internal
|
|
// package (see [cmsg.SendFile]). It will be removed in runc 1.6.
|
|
func SendFile(socket, file *os.File) error {
|
|
return cmsg.SendFile(socket, file)
|
|
}
|
|
|
|
// SendRawFd sends a specific file descriptor over the given AF_UNIX socket.
|
|
//
|
|
// Deprecated: This method is deprecated and has been moved to an internal
|
|
// package (see [cmsg.SendRawFd]). It will be removed in runc 1.6.
|
|
func SendRawFd(socket *os.File, msg string, fd uintptr) error {
|
|
return cmsg.SendRawFd(socket, msg, fd)
|
|
}
|