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.
(socket, file *os.File)
| 118 | // included so that if the other end uses RecvFile, the file will have the same |
| 119 | // name information. |
| 120 | func SendFile(socket, file *os.File) error { |
| 121 | name := file.Name() |
| 122 | if len(name) >= MaxNameLen { |
| 123 | return fmt.Errorf("sendfd: filename too long: %s", name) |
| 124 | } |
| 125 | err := SendRawFd(socket, name, file.Fd()) |
| 126 | runtime.KeepAlive(file) |
| 127 | return err |
| 128 | } |
| 129 | |
| 130 | // SendRawFd sends a specific file descriptor over the given AF_UNIX socket. |
| 131 | func SendRawFd(socket *os.File, msg string, fd uintptr) error { |
no test coverage detected
searching dependent graphs…