diff options
author | Tobias Brunner <tobias@strongswan.org> | 2015-11-11 16:54:47 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2015-11-12 14:11:21 +0100 |
commit | 073761ec41f59aa0ea81484561485b7584656540 (patch) | |
tree | 5486e781206d278c6e458079b982432702bf300b /src/libstrongswan/utils | |
parent | 9be6b2e0b55434754bebddd74c8331337567db7d (diff) | |
download | strongswan-073761ec41f59aa0ea81484561485b7584656540.tar.bz2 strongswan-073761ec41f59aa0ea81484561485b7584656540.tar.xz |
android: Provide a fallback for sigwaitinfo()
Diffstat (limited to 'src/libstrongswan/utils')
-rw-r--r-- | src/libstrongswan/utils/compat/android.h | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/libstrongswan/utils/compat/android.h b/src/libstrongswan/utils/compat/android.h index 91b6b1483..a9a1b13a5 100644 --- a/src/libstrongswan/utils/compat/android.h +++ b/src/libstrongswan/utils/compat/android.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 Tobias Brunner + * Copyright (C) 2010-2015 Tobias Brunner * Hochschule fuer Technik Rapperswil * * This program is free software; you can redistribute it and/or modify it @@ -21,6 +21,8 @@ #ifndef ANDROID_H_ #define ANDROID_H_ +#include <android/api-level.h> + /* stuff defined in AndroidConfig.h, which is included using the -include * command-line option, thus cannot be undefined using -U CFLAGS options. * the reason we have to undefine these flags in the first place, is that @@ -28,4 +30,30 @@ * actually defined. */ #undef HAVE_BACKTRACE +/* sigwaitinfo() is not defined up to this API level, provide a fallback */ +#if __ANDROID_API__ <= 21 +#include <errno.h> +#include <signal.h> + +static inline int sigwaitinfo(const sigset_t *set, void *info) +{ + int sig, err; + + if (info) + { /* we don't replicate siginfo_t, which we don't use */ + errno = EINVAL; + return -1; + } + err = sigwait(set, &sig); + if (err != 0) + { + errno = err; + sig = -1; + } + return sig; +} +#else +#error Check availability of sigwaitinfo() in this API level +#endif + #endif /** ANDROID_H_ @}*/ |