am 13d77b6c: Merge "Use linker -Wl,--wrap=symbol"
* commit '13d77b6c070e32adeb12d0c2d4c0870be2eed06b': Use linker -Wl,--wrap=symbol
This commit is contained in:
@@ -14,15 +14,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
|
||||||
int epoll_ctl_portable(int epfd, int op, int fd, struct epoll_event *event)
|
int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event *event)
|
||||||
{
|
{
|
||||||
return epoll_ctl(epfd, op, fd, event);
|
return REAL(epoll_ctl)(epfd, op, fd, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int epoll_wait_portable(int epfd, struct epoll_event *events, int max, int timeout)
|
int WRAP(epoll_wait)(int epfd, struct epoll_event *events, int max, int timeout)
|
||||||
{
|
{
|
||||||
return epoll_wait(epfd, events, max, timeout);
|
return REAL(epoll_wait)(epfd, events, max, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern volatile int* __errno(void);
|
#include <portability.h>
|
||||||
volatile int* __errno_portable()
|
|
||||||
|
extern volatile int* REAL(__errno)(void);
|
||||||
|
volatile int* WRAP(__errno)()
|
||||||
{
|
{
|
||||||
return __errno();
|
return REAL(__errno)();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/linux-syscalls.h>
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
int socket_portable(int domain, int type, int protocol) {
|
int WRAP(socket)(int domain, int type, int protocol) {
|
||||||
return socket(domain, type, protocol);
|
return REAL(socket)(domain, type, protocol);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,17 +14,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
extern int setsockopt(int, int, int, const void *, socklen_t);
|
extern int setsockopt(int, int, int, const void *, socklen_t);
|
||||||
int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
|
int WRAP(setsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen)
|
||||||
{
|
{
|
||||||
return setsockopt(s, level, optname, optval, optlen);
|
return REAL(setsockopt)(s, level, optname, optval, optlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int getsockopt (int, int, int, void *, socklen_t *);
|
extern int getsockopt (int, int, int, void *, socklen_t *);
|
||||||
int getsockopt_portable(int s, int level, int optname, void *optval, socklen_t *optlen)
|
int WRAP(getsockopt)(int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||||
{
|
{
|
||||||
return getsockopt(s, level, optname, optval, optlen);
|
return REAL(getsockopt)(s, level, optname, optval, optlen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,25 +14,26 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stat_portable.h>
|
#include <stat_portable.h>
|
||||||
|
|
||||||
/* Note: The Portable Header will define stat to stat_portable */
|
/* Note: The Portable Header will define stat to stat_portable */
|
||||||
int stat_portable(const char *path, struct stat_portable *s)
|
int WRAP(stat)(const char *path, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
return stat(path, s);
|
return REAL(stat)(path, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstat_portable(int fd, struct stat_portable *s)
|
int WRAP(fstat)(int fd, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
return fstat(fd, s);
|
return REAL(fstat)(fd, s);
|
||||||
}
|
|
||||||
|
|
||||||
int lstat_portable(const char *path, struct stat_portable *s)
|
|
||||||
{
|
|
||||||
return lstat(path, s);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags)
|
int WRAP(lstat)(const char *path, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
return fstatat(dirfd, path, s, flags);
|
return REAL(lstat)(path, s);
|
||||||
|
}
|
||||||
|
|
||||||
|
int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags)
|
||||||
|
{
|
||||||
|
return REAL(fstatat)(dirfd, path, s, flags);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
struct _Unwind_Context;
|
struct _Unwind_Context;
|
||||||
@@ -55,25 +56,25 @@ _Unwind_VRS_Result _Unwind_VRS_Set(struct _Unwind_Context *context,
|
|||||||
#define UNWIND_STACK_REG 13
|
#define UNWIND_STACK_REG 13
|
||||||
#define UNWIND_IP_REG 15
|
#define UNWIND_IP_REG 15
|
||||||
|
|
||||||
uint64_t _Unwind_GetGR_portable(struct _Unwind_Context* ctx, int index) {
|
uint64_t WRAP(_Unwind_GetGR)(struct _Unwind_Context* ctx, int index) {
|
||||||
uint32_t val;
|
uint32_t val;
|
||||||
_Unwind_VRS_Get(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val);
|
_Unwind_VRS_Get(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val);
|
||||||
return (uint64_t)val;
|
return (uint64_t)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _Unwind_SetGR_portable(struct _Unwind_Context* ctx, int index, uint64_t new_value) {
|
void WRAP(_Unwind_SetGR)(struct _Unwind_Context* ctx, int index, uint64_t new_value) {
|
||||||
uint32_t val = (uint32_t)new_value;
|
uint32_t val = (uint32_t)new_value;
|
||||||
_Unwind_VRS_Set(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val);
|
_Unwind_VRS_Set(ctx, _UVRSC_CORE, index, _UVRSD_UINT32, &val);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t _Unwind_GetIP_portable(struct _Unwind_Context* ctx) {
|
uint64_t WRAP(_Unwind_GetIP)(struct _Unwind_Context* ctx) {
|
||||||
return _Unwind_GetGR_portable(ctx, UNWIND_IP_REG) & ~1; // thumb bit
|
return WRAP(_Unwind_GetGR)(ctx, UNWIND_IP_REG) & ~1; // thumb bit
|
||||||
}
|
}
|
||||||
|
|
||||||
void _Unwind_SetIP_portable(struct _Unwind_Context* ctx, uintptr_t new_value) {
|
void WRAP(_Unwind_SetIP)(struct _Unwind_Context* ctx, uintptr_t new_value) {
|
||||||
uint32_t val = (uint32_t)new_value;
|
uint32_t val = (uint32_t)new_value;
|
||||||
// Propagate thumb bit to instruction pointer
|
// Propagate thumb bit to instruction pointer
|
||||||
uint32_t thumbState = _Unwind_GetGR_portable(ctx, UNWIND_IP_REG) & 1;
|
uint32_t thumbState = WRAP(_Unwind_GetGR)(ctx, UNWIND_IP_REG) & 1;
|
||||||
uint64_t new_val = (uint64_t)(val | thumbState);
|
uint64_t new_val = (uint64_t)(val | thumbState);
|
||||||
_Unwind_SetGR_portable(ctx, UNWIND_IP_REG, new_val);
|
WRAP(_Unwind_SetGR)(ctx, UNWIND_IP_REG, new_val);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE
|
#define _GNU_SOURCE
|
||||||
|
#include <portability.h>
|
||||||
#include <sched.h>
|
#include <sched.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -47,7 +48,7 @@
|
|||||||
* If no signal is specified, then the parent process is not
|
* If no signal is specified, then the parent process is not
|
||||||
* signaled when the child terminates.
|
* signaled when the child terminates.
|
||||||
*/
|
*/
|
||||||
int clone_portable(int (*fn)(void *), void *child_stack, int port_flags, void *arg, ...)
|
int WRAP(clone)(int (*fn)(void *), void *child_stack, int port_flags, void *arg, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -117,7 +118,7 @@ int clone_portable(int (*fn)(void *), void *child_stack, int port_flags, void *a
|
|||||||
ALOGV("%s: clone(%p, %p, 0x%x, %p, %p, %p, %p);", __func__,
|
ALOGV("%s: clone(%p, %p, 0x%x, %p, %p, %p, %p);", __func__,
|
||||||
fn, child_stack, mips_flags, arg, parent_tidptr, new_tls, child_tidptr);
|
fn, child_stack, mips_flags, arg, parent_tidptr, new_tls, child_tidptr);
|
||||||
|
|
||||||
ret = clone(fn, child_stack, mips_flags, arg, parent_tidptr,
|
ret = REAL(clone)(fn, child_stack, mips_flags, arg, parent_tidptr,
|
||||||
new_tls, child_tidptr);
|
new_tls, child_tidptr);
|
||||||
|
|
||||||
if (ret > 0) {
|
if (ret > 0) {
|
||||||
|
|||||||
@@ -14,15 +14,16 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
|
|
||||||
int epoll_ctl_portable(int epfd, int op, int fd, struct epoll_event *event)
|
int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event *event)
|
||||||
{
|
{
|
||||||
return epoll_ctl(epfd, op, fd, event);
|
return REAL(epoll_ctl)(epfd, op, fd, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int epoll_wait_portable(int epfd, struct epoll_event *events, int max, int timeout)
|
int WRAP(epoll_wait)(int epfd, struct epoll_event *events, int max, int timeout)
|
||||||
{
|
{
|
||||||
return epoll_wait(epfd, events, max, timeout);
|
return REAL(epoll_wait)(epfd, events, max, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -278,7 +279,7 @@ static struct errno_state *errno_key_data(void)
|
|||||||
* This can be assigned to without affecting the native errno. If the key
|
* This can be assigned to without affecting the native errno. If the key
|
||||||
* allocation fails fall back to using the native errno location.
|
* allocation fails fall back to using the native errno location.
|
||||||
*/
|
*/
|
||||||
volatile int* __errno_portable()
|
volatile int* WRAP(__errno)()
|
||||||
{
|
{
|
||||||
struct errno_state *p;
|
struct errno_state *p;
|
||||||
int save_errno;
|
int save_errno;
|
||||||
@@ -331,7 +332,7 @@ volatile int* __errno_portable()
|
|||||||
|
|
||||||
|
|
||||||
/* set portable errno */
|
/* set portable errno */
|
||||||
void __set_errno_portable(int portable_errno)
|
void WRAP(__set_errno)(int portable_errno)
|
||||||
{
|
{
|
||||||
struct errno_state *p;
|
struct errno_state *p;
|
||||||
int save_errno;
|
int save_errno;
|
||||||
@@ -356,13 +357,14 @@ void __set_errno_portable(int portable_errno)
|
|||||||
ALOGV("%s: return; }", __func__);
|
ALOGV("%s: return; }", __func__);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *strerror_portable(int errnum)
|
extern char* REAL(strerror)(int);
|
||||||
|
char *WRAP(strerror)(int errnum)
|
||||||
{
|
{
|
||||||
return strerror(errno_pton(errnum));
|
return REAL(strerror)(errno_pton(errnum));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* BSD style strerror_r */
|
/* BSD style strerror_r */
|
||||||
int strerror_r_portable(int errnum, char *buf, size_t buflen)
|
int WRAP(strerror_r)(int errnum, char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
return strerror_r(errno_pton(errnum), buf, buflen);
|
return REAL(strerror_r)(errno_pton(errnum), buf, buflen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -71,7 +72,7 @@ static inline int efd_flags_pton(int portable_flags)
|
|||||||
* new eventfd2 system call number, so it likely best to just use
|
* new eventfd2 system call number, so it likely best to just use
|
||||||
* the Android eventfd() for both eventfd and eventfd2 system calls.
|
* the Android eventfd() for both eventfd and eventfd2 system calls.
|
||||||
*/
|
*/
|
||||||
int eventfd_portable(unsigned int initval, int portable_flags) {
|
int WRAP(eventfd)(unsigned int initval, int portable_flags) {
|
||||||
int rv;
|
int rv;
|
||||||
int native_flags;
|
int native_flags;
|
||||||
|
|
||||||
@@ -81,7 +82,7 @@ int eventfd_portable(unsigned int initval, int portable_flags) {
|
|||||||
|
|
||||||
native_flags = efd_flags_pton(portable_flags);
|
native_flags = efd_flags_pton(portable_flags);
|
||||||
|
|
||||||
rv = eventfd(initval, native_flags);
|
rv = REAL(eventfd)(initval, native_flags);
|
||||||
if (rv >= 0) {
|
if (rv >= 0) {
|
||||||
if (native_flags & EFD_CLOEXEC) {
|
if (native_flags & EFD_CLOEXEC) {
|
||||||
filefd_CLOEXEC_enabled(rv);
|
filefd_CLOEXEC_enabled(rv);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -284,7 +285,7 @@ extern int __fcntl64(int, int, void *);
|
|||||||
* pid_t l_pid; pid_t l_pid;
|
* pid_t l_pid; pid_t l_pid;
|
||||||
* } }
|
* } }
|
||||||
*/
|
*/
|
||||||
int fcntl_portable(int fd, int portable_cmd, ...)
|
int WRAP(fcntl)(int fd, int portable_cmd, ...)
|
||||||
{
|
{
|
||||||
int flags;
|
int flags;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|||||||
@@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <portability.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <errno_portable.h>
|
#include <errno_portable.h>
|
||||||
@@ -415,14 +415,14 @@ __hidden void filefd_disable_mapping()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int close_portable(int fd)
|
int WRAP(close)(int fd)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(fd:%d) {", __func__, fd);
|
ALOGV("%s(fd:%d) {", __func__, fd);
|
||||||
|
|
||||||
rv = close(fd);
|
rv = REAL(close)(fd);
|
||||||
filefd_closed(fd);
|
filefd_closed(fd);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
@@ -430,7 +430,7 @@ int close_portable(int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int read_portable(int fd, void *buf, size_t count)
|
int WRAP(read)(int fd, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
enum filefd_type fd_type;
|
enum filefd_type fd_type;
|
||||||
@@ -449,7 +449,7 @@ int read_portable(int fd, void *buf, size_t count)
|
|||||||
case EVENT_FD_TYPE:
|
case EVENT_FD_TYPE:
|
||||||
case INOTIFY_FD_TYPE:
|
case INOTIFY_FD_TYPE:
|
||||||
case TIMER_FD_TYPE:
|
case TIMER_FD_TYPE:
|
||||||
rv = read(fd, buf, count);
|
rv = REAL(read)(fd, buf, count);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The read() of a signalfd() file descriptor needs to be mapped. */
|
/* The read() of a signalfd() file descriptor needs to be mapped. */
|
||||||
@@ -457,13 +457,13 @@ int read_portable(int fd, void *buf, size_t count)
|
|||||||
if (filefd_enabled) {
|
if (filefd_enabled) {
|
||||||
rv = read_signalfd_mapper(fd, buf, count);
|
rv = read_signalfd_mapper(fd, buf, count);
|
||||||
} else {
|
} else {
|
||||||
rv = read(fd, buf, count);
|
rv = REAL(read)(fd, buf, count);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ALOGE("Unknown fd_type:%d!", fd_type);
|
ALOGE("Unknown fd_type:%d!", fd_type);
|
||||||
rv = read(fd, buf, count);
|
rv = REAL(read)(fd, buf, count);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ int read_portable(int fd, void *buf, size_t count)
|
|||||||
* Tries a second time if it detects an extremely unlikely
|
* Tries a second time if it detects an extremely unlikely
|
||||||
* race condition.
|
* race condition.
|
||||||
*/
|
*/
|
||||||
int execve_portable(const char *filename, char *const argv[], char *const envp[])
|
int WRAP(execve)(const char *filename, char *const argv[], char *const envp[])
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
int mapped_files = filefd_mapped_files;
|
int mapped_files = filefd_mapped_files;
|
||||||
@@ -494,7 +494,7 @@ int execve_portable(const char *filename, char *const argv[], char *const envp[
|
|||||||
}
|
}
|
||||||
import_fd_env(verify_consistancy); /* File type table consistancy verified. */
|
import_fd_env(verify_consistancy); /* File type table consistancy verified. */
|
||||||
|
|
||||||
rv = execve(filename, argv, envp);
|
rv = REAL(execve)(filename, argv, envp);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fcntl_portable.h>
|
#include <fcntl_portable.h>
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
extern int __sflags(const char *, int *);
|
extern int __sflags(const char *, int *);
|
||||||
|
|
||||||
int
|
int
|
||||||
__sflags_portable(const char *mode, int *optr)
|
WRAP(__sflags)(const char *mode, int *optr)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
int nflags, pflags;
|
int nflags, pflags;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -60,7 +61,7 @@ static inline int in_flags_pton(int portable_flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int inotify_init1_portable(int portable_flags) {
|
int WRAP(inotify_init1)(int portable_flags) {
|
||||||
int rv;
|
int rv;
|
||||||
int native_flags;
|
int native_flags;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <ioctls_portable.h>
|
#include <ioctls_portable.h>
|
||||||
@@ -213,7 +214,7 @@ static inline int mips_change_request(int request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern int __ioctl(int, int, void *);
|
extern int __ioctl(int, int, void *);
|
||||||
int ioctl_portable(int fd, int request, ...)
|
int WRAP(ioctl)(int fd, int request, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
void * arg;
|
void * arg;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
@@ -87,8 +88,8 @@ static inline int mmap_flags_pton(int portable_flags)
|
|||||||
return native_flags;
|
return native_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void* REAL(mmap)(void *, size_t, int, int, int, off_t);
|
||||||
void *mmap_portable(void *addr, size_t size, int prot, int flags, int fd, long byte_offset)
|
void *WRAP(mmap)(void *addr, size_t size, int prot, int flags, int fd, long byte_offset)
|
||||||
{
|
{
|
||||||
int native_prot, native_flags;
|
int native_prot, native_flags;
|
||||||
int saved_errno;
|
int saved_errno;
|
||||||
@@ -101,7 +102,7 @@ void *mmap_portable(void *addr, size_t size, int prot, int flags, int fd, long b
|
|||||||
native_prot = mmap_prot_pton(prot);
|
native_prot = mmap_prot_pton(prot);
|
||||||
native_flags = mmap_flags_pton(flags);
|
native_flags = mmap_flags_pton(flags);
|
||||||
|
|
||||||
ret_addr = mmap(addr, size, native_prot, native_flags, fd, byte_offset);
|
ret_addr = REAL(mmap)(addr, size, native_prot, native_flags, fd, byte_offset);
|
||||||
|
|
||||||
ALOGV("%s: return(ret_addr:%p); }", __func__, ret_addr);
|
ALOGV("%s: return(ret_addr:%p); }", __func__, ret_addr);
|
||||||
return ret_addr;
|
return ret_addr;
|
||||||
@@ -110,7 +111,7 @@ void *mmap_portable(void *addr, size_t size, int prot, int flags, int fd, long b
|
|||||||
|
|
||||||
extern int mprotect(const void *, size_t, int);
|
extern int mprotect(const void *, size_t, int);
|
||||||
|
|
||||||
int mprotect_portable(const void *addr, size_t size, int portable_prot)
|
int WRAP(mprotect)(const void *addr, size_t size, int portable_prot)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
int native_prot;
|
int native_prot;
|
||||||
@@ -121,7 +122,7 @@ int mprotect_portable(const void *addr, size_t size, int portable_prot)
|
|||||||
|
|
||||||
native_prot = mmap_prot_pton(portable_prot);
|
native_prot = mmap_prot_pton(portable_prot);
|
||||||
|
|
||||||
rv = mprotect(addr, size, native_prot);
|
rv = REAL(mprotect)(addr, size, native_prot);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -72,7 +73,7 @@ static inline int open_flags_pton(int flags)
|
|||||||
|
|
||||||
extern int __open(const char*, int, int);
|
extern int __open(const char*, int, int);
|
||||||
|
|
||||||
int open_portable(const char *pathname, int flags, ...)
|
int WRAP(open)(const char *pathname, int flags, ...)
|
||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
int native_flags;
|
int native_flags;
|
||||||
@@ -113,7 +114,7 @@ int open_portable(const char *pathname, int flags, ...)
|
|||||||
|
|
||||||
extern int __openat(int, const char*, int, int);
|
extern int __openat(int, const char*, int, int);
|
||||||
|
|
||||||
int openat_portable(int dirfd, const char *pathname, int flags, ...)
|
int WRAP(openat)(int dirfd, const char *pathname, int flags, ...)
|
||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
int native_flags;
|
int native_flags;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define _GNU_SOURCE /* GLibc compatibility to declare pipe2(2) */
|
#define _GNU_SOURCE /* GLibc compatibility to declare pipe2(2) */
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -59,7 +60,7 @@ static inline int tdf_flags_pton(int portable_flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pipe2_portable(int pipefd[2], int portable_flags) {
|
int WRAP(pipe2)(int pipefd[2], int portable_flags) {
|
||||||
int native_flags;
|
int native_flags;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@@ -69,7 +70,7 @@ int pipe2_portable(int pipefd[2], int portable_flags) {
|
|||||||
|
|
||||||
native_flags = tdf_flags_pton(portable_flags);
|
native_flags = tdf_flags_pton(portable_flags);
|
||||||
|
|
||||||
rv = pipe2(pipefd, native_flags);
|
rv = REAL(pipe2)(pipefd, native_flags);
|
||||||
if (rv >= 0) {
|
if (rv >= 0) {
|
||||||
ALOGV("%s: pipe2() returned pipefd[0]:%d, pipefd[1]:%d", __func__,
|
ALOGV("%s: pipe2() returned pipefd[0]:%d, pipefd[1]:%d", __func__,
|
||||||
pipefd[0], pipefd[1]);
|
pipefd[0], pipefd[1]);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
#include <poll_portable.h>
|
#include <poll_portable.h>
|
||||||
|
|
||||||
@@ -105,7 +106,7 @@ static inline short change_mips_events(short mips_events)
|
|||||||
|
|
||||||
extern int poll(struct pollfd *, nfds_t, long);
|
extern int poll(struct pollfd *, nfds_t, long);
|
||||||
|
|
||||||
int poll_portable(struct pollfd *fds, nfds_t nfds, long timeout)
|
int WRAP(poll)(struct pollfd *fds, nfds_t nfds, long timeout)
|
||||||
{
|
{
|
||||||
nfds_t i;
|
nfds_t i;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -113,7 +114,7 @@ int poll_portable(struct pollfd *fds, nfds_t nfds, long timeout)
|
|||||||
for (i = 0; i < nfds; i++)
|
for (i = 0; i < nfds; i++)
|
||||||
fds->events = mips_change_portable_events(fds->events);
|
fds->events = mips_change_portable_events(fds->events);
|
||||||
|
|
||||||
ret = poll(fds, nfds, timeout);
|
ret = REAL(poll)(fds, nfds, timeout);
|
||||||
|
|
||||||
for (i = 0; i < nfds; i++) {
|
for (i = 0; i < nfds; i++) {
|
||||||
fds->events = change_mips_events(fds->events);
|
fds->events = change_mips_events(fds->events);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -54,13 +55,13 @@
|
|||||||
* Call pthread function and convert return value (a native errno) to portable error number.
|
* Call pthread function and convert return value (a native errno) to portable error number.
|
||||||
*/
|
*/
|
||||||
#define PTHREAD_WRAPPER(fn, DECLARGS, CALLARGS, fmt) \
|
#define PTHREAD_WRAPPER(fn, DECLARGS, CALLARGS, fmt) \
|
||||||
int fn##_portable DECLARGS \
|
int WRAP(fn) DECLARGS \
|
||||||
{ \
|
{ \
|
||||||
int rv, portable_rv; \
|
int rv, portable_rv; \
|
||||||
\
|
\
|
||||||
ALOGV(" "); \
|
ALOGV(" "); \
|
||||||
ALOGV("%s" fmt, __func__, STRIP_PARENS(CALLARGS)); \
|
ALOGV("%s" fmt, __func__, STRIP_PARENS(CALLARGS)); \
|
||||||
rv = fn CALLARGS; \
|
rv = REAL(fn) CALLARGS; \
|
||||||
portable_rv = errno_ntop(rv); \
|
portable_rv = errno_ntop(rv); \
|
||||||
ALOGV("%s: return(portable_rv:%d); rv:%d;", __func__, \
|
ALOGV("%s: return(portable_rv:%d); rv:%d;", __func__, \
|
||||||
portable_rv, rv); \
|
portable_rv, rv); \
|
||||||
@@ -258,7 +259,7 @@ PTHREAD_WRAPPER(pthread_setspecific, (pthread_key_t key, const void *value), (ke
|
|||||||
|
|
||||||
// void *pthread_getspecific(pthread_key_t key);
|
// void *pthread_getspecific(pthread_key_t key);
|
||||||
|
|
||||||
int pthread_kill_portable(pthread_t thread, int portable_signum)
|
int WRAP(pthread_kill)(pthread_t thread, int portable_signum)
|
||||||
{
|
{
|
||||||
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
||||||
int mips_signum;
|
int mips_signum;
|
||||||
@@ -274,7 +275,7 @@ int pthread_kill_portable(pthread_t thread, int portable_signum)
|
|||||||
} else {
|
} else {
|
||||||
ALOGV("%s: calling pthread_kill(thread:%lx, mips_signum:%d);", __func__,
|
ALOGV("%s: calling pthread_kill(thread:%lx, mips_signum:%d);", __func__,
|
||||||
thread, mips_signum);
|
thread, mips_signum);
|
||||||
ret = pthread_kill(thread, mips_signum);
|
ret = REAL(pthread_kill)(thread, mips_signum);
|
||||||
}
|
}
|
||||||
portable_ret = errno_ntop(ret);
|
portable_ret = errno_ntop(ret);
|
||||||
|
|
||||||
@@ -284,7 +285,7 @@ int pthread_kill_portable(pthread_t thread, int portable_signum)
|
|||||||
return portable_ret;
|
return portable_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pthread_sigmask_portable(int portable_how, const sigset_portable_t *portable_sigset,
|
int WRAP(pthread_sigmask)(int portable_how, const sigset_portable_t *portable_sigset,
|
||||||
sigset_portable_t *portable_oldset)
|
sigset_portable_t *portable_oldset)
|
||||||
{
|
{
|
||||||
int portable_ret, ret;
|
int portable_ret, ret;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <resource_portable.h>
|
#include <resource_portable.h>
|
||||||
|
|
||||||
@@ -39,13 +40,13 @@ static inline int mips_change_resource(int resource)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern int getrlimit(int resource, struct rlimit *rlp);
|
extern int getrlimit(int resource, struct rlimit *rlp);
|
||||||
int getrlimit_portable(int resource, struct rlimit *rlp)
|
int WRAP(getrlimit)(int resource, struct rlimit *rlp)
|
||||||
{
|
{
|
||||||
return getrlimit(mips_change_resource(resource), rlp);
|
return REAL(getrlimit)(mips_change_resource(resource), rlp);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int setrlimit(int resource, const struct rlimit *rlp);
|
extern int setrlimit(int resource, const struct rlimit *rlp);
|
||||||
int setrlimit_portable(int resource, const struct rlimit *rlp)
|
int WRAP(setrlimit)(int resource, const struct rlimit *rlp)
|
||||||
{
|
{
|
||||||
return setrlimit(mips_change_resource(resource), rlp);
|
return REAL(setrlimit)(mips_change_resource(resource), rlp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <asm-generic/portability.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include <machine/regnum.h>
|
#include <machine/regnum.h>
|
||||||
|
|
||||||
@@ -57,10 +58,10 @@ RAOFF= FRAMESZ-1*REGSZ
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
NON_LEAF(setjmp_portable, FRAMESZ, ra)
|
NON_LEAF(WRAP(setjmp), FRAMESZ, ra)
|
||||||
.mask 0x80000000, RAOFF
|
.mask 0x80000000, RAOFF
|
||||||
PTR_SUBU sp, FRAMESZ # allocate stack frame
|
PTR_SUBU sp, FRAMESZ # allocate stack frame
|
||||||
SETUP_GP64(GPOFF, setjmp_portable)
|
SETUP_GP64(GPOFF, WRAP(setjmp))
|
||||||
SAVE_GP(GPOFF)
|
SAVE_GP(GPOFF)
|
||||||
.set reorder
|
.set reorder
|
||||||
REG_S ra, RAOFF(sp) # save state
|
REG_S ra, RAOFF(sp) # save state
|
||||||
@@ -143,12 +144,12 @@ botch:
|
|||||||
jal abort
|
jal abort
|
||||||
RESTORE_GP64
|
RESTORE_GP64
|
||||||
PTR_ADDU sp, FRAMESZ
|
PTR_ADDU sp, FRAMESZ
|
||||||
END(setjmp_portable)
|
END(WRAP(setjmp))
|
||||||
|
|
||||||
|
|
||||||
LEAF(longjmp_portable, FRAMESZ)
|
LEAF(WRAP(longjmp), FRAMESZ)
|
||||||
PTR_SUBU sp, FRAMESZ
|
PTR_SUBU sp, FRAMESZ
|
||||||
SETUP_GP64(GPOFF, longjmp_portable)
|
SETUP_GP64(GPOFF, WRAP(longjmp))
|
||||||
SAVE_GP(GPOFF)
|
SAVE_GP(GPOFF)
|
||||||
.set reorder
|
.set reorder
|
||||||
sw a1, A1OFF(sp)
|
sw a1, A1OFF(sp)
|
||||||
@@ -214,4 +215,4 @@ LEAF(longjmp_portable, FRAMESZ)
|
|||||||
j ra
|
j ra
|
||||||
move v0, a1
|
move v0, a1
|
||||||
|
|
||||||
END(longjmp_portable)
|
END(WRAP(longjmp))
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -732,7 +733,7 @@ do_signal_portable(int portable_signum, sighandler_portable_t portable_handler,
|
|||||||
* redirects the call to bsd_signal(). _signal() is a static function; not to be called
|
* redirects the call to bsd_signal(). _signal() is a static function; not to be called
|
||||||
* directly. This function isn't actually needed.
|
* directly. This function isn't actually needed.
|
||||||
*/
|
*/
|
||||||
sighandler_portable_t signal_portable(int portable_signum, sighandler_portable_t handler)
|
sighandler_portable_t WRAP(signal)(int portable_signum, sighandler_portable_t handler)
|
||||||
{
|
{
|
||||||
sighandler_portable_t rv;
|
sighandler_portable_t rv;
|
||||||
|
|
||||||
@@ -748,7 +749,7 @@ sighandler_portable_t signal_portable(int portable_signum, sighandler_portable_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sighandler_portable_t sysv_signal_portable(int portable_signum, sighandler_portable_t handler)
|
sighandler_portable_t WRAP(sysv_signal)(int portable_signum, sighandler_portable_t handler)
|
||||||
{
|
{
|
||||||
sighandler_portable_t rv;
|
sighandler_portable_t rv;
|
||||||
|
|
||||||
@@ -771,7 +772,8 @@ sighandler_portable_t sysv_signal_portable(int portable_signum, sighandler_porta
|
|||||||
* or
|
* or
|
||||||
* the sysv_signal() signal handler.
|
* the sysv_signal() signal handler.
|
||||||
*/
|
*/
|
||||||
sighandler_portable_t bsd_signal_portable(int portable_signum, sighandler_portable_t handler)
|
|
||||||
|
sighandler_portable_t WRAP(bsd_signal)(int portable_signum, sighandler_portable_t handler)
|
||||||
{
|
{
|
||||||
sighandler_portable_t rv;
|
sighandler_portable_t rv;
|
||||||
|
|
||||||
@@ -812,46 +814,48 @@ static int do_kill(int id, int portable_signum, int (*fn)(int, int))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int killpg_portable(int pgrp, int portable_signum)
|
int WRAP(killpg)(int pgrp, int portable_signum)
|
||||||
{
|
{
|
||||||
|
extern int REAL(killpg)(int pgrp, int sig);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(pgrp:%d, portable_signum:%d) {", __func__,
|
ALOGV("%s(pgrp:%d, portable_signum:%d) {", __func__,
|
||||||
pgrp, portable_signum);
|
pgrp, portable_signum);
|
||||||
|
|
||||||
rv = do_kill(pgrp, portable_signum, killpg);
|
rv = do_kill(pgrp, portable_signum, REAL(killpg));
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int kill_portable(pid_t pid, int portable_signum)
|
int WRAP(kill)(pid_t pid, int portable_signum)
|
||||||
{
|
{
|
||||||
|
extern int REAL(kill)(pid_t, int);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(pid:%d, portable_signum:%d) {", __func__,
|
ALOGV("%s(pid:%d, portable_signum:%d) {", __func__,
|
||||||
pid, portable_signum);
|
pid, portable_signum);
|
||||||
|
|
||||||
rv = do_kill(pid, portable_signum, kill);
|
rv = do_kill(pid, portable_signum, REAL(kill));
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int tkill_portable(int tid, int portable_signum)
|
int WRAP(tkill)(int tid, int portable_signum)
|
||||||
{
|
{
|
||||||
extern int tkill(int, int);
|
extern int REAL(tkill)(int, int);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(tid:%d, portable_signum:%d) {", __func__,
|
ALOGV("%s(tid:%d, portable_signum:%d) {", __func__,
|
||||||
tid, portable_signum);
|
tid, portable_signum);
|
||||||
|
|
||||||
rv = do_kill(tid, portable_signum, tkill);
|
rv = do_kill(tid, portable_signum, REAL(tkill));
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
@@ -860,7 +864,7 @@ int tkill_portable(int tid, int portable_signum)
|
|||||||
|
|
||||||
/* tgkill is not exported from android-14 libc.so */
|
/* tgkill is not exported from android-14 libc.so */
|
||||||
#if 0
|
#if 0
|
||||||
int tgkill_portable(int tgid, int tid, int portable_signum)
|
int WRAP(tgkill)(int tgid, int tid, int portable_signum)
|
||||||
{
|
{
|
||||||
extern int tgkill(int, int, int);
|
extern int tgkill(int, int, int);
|
||||||
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
||||||
@@ -875,7 +879,7 @@ int tgkill_portable(int tgid, int tid, int portable_signum)
|
|||||||
if ((portable_signum != 0) && (mips_signum == 0))
|
if ((portable_signum != 0) && (mips_signum == 0))
|
||||||
rv = 0;
|
rv = 0;
|
||||||
else
|
else
|
||||||
rv = tgkill(tgid, tid, mips_signum);
|
rv = REAL(tgkill)(tgid, tid, mips_signum);
|
||||||
|
|
||||||
ALOGV("%s: return rv:%d; }", __func__, rv);
|
ALOGV("%s: return rv:%d; }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
@@ -883,7 +887,7 @@ int tgkill_portable(int tgid, int tid, int portable_signum)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int raise_portable(int portable_signum)
|
int WRAP(raise)(int portable_signum)
|
||||||
{
|
{
|
||||||
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
||||||
int mips_signum = signum_pton(portable_signum);
|
int mips_signum = signum_pton(portable_signum);
|
||||||
@@ -894,7 +898,7 @@ int raise_portable(int portable_signum)
|
|||||||
if ((portable_signum != 0) && (mips_signum == 0))
|
if ((portable_signum != 0) && (mips_signum == 0))
|
||||||
rv = 0;
|
rv = 0;
|
||||||
else
|
else
|
||||||
rv = raise(mips_signum);
|
rv = REAL(raise)(mips_signum);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
@@ -919,7 +923,7 @@ void sigset_pton(sigset_portable_t *portable_sigset, sigset_t *mips_sigset)
|
|||||||
|
|
||||||
for(portable_signum = 1; portable_signum <= NSIG_PORTABLE; portable_signum++) {
|
for(portable_signum = 1; portable_signum <= NSIG_PORTABLE; portable_signum++) {
|
||||||
|
|
||||||
if (sigismember_portable(portable_sigset, portable_signum)) {
|
if (WRAP(sigismember)(portable_sigset, portable_signum)) {
|
||||||
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
char *portable_signame = map_portable_signum_to_name(portable_signum);
|
||||||
int mips_signum = signum_pton(portable_signum);
|
int mips_signum = signum_pton(portable_signum);
|
||||||
char *mips_signame;
|
char *mips_signame;
|
||||||
@@ -962,14 +966,14 @@ sigset_ntop(const sigset_t *const_mips_sigset, sigset_portable_t *portable_sigse
|
|||||||
portable_sigset);
|
portable_sigset);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
sigemptyset_portable(portable_sigset);
|
WRAP(sigemptyset)(portable_sigset);
|
||||||
|
|
||||||
for(mips_signum = 1; mips_signum <= NSIG; mips_signum++) {
|
for(mips_signum = 1; mips_signum <= NSIG; mips_signum++) {
|
||||||
if (sigismember(mips_sigset, mips_signum)) {
|
if (sigismember(mips_sigset, mips_signum)) {
|
||||||
int portable_signum = signum_ntop(mips_signum);
|
int portable_signum = signum_ntop(mips_signum);
|
||||||
|
|
||||||
if (portable_signum != 0)
|
if (portable_signum != 0)
|
||||||
sigaddset_portable(portable_sigset, portable_signum);
|
WRAP(sigaddset)(portable_sigset, portable_signum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1172,7 +1176,7 @@ static int do_sigaction_portable(int portable_signum, const struct sigaction_por
|
|||||||
mips_oldact.sa_sigaction == (__sigaction_handler_portable_t) mips_sighandler) {
|
mips_oldact.sa_sigaction == (__sigaction_handler_portable_t) mips_sighandler) {
|
||||||
|
|
||||||
oldact->sa_sigaction_portable =
|
oldact->sa_sigaction_portable =
|
||||||
(__sigaction_handler_portable_t) prev_portable_handler;
|
(__sigaction_handler_portable_t) prev_portable_handler;
|
||||||
} else {
|
} else {
|
||||||
oldact->sa_sigaction_portable =
|
oldact->sa_sigaction_portable =
|
||||||
(__sigaction_handler_portable_t) mips_oldact.sa_sigaction;
|
(__sigaction_handler_portable_t) mips_oldact.sa_sigaction;
|
||||||
@@ -1190,16 +1194,17 @@ done:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sigaction_portable(int portable_signum, const struct sigaction_portable *act,
|
int WRAP(sigaction)(int portable_signum, const struct sigaction_portable *act,
|
||||||
struct sigaction_portable *oldact)
|
struct sigaction_portable *oldact)
|
||||||
{
|
{
|
||||||
|
extern int REAL(sigaction)(int, const struct sigaction *, struct sigaction *);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(portable_signum:%d, act:%p, oldact:%p) {", __func__,
|
ALOGV("%s(portable_signum:%d, act:%p, oldact:%p) {", __func__,
|
||||||
portable_signum, act, oldact);
|
portable_signum, act, oldact);
|
||||||
|
|
||||||
rv = do_sigaction_portable(portable_signum, act, oldact, sigaction, NULL);
|
rv = do_sigaction_portable(portable_signum, act, oldact, REAL(sigaction), NULL);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
@@ -1261,7 +1266,7 @@ __hidden int do_signalfd4_portable(int fd, const sigset_portable_t *portable_sig
|
|||||||
* This function can't be called from bionic, so there isn't an entry in the experimental
|
* This function can't be called from bionic, so there isn't an entry in the experimental
|
||||||
* linker.cpp table for testing and this function.
|
* linker.cpp table for testing and this function.
|
||||||
*/
|
*/
|
||||||
int signalfd_portable(int fd, const sigset_portable_t *portable_sigmask, int portable_flags)
|
int WRAP(signalfd)(int fd, const sigset_portable_t *portable_sigmask, int portable_flags)
|
||||||
{
|
{
|
||||||
int portable_sigsetsize = sizeof(sigset_portable_t);
|
int portable_sigsetsize = sizeof(sigset_portable_t);
|
||||||
int rv;
|
int rv;
|
||||||
@@ -1325,7 +1330,7 @@ __hidden int read_signalfd_mapper(int fd, void *buf, size_t count)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sigsuspend_portable(const sigset_portable_t *portable_sigmask)
|
int WRAP(sigsuspend)(const sigset_portable_t *portable_sigmask)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
sigset_t mips_sigmask;
|
sigset_t mips_sigmask;
|
||||||
@@ -1337,7 +1342,7 @@ int sigsuspend_portable(const sigset_portable_t *portable_sigmask)
|
|||||||
rv = -1;
|
rv = -1;
|
||||||
} else {
|
} else {
|
||||||
sigset_pton((sigset_portable_t *)portable_sigmask, &mips_sigmask);
|
sigset_pton((sigset_portable_t *)portable_sigmask, &mips_sigmask);
|
||||||
rv = sigsuspend(&mips_sigmask);
|
rv = REAL(sigsuspend)(&mips_sigmask);
|
||||||
}
|
}
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
@@ -1345,7 +1350,7 @@ int sigsuspend_portable(const sigset_portable_t *portable_sigmask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sigpending_portable(sigset_portable_t *portable_sigset)
|
int WRAP(sigpending)(sigset_portable_t *portable_sigset)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
sigset_t mips_sigset;
|
sigset_t mips_sigset;
|
||||||
@@ -1357,7 +1362,7 @@ int sigpending_portable(sigset_portable_t *portable_sigset)
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
rv = -1;
|
rv = -1;
|
||||||
} else {
|
} else {
|
||||||
rv = sigpending(&mips_sigset);
|
rv = REAL(sigpending)(&mips_sigset);
|
||||||
sigset_ntop(&mips_sigset, portable_sigset);
|
sigset_ntop(&mips_sigset, portable_sigset);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1366,7 +1371,7 @@ int sigpending_portable(sigset_portable_t *portable_sigset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sigwait_portable(const sigset_portable_t *portable_sigset, int *ptr_to_portable_sig)
|
int WRAP(sigwait)(const sigset_portable_t *portable_sigset, int *ptr_to_portable_sig)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
sigset_t mips_sigset;
|
sigset_t mips_sigset;
|
||||||
@@ -1382,7 +1387,7 @@ int sigwait_portable(const sigset_portable_t *portable_sigset, int *ptr_to_porta
|
|||||||
} else {
|
} else {
|
||||||
sigset_pton((sigset_portable_t *)portable_sigset, &mips_sigset);
|
sigset_pton((sigset_portable_t *)portable_sigset, &mips_sigset);
|
||||||
|
|
||||||
rv = sigwait(&mips_sigset, &mips_sig);
|
rv = REAL(sigwait)(&mips_sigset, &mips_sig);
|
||||||
|
|
||||||
portable_sig = signum_ntop(mips_sig);
|
portable_sig = signum_ntop(mips_sig);
|
||||||
*ptr_to_portable_sig = portable_sig;
|
*ptr_to_portable_sig = portable_sig;
|
||||||
@@ -1392,7 +1397,7 @@ int sigwait_portable(const sigset_portable_t *portable_sigset, int *ptr_to_porta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int siginterrupt_portable(int portable_signum, int flag)
|
int WRAP(siginterrupt)(int portable_signum, int flag)
|
||||||
|
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
@@ -1408,7 +1413,7 @@ int siginterrupt_portable(int portable_signum, int flag)
|
|||||||
portable_signum);
|
portable_signum);
|
||||||
rv = 0;
|
rv = 0;
|
||||||
} else {
|
} else {
|
||||||
rv = siginterrupt(mips_signum, flag);
|
rv = REAL(siginterrupt)(mips_signum, flag);
|
||||||
}
|
}
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
@@ -1474,26 +1479,27 @@ __hidden int do_sigmask(int portable_how, const sigset_portable_t *portable_sigs
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int sigprocmask_portable(int portable_how, const sigset_portable_t *portable_sigset,
|
int WRAP(sigprocmask)(int portable_how, const sigset_portable_t *portable_sigset,
|
||||||
sigset_portable_t *portable_oldset)
|
sigset_portable_t *portable_oldset)
|
||||||
{
|
{
|
||||||
|
extern int REAL(sigprocmask)(int, const sigset_t *, sigset_t *);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(portable_how:%d, portable_sigset:%p, portable_oldset:%p) {", __func__,
|
ALOGV("%s(portable_how:%d, portable_sigset:%p, portable_oldset:%p) {", __func__,
|
||||||
portable_how, portable_sigset, portable_oldset);
|
portable_how, portable_sigset, portable_oldset);
|
||||||
|
|
||||||
rv = do_sigmask(portable_how, portable_sigset, portable_oldset, sigprocmask, NULL);
|
rv = do_sigmask(portable_how, portable_sigset, portable_oldset, REAL(sigprocmask), NULL);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int __rt_sigaction_portable(int portable_signum, const struct sigaction_portable *act,
|
int WRAP(__rt_sigaction)(int portable_signum, const struct sigaction_portable *act,
|
||||||
struct sigaction_portable *oldact, size_t sigsetsize)
|
struct sigaction_portable *oldact, size_t sigsetsize)
|
||||||
{
|
{
|
||||||
extern int __rt_sigaction(int , const struct sigaction *, struct sigaction *, size_t);
|
extern int REAL(__rt_sigaction)(int , const struct sigaction *, struct sigaction *, size_t);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
@@ -1506,19 +1512,19 @@ int __rt_sigaction_portable(int portable_signum, const struct sigaction_portable
|
|||||||
rv = -1;
|
rv = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
rv = do_sigaction_portable(portable_signum, act, oldact, NULL, __rt_sigaction);
|
rv = do_sigaction_portable(portable_signum, act, oldact, NULL, REAL(__rt_sigaction));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int __rt_sigprocmask_portable(int portable_how,
|
int WRAP(__rt_sigprocmask)(int portable_how,
|
||||||
const sigset_portable_t *portable_sigset,
|
const sigset_portable_t *portable_sigset,
|
||||||
sigset_portable_t *portable_oldset,
|
sigset_portable_t *portable_oldset,
|
||||||
size_t sigsetsize)
|
size_t sigsetsize)
|
||||||
{
|
{
|
||||||
extern int __rt_sigprocmask(int, const sigset_t *, sigset_t *, size_t);
|
extern int REAL(__rt_sigprocmask)(int, const sigset_t *, sigset_t *, size_t);
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
@@ -1531,7 +1537,7 @@ int __rt_sigprocmask_portable(int portable_how,
|
|||||||
rv = -1;
|
rv = -1;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
rv = do_sigmask(portable_how, portable_sigset, portable_oldset, NULL, __rt_sigprocmask);
|
rv = do_sigmask(portable_how, portable_sigset, portable_oldset, NULL, REAL(__rt_sigprocmask));
|
||||||
|
|
||||||
done:
|
done:
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
@@ -1540,12 +1546,12 @@ int __rt_sigprocmask_portable(int portable_how,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int __rt_sigtimedwait_portable(const sigset_portable_t *portable_sigset,
|
int WRAP(__rt_sigtimedwait)(const sigset_portable_t *portable_sigset,
|
||||||
siginfo_portable_t *portable_siginfo,
|
siginfo_portable_t *portable_siginfo,
|
||||||
const struct timespec *timeout,
|
const struct timespec *timeout,
|
||||||
size_t portable_sigsetsize)
|
size_t portable_sigsetsize)
|
||||||
{
|
{
|
||||||
extern int __rt_sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *, size_t);
|
extern int REAL(__rt_sigtimedwait)(const sigset_t *, siginfo_t *, const struct timespec *, size_t);
|
||||||
|
|
||||||
sigset_t native_sigset_struct;
|
sigset_t native_sigset_struct;
|
||||||
sigset_t *native_sigset = &native_sigset_struct;
|
sigset_t *native_sigset = &native_sigset_struct;
|
||||||
@@ -1573,7 +1579,7 @@ int __rt_sigtimedwait_portable(const sigset_portable_t *portable_sigset,
|
|||||||
} else {
|
} else {
|
||||||
native_siginfo = &native_siginfo_struct;
|
native_siginfo = &native_siginfo_struct;
|
||||||
}
|
}
|
||||||
rv = __rt_sigtimedwait(native_sigset, native_siginfo, timeout, sizeof(sigset_t));
|
rv = REAL(__rt_sigtimedwait)(native_sigset, native_siginfo, timeout, sizeof(sigset_t));
|
||||||
if (rv == 0 && native_siginfo != NULL) {
|
if (rv == 0 && native_siginfo != NULL) {
|
||||||
/* Map siginfo struct from native to portable format. */
|
/* Map siginfo struct from native to portable format. */
|
||||||
siginfo_ntop(native_siginfo, portable_siginfo);
|
siginfo_ntop(native_siginfo, portable_siginfo);
|
||||||
@@ -1604,7 +1610,7 @@ done:
|
|||||||
*
|
*
|
||||||
* sigqueue() must return EAGAIN if exceeded and we don't on Android.
|
* sigqueue() must return EAGAIN if exceeded and we don't on Android.
|
||||||
*/
|
*/
|
||||||
int sigqueue_portable(pid_t pid, int portable_sig, const union sigval value)
|
int WRAP(sigqueue)(pid_t pid, int portable_sig, const union sigval value)
|
||||||
{
|
{
|
||||||
siginfo_t native_siginfo;
|
siginfo_t native_siginfo;
|
||||||
siginfo_t *native_sip;
|
siginfo_t *native_sip;
|
||||||
@@ -1646,7 +1652,7 @@ int sigqueue_portable(pid_t pid, int portable_sig, const union sigval value)
|
|||||||
/*
|
/*
|
||||||
* Real Time version of sigqueueinfo().
|
* Real Time version of sigqueueinfo().
|
||||||
*/
|
*/
|
||||||
int rt_sigqueueinfo_portable(pid_t pid, int portable_sig, siginfo_portable_t *portable_sip)
|
int WRAP(rt_sigqueueinfo)(pid_t pid, int portable_sig, siginfo_portable_t *portable_sip)
|
||||||
{
|
{
|
||||||
int native_sig;
|
int native_sig;
|
||||||
siginfo_t native_siginfo, *native_sip;
|
siginfo_t native_siginfo, *native_sip;
|
||||||
@@ -1676,7 +1682,7 @@ int rt_sigqueueinfo_portable(pid_t pid, int portable_sig, siginfo_portable_t *po
|
|||||||
/*
|
/*
|
||||||
* Thread Group flavor of the real time version of sigqueueinfo().
|
* Thread Group flavor of the real time version of sigqueueinfo().
|
||||||
*/
|
*/
|
||||||
int rt_tgsigqueueinfo_portable(pid_t tgid, pid_t pid, int portable_sig,
|
int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int portable_sig,
|
||||||
siginfo_portable_t *portable_sip)
|
siginfo_portable_t *portable_sip)
|
||||||
{
|
{
|
||||||
siginfo_t native_siginfo, *native_sip;
|
siginfo_t native_siginfo, *native_sip;
|
||||||
@@ -1715,7 +1721,7 @@ int rt_tgsigqueueinfo_portable(pid_t tgid, pid_t pid, int portable_sig,
|
|||||||
* } stack_t;
|
* } stack_t;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int sigaltstack_portable(const portable_stack_t *ss, portable_stack_t *oss)
|
int WRAP(sigaltstack)(const portable_stack_t *ss, portable_stack_t *oss)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
stack_t new_stack, *mips_ss;
|
stack_t new_stack, *mips_ss;
|
||||||
@@ -1754,7 +1760,7 @@ int sigaltstack_portable(const portable_stack_t *ss, portable_stack_t *oss)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = sigaltstack(mips_ss, mips_oss);
|
rv = REAL(sigaltstack)(mips_ss, mips_oss);
|
||||||
|
|
||||||
if (!invalid_pointer(oss)) {
|
if (!invalid_pointer(oss)) {
|
||||||
oss->ss_sp = old_stack.ss_sp;
|
oss->ss_sp = old_stack.ss_sp;
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <asm-generic/portability.h>
|
||||||
#include <machine/asm.h>
|
#include <machine/asm.h>
|
||||||
#include <machine/regnum.h>
|
#include <machine/regnum.h>
|
||||||
|
|
||||||
@@ -42,7 +43,7 @@
|
|||||||
FRAMESZ= MKFSIZ(1,1)
|
FRAMESZ= MKFSIZ(1,1)
|
||||||
GPOFF= FRAMESZ-2*REGSZ
|
GPOFF= FRAMESZ-2*REGSZ
|
||||||
|
|
||||||
LEAF(sigsetjmp_portable, FRAMESZ)
|
LEAF(WRAP(sigsetjmp), FRAMESZ)
|
||||||
PTR_SUBU sp, FRAMESZ
|
PTR_SUBU sp, FRAMESZ
|
||||||
SETUP_GP64(GPOFF, sigsetjmp)
|
SETUP_GP64(GPOFF, sigsetjmp)
|
||||||
.set reorder
|
.set reorder
|
||||||
@@ -53,15 +54,15 @@ LEAF(sigsetjmp_portable, FRAMESZ)
|
|||||||
PTR_ADDU sp, FRAMESZ
|
PTR_ADDU sp, FRAMESZ
|
||||||
jr t9
|
jr t9
|
||||||
|
|
||||||
1: LA t9, setjmp_portable
|
1: LA t9, WRAP(setjmp)
|
||||||
RESTORE_GP64
|
RESTORE_GP64
|
||||||
PTR_ADDU sp, FRAMESZ
|
PTR_ADDU sp, FRAMESZ
|
||||||
jr t9
|
jr t9
|
||||||
END(sigsetjmp_portable)
|
END(WRAP(sigsetjmp))
|
||||||
|
|
||||||
LEAF(siglongjmp_portable, FRAMESZ)
|
LEAF(WRAP(siglongjmp), FRAMESZ)
|
||||||
PTR_SUBU sp, FRAMESZ
|
PTR_SUBU sp, FRAMESZ
|
||||||
SETUP_GP64(GPOFF, siglongjmp_portable)
|
SETUP_GP64(GPOFF, WRAP(siglongjmp))
|
||||||
.set reorder
|
.set reorder
|
||||||
REG_L t0, JB_SAVEMASK(a0) # get "savemask"
|
REG_L t0, JB_SAVEMASK(a0) # get "savemask"
|
||||||
bne t0, 0x0, 1f # restore signal mask?
|
bne t0, 0x0, 1f # restore signal mask?
|
||||||
@@ -70,8 +71,8 @@ LEAF(siglongjmp_portable, FRAMESZ)
|
|||||||
PTR_ADDU sp, FRAMESZ
|
PTR_ADDU sp, FRAMESZ
|
||||||
jr t9
|
jr t9
|
||||||
1:
|
1:
|
||||||
LA t9, longjmp_portable
|
LA t9, WRAP(longjmp)
|
||||||
RESTORE_GP64
|
RESTORE_GP64
|
||||||
PTR_ADDU sp, FRAMESZ
|
PTR_ADDU sp, FRAMESZ
|
||||||
jr t9
|
jr t9
|
||||||
END(siglongjmp_portable)
|
END(WRAP(siglongjmp))
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
@@ -127,30 +128,30 @@ static inline int socktype_ntop(int native_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern int socket(int, int, int);
|
extern int REAL(socket)(int, int, int);
|
||||||
|
|
||||||
int socket_portable(int domain, int type, int protocol) {
|
int WRAP(socket)(int domain, int type, int protocol) {
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(domain:%d, type:%d, protocol:%d) {", __func__,
|
ALOGV("%s(domain:%d, type:%d, protocol:%d) {", __func__,
|
||||||
domain, type, protocol);
|
domain, type, protocol);
|
||||||
|
|
||||||
rv = socket(domain, socktype_pton(type), protocol);
|
rv = REAL(socket)(domain, socktype_pton(type), protocol);
|
||||||
|
|
||||||
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
ALOGV("%s: return(rv:%d); }", __func__, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int socketpair_portable(int domain, int type, int protocol, int sv[2]) {
|
int WRAP(socketpair)(int domain, int type, int protocol, int sv[2]) {
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
ALOGV(" ");
|
ALOGV(" ");
|
||||||
ALOGV("%s(domain:%d, type:%d, protocol:%d, sv[2]:%p) {", __func__,
|
ALOGV("%s(domain:%d, type:%d, protocol:%d, sv[2]:%p) {", __func__,
|
||||||
domain, type, protocol, sv);
|
domain, type, protocol, sv);
|
||||||
|
|
||||||
rv = socketpair(domain, socktype_pton(type), protocol, sv);
|
rv = REAL(socketpair)(domain, socktype_pton(type), protocol, sv);
|
||||||
|
|
||||||
if ((rv != 0) || invalid_pointer(sv)) {
|
if ((rv != 0) || invalid_pointer(sv)) {
|
||||||
ALOGV("%s: return(rv:%d); }", __func__,
|
ALOGV("%s: return(rv:%d); }", __func__,
|
||||||
@@ -175,7 +176,7 @@ int socketpair_portable(int domain, int type, int protocol, int sv[2]) {
|
|||||||
* later made free with a call to the portable version of
|
* later made free with a call to the portable version of
|
||||||
* freeaddrinfo(); which is written below this function.
|
* freeaddrinfo(); which is written below this function.
|
||||||
*/
|
*/
|
||||||
int getaddrinfo_portable(const char *node, const char *service,
|
int WRAP(getaddrinfo)(const char *node, const char *service,
|
||||||
struct addrinfo_portable *portable_hints,
|
struct addrinfo_portable *portable_hints,
|
||||||
struct addrinfo_portable **portable_results)
|
struct addrinfo_portable **portable_results)
|
||||||
{
|
{
|
||||||
@@ -203,7 +204,7 @@ int getaddrinfo_portable(const char *node, const char *service,
|
|||||||
ASSERT(portable_results != NULL);
|
ASSERT(portable_results != NULL);
|
||||||
native_results = (struct addrinfo **) portable_results;
|
native_results = (struct addrinfo **) portable_results;
|
||||||
|
|
||||||
rv = getaddrinfo(node, service, native_hints, native_results);
|
rv = REAL(getaddrinfo)(node, service, native_hints, native_results);
|
||||||
|
|
||||||
if (native_hints != NULL) {
|
if (native_hints != NULL) {
|
||||||
portable_hints->ai_socktype = saved_portable_socktype;
|
portable_hints->ai_socktype = saved_portable_socktype;
|
||||||
@@ -230,7 +231,7 @@ int getaddrinfo_portable(const char *node, const char *service,
|
|||||||
* Free the results list returned from a previous call
|
* Free the results list returned from a previous call
|
||||||
* to the portable version of getaddrinfo().
|
* to the portable version of getaddrinfo().
|
||||||
*/
|
*/
|
||||||
void freeaddrinfo_portable(struct addrinfo_portable *portable_results)
|
void WRAP(freeaddrinfo)(struct addrinfo_portable *portable_results)
|
||||||
{
|
{
|
||||||
struct addrinfo *native_results, *rp;
|
struct addrinfo *native_results, *rp;
|
||||||
|
|
||||||
@@ -253,7 +254,7 @@ void freeaddrinfo_portable(struct addrinfo_portable *portable_results)
|
|||||||
PRINT_ADDRINFO(rp);
|
PRINT_ADDRINFO(rp);
|
||||||
rp->ai_socktype = socktype_pton(rp->ai_socktype); /* Likely not really necessary */
|
rp->ai_socktype = socktype_pton(rp->ai_socktype); /* Likely not really necessary */
|
||||||
}
|
}
|
||||||
freeaddrinfo(native_results);
|
REAL(freeaddrinfo)(native_results);
|
||||||
|
|
||||||
ALOGV("%s: return; }", __func__);
|
ALOGV("%s: return; }", __func__);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -14,11 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <socket_portable.h>
|
#include <socket_portable.h>
|
||||||
|
|
||||||
|
|
||||||
#if SOL_SOCKET_PORTABLE==SOL_SOCKET
|
#if SOL_SOCKET_PORTABLE==SOL_SOCKET
|
||||||
#error Build environment
|
#error Build environment
|
||||||
#endif
|
#endif
|
||||||
@@ -108,13 +108,13 @@ static inline int mips_change_optname(int optname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern int setsockopt(int, int, int, const void *, socklen_t);
|
extern int setsockopt(int, int, int, const void *, socklen_t);
|
||||||
int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
|
int WRAP(setsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen)
|
||||||
{
|
{
|
||||||
return setsockopt(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
|
return REAL(setsockopt)(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int getsockopt (int, int, int, void *, socklen_t *);
|
extern int getsockopt (int, int, int, void *, socklen_t *);
|
||||||
int getsockopt_portable(int s, int level, int optname, void *optval, socklen_t *optlen)
|
int WRAP(getsockopt)(int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||||
{
|
{
|
||||||
return getsockopt(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
|
return REAL(getsockopt)(s, mips_change_level(level), mips_change_optname(optname), optval, optlen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stat_portable.h>
|
#include <stat_portable.h>
|
||||||
|
|
||||||
#include <portability.h>
|
|
||||||
|
|
||||||
/* Note: The Portable Header will define stat to stat_portable */
|
/* Note: The Portable Header will define stat to stat_portable */
|
||||||
int stat_portable(const char *path, struct stat_portable *s)
|
int WRAP(stat)(const char *path, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
struct stat mips_stat;
|
struct stat mips_stat;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -29,12 +28,12 @@ int stat_portable(const char *path, struct stat_portable *s)
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = stat(path, &mips_stat);
|
ret = REAL(stat)(path, &mips_stat);
|
||||||
stat_ntop(&mips_stat, s);
|
stat_ntop(&mips_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstat_portable(int fd, struct stat_portable *s)
|
int WRAP(fstat)(int fd, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
struct stat mips_stat;
|
struct stat mips_stat;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -43,12 +42,12 @@ int fstat_portable(int fd, struct stat_portable *s)
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = fstat(fd, &mips_stat);
|
ret = REAL(fstat)(fd, &mips_stat);
|
||||||
stat_ntop(&mips_stat, s);
|
stat_ntop(&mips_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lstat_portable(const char *path, struct stat_portable *s)
|
int WRAP(lstat)(const char *path, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
struct stat mips_stat;
|
struct stat mips_stat;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -57,12 +56,12 @@ int lstat_portable(const char *path, struct stat_portable *s)
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = lstat(path, &mips_stat);
|
ret = REAL(lstat)(path, &mips_stat);
|
||||||
stat_ntop(&mips_stat, s);
|
stat_ntop(&mips_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags)
|
int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags)
|
||||||
{
|
{
|
||||||
struct stat mips_stat;
|
struct stat mips_stat;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -71,7 +70,7 @@ int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int f
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = fstatat(dirfd, path, &mips_stat, flags);
|
ret = REAL(fstatat)(dirfd, path, &mips_stat, flags);
|
||||||
stat_ntop(&mips_stat, s);
|
stat_ntop(&mips_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,12 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <statfs_portable.h>
|
#include <statfs_portable.h>
|
||||||
|
|
||||||
#include <portability.h>
|
|
||||||
|
|
||||||
static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs)
|
static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs)
|
||||||
{
|
{
|
||||||
memset(p_statfs, '\0', sizeof(struct statfs_portable));
|
memset(p_statfs, '\0', sizeof(struct statfs_portable));
|
||||||
@@ -35,7 +34,7 @@ static inline void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *
|
|||||||
p_statfs->f_frsize = n_statfs->f_frsize;
|
p_statfs->f_frsize = n_statfs->f_frsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int statfs_portable(const char* path, struct statfs_portable* stat)
|
int WRAP(statfs)(const char* path, struct statfs_portable* stat)
|
||||||
{
|
{
|
||||||
struct statfs mips_stat;
|
struct statfs mips_stat;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -44,12 +43,12 @@ int statfs_portable(const char* path, struct statfs_portable* stat)
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = statfs(path, &mips_stat);
|
ret = REAL(statfs)(path, &mips_stat);
|
||||||
statfs_ntop(&mips_stat, stat);
|
statfs_ntop(&mips_stat, stat);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstatfs_portable(int fd, struct statfs_portable* stat)
|
int WRAP(fstatfs)(int fd, struct statfs_portable* stat)
|
||||||
{
|
{
|
||||||
struct statfs mips_stat;
|
struct statfs mips_stat;
|
||||||
int ret;
|
int ret;
|
||||||
@@ -58,7 +57,7 @@ int fstatfs_portable(int fd, struct statfs_portable* stat)
|
|||||||
errno = EFAULT;
|
errno = EFAULT;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = fstatfs(fd, &mips_stat);
|
ret = REAL(fstatfs)(fd, &mips_stat);
|
||||||
statfs_ntop(&mips_stat, stat);
|
statfs_ntop(&mips_stat, stat);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -48,11 +49,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
extern int syscall(int, ...);
|
extern int REAL(syscall)(int, ...);
|
||||||
|
|
||||||
#define MAXARGS 8
|
#define MAXARGS 8
|
||||||
|
|
||||||
int syscall_portable(int portable_number, ...)
|
int WRAP(syscall)(int portable_number, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int native_number, ret;
|
int native_number, ret;
|
||||||
@@ -126,7 +127,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = eventfd_portable(initval, flags); /* Android uses __NR_eventfd2 in eventfd() */
|
ret = WRAP(eventfd)(initval, flags); /* Android uses __NR_eventfd2 in eventfd() */
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -148,7 +149,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
|
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = eventfd_portable(initval, flags); /* Android uses __NR_eventfd2 in eventfd() */
|
ret = WRAP(eventfd)(initval, flags); /* Android uses __NR_eventfd2 in eventfd() */
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -229,7 +230,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
portable_flags = va_arg(ap, int);
|
portable_flags = va_arg(ap, int);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = inotify_init1_portable(portable_flags);
|
ret = WRAP(inotify_init1)(portable_flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -268,7 +269,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
portable_flags = va_arg(ap, int);
|
portable_flags = va_arg(ap, int);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = pipe2_portable(pipefd_ptr, portable_flags);
|
ret = WRAP(pipe2)(pipefd_ptr, portable_flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -298,7 +299,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
oact = va_arg(ap, struct sigaction_portable *);
|
oact = va_arg(ap, struct sigaction_portable *);
|
||||||
sigsetsize = va_arg(ap, size_t);
|
sigsetsize = va_arg(ap, size_t);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
return __rt_sigaction_portable(sig, act, oact, sigsetsize);
|
return WRAP(__rt_sigaction)(sig, act, oact, sigsetsize);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -316,7 +317,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
sigsetsize = va_arg(ap, size_t);
|
sigsetsize = va_arg(ap, size_t);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = __rt_sigprocmask_portable(how, set, oset, sigsetsize);
|
ret = WRAP(__rt_sigprocmask)(how, set, oset, sigsetsize);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -335,7 +336,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
sigsetsize = va_arg(ap, size_t);
|
sigsetsize = va_arg(ap, size_t);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = __rt_sigtimedwait_portable(set, info, timeout, sigsetsize);
|
ret = WRAP(__rt_sigtimedwait)(set, info, timeout, sigsetsize);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -352,7 +353,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
uinfo = va_arg(ap, siginfo_portable_t *);
|
uinfo = va_arg(ap, siginfo_portable_t *);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = rt_sigqueueinfo_portable(pid, sig, uinfo);
|
ret = WRAP(rt_sigqueueinfo)(pid, sig, uinfo);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -465,7 +466,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
native_number, fd, align_fill, offset_low, offset_high,
|
native_number, fd, align_fill, offset_low, offset_high,
|
||||||
nbytes_low, nbytes_high, flags);
|
nbytes_low, nbytes_high, flags);
|
||||||
|
|
||||||
ret = syscall(native_number, fd, align_fill, offset_low, offset_high,
|
ret = REAL(syscall)(native_number, fd, align_fill, offset_low, offset_high,
|
||||||
nbytes_low, nbytes_high, flags);
|
nbytes_low, nbytes_high, flags);
|
||||||
|
|
||||||
goto done;
|
goto done;
|
||||||
@@ -501,7 +502,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
timerid = va_arg(ap, timer_t *);
|
timerid = va_arg(ap, timer_t *);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = timer_create_portable(clockid, evp, timerid);
|
ret = WRAP(timer_create)(clockid, evp, timerid);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -516,7 +517,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
flags = va_arg(ap, int); /* flags need to be mapped */
|
flags = va_arg(ap, int); /* flags need to be mapped */
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = timerfd_create_portable(clockid, flags);
|
ret = WRAP(timerfd_create)(clockid, flags);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -555,7 +556,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
uinfo = va_arg(ap, siginfo_portable_t *);
|
uinfo = va_arg(ap, siginfo_portable_t *);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = rt_tgsigqueueinfo_portable(tgid, pid, sig, uinfo);
|
ret = WRAP(rt_tgsigqueueinfo)(tgid, pid, sig, uinfo);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -569,7 +570,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
sig = va_arg(ap, int);
|
sig = va_arg(ap, int);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
ret = tkill_portable(tid, sig);
|
ret = WRAP(tkill)(tid, sig);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -627,7 +628,7 @@ int syscall_portable(int portable_number, ...)
|
|||||||
native_number, args[0], args[1], args[2], args[3], args[4],
|
native_number, args[0], args[1], args[2], args[3], args[4],
|
||||||
args[5], args[6], args[7]);
|
args[5], args[6], args[7]);
|
||||||
|
|
||||||
ret = syscall(native_number, args[0], args[1], args[2], args[3],
|
ret = REAL(syscall)(native_number, args[0], args[1], args[2], args[3],
|
||||||
args[4], args[5], args[6], args[7]);
|
args[4], args[5], args[6], args[7]);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|||||||
@@ -14,13 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <signal_portable.h>
|
#include <signal_portable.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include <portability.h>
|
int WRAP(timer_create)(clockid_t clockid, struct sigevent *portable_evp,
|
||||||
|
|
||||||
int timer_create_portable(clockid_t clockid, struct sigevent *portable_evp,
|
|
||||||
timer_t *timerid)
|
timer_t *timerid)
|
||||||
{
|
{
|
||||||
struct sigevent native_sigevent, *evp = portable_evp;
|
struct sigevent native_sigevent, *evp = portable_evp;
|
||||||
@@ -33,5 +32,5 @@ int timer_create_portable(clockid_t clockid, struct sigevent *portable_evp,
|
|||||||
evp = &native_sigevent;
|
evp = &native_sigevent;
|
||||||
evp->sigev_signo = signum_pton(evp->sigev_signo);
|
evp->sigev_signo = signum_pton(evp->sigev_signo);
|
||||||
}
|
}
|
||||||
return timer_create(clockid, evp, timerid);
|
return REAL(timer_create)(clockid, evp, timerid);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ static inline int tdf_flags_pton(int portable_flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int timerfd_create_portable(int clockid, int portable_flags) {
|
int WRAP(timerfd_create)(int clockid, int portable_flags) {
|
||||||
int rv;
|
int rv;
|
||||||
int native_flags;
|
int native_flags;
|
||||||
|
|
||||||
@@ -67,7 +68,7 @@ int timerfd_create_portable(int clockid, int portable_flags) {
|
|||||||
|
|
||||||
native_flags = tdf_flags_pton(portable_flags);
|
native_flags = tdf_flags_pton(portable_flags);
|
||||||
|
|
||||||
rv = syscall(__NR_timerfd_create, clockid, native_flags);
|
rv = REAL(syscall)(__NR_timerfd_create, clockid, native_flags);
|
||||||
if (rv >= 0) {
|
if (rv >= 0) {
|
||||||
if (native_flags & TFD_CLOEXEC) {
|
if (native_flags & TFD_CLOEXEC) {
|
||||||
filefd_CLOEXEC_enabled(rv);
|
filefd_CLOEXEC_enabled(rv);
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -24,11 +25,11 @@
|
|||||||
#define PORTABLE_TAG "waitpid_portable"
|
#define PORTABLE_TAG "waitpid_portable"
|
||||||
#include <log_portable.h>
|
#include <log_portable.h>
|
||||||
|
|
||||||
pid_t waitpid_portable(pid_t pid, int *status, int options)
|
pid_t WRAP(waitpid)(pid_t pid, int *status, int options)
|
||||||
{
|
{
|
||||||
pid_t ret;
|
pid_t ret;
|
||||||
|
|
||||||
ret = waitpid(pid, status, options);
|
ret = REAL(waitpid)(pid, status, options);
|
||||||
if (status && ret > 0) {
|
if (status && ret > 0) {
|
||||||
/*
|
/*
|
||||||
* Status layout is identical, so just the signal
|
* Status layout is identical, so just the signal
|
||||||
|
|||||||
@@ -14,23 +14,24 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/epoll.h>
|
#include <sys/epoll.h>
|
||||||
#include <epoll_portable.h>
|
#include <epoll_portable.h>
|
||||||
|
|
||||||
int epoll_ctl_portable(int epfd, int op, int fd, struct epoll_event_portable *event)
|
int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event_portable *event)
|
||||||
{
|
{
|
||||||
struct epoll_event x86_epoll_event;
|
struct epoll_event x86_epoll_event;
|
||||||
|
|
||||||
x86_epoll_event.events = event->events;
|
x86_epoll_event.events = event->events;
|
||||||
x86_epoll_event.data = event->data;
|
x86_epoll_event.data = event->data;
|
||||||
|
|
||||||
return epoll_ctl(epfd, op, fd, &x86_epoll_event);
|
return REAL(epoll_ctl)(epfd, op, fd, &x86_epoll_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
int epoll_wait_portable(int epfd, struct epoll_event_portable *events, int max, int timeout)
|
int WRAP(epoll_wait)(int epfd, struct epoll_event_portable *events, int max, int timeout)
|
||||||
{
|
{
|
||||||
struct epoll_event x86_epoll_event;
|
struct epoll_event x86_epoll_event;
|
||||||
int ret = epoll_wait(epfd, &x86_epoll_event, max, timeout);
|
int ret = REAL(epoll_wait)(epfd, &x86_epoll_event, max, timeout);
|
||||||
|
|
||||||
events->events = x86_epoll_event.events;
|
events->events = x86_epoll_event.events;
|
||||||
events->data = x86_epoll_event.data;
|
events->data = x86_epoll_event.data;
|
||||||
|
|||||||
@@ -14,8 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern volatile int* __errno(void);
|
#include <portability.h>
|
||||||
volatile int* __errno_portable()
|
|
||||||
|
extern volatile int* REAL(__errno)(void);
|
||||||
|
volatile int* WRAP(__errno)()
|
||||||
{
|
{
|
||||||
return __errno();
|
return REAL(__errno)();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,14 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <fcntl_portable.h>
|
#include <fcntl_portable.h>
|
||||||
|
|
||||||
extern int __fcntl64(int, int, void *);
|
extern int __fcntl64(int, int, void *);
|
||||||
|
|
||||||
int fcntl_portable(int fd, int cmd, ...)
|
int WRAP(fcntl)(int fd, int cmd, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
void * arg;
|
void * arg;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <ioctls_portable.h>
|
#include <ioctls_portable.h>
|
||||||
@@ -31,7 +32,7 @@ static inline int x86_change_request(int request)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern int __ioctl(int, int, void *);
|
extern int __ioctl(int, int, void *);
|
||||||
int ioctl_portable(int fd, int request, ...)
|
int WRAP(ioctl)(int fd, int request, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
void * arg;
|
void * arg;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
@@ -56,7 +57,7 @@ static inline int x86_change_flags(int flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
extern int __open(const char*, int, int);
|
extern int __open(const char*, int, int);
|
||||||
int open_portable(const char *pathname, int flags, ...)
|
int WRAP(open)(const char *pathname, int flags, ...)
|
||||||
{
|
{
|
||||||
mode_t mode = 0;
|
mode_t mode = 0;
|
||||||
flags |= O_LARGEFILE;
|
flags |= O_LARGEFILE;
|
||||||
|
|||||||
@@ -14,10 +14,11 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/linux-syscalls.h>
|
#include <sys/linux-syscalls.h>
|
||||||
|
|
||||||
int socket_portable(int domain, int type, int protocol) {
|
int WRAP(socket)(int domain, int type, int protocol) {
|
||||||
return socket(domain, type, protocol);
|
return REAL(socket)(domain, type, protocol);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,17 +14,18 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
|
||||||
extern int setsockopt(int, int, int, const void *, socklen_t);
|
extern int REAL(setsockopt)(int, int, int, const void *, socklen_t);
|
||||||
int setsockopt_portable(int s, int level, int optname, const void *optval, socklen_t optlen)
|
int WRAP(setsockopt)(int s, int level, int optname, const void *optval, socklen_t optlen)
|
||||||
{
|
{
|
||||||
return setsockopt(s, level, optname, optval, optlen);
|
return REAL(setsockopt)(s, level, optname, optval, optlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int getsockopt (int, int, int, void *, socklen_t *);
|
extern int REAL(getsockopt)(int, int, int, void *, socklen_t *);
|
||||||
int getsockopt_portable(int s, int level, int optname, void *optval, socklen_t *optlen)
|
int WRAP(getsockopt)(int s, int level, int optname, void *optval, socklen_t *optlen)
|
||||||
{
|
{
|
||||||
return getsockopt(s, level, optname, optval, optlen);
|
return REAL(getsockopt)(s, level, optname, optval, optlen);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,37 +14,38 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <portability.h>
|
||||||
#include <stat_portable.h>
|
#include <stat_portable.h>
|
||||||
|
|
||||||
/* Note: The Portable Header will define stat to stat_portable */
|
/* Note: The Portable Header will define stat to stat_portable */
|
||||||
int stat_portable(const char *path, struct stat_portable *s)
|
int WRAP(stat)(const char *path, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
struct stat x86_stat;
|
struct stat x86_stat;
|
||||||
int ret = stat(path, &x86_stat);
|
int ret = REAL(stat)(path, &x86_stat);
|
||||||
stat_ntop(&x86_stat, s);
|
stat_ntop(&x86_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstat_portable(int fd, struct stat_portable *s)
|
int WRAP(fstat)(int fd, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
struct stat x86_stat;
|
struct stat x86_stat;
|
||||||
int ret = fstat(fd, &x86_stat);
|
int ret = REAL(fstat)(fd, &x86_stat);
|
||||||
stat_ntop(&x86_stat, s);
|
stat_ntop(&x86_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lstat_portable(const char *path, struct stat_portable *s)
|
int WRAP(lstat)(const char *path, struct stat_portable *s)
|
||||||
{
|
{
|
||||||
struct stat x86_stat;
|
struct stat x86_stat;
|
||||||
int ret = lstat(path, &x86_stat);
|
int ret = REAL(lstat)(path, &x86_stat);
|
||||||
stat_ntop(&x86_stat, s);
|
stat_ntop(&x86_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fstatat_portable(int dirfd, const char *path, struct stat_portable *s, int flags)
|
int WRAP(fstatat)(int dirfd, const char *path, struct stat_portable *s, int flags)
|
||||||
{
|
{
|
||||||
struct stat x86_stat;
|
struct stat x86_stat;
|
||||||
int ret = fstatat(dirfd, path, &x86_stat, flags);
|
int ret = REAL(fstatat)(dirfd, path, &x86_stat, flags);
|
||||||
stat_ntop(&x86_stat, s);
|
stat_ntop(&x86_stat, s);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2012, The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ASM_PORTABILITY_H_
|
||||||
|
#define _ASM_PORTABILITY_H_
|
||||||
|
|
||||||
|
#if !defined(__HOST__)
|
||||||
|
#define WRAP(f) f ## _portable
|
||||||
|
#define REAL(f) f
|
||||||
|
#else
|
||||||
|
/* On host app link with libpportable.a with -Wl,--wrap=symbol, which resolve symbol symbol to __wrap_symbol,
|
||||||
|
* and __real_symbol refer to the original symbol
|
||||||
|
*/
|
||||||
|
#define WRAP(f) __wrap_ ## f
|
||||||
|
#define REAL(f) __real_ ## f
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _ASM_PORTABILITY_H_ */
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
#ifndef _SYS_EVENTFD_PORTABLE_H
|
#ifndef _SYS_EVENTFD_PORTABLE_H
|
||||||
#define _SYS_EVENTFD_PORTABLE_H
|
#define _SYS_EVENTFD_PORTABLE_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <portability.h>
|
#include <portability.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#include <fcntl_portable.h>
|
#include <fcntl_portable.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
@@ -50,7 +50,7 @@ __BEGIN_DECLS
|
|||||||
/* type of event counter */
|
/* type of event counter */
|
||||||
typedef uint64_t eventfd_portable_t;
|
typedef uint64_t eventfd_portable_t;
|
||||||
|
|
||||||
extern int eventfd_portable(unsigned int initval, int flags);
|
extern int WRAP(eventfd)(unsigned int initval, int flags);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Compatibility with GLibc; libportable versions don't appear to be necessary */
|
/* Compatibility with GLibc; libportable versions don't appear to be necessary */
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ extern __hidden void filefd_CLOEXEC_enabled(int fd);
|
|||||||
extern __hidden void filefd_CLOEXEC_disabled(int fd);
|
extern __hidden void filefd_CLOEXEC_disabled(int fd);
|
||||||
extern __hidden void filefd_disable_mapping(void);
|
extern __hidden void filefd_disable_mapping(void);
|
||||||
|
|
||||||
extern int close_portable(int fd);
|
extern int WRAP(close)(int fd);
|
||||||
extern int read_portable(int fd, void *buf, size_t count);
|
extern int WRAP(read)(int fd, void *buf, size_t count);
|
||||||
extern int pipe2_portable(int pipefd[2], int portable_flags);
|
extern int WRAP(pipe2)(int pipefd[2], int portable_flags);
|
||||||
|
|
||||||
#endif /* _FILEFD_PORTABLE_H_ */
|
#endif /* _FILEFD_PORTABLE_H_ */
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef _SYS_INOTIFY_PORTABLE_H
|
#ifndef _SYS_INOTIFY_PORTABLE_H
|
||||||
#define _SYS_INOTIFY_PORTABLE_H
|
#define _SYS_INOTIFY_PORTABLE_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <portability.h>
|
#include <portability.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fcntl_portable.h>
|
#include <fcntl_portable.h>
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ __BEGIN_DECLS
|
|||||||
#define IN_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
|
#define IN_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
|
||||||
#define IN_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
|
#define IN_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
|
||||||
|
|
||||||
extern int inotify_init1_portable(int flags);
|
extern int WRAP(inotify_init1)(int flags);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ static inline char *portable_tag() {
|
|||||||
_rv; /* Returned to caller */ \
|
_rv; /* Returned to caller */ \
|
||||||
})
|
})
|
||||||
|
|
||||||
#if !defined(HAS_NO_LOG_H)
|
#if !defined(__HOST__)
|
||||||
#include <cutils/log.h>
|
#include <cutils/log.h>
|
||||||
|
|
||||||
# define PERROR(str) { \
|
# define PERROR(str) { \
|
||||||
@@ -91,8 +91,11 @@ static inline char *portable_tag() {
|
|||||||
# define ASSERT(cond) ALOG_ASSERT(cond, "assertion failed:(%s), file: %s, line: %d:%s", \
|
# define ASSERT(cond) ALOG_ASSERT(cond, "assertion failed:(%s), file: %s, line: %d:%s", \
|
||||||
#cond, __FILE__, __LINE__, __func__);
|
#cond, __FILE__, __LINE__, __func__);
|
||||||
#else
|
#else
|
||||||
|
#include <assert.h>
|
||||||
# define PERROR(str) fprintf(stderr, "%s: PERROR('%s'): errno:%d:'%s'", __func__, str, errno, strerror(errno))
|
# define PERROR(str) fprintf(stderr, "%s: PERROR('%s'): errno:%d:'%s'", __func__, str, errno, strerror(errno))
|
||||||
# define ASSERT(cond) assert(cond)
|
# define ASSERT(cond) assert(cond)
|
||||||
|
# define ALOGV(a,...)
|
||||||
|
# define ALOGW(a,...)
|
||||||
|
# define ALOGE(a,...)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -232,10 +232,10 @@ void herror(const char *);
|
|||||||
const char *hstrerror(int);
|
const char *hstrerror(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int getaddrinfo_portable(const char *, const char *, struct addrinfo_portable *,
|
int WRAP(getaddrinfo)(const char *, const char *, struct addrinfo_portable *,
|
||||||
struct addrinfo_portable **);
|
struct addrinfo_portable **);
|
||||||
|
|
||||||
void freeaddrinfo_portable(struct addrinfo_portable *);
|
void WRAP(freeaddrinfo)(struct addrinfo_portable *);
|
||||||
|
|
||||||
#if 0 /* Not needed for addrinfo mapping */
|
#if 0 /* Not needed for addrinfo mapping */
|
||||||
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
|
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#ifndef _PORTABILITY_H_
|
#ifndef _PORTABILITY_H_
|
||||||
#define _PORTABILITY_H_
|
#define _PORTABILITY_H_
|
||||||
|
|
||||||
|
#include "asm-generic/portability.h"
|
||||||
/*
|
/*
|
||||||
* Common portability helper routines
|
* Common portability helper routines
|
||||||
*/
|
*/
|
||||||
@@ -31,7 +32,7 @@
|
|||||||
*/
|
*/
|
||||||
inline static int invalid_pointer(void *p)
|
inline static int invalid_pointer(void *p)
|
||||||
{
|
{
|
||||||
return p == NULL
|
return p == 0
|
||||||
|| p == (void *)-1
|
|| p == (void *)-1
|
||||||
#ifdef __mips__
|
#ifdef __mips__
|
||||||
|| (int)p < 0
|
|| (int)p < 0
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ typedef int sig_atomic_t;
|
|||||||
extern const char * const sys_siglist[];
|
extern const char * const sys_siglist[];
|
||||||
extern const char * const sys_signame[];
|
extern const char * const sys_signame[];
|
||||||
|
|
||||||
static __inline__ int sigismember_portable(sigset_portable_t *set, int signum)
|
static __inline__ int WRAP(sigismember)(sigset_portable_t *set, int signum)
|
||||||
{
|
{
|
||||||
unsigned long *local_set = (unsigned long *)set;
|
unsigned long *local_set = (unsigned long *)set;
|
||||||
signum--;
|
signum--;
|
||||||
@@ -72,7 +72,7 @@ static __inline__ int sigismember_portable(sigset_portable_t *set, int signum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static __inline__ int sigaddset_portable(sigset_portable_t *set, int signum)
|
static __inline__ int WRAP(sigaddset)(sigset_portable_t *set, int signum)
|
||||||
{
|
{
|
||||||
unsigned long *local_set = (unsigned long *)set;
|
unsigned long *local_set = (unsigned long *)set;
|
||||||
signum--;
|
signum--;
|
||||||
@@ -81,7 +81,7 @@ static __inline__ int sigaddset_portable(sigset_portable_t *set, int signum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static __inline__ int sigdelset_portable(sigset_portable_t *set, int signum)
|
static __inline__ int WRAP(sigdelset)(sigset_portable_t *set, int signum)
|
||||||
{
|
{
|
||||||
unsigned long *local_set = (unsigned long *)set;
|
unsigned long *local_set = (unsigned long *)set;
|
||||||
signum--;
|
signum--;
|
||||||
@@ -90,13 +90,13 @@ static __inline__ int sigdelset_portable(sigset_portable_t *set, int signum)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static __inline__ int sigemptyset_portable(sigset_portable_t *set)
|
static __inline__ int WRAP(sigemptyset)(sigset_portable_t *set)
|
||||||
{
|
{
|
||||||
memset(set, 0, sizeof *set);
|
memset(set, 0, sizeof *set);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __inline__ int sigfillset_portable(sigset_portable_t *set)
|
static __inline__ int WRAP(sigfillset)(sigset_portable_t *set)
|
||||||
{
|
{
|
||||||
memset(set, ~0, sizeof *set);
|
memset(set, ~0, sizeof *set);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -116,34 +116,34 @@ extern __sighandler_t bsd_signal(int, __sighandler_portable_t);
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* the default is bsd */
|
/* the default is bsd */
|
||||||
static __inline__ __sighandler_portable_t signal_portable(int s, sighandler_portable_t f)
|
static __inline__ __sighandler_portable_t WRAP(signal)(int s, sighandler_portable_t f)
|
||||||
{
|
{
|
||||||
return bsd_signal(s,f);
|
return bsd_signal(s,f);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* the portable mapped syscall itself */
|
/* the portable mapped syscall itself */
|
||||||
extern __sighandler_portable_t __signal_portable(int, __sighandler_portable_t);
|
extern __sighandler_portable_t WRAP(__signal)(int, __sighandler_portable_t);
|
||||||
|
|
||||||
extern int sigprocmask_portable(int, const sigset_portable_t *, sigset_portable_t *);
|
extern int WRAP(sigprocmask)(int, const sigset_portable_t *, sigset_portable_t *);
|
||||||
|
|
||||||
extern int sigaction_portable(int, const struct sigaction_portable *,
|
extern int WRAP(sigaction)(int, const struct sigaction_portable *,
|
||||||
struct sigaction_portable *);
|
struct sigaction_portable *);
|
||||||
|
|
||||||
extern int sigpending_portable(sigset_portable_t *);
|
extern int WRAP(sigpending)(sigset_portable_t *);
|
||||||
extern int sigsuspend_portable(const sigset_portable_t *);
|
extern int WRAP(sigsuspend)(const sigset_portable_t *);
|
||||||
extern int sigwait_portable(const sigset_portable_t *set, int *sig);
|
extern int WRAP(sigwait)(const sigset_portable_t *set, int *sig);
|
||||||
extern int siginterrupt_portable(int sig, int flag);
|
extern int WRAP(siginterrupt)(int sig, int flag);
|
||||||
|
|
||||||
extern int raise_portable(int);
|
extern int WRAP(raise)(int);
|
||||||
extern int kill_portable(pid_t, int);
|
extern int WRAP(kill)(pid_t, int);
|
||||||
extern int killpg_portable(int pgrp, int sig);
|
extern int WRAP(killpg)(int pgrp, int sig);
|
||||||
extern int tkill_portable(int tid, int portable_signum);
|
extern int WRAP(tkill)(int tid, int portable_signum);
|
||||||
extern int sigaltstack_portable(const portable_stack_t *ss, portable_stack_t *oss);
|
extern int WRAP(sigaltstack)(const portable_stack_t *ss, portable_stack_t *oss);
|
||||||
extern int timer_create_portable(clockid_t, struct sigevent *, timer_t *);
|
extern int WRAP(timer_create)(clockid_t, struct sigevent *, timer_t *);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
extern int signalfd_portable(int fd, const sigset_portable_t *portable_sigmask, int flags);
|
extern int WRAP(signalfd)(int fd, const sigset_portable_t *portable_sigmask, int flags);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern __hidden int do_signalfd4_portable(int fd, const sigset_portable_t *portable_sigmask,
|
extern __hidden int do_signalfd4_portable(int fd, const sigset_portable_t *portable_sigmask,
|
||||||
@@ -167,26 +167,26 @@ extern __hidden int do_sigmask(int portable_how, const sigset_portable_t *portab
|
|||||||
|
|
||||||
|
|
||||||
/* These functions are called from syscall.c and experimental Bionic linker. */
|
/* These functions are called from syscall.c and experimental Bionic linker. */
|
||||||
extern int __rt_sigaction_portable(int portable_signum,
|
extern int WRAP(__rt_sigaction)(int portable_signum,
|
||||||
const struct sigaction_portable *act,
|
const struct sigaction_portable *act,
|
||||||
struct sigaction_portable *oldact,
|
struct sigaction_portable *oldact,
|
||||||
size_t sigsetsize);
|
size_t sigsetsize);
|
||||||
|
|
||||||
extern int __rt_sigprocmask_portable(int portable_how,
|
extern int WRAP(__rt_sigprocmask)(int portable_how,
|
||||||
const sigset_portable_t *portable_sigset,
|
const sigset_portable_t *portable_sigset,
|
||||||
sigset_portable_t *portable_oldset,
|
sigset_portable_t *portable_oldset,
|
||||||
size_t sigsetsize);
|
size_t sigsetsize);
|
||||||
|
|
||||||
extern int __rt_sigtimedwait_portable(const sigset_portable_t *portable_sigset,
|
extern int WRAP(__rt_sigtimedwait)(const sigset_portable_t *portable_sigset,
|
||||||
siginfo_portable_t *portable_siginfo,
|
siginfo_portable_t *portable_siginfo,
|
||||||
const struct timespec *timeout,
|
const struct timespec *timeout,
|
||||||
size_t portable_sigsetsize);
|
size_t portable_sigsetsize);
|
||||||
|
|
||||||
|
|
||||||
/* These functions are only called from syscall.c; not experimental Bionic linker. */
|
/* These functions are only called from syscall.c; not experimental Bionic linker. */
|
||||||
extern __hidden int rt_sigqueueinfo_portable(pid_t pid, int sig, siginfo_portable_t *uinfo);
|
extern __hidden int WRAP(rt_sigqueueinfo)(pid_t pid, int sig, siginfo_portable_t *uinfo);
|
||||||
|
|
||||||
extern __hidden int rt_tgsigqueueinfo_portable(pid_t tgid, pid_t pid, int sig,
|
extern __hidden int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int sig,
|
||||||
siginfo_portable_t *uinfo);
|
siginfo_portable_t *uinfo);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@
|
|||||||
#ifndef _SYS_TIMERFD_PORTABLE_H
|
#ifndef _SYS_TIMERFD_PORTABLE_H
|
||||||
#define _SYS_TIMERFD_PORTABLE_H
|
#define _SYS_TIMERFD_PORTABLE_H
|
||||||
|
|
||||||
#include <sys/cdefs.h>
|
|
||||||
#include <portability.h>
|
#include <portability.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <fcntl_portable.h>
|
#include <fcntl_portable.h>
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ __BEGIN_DECLS
|
|||||||
#define TFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
|
#define TFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
|
||||||
#define TFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
|
#define TFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
|
||||||
|
|
||||||
extern int timerfd_create_portable(int clockid, int flags);
|
extern int WRAP(timerfd_create)(int clockid, int flags);
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user