Skip to content

Optimize errno decoding. - #57

Open
bwelling wants to merge 1 commit into
Mic92:mainfrom
bwelling:faster-errno
Open

Optimize errno decoding.#57
bwelling wants to merge 1 commit into
Mic92:mainfrom
bwelling:faster-errno

Conversation

@bwelling

Copy link
Copy Markdown
Contributor

The current code evaluates "*(int *)__error()" each time a syscall returns an error, matching the declaration of errno(). This is slow, as it involves executing code in the debugged process.

Instead, we can evaluate and cache "(int *)__error()" once per thread, which gives us the per-thread location of errno, and simply dereference the pointer when we want the current errno.

The current code evaluates "*(int *)__error()" each time a syscall
returns an error, matching the declaration of errno().  This is slow, as
it involves executing code in the debugged process.

Instead, we can evaluate and cache "(int *)__error()" once per thread,
which gives us the per-thread location of errno, and simply dereference
the pointer when we want the current errno.
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 this pull request may close these issues.

1 participant