Skip to content

x/sys/unix: add Solaris Fcntl? #24649

@ppbrown

Description

@ppbrown

(I'm trying to follow the contributor guidelines: this is my first submission. I have 20 years of coding experience, and my own github repositories at https://github.com/bolthole )

My relevant environment:
go version go1.10.1 solaris/amd64

Background: 3rd party code I want to use, calls
unix.Syscall(unix.SYS_FCNTL, ...)

Problem is, my platform of Solaris, while being a supported platform.. does not have an implementation of Syscall(). Nor can it have one, because the OS does not have that API.

Seeing as how fcntl() is in the actual POSIX standard, seems like it would be a good idea for Go to actually have an official function call for it. Particularly since practically all the platforms suported in the "unix" collection, actually have OS suport for a native fcntl() call.

I have working code, that I'd like to submit to the repo, for Solaris.
I could potentially submit an attempt at other platforms, as well, but I do not have a testbed for them.

Proof my code works:

$ cat test.go
package main

import (
"golang.org/x/sys/unix"
"fmt"
)

func main() {
var retval int

    fmt.Println("Hi there")
    retval, _ = unix.Fcntl(1,unix.F_SETFD, unix.FD_CLOEXEC)
    fmt.Println("status of fcntl: ", retval)

}

$ go build test.go
$ truss ./test
/1: write(1, " H i t h e r e\n", 9) = 9
/1: fcntl(1, F_SETFD, 0x00000001) = 0
status of fcntl: 0
/1: write(1, " s t a t u s o f f c".., 20) = 20
/1: _exit(0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.OS-Solaris

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions