This is an archive of the discontinued LLVM Phabricator instance.

Add temp_failure_retry helper function
ClosedPublic

Authored by labath on Jun 2 2017, 7:35 AM.

Details

Summary

It is intended to wrap functions which can fail with EINTR (which we
have a surprising number of). It is inspired by the TEMP_FAILURE_RETRY
macro in glibc, but I've c++-ified it and made it more generic (by
specifying an explicit fail value), so it can also be used for functions
like fopen(3).

Event Timeline

labath created this revision.Jun 2 2017, 7:35 AM
krytarowski added inline comments.Jun 2 2017, 7:48 AM
source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
788

-1 sem_wait -> -1, ::sem_wait

source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
852

It might be prettier to use consistently ::waitpid across the whole codebase, here and in other places.

labath updated this revision to Diff 101212.Jun 2 2017, 7:51 AM
  • fix freebsd typo
  • use ::waitpid consistently
krytarowski added inline comments.Jun 2 2017, 7:55 AM
include/lldb/Host/Host.h
252

Will this build on Windows for their native API? If so, will it be useful there?

labath added inline comments.Jun 2 2017, 7:59 AM
include/lldb/Host/Host.h
252

It will build, although it will probably be a no-op. Some windows apis (i guess just the posix-compatibility ones) use errno, although I don't know if they can actually fail with EINTR. It's still useful in generic code, as some of those apis are used in shared code.

krytarowski accepted this revision.Jun 2 2017, 8:01 AM
This revision is now accepted and ready to land.Jun 2 2017, 8:01 AM
This revision was automatically updated to reflect the committed changes.