Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print errno and strerror in POSIX transport to see better error messages #2373

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

pnorbert
Copy link
Contributor

-- don't know what is happening on the NVMe

@@ -59,7 +59,9 @@ void FilePOSIX::Open(const std::string &name, const Mode openMode,
{
auto lf_AsyncOpenWrite = [&](const std::string &name) -> int {
ProfilerStart("open");
errno = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused about this. You set errno to zero, then assign m_Errno to errno, without any intervening assignments. So m_Errno is always zero.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow I just read about errno; I guess it behaves like an eflags register.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an intervening system function call that sets 'errno' to non-zero if there is an error. It's standard practice (for C programmers at least) to zero out errno before system calls to not catch errors from the past, hence the errno=0 statement here. m_Errno is used to remember the (possible) error for the call right after this and checked later (possibly the call in happens in a thread, line 63, but the check is in main thread much later)

@pnorbert pnorbert merged commit 937ff00 into ornladios:master Jul 13, 2020
@pnorbert pnorbert deleted the posix-errmsg branch July 13, 2020 18:37
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.

2 participants