Add a GNU-compatible TEMP_FAILURE_RETRY.
I wondered about #ifndef, but the other macros in here don't use it. I also wondered about __GNUC__, since this macro uses two GCC extensions.
This commit is contained in:
parent
44e55ba8eb
commit
cf399f77b8
1 changed files with 8 additions and 0 deletions
|
@ -185,6 +185,14 @@ extern int cacheflush(long start, long end, long flags);
|
|||
extern pid_t tcgetpgrp(int fd);
|
||||
extern int tcsetpgrp(int fd, pid_t _pid);
|
||||
|
||||
/* Used to retry syscalls that can return EINTR. */
|
||||
#define TEMP_FAILURE_RETRY(exp) ({ \
|
||||
typeof (exp) _rc; \
|
||||
do { \
|
||||
_rc = (exp); \
|
||||
} while (_rc == -1 && errno == EINTR); \
|
||||
_rc; })
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _UNISTD_H_ */
|
||||
|
|
Loading…
Reference in a new issue