Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

samterm doesn't compile on AIX #123

Open
bhuntsman opened this issue Feb 17, 2025 · 0 comments · May be fixed by #124
Open

samterm doesn't compile on AIX #123

bhuntsman opened this issue Feb 17, 2025 · 0 comments · May be fixed by #124

Comments

@bhuntsman
Copy link

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.

bhuntsman added a commit to bhuntsman/9fans-go that referenced this issue Feb 17, 2025
The samterm code calls syscall.Mkfifo in two places.  When compiling on
AIX, this results in a compilation error:

$ go install
./unix.go:25:17: undefined: syscall.Mkfifo
./unix.go:36:22: undefined: syscall.Mkfifo

This is because the Mkfifo call is not implemented for AIX in the syscall
package.  However, Mkfifo is available in the unix package, which is
already imported in cmd/samterm/unix.go.  This change uses the Mkfifo from
unix instead of syscall.

Fixes 9fans#123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant