#123·go

samterm doesn't compile on AIX

Author: bhuntsmanCreated Feb 17, 2025Updated Feb 17, 2025

On the AIX platform, cmd/samterm fails to compile and produces the following error:

$ go install
# 9fans.net/go/cmd/samterm
./unix.go:25:17: undefined: syscall.Mkfifo
./unix.go:36:22: undefined: syscall.Mkfifo

This is because on AIX mkfifo is not a kernel function and isn't present in the syscall package. However, it is implemented for AIX in the unix package. The following modification allows samterm to compile:

diff --git a/cmd/samterm/unix.go b/cmd/samterm/unix.go
index 665dbe8..933e76c 100644
--- a/cmd/samterm/unix.go
+++ b/cmd/samterm/unix.go
@@ -22,7 +22,7 @@ func extstart() {
        } else {
                exname = fmt.Sprintf("/tmp/.sam.%s", user)
        }
-       err := syscall.Mkfifo(exname, 0600)
+       err := unix.Mkfifo(exname, 0600)
        if err != nil {
                if !os.IsExist(err) {
                        return
@@ -33,7 +33,7 @@ func extstart() {
                }
                if st.Mode()&fs.ModeNamedPipe == 0 {
                        removeextern()
-                       if err := syscall.Mkfifo(exname, 0600); err != nil {
+                       if err := unix.Mkfifo(exname, 0600); err != nil {
                                return
                        }
                }

I will set up a pull request soon unless there is an objection.