Skip to content

x/sys/unix: expose signal and errno names as strings #25134

@AlekSi

Description

@AlekSi

Currently, signal and errno names are represented by the following generated Go code (abbreviated):

const (
  SIGINT = syscall.Signal(0x2)
)

const (
  EAGAIN = syscall.Errno(0xb)
)

var signals = [...]string{
  2: "interrupt",
}

var errors = [...]string{
  11: "resource temporarily unavailable",
}

There is no way to get back signal or errno name (SIGINT and EAGAIN) from the number for, for example, nice logging messages.

I propose to expose them via two functions:

func SignalName(s syscall.Signal) string { }
func ErrnoName(e syscall.Errno) string { }

That's something that annoyed me for years, but I finally decided to create an issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureRequestIssues asking for a new feature that does not need a proposal.FrozenDueToAge

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions