diff options
author | Stephen Webb <swebb@blackberry.com> | 2020-05-25 21:47:52 -0400 |
---|---|---|
committer | Dave Watson <dade.watson@gmail.com> | 2020-06-18 13:42:19 -0700 |
commit | b03851b283049a5c2917eaced03305f82a8f73ef (patch) | |
tree | 7d3e06ca8c71e8f2708de32d54da5eb8faf99712 /src | |
parent | d4f91519bb0352259aaea484ddce60ad12f1f444 (diff) | |
download | libunwind-b03851b283049a5c2917eaced03305f82a8f73ef.tar.gz |
Autodetect <sys/syscall.h>
Use the system header <sys/syscall.h> only on those OS targets for which it is
available.
Diffstat (limited to 'src')
-rw-r--r-- | src/ppc32/Gresume.c | 2 | ||||
-rw-r--r-- | src/ppc64/Gresume.c | 2 | ||||
-rw-r--r-- | src/x86_64/Ginit.c | 12 |
3 files changed, 9 insertions, 7 deletions
diff --git a/src/ppc32/Gresume.c b/src/ppc32/Gresume.c index c0f95837..b0f04fa0 100644 --- a/src/ppc32/Gresume.c +++ b/src/ppc32/Gresume.c @@ -31,8 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UNW_REMOTE_ONLY -#include <sys/syscall.h> - /* sigreturn() is a no-op on x86_64 glibc. */ static NORETURN inline long diff --git a/src/ppc64/Gresume.c b/src/ppc64/Gresume.c index 0d832d0d..f9455ef8 100644 --- a/src/ppc64/Gresume.c +++ b/src/ppc64/Gresume.c @@ -31,8 +31,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef UNW_REMOTE_ONLY -#include <sys/syscall.h> - /* sigreturn() is a no-op on x86_64 glibc. */ static NORETURN inline long diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c index 800c5f6f..785d2e4a 100644 --- a/src/x86_64/Ginit.c +++ b/src/x86_64/Ginit.c @@ -34,7 +34,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <stdlib.h> #include <string.h> #include <sys/mman.h> -#include <sys/syscall.h> +#if defined(HAVE_SYS_SYSCALL_H) +# include <sys/syscall.h> +#endif #include <stdatomic.h> #include "unwind_i.h" @@ -138,8 +140,12 @@ write_validate (void *addr) do { - /* use syscall insteadof write() so that ASAN does not complain */ - ret = syscall (SYS_write, mem_validate_pipe[1], addr, 1); +#ifdef HAVE_SYS_SYSCALL_H + /* use syscall insteadof write() so that ASAN does not complain */ + ret = syscall (SYS_write, mem_validate_pipe[1], addr, 1); +#else + ret = write (mem_validate_pipe[1], addr, 1); +#endif } while ( errno == EINTR ); |