ThomasRones
ThomasRones

Reputation: 683

Where do I find exit status codes and their meanings?

I was watching a tutorial on concurrency in golang and after hitting a race condition the program exited with status code 66.

I understand you can set the status code with the Exit pkg: https://pkg.go.dev/github.com/carlmjohnson/exitcode#Exit

I found this resource for Linux, but it's missing 3-125 https://tldp.org/LDP/abs/html/exitcodes.html

Upvotes: 0

Views: 946

Answers (1)

LeGEC
LeGEC

Reputation: 51860

The exit code doesn't have a generic meaning -- not a meaning shared with the exit code of all linux programs.

The doc page for the race detector indicates that the 66 exit code is just a value the go developpers chose -- it is "non standard" enough to indicate that the cause was a race detection -- and that you can actually change it via the GORACE environment variable :

$ GORACE="exitcode=42" go run -race my_racey_program.go
...
exit status 42

As far as source code goes : the go repository contains a bunch of *.syso binary files under src/runtime/race/ (<- link to go1.18.4 posted),

and the comment at the beginning of src/runtime/race/race.go mentions :

...
The prebuilt race runtime lives in race_GOOS_GOARCH.syso.
Calls to the runtime are done directly from src/runtime/race.go.

Upvotes: 1

Related Questions