unix: add Mkfifoat function on Linux
Add the Mkfifoat function on Linux, akin to the existing Mkfifo function
but taking an additional dirfd parameter. See
http://man7.org/linux/man-pages/man3/mkfifo.3.html
Originally requested in golang/go#14216
Also remove the named result parameter for Mkfifo, as they add no
additional use (suggested by Brad Fitzpatrick).
Change-Id: I7b759752abf3e1469d7f883a7f13313e3062aeb4
Reviewed-on: https://go-review.googlesource.com/48530
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go
index cc618f7..a6ac8e9 100644
--- a/unix/syscall_linux.go
+++ b/unix/syscall_linux.go
@@ -342,10 +342,14 @@
return
}
-func Mkfifo(path string, mode uint32) (err error) {
+func Mkfifo(path string, mode uint32) error {
return Mknod(path, mode|S_IFIFO, 0)
}
+func Mkfifoat(dirfd int, path string, mode uint32) error {
+ return Mknodat(dirfd, path, mode|S_IFIFO, 0)
+}
+
func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, _Socklen, error) {
if sa.Port < 0 || sa.Port > 0xFFFF {
return nil, 0, EINVAL