[SERVER-44995] lookup table of errno macro names for logging Created: 06/Dec/19  Updated: 06/Dec/22  Resolved: 23/Jan/20

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Trivial - P5
Reporter: Billy Donahue Assignee: DO NOT USE - Backlog - Dev Tools
Resolution: Won't Fix Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File errnos-linux.h     File errnos-mac.h    
Assigned Teams:
Developer Tools
Participants:

 Description   

strerror(EINTR) gives us "Interrupted system call", but sometimes we really want "EINTR".

This is how the `errno` tool (from moreutils) generates the list of errno values.
They use $(CC) to scrape <errno.h> to generate their own header table.
The -dD flag is a debug switch to make gcc retain macro definitions in the -E source.
errnos.h:

echo "#include <errno.h>" > dump.c ;
gcc -E -dD dump.c | awk '/^#define E/ { printf "{\"%s\",%s},\n", $2, $2 }'

 



 Comments   
Comment by Billy Donahue [ 06/Dec/19 ]

Ran the above code once on Linux errnos-linux.h , once on Mac errnos-mac.h.
We could just check these in instead of teaching Scons how to make them.

Generated at Thu Feb 08 05:07:34 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.