Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Define TEMP_FAILURE_RETRY on non-glibc systems
This makes it work for example on Musl systems
  • Loading branch information
PureTryOut committed Mar 26, 2020
1 parent c0302c8 commit 6d19366
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/usb_moded-modesetting.h
Expand Up @@ -57,4 +57,14 @@ void modesetting_quit (void);
# define write_to_file(path,text)\
modesetting_write_to_file_real(__FILE__,__LINE__,__FUNCTION__,(path),(text))

/* Used to retry syscalls that can return EINTR. Taken from bionic unistd.h */
#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(exp) ({ \
__typeof__(exp) _rc; \
do { \
_rc = (exp); \
} while (_rc == -1 && errno == EINTR); \
_rc; })
#endif

#endif /* USB_MODED_MODESETTING_H_ */
10 changes: 10 additions & 0 deletions src/usb_moded-sigpipe.h
Expand Up @@ -37,4 +37,14 @@

bool sigpipe_init(void);

/* Used to retry syscalls that can return EINTR. Taken from Bionic unistd.h */
#ifndef TEMP_FAILURE_RETRY
#define TEMP_FAILURE_RETRY(exp) ({ \
__typeof__(exp) _rc; \
do { \
_rc = (exp); \
} while (_rc == -1 && errno == EINTR); \
_rc; })
#endif

#endif /* USB_MODED_SIGPIPE_H_ */

0 comments on commit 6d19366

Please sign in to comment.