forked from OSchip/llvm-project
parent
0439f03bcf
commit
49e8576a09
|
@ -179,4 +179,10 @@ extern "C" void* _ReturnAddress(void);
|
|||
# define GET_CURRENT_FRAME() (uptr)0xDEADBEEF
|
||||
#endif
|
||||
|
||||
#define HANDLE_EINTR(res, f) { \
|
||||
do { \
|
||||
res = (f); \
|
||||
} while (res == -1 && errno == EINTR); \
|
||||
}
|
||||
|
||||
#endif // SANITIZER_DEFS_H
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
namespace __sanitizer {
|
||||
|
||||
|
@ -56,11 +57,15 @@ fd_t internal_open(const char *filename, bool write) {
|
|||
}
|
||||
|
||||
uptr internal_read(fd_t fd, void *buf, uptr count) {
|
||||
return (uptr)syscall(__NR_read, fd, buf, count);
|
||||
sptr res;
|
||||
HANDLE_EINTR(res, (sptr)syscall(__NR_read, fd, buf, count));
|
||||
return res;
|
||||
}
|
||||
|
||||
uptr internal_write(fd_t fd, const void *buf, uptr count) {
|
||||
return (uptr)syscall(__NR_write, fd, buf, count);
|
||||
sptr res;
|
||||
HANDLE_EINTR(res, (sptr)syscall(__NR_write, fd, buf, count));
|
||||
return res;
|
||||
}
|
||||
|
||||
uptr internal_filesize(fd_t fd) {
|
||||
|
|
Loading…
Reference in New Issue