From 4cd6d1a821c7175768725b55ca82f14683a29ea4 Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 14 Jul 2017 15:21:52 +0200 Subject: [PATCH] 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 --- unix/syscall_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index cc618f7c..a6ac8e92 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go @@ -342,10 +342,14 @@ func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, 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