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:
Elliott Hughes 2009-10-05 13:19:05 -07:00
parent 44e55ba8eb
commit cf399f77b8

View file

@ -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_ */