libportable to adapt L header functions.

Change-Id: Ie15c321ee3b1b21f264b12641bc064ee33dec418
This commit is contained in:
WenHan Gu
2014-07-30 11:01:56 +08:00
committed by Andrew Hsieh
parent 9b87a9735a
commit bce5ab4f3f
83 changed files with 861 additions and 10464 deletions

View File

@@ -1,35 +0,0 @@
/*
* 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 resolves undefined symbol to __wrap_symbol,
* and undefined __real_symbol to the original symbol
*/
#define WRAP(f) __wrap_ ## f
#define REAL(f) __real_ ## f
#endif
#if defined(__mips__) && !defined(END)
#define END(f) .cfi_endproc; .end f
#endif
#endif /* _ASM_PORTABILITY_H_ */

View File

@@ -1,221 +0,0 @@
/****************************************************************************
Derived from platforms/android-14/arch-arm/usr/include/asm-generic/siginfo.h
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef _ASM_PORTABLE_GENERIC_SIGINFO_H
#define _ASM_PORTABLE_GENERIC_SIGINFO_H
#include <linux/compiler.h>
#include <linux/types.h>
typedef union sigval_portable {
int sival_int;
void __user *sival_ptr;
} sigval_portable_t;
#ifndef __ARCH_SI_PREAMBLE_SIZE
#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
#endif
#define SI_MAX_SIZE 128
#ifndef SI_PAD_SIZE
#define SI_PAD_SIZE ((SI_MAX_SIZE - __ARCH_SI_PREAMBLE_SIZE) / sizeof(int))
#endif
#ifndef __ARCH_SI_UID_T
#define __ARCH_SI_UID_T uid_t
#endif
#ifndef __ARCH_SI_BAND_T
#define __ARCH_SI_BAND_T long
#endif
typedef struct siginfo_portable {
int si_signo;
int si_errno;
int si_code;
union {
int _pad[SI_PAD_SIZE];
struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
} _kill;
struct {
timer_t _tid;
int _overrun;
char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
sigval_portable_t _sigval;
int _sys_private;
} _timer;
struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
sigval_t _sigval;
} _rt;
struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
int _status;
clock_t _utime;
clock_t _stime;
} _sigchld;
struct {
void __user *_addr;
#ifdef __ARCH_SI_TRAPNO
int _trapno;
#endif
} _sigfault;
struct {
__ARCH_SI_BAND_T _band;
int _fd;
} _sigpoll;
} _sifields;
} siginfo_portable_t;
#ifndef si_pid
#define si_pid _sifields._kill._pid
#define si_uid _sifields._kill._uid
#define si_tid _sifields._timer._tid
#define si_overrun _sifields._timer._overrun
#define si_sys_private _sifields._timer._sys_private
#define si_status _sifields._sigchld._status
#define si_utime _sifields._sigchld._utime
#define si_stime _sifields._sigchld._stime
#define si_value _sifields._rt._sigval
#define si_int _sifields._rt._sigval.sival_int
#define si_ptr _sifields._rt._sigval.sival_ptr
#define si_addr _sifields._sigfault._addr
#ifdef __ARCH_SI_TRAPNO
#define si_trapno _sifields._sigfault._trapno
#endif
#define si_band _sifields._sigpoll._band
#define si_fd _sifields._sigpoll._fd
#endif
#ifndef __SI_KILL
#define __SI_KILL 0
#define __SI_TIMER 0
#define __SI_POLL 0
#define __SI_FAULT 0
#define __SI_CHLD 0
#define __SI_RT 0
#define __SI_MESGQ 0
#define __SI_CODE(T,N) (N)
#endif
#ifndef SI_USER
#define SI_USER 0
#define SI_KERNEL 0x80
#define SI_QUEUE -1
#define SI_TIMER __SI_CODE(__SI_TIMER,-2)
#define SI_MESGQ __SI_CODE(__SI_MESGQ,-3)
#define SI_ASYNCIO -4
#define SI_SIGIO -5
#define SI_TKILL -6
#define SI_DETHREAD -7
#define SI_FROMUSER(siptr) ((siptr)->si_code <= 0)
#define SI_FROMKERNEL(siptr) ((siptr)->si_code > 0)
#endif
#ifndef ILL_ILLOPC
#define ILL_ILLOPC (__SI_FAULT|1)
#define ILL_ILLOPN (__SI_FAULT|2)
#define ILL_ILLADR (__SI_FAULT|3)
#define ILL_ILLTRP (__SI_FAULT|4)
#define ILL_PRVOPC (__SI_FAULT|5)
#define ILL_PRVREG (__SI_FAULT|6)
#define ILL_COPROC (__SI_FAULT|7)
#define ILL_BADSTK (__SI_FAULT|8)
#define NSIGILL 8
#endif
#ifndef FPE_INTDIV
#define FPE_INTDIV (__SI_FAULT|1)
#define FPE_INTOVF (__SI_FAULT|2)
#define FPE_FLTDIV (__SI_FAULT|3)
#define FPE_FLTOVF (__SI_FAULT|4)
#define FPE_FLTUND (__SI_FAULT|5)
#define FPE_FLTRES (__SI_FAULT|6)
#define FPE_FLTINV (__SI_FAULT|7)
#define FPE_FLTSUB (__SI_FAULT|8)
#define NSIGFPE 8
#define SEGV_MAPERR (__SI_FAULT|1)
#define SEGV_ACCERR (__SI_FAULT|2)
#define NSIGSEGV 2
#define BUS_ADRALN (__SI_FAULT|1)
#define BUS_ADRERR (__SI_FAULT|2)
#define BUS_OBJERR (__SI_FAULT|3)
#define NSIGBUS 3
#define TRAP_BRKPT (__SI_FAULT|1)
#define TRAP_TRACE (__SI_FAULT|2)
#define NSIGTRAP 2
#define CLD_EXITED (__SI_CHLD|1)
#define CLD_KILLED (__SI_CHLD|2)
#define CLD_DUMPED (__SI_CHLD|3)
#define CLD_TRAPPED (__SI_CHLD|4)
#define CLD_STOPPED (__SI_CHLD|5)
#define CLD_CONTINUED (__SI_CHLD|6)
#define NSIGCHLD 6
#define POLL_IN (__SI_POLL|1)
#define POLL_OUT (__SI_POLL|2)
#define POLL_MSG (__SI_POLL|3)
#define POLL_ERR (__SI_POLL|4)
#define POLL_PRI (__SI_POLL|5)
#define POLL_HUP (__SI_POLL|6)
#define NSIGPOLL 6
#define SIGEV_SIGNAL 0
#define SIGEV_NONE 1
#define SIGEV_THREAD 2
#define SIGEV_THREAD_ID 4
#endif /* FPE_INTDIV */
#ifndef __ARCH_SIGEV_PREAMBLE_SIZE
#define __ARCH_SIGEV_PREAMBLE_SIZE (sizeof(int) * 2 + sizeof(sigval_portable_t))
#endif
#define SIGEV_MAX_SIZE 64
#define SIGEV_PAD_SIZE ((SIGEV_MAX_SIZE - __ARCH_SIGEV_PREAMBLE_SIZE) / sizeof(int))
typedef struct sigevent_portable {
sigval_portable_t sigev_value;
int sigev_signo;
int sigev_notify;
union {
int _pad[SIGEV_PAD_SIZE];
int _tid;
struct {
void (*_function)(sigval_portable_t);
void *_attribute;
} _sigev_thread;
} _sigev_un;
} sigevent_portable_t;
#define sigev_notify_function _sigev_un._sigev_thread._function
#define sigev_notify_attributes _sigev_un._sigev_thread._attribute
#define sigev_notify_thread_id _sigev_un._tid
#endif

View File

@@ -1,21 +0,0 @@
/****************************************************************************
Derived from platforms/android-14/arch-arm/usr/include/asm-generic/signal.h
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef __ASM_GENERIC_SIGNAL_PORTABLE_H
#define __ASM_GENERIC_SIGNAL_PORTABLE_H
#define SIG_BLOCK_PORTABLE 0
#define SIG_UNBLOCK_PORTABLE 1
#define SIG_SETMASK_PORTABLE 2
#endif

View File

@@ -1,40 +0,0 @@
/****************************************************************************
Derived from gdk/platforms/android-14/arch-arm/usr/include/asm/sigcontext.h
****************************************************************************
***
*** This header was ORIGINALLY automatically generated from a Linux kernel
*** header of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef _ASMARM_SIGCONTEXT_PORTABLE_H
#define _ASMARM_SIGCONTEXT_PORTABLE_H
struct sigcontext_portable {
unsigned long trap_no;
unsigned long error_code;
unsigned long oldmask;
unsigned long arm_r0;
unsigned long arm_r1;
unsigned long arm_r2;
unsigned long arm_r3;
unsigned long arm_r4;
unsigned long arm_r5;
unsigned long arm_r6;
unsigned long arm_r7;
unsigned long arm_r8;
unsigned long arm_r9;
unsigned long arm_r10;
unsigned long arm_fp;
unsigned long arm_ip;
unsigned long arm_sp;
unsigned long arm_lr;
unsigned long arm_pc;
unsigned long arm_cpsr;
unsigned long fault_address;
};
#endif

View File

@@ -1,17 +0,0 @@
/****************************************************************************
****************************************************************************
***
*** This header was automatically generated from a Linux kernel header
*** of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef _ASM_PORTABLE_SIGINFO_H
#define _ASM_PORTABLE_SIGINFO_H
#include <asm-generic/siginfo_portable.h>
#endif

View File

@@ -1,193 +0,0 @@
/****************************************************************************
Derived from gdk/platforms/android-14/arch-arm/usr/include/asm/signal.h
****************************************************************************
***
*** This header was ORIGINALLY automatically generated from a Linux kernel
*** header of the same name, to make information necessary for userspace to
*** call into the kernel available to libc. It contains only constants,
*** structures, and macros generated from the original header, and thus,
*** contains no copyrightable information.
***
****************************************************************************
****************************************************************************/
#ifndef _ASMARM_SIGNAL_PORTABLE_H
#define _ASMARM_SIGNAL_PORTABLE_H
struct siginfo; /* TODO: Change to siginfo_portable */
#define NSIG_PORTABLE 64
typedef unsigned long sigset_portable_t;
#define SIGHUP_PORTABLE 1
#define SIGINT_PORTABLE 2
#define SIGQUIT_PORTABLE 3
#define SIGILL_PORTABLE 4
#define SIGTRAP_PORTABLE 5
#define SIGABRT_PORTABLE 6
#define SIGIOT_PORTABLE 6
#define SIGBUS_PORTABLE 7
#define SIGFPE_PORTABLE 8
#define SIGKILL_PORTABLE 9
#define SIGUSR1_PORTABLE 10
#define SIGSEGV_PORTABLE 11
#define SIGUSR2_PORTABLE 12
#define SIGPIPE_PORTABLE 13
#define SIGALRM_PORTABLE 14
#define SIGTERM_PORTABLE 15
#define SIGSTKFLT_PORTABLE 16
#define SIGCHLD_PORTABLE 17
#define SIGCONT_PORTABLE 18
#define SIGSTOP_PORTABLE 19
#define SIGTSTP_PORTABLE 20
#define SIGTTIN_PORTABLE 21
#define SIGTTOU_PORTABLE 22
#define SIGURG_PORTABLE 23
#define SIGXCPU_PORTABLE 24
#define SIGXFSZ_PORTABLE 25
#define SIGVTALRM_PORTABLE 26
#define SIGPROF_PORTABLE 27
#define SIGWINCH_PORTABLE 28
#define SIGIO_PORTABLE 29
#define SIGPOLL_PORTABLE SIGIO
#define SIGPWR_PORTABLE 30
#define SIGSYS_PORTABLE 31
#define SIGUNUSED_PORTABLE 31
#define SIGSWI_PORTABLE 32
#define SIGRTMIN_PORTABLE 32
#define SIGRT_1_PORTABLE (SIGRTMIN_PORTABLE + 1)
#define SIGRT_2_PORTABLE (SIGRTMIN_PORTABLE + 2)
#define SIGRT_3_PORTABLE (SIGRTMIN_PORTABLE + 3)
#define SIGRT_4_PORTABLE (SIGRTMIN_PORTABLE + 4)
#define SIGRT_5_PORTABLE (SIGRTMIN_PORTABLE + 5)
#define SIGRT_5_PORTABLE (SIGRTMIN_PORTABLE + 5)
#define SIGRT_6_PORTABLE (SIGRTMIN_PORTABLE + 6)
#define SIGRT_7_PORTABLE (SIGRTMIN_PORTABLE + 7)
#define SIGRT_8_PORTABLE (SIGRTMIN_PORTABLE + 8)
#define SIGRT_9_PORTABLE (SIGRTMIN_PORTABLE + 9)
#define SIGRT_10_PORTABLE (SIGRTMIN_PORTABLE + 10)
#define SIGRT_11_PORTABLE (SIGRTMIN_PORTABLE + 11)
#define SIGRT_12_PORTABLE (SIGRTMIN_PORTABLE + 12)
#define SIGRT_13_PORTABLE (SIGRTMIN_PORTABLE + 13)
#define SIGRT_14_PORTABLE (SIGRTMIN_PORTABLE + 14)
#define SIGRT_15_PORTABLE (SIGRTMIN_PORTABLE + 15)
#define SIGRT_15_PORTABLE (SIGRTMIN_PORTABLE + 15)
#define SIGRT_16_PORTABLE (SIGRTMIN_PORTABLE + 16)
#define SIGRT_17_PORTABLE (SIGRTMIN_PORTABLE + 17)
#define SIGRT_18_PORTABLE (SIGRTMIN_PORTABLE + 18)
#define SIGRT_19_PORTABLE (SIGRTMIN_PORTABLE + 19)
#define SIGRT_20_PORTABLE (SIGRTMIN_PORTABLE + 20)
#define SIGRT_20_PORTABLE (SIGRTMIN_PORTABLE + 20)
#define SIGRT_21_PORTABLE (SIGRTMIN_PORTABLE + 21)
#define SIGRT_22_PORTABLE (SIGRTMIN_PORTABLE + 22)
#define SIGRT_23_PORTABLE (SIGRTMIN_PORTABLE + 23)
#define SIGRT_24_PORTABLE (SIGRTMIN_PORTABLE + 24)
#define SIGRT_25_PORTABLE (SIGRTMIN_PORTABLE + 25)
#define SIGRT_25_PORTABLE (SIGRTMIN_PORTABLE + 25)
#define SIGRT_26_PORTABLE (SIGRTMIN_PORTABLE + 26)
#define SIGRT_27_PORTABLE (SIGRTMIN_PORTABLE + 27)
#define SIGRT_28_PORTABLE (SIGRTMIN_PORTABLE + 28)
#define SIGRT_29_PORTABLE (SIGRTMIN_PORTABLE + 29)
#define SIGRT_30_PORTABLE (SIGRTMIN_PORTABLE + 30)
#define SIGRT_31_PORTABLE (SIGRTMIN_PORTABLE + 31)
#define SIGRT_32_PORTABLE (SIGRTMIN_PORTABLE + 32)
#define SIGRTMAX_PORTABLE NSIG_PORTABLE
/*
* Define MIPS/Native Real Time Signal Names for debugging.
* NOTE:
* Currently only defining the 32 RT signals that the
* lib-portable application can interact with. MIPS has
* an additional 63 signals.
*/
#ifndef __SIGRTMIN
#define __SIGRTMIN SIGRTMIN
#endif
#ifndef __SIGRTMAX
#define __SIGRTMAX SIGRTMAX
#endif
#define SIGRT_1 (__SIGRTMIN + 1)
#define SIGRT_2 (__SIGRTMIN + 2)
#define SIGRT_3 (__SIGRTMIN + 3)
#define SIGRT_4 (__SIGRTMIN + 4)
#define SIGRT_5 (__SIGRTMIN + 5)
#define SIGRT_5 (__SIGRTMIN + 5)
#define SIGRT_6 (__SIGRTMIN + 6)
#define SIGRT_7 (__SIGRTMIN + 7)
#define SIGRT_8 (__SIGRTMIN + 8)
#define SIGRT_9 (__SIGRTMIN + 9)
#define SIGRT_10 (__SIGRTMIN + 10)
#define SIGRT_11 (__SIGRTMIN + 11)
#define SIGRT_12 (__SIGRTMIN + 12)
#define SIGRT_13 (__SIGRTMIN + 13)
#define SIGRT_14 (__SIGRTMIN + 14)
#define SIGRT_15 (__SIGRTMIN + 15)
#define SIGRT_15 (__SIGRTMIN + 15)
#define SIGRT_16 (__SIGRTMIN + 16)
#define SIGRT_17 (__SIGRTMIN + 17)
#define SIGRT_18 (__SIGRTMIN + 18)
#define SIGRT_19 (__SIGRTMIN + 19)
#define SIGRT_20 (__SIGRTMIN + 20)
#define SIGRT_20 (__SIGRTMIN + 20)
#define SIGRT_21 (__SIGRTMIN + 21)
#define SIGRT_22 (__SIGRTMIN + 22)
#define SIGRT_23 (__SIGRTMIN + 23)
#define SIGRT_24 (__SIGRTMIN + 24)
#define SIGRT_25 (__SIGRTMIN + 25)
#define SIGRT_25 (__SIGRTMIN + 25)
#define SIGRT_26 (__SIGRTMIN + 26)
#define SIGRT_27 (__SIGRTMIN + 27)
#define SIGRT_28 (__SIGRTMIN + 28)
#define SIGRT_29 (__SIGRTMIN + 29)
#define SIGRT_30 (__SIGRTMIN + 30)
#define SIGRT_31 (__SIGRTMIN + 31)
#define SIGRT_32 (__SIGRTMIN + 32)
/*
* NOTE: Native signals SIGRT_33 ... SIGRTMAX
* can't be used by a lib-portable application.
*/
#define SA_NOCLDSTOP_PORTABLE 0x00000001
#define SA_NOCLDWAIT_PORTABLE 0x00000002
#define SA_SIGINFO_PORTABLE 0x00000004
#define SA_THIRTYTWO_PORTABLE 0x02000000
#define SA_RESTORER_PORTABLE 0x04000000
#define SA_ONSTACK_PORTABLE 0x08000000
#define SA_RESTART_PORTABLE 0x10000000
#define SA_NODEFER_PORTABLE 0x40000000
#define SA_RESETHAND_PORTABLE 0x80000000
#define SA_NOMASK_PORTSBLE SA_NODEFER_PORTABLE
#define SA_ONESHOT_PORTABLE SA_RESETHAND_PORABLE
#include <asm-generic/signal_portable.h>
typedef __signalfn_t __user *__sighandler_portable_t;
typedef void (*__sigaction_handler_portable_t)(int, struct siginfo *, void *);
struct sigaction_portable {
union {
__sighandler_portable_t _sa_handler;
__sigaction_handler_portable_t _sa_sigaction;
} _u;
sigset_portable_t sa_mask;
unsigned long sa_flags;
void (*sa_restorer)(void);
};
#define sa_handler_portable _u._sa_handler
#define sa_sigaction_portable _u._sa_sigaction
typedef struct sigaltstack_portable {
void __user *ss_sp;
int ss_flags;
size_t ss_size;
} portable_stack_t;
#endif

View File

@@ -1,401 +0,0 @@
#ifndef __ASM_UNISTD_PORTABLE_H
#define __ASM_UNISTD_PORTABLE_H
/* Derived from android-14/arch-arm/usr/include/asm/unistd.h */
#define __NR_SYSCALL_BASE_portable 0
#define __NR_restart_syscall_portable (__NR_SYSCALL_BASE_portable+ 0)
#define __NR_exit_portable (__NR_SYSCALL_BASE_portable+ 1)
#define __NR_fork_portable (__NR_SYSCALL_BASE_portable+ 2)
#define __NR_read_portable (__NR_SYSCALL_BASE_portable+ 3)
#define __NR_write_portable (__NR_SYSCALL_BASE_portable+ 4)
#define __NR_open_portable (__NR_SYSCALL_BASE_portable+ 5)
#define __NR_close_portable (__NR_SYSCALL_BASE_portable+ 6)
#define __NR_creat_portable (__NR_SYSCALL_BASE_portable+ 8)
#define __NR_link_portable (__NR_SYSCALL_BASE_portable+ 9)
#define __NR_unlink_portable (__NR_SYSCALL_BASE_portable+ 10)
#define __NR_execve_portable (__NR_SYSCALL_BASE_portable+ 11)
#define __NR_chdir_portable (__NR_SYSCALL_BASE_portable+ 12)
#define __NR_time_portable (__NR_SYSCALL_BASE_portable+ 13)
#define __NR_mknod_portable (__NR_SYSCALL_BASE_portable+ 14)
#define __NR_chmod_portable (__NR_SYSCALL_BASE_portable+ 15)
#define __NR_lchown_portable (__NR_SYSCALL_BASE_portable+ 16)
#define __NR_lseek_portable (__NR_SYSCALL_BASE_portable+ 19)
#define __NR_getpid_portable (__NR_SYSCALL_BASE_portable+ 20)
#define __NR_mount_portable (__NR_SYSCALL_BASE_portable+ 21)
#define __NR_umount_portable (__NR_SYSCALL_BASE_portable+ 22)
#define __NR_setuid_portable (__NR_SYSCALL_BASE_portable+ 23)
#define __NR_getuid_portable (__NR_SYSCALL_BASE_portable+ 24)
#define __NR_stime_portable (__NR_SYSCALL_BASE_portable+ 25)
#define __NR_ptrace_portable (__NR_SYSCALL_BASE_portable+ 26)
#define __NR_alarm_portable (__NR_SYSCALL_BASE_portable+ 27)
#define __NR_pause_portable (__NR_SYSCALL_BASE_portable+ 29)
#define __NR_utime_portable (__NR_SYSCALL_BASE_portable+ 30)
#define __NR_access_portable (__NR_SYSCALL_BASE_portable+ 33)
#define __NR_nice_portable (__NR_SYSCALL_BASE_portable+ 34)
#define __NR_sync_portable (__NR_SYSCALL_BASE_portable+ 36)
#define __NR_kill_portable (__NR_SYSCALL_BASE_portable+ 37)
#define __NR_rename_portable (__NR_SYSCALL_BASE_portable+ 38)
#define __NR_mkdir_portable (__NR_SYSCALL_BASE_portable+ 39)
#define __NR_rmdir_portable (__NR_SYSCALL_BASE_portable+ 40)
#define __NR_dup_portable (__NR_SYSCALL_BASE_portable+ 41)
#define __NR_pipe_portable (__NR_SYSCALL_BASE_portable+ 42)
#define __NR_times_portable (__NR_SYSCALL_BASE_portable+ 43)
#define __NR_brk_portable (__NR_SYSCALL_BASE_portable+ 45)
#define __NR_setgid_portable (__NR_SYSCALL_BASE_portable+ 46)
#define __NR_getgid_portable (__NR_SYSCALL_BASE_portable+ 47)
#define __NR_geteuid_portable (__NR_SYSCALL_BASE_portable+ 49)
#define __NR_getegid_portable (__NR_SYSCALL_BASE_portable+ 50)
#define __NR_acct_portable (__NR_SYSCALL_BASE_portable+ 51)
#define __NR_umount2_portable (__NR_SYSCALL_BASE_portable+ 52)
#define __NR_ioctl_portable (__NR_SYSCALL_BASE_portable+ 54)
#define __NR_fcntl_portable (__NR_SYSCALL_BASE_portable+ 55)
#define __NR_setpgid_portable (__NR_SYSCALL_BASE_portable+ 57)
#define __NR_umask_portable (__NR_SYSCALL_BASE_portable+ 60)
#define __NR_chroot_portable (__NR_SYSCALL_BASE_portable+ 61)
#define __NR_ustat_portable (__NR_SYSCALL_BASE_portable+ 62)
#define __NR_dup2_portable (__NR_SYSCALL_BASE_portable+ 63)
#define __NR_getppid_portable (__NR_SYSCALL_BASE_portable+ 64)
#define __NR_getpgrp_portable (__NR_SYSCALL_BASE_portable+ 65)
#define __NR_setsid_portable (__NR_SYSCALL_BASE_portable+ 66)
#define __NR_sigaction_portable (__NR_SYSCALL_BASE_portable+ 67)
#define __NR_setreuid_portable (__NR_SYSCALL_BASE_portable+ 70)
#define __NR_setregid_portable (__NR_SYSCALL_BASE_portable+ 71)
#define __NR_sigsuspend_portable (__NR_SYSCALL_BASE_portable+ 72)
#define __NR_sigpending_portable (__NR_SYSCALL_BASE_portable+ 73)
#define __NR_sethostname_portable (__NR_SYSCALL_BASE_portable+ 74)
#define __NR_setrlimit_portable (__NR_SYSCALL_BASE_portable+ 75)
#define __NR_getrlimit_portable (__NR_SYSCALL_BASE_portable+ 76)
#define __NR_getrusage_portable (__NR_SYSCALL_BASE_portable+ 77)
#define __NR_gettimeofday_portable (__NR_SYSCALL_BASE_portable+ 78)
#define __NR_settimeofday_portable (__NR_SYSCALL_BASE_portable+ 79)
#define __NR_getgroups_portable (__NR_SYSCALL_BASE_portable+ 80)
#define __NR_setgroups_portable (__NR_SYSCALL_BASE_portable+ 81)
#define __NR_select_portable (__NR_SYSCALL_BASE_portable+ 82)
#define __NR_symlink_portable (__NR_SYSCALL_BASE_portable+ 83)
#define __NR_readlink_portable (__NR_SYSCALL_BASE_portable+ 85)
#define __NR_uselib_portable (__NR_SYSCALL_BASE_portable+ 86)
#define __NR_swapon_portable (__NR_SYSCALL_BASE_portable+ 87)
#define __NR_reboot_portable (__NR_SYSCALL_BASE_portable+ 88)
#define __NR_readdir_portable (__NR_SYSCALL_BASE_portable+ 89)
#define __NR_mmap_portable (__NR_SYSCALL_BASE_portable+ 90)
#define __NR_munmap_portable (__NR_SYSCALL_BASE_portable+ 91)
#define __NR_truncate_portable (__NR_SYSCALL_BASE_portable+ 92)
#define __NR_ftruncate_portable (__NR_SYSCALL_BASE_portable+ 93)
#define __NR_fchmod_portable (__NR_SYSCALL_BASE_portable+ 94)
#define __NR_fchown_portable (__NR_SYSCALL_BASE_portable+ 95)
#define __NR_getpriority_portable (__NR_SYSCALL_BASE_portable+ 96)
#define __NR_setpriority_portable (__NR_SYSCALL_BASE_portable+ 97)
#define __NR_statfs_portable (__NR_SYSCALL_BASE_portable+ 99)
#define __NR_fstatfs_portable (__NR_SYSCALL_BASE_portable+100)
#define __NR_socketcall_portable (__NR_SYSCALL_BASE_portable+102)
#define __NR_syslog_portable (__NR_SYSCALL_BASE_portable+103)
#define __NR_setitimer_portable (__NR_SYSCALL_BASE_portable+104)
#define __NR_getitimer_portable (__NR_SYSCALL_BASE_portable+105)
#define __NR_stat_portable (__NR_SYSCALL_BASE_portable+106)
#define __NR_lstat_portable (__NR_SYSCALL_BASE_portable+107)
#define __NR_fstat_portable (__NR_SYSCALL_BASE_portable+108)
#define __NR_vhangup_portable (__NR_SYSCALL_BASE_portable+111)
#define __NR_syscall_portable (__NR_SYSCALL_BASE_portable+113)
#define __NR_wait4_portable (__NR_SYSCALL_BASE_portable+114)
#define __NR_swapoff_portable (__NR_SYSCALL_BASE_portable+115)
#define __NR_sysinfo_portable (__NR_SYSCALL_BASE_portable+116)
#define __NR_ipc_portable (__NR_SYSCALL_BASE_portable+117)
#define __NR_fsync_portable (__NR_SYSCALL_BASE_portable+118)
#define __NR_sigreturn_portable (__NR_SYSCALL_BASE_portable+119)
#define __NR_clone_portable (__NR_SYSCALL_BASE_portable+120)
#define __NR_setdomainname_portable (__NR_SYSCALL_BASE_portable+121)
#define __NR_uname_portable (__NR_SYSCALL_BASE_portable+122)
#define __NR_adjtimex_portable (__NR_SYSCALL_BASE_portable+124)
#define __NR_mprotect_portable (__NR_SYSCALL_BASE_portable+125)
#define __NR_sigprocmask_portable (__NR_SYSCALL_BASE_portable+126)
#define __NR_init_module_portable (__NR_SYSCALL_BASE_portable+128)
#define __NR_delete_module_portable (__NR_SYSCALL_BASE_portable+129)
#define __NR_quotactl_portable (__NR_SYSCALL_BASE_portable+131)
#define __NR_getpgid_portable (__NR_SYSCALL_BASE_portable+132)
#define __NR_fchdir_portable (__NR_SYSCALL_BASE_portable+133)
#define __NR_bdflush_portable (__NR_SYSCALL_BASE_portable+134)
#define __NR_sysfs_portable (__NR_SYSCALL_BASE_portable+135)
#define __NR_personality_portable (__NR_SYSCALL_BASE_portable+136)
#define __NR_setfsuid_portable (__NR_SYSCALL_BASE_portable+138)
#define __NR_setfsgid_portable (__NR_SYSCALL_BASE_portable+139)
#define __NR__llseek_portable (__NR_SYSCALL_BASE_portable+140)
#define __NR_getdents_portable (__NR_SYSCALL_BASE_portable+141)
#define __NR__newselect_portable (__NR_SYSCALL_BASE_portable+142)
#define __NR_flock_portable (__NR_SYSCALL_BASE_portable+143)
#define __NR_msync_portable (__NR_SYSCALL_BASE_portable+144)
#define __NR_readv_portable (__NR_SYSCALL_BASE_portable+145)
#define __NR_writev_portable (__NR_SYSCALL_BASE_portable+146)
#define __NR_getsid_portable (__NR_SYSCALL_BASE_portable+147)
#define __NR_fdatasync_portable (__NR_SYSCALL_BASE_portable+148)
#define __NR__sysctl_portable (__NR_SYSCALL_BASE_portable+149)
#define __NR_mlock_portable (__NR_SYSCALL_BASE_portable+150)
#define __NR_munlock_portable (__NR_SYSCALL_BASE_portable+151)
#define __NR_mlockall_portable (__NR_SYSCALL_BASE_portable+152)
#define __NR_munlockall_portable (__NR_SYSCALL_BASE_portable+153)
#define __NR_sched_setparam_portable (__NR_SYSCALL_BASE_portable+154)
#define __NR_sched_getparam_portable (__NR_SYSCALL_BASE_portable+155)
#define __NR_sched_setscheduler_portable (__NR_SYSCALL_BASE_portable+156)
#define __NR_sched_getscheduler_portable (__NR_SYSCALL_BASE_portable+157)
#define __NR_sched_yield_portable (__NR_SYSCALL_BASE_portable+158)
#define __NR_sched_get_priority_max_portable (__NR_SYSCALL_BASE_portable+159)
#define __NR_sched_get_priority_min_portable (__NR_SYSCALL_BASE_portable+160)
#define __NR_sched_rr_get_interval_portable (__NR_SYSCALL_BASE_portable+161)
#define __NR_nanosleep_portable (__NR_SYSCALL_BASE_portable+162)
#define __NR_mremap_portable (__NR_SYSCALL_BASE_portable+163)
#define __NR_setresuid_portable (__NR_SYSCALL_BASE_portable+164)
#define __NR_getresuid_portable (__NR_SYSCALL_BASE_portable+165)
#define __NR_poll_portable (__NR_SYSCALL_BASE_portable+168)
#define __NR_nfsservctl_portable (__NR_SYSCALL_BASE_portable+169)
#define __NR_setresgid_portable (__NR_SYSCALL_BASE_portable+170)
#define __NR_getresgid_portable (__NR_SYSCALL_BASE_portable+171)
#define __NR_prctl_portable (__NR_SYSCALL_BASE_portable+172)
#define __NR_rt_sigreturn_portable (__NR_SYSCALL_BASE_portable+173)
#define __NR_rt_sigaction_portable (__NR_SYSCALL_BASE_portable+174)
#define __NR_rt_sigprocmask_portable (__NR_SYSCALL_BASE_portable+175)
#define __NR_rt_sigpending_portable (__NR_SYSCALL_BASE_portable+176)
#define __NR_rt_sigtimedwait_portable (__NR_SYSCALL_BASE_portable+177)
#define __NR_rt_sigqueueinfo_portable (__NR_SYSCALL_BASE_portable+178)
#define __NR_rt_sigsuspend_portable (__NR_SYSCALL_BASE_portable+179)
#define __NR_pread64_portable (__NR_SYSCALL_BASE_portable+180)
#define __NR_pwrite64_portable (__NR_SYSCALL_BASE_portable+181)
#define __NR_chown_portable (__NR_SYSCALL_BASE_portable+182)
#define __NR_getcwd_portable (__NR_SYSCALL_BASE_portable+183)
#define __NR_capget_portable (__NR_SYSCALL_BASE_portable+184)
#define __NR_capset_portable (__NR_SYSCALL_BASE_portable+185)
#define __NR_sigaltstack_portable (__NR_SYSCALL_BASE_portable+186)
#define __NR_sendfile_portable (__NR_SYSCALL_BASE_portable+187)
#define __NR_vfork_portable (__NR_SYSCALL_BASE_portable+190)
#define __NR_ugetrlimit_portable (__NR_SYSCALL_BASE_portable+191)
#define __NR_mmap2_portable (__NR_SYSCALL_BASE_portable+192)
#define __NR_truncate64_portable (__NR_SYSCALL_BASE_portable+193)
#define __NR_ftruncate64_portable (__NR_SYSCALL_BASE_portable+194)
#define __NR_stat64_portable (__NR_SYSCALL_BASE_portable+195)
#define __NR_lstat64_portable (__NR_SYSCALL_BASE_portable+196)
#define __NR_fstat64_portable (__NR_SYSCALL_BASE_portable+197)
#define __NR_lchown32_portable (__NR_SYSCALL_BASE_portable+198)
#define __NR_getuid32_portable (__NR_SYSCALL_BASE_portable+199)
#define __NR_getgid32_portable (__NR_SYSCALL_BASE_portable+200)
#define __NR_geteuid32_portable (__NR_SYSCALL_BASE_portable+201)
#define __NR_getegid32_portable (__NR_SYSCALL_BASE_portable+202)
#define __NR_setreuid32_portable (__NR_SYSCALL_BASE_portable+203)
#define __NR_setregid32_portable (__NR_SYSCALL_BASE_portable+204)
#define __NR_getgroups32_portable (__NR_SYSCALL_BASE_portable+205)
#define __NR_setgroups32_portable (__NR_SYSCALL_BASE_portable+206)
#define __NR_fchown32_portable (__NR_SYSCALL_BASE_portable+207)
#define __NR_setresuid32_portable (__NR_SYSCALL_BASE_portable+208)
#define __NR_getresuid32_portable (__NR_SYSCALL_BASE_portable+209)
#define __NR_setresgid32_portable (__NR_SYSCALL_BASE_portable+210)
#define __NR_getresgid32_portable (__NR_SYSCALL_BASE_portable+211)
#define __NR_chown32_portable (__NR_SYSCALL_BASE_portable+212)
#define __NR_setuid32_portable (__NR_SYSCALL_BASE_portable+213)
#define __NR_setgid32_portable (__NR_SYSCALL_BASE_portable+214)
#define __NR_setfsuid32_portable (__NR_SYSCALL_BASE_portable+215)
#define __NR_setfsgid32_portable (__NR_SYSCALL_BASE_portable+216)
#define __NR_getdents64_portable (__NR_SYSCALL_BASE_portable+217)
#define __NR_pivot_root_portable (__NR_SYSCALL_BASE_portable+218)
#define __NR_mincore_portable (__NR_SYSCALL_BASE_portable+219)
#define __NR_madvise_portable (__NR_SYSCALL_BASE_portable+220)
#define __NR_fcntl64_portable (__NR_SYSCALL_BASE_portable+221)
#define __NR_gettid_portable (__NR_SYSCALL_BASE_portable+224)
#define __NR_readahead_portable (__NR_SYSCALL_BASE_portable+225)
#define __NR_setxattr_portable (__NR_SYSCALL_BASE_portable+226)
#define __NR_lsetxattr_portable (__NR_SYSCALL_BASE_portable+227)
#define __NR_fsetxattr_portable (__NR_SYSCALL_BASE_portable+228)
#define __NR_getxattr_portable (__NR_SYSCALL_BASE_portable+229)
#define __NR_lgetxattr_portable (__NR_SYSCALL_BASE_portable+230)
#define __NR_fgetxattr_portable (__NR_SYSCALL_BASE_portable+231)
#define __NR_listxattr_portable (__NR_SYSCALL_BASE_portable+232)
#define __NR_llistxattr_portable (__NR_SYSCALL_BASE_portable+233)
#define __NR_flistxattr_portable (__NR_SYSCALL_BASE_portable+234)
#define __NR_removexattr_portable (__NR_SYSCALL_BASE_portable+235)
#define __NR_lremovexattr_portable (__NR_SYSCALL_BASE_portable+236)
#define __NR_fremovexattr_portable (__NR_SYSCALL_BASE_portable+237)
#define __NR_tkill_portable (__NR_SYSCALL_BASE_portable+238)
#define __NR_sendfile64_portable (__NR_SYSCALL_BASE_portable+239)
#define __NR_futex_portable (__NR_SYSCALL_BASE_portable+240)
#define __NR_sched_setaffinity_portable (__NR_SYSCALL_BASE_portable+241)
#define __NR_sched_getaffinity_portable (__NR_SYSCALL_BASE_portable+242)
#define __NR_io_setup_portable (__NR_SYSCALL_BASE_portable+243)
#define __NR_io_destroy_portable (__NR_SYSCALL_BASE_portable+244)
#define __NR_io_getevents_portable (__NR_SYSCALL_BASE_portable+245)
#define __NR_io_submit_portable (__NR_SYSCALL_BASE_portable+246)
#define __NR_io_cancel_portable (__NR_SYSCALL_BASE_portable+247)
#define __NR_exit_group_portable (__NR_SYSCALL_BASE_portable+248)
#define __NR_lookup_dcookie_portable (__NR_SYSCALL_BASE_portable+249)
#define __NR_epoll_create_portable (__NR_SYSCALL_BASE_portable+250)
#define __NR_epoll_ctl_portable (__NR_SYSCALL_BASE_portable+251)
#define __NR_epoll_wait_portable (__NR_SYSCALL_BASE_portable+252)
#define __NR_remap_file_pages_portable (__NR_SYSCALL_BASE_portable+253)
#define __NR_set_tid_address_portable (__NR_SYSCALL_BASE_portable+256)
#define __NR_timer_create_portable (__NR_SYSCALL_BASE_portable+257)
#define __NR_timer_settime_portable (__NR_SYSCALL_BASE_portable+258)
#define __NR_timer_gettime_portable (__NR_SYSCALL_BASE_portable+259)
#define __NR_timer_getoverrun_portable (__NR_SYSCALL_BASE_portable+260)
#define __NR_timer_delete_portable (__NR_SYSCALL_BASE_portable+261)
#define __NR_clock_settime_portable (__NR_SYSCALL_BASE_portable+262)
#define __NR_clock_gettime_portable (__NR_SYSCALL_BASE_portable+263)
#define __NR_clock_getres_portable (__NR_SYSCALL_BASE_portable+264)
#define __NR_clock_nanosleep_portable (__NR_SYSCALL_BASE_portable+265)
#define __NR_statfs64_portable (__NR_SYSCALL_BASE_portable+266)
#define __NR_fstatfs64_portable (__NR_SYSCALL_BASE_portable+267)
#define __NR_tgkill_portable (__NR_SYSCALL_BASE_portable+268)
#define __NR_utimes_portable (__NR_SYSCALL_BASE_portable+269)
#define __NR_arm_fadvise64_64_portable (__NR_SYSCALL_BASE_portable+270)
#define __NR_pciconfig_iobase_portable (__NR_SYSCALL_BASE_portable+271)
#define __NR_pciconfig_read_portable (__NR_SYSCALL_BASE_portable+272)
#define __NR_pciconfig_write_portable (__NR_SYSCALL_BASE_portable+273)
#define __NR_mq_open_portable (__NR_SYSCALL_BASE_portable+274)
#define __NR_mq_unlink_portable (__NR_SYSCALL_BASE_portable+275)
#define __NR_mq_timedsend_portable (__NR_SYSCALL_BASE_portable+276)
#define __NR_mq_timedreceive_portable (__NR_SYSCALL_BASE_portable+277)
#define __NR_mq_notify_portable (__NR_SYSCALL_BASE_portable+278)
#define __NR_mq_getsetattr_portable (__NR_SYSCALL_BASE_portable+279)
#define __NR_waitid_portable (__NR_SYSCALL_BASE_portable+280)
#define __NR_socket_portable (__NR_SYSCALL_BASE_portable+281)
#define __NR_bind_portable (__NR_SYSCALL_BASE_portable+282)
#define __NR_connect_portable (__NR_SYSCALL_BASE_portable+283)
#define __NR_listen_portable (__NR_SYSCALL_BASE_portable+284)
#define __NR_accept_portable (__NR_SYSCALL_BASE_portable+285)
#define __NR_getsockname_portable (__NR_SYSCALL_BASE_portable+286)
#define __NR_getpeername_portable (__NR_SYSCALL_BASE_portable+287)
#define __NR_socketpair_portable (__NR_SYSCALL_BASE_portable+288)
#define __NR_send_portable (__NR_SYSCALL_BASE_portable+289)
#define __NR_sendto_portable (__NR_SYSCALL_BASE_portable+290)
#define __NR_recv_portable (__NR_SYSCALL_BASE_portable+291)
#define __NR_recvfrom_portable (__NR_SYSCALL_BASE_portable+292)
#define __NR_shutdown_portable (__NR_SYSCALL_BASE_portable+293)
#define __NR_setsockopt_portable (__NR_SYSCALL_BASE_portable+294)
#define __NR_getsockopt_portable (__NR_SYSCALL_BASE_portable+295)
#define __NR_sendmsg_portable (__NR_SYSCALL_BASE_portable+296)
#define __NR_recvmsg_portable (__NR_SYSCALL_BASE_portable+297)
#define __NR_semop_portable (__NR_SYSCALL_BASE_portable+298)
#define __NR_semget_portable (__NR_SYSCALL_BASE_portable+299)
#define __NR_semctl_portable (__NR_SYSCALL_BASE_portable+300)
#define __NR_msgsnd_portable (__NR_SYSCALL_BASE_portable+301)
#define __NR_msgrcv_portable (__NR_SYSCALL_BASE_portable+302)
#define __NR_msgget_portable (__NR_SYSCALL_BASE_portable+303)
#define __NR_msgctl_portable (__NR_SYSCALL_BASE_portable+304)
#define __NR_shmat_portable (__NR_SYSCALL_BASE_portable+305)
#define __NR_shmdt_portable (__NR_SYSCALL_BASE_portable+306)
#define __NR_shmget_portable (__NR_SYSCALL_BASE_portable+307)
#define __NR_shmctl_portable (__NR_SYSCALL_BASE_portable+308)
#define __NR_add_key_portable (__NR_SYSCALL_BASE_portable+309)
#define __NR_request_key_portable (__NR_SYSCALL_BASE_portable+310)
#define __NR_keyctl_portable (__NR_SYSCALL_BASE_portable+311)
#define __NR_semtimedop_portable (__NR_SYSCALL_BASE_portable+312)
#define __NR_vserver_portable (__NR_SYSCALL_BASE_portable+313)
#define __NR_ioprio_set_portable (__NR_SYSCALL_BASE_portable+314)
#define __NR_ioprio_get_portable (__NR_SYSCALL_BASE_portable+315)
#define __NR_inotify_init_portable (__NR_SYSCALL_BASE_portable+316)
#define __NR_inotify_add_watch_portable (__NR_SYSCALL_BASE_portable+317)
#define __NR_inotify_rm_watch_portable (__NR_SYSCALL_BASE_portable+318)
#define __NR_mbind_portable (__NR_SYSCALL_BASE_portable+319)
#define __NR_get_mempolicy_portable (__NR_SYSCALL_BASE_portable+320)
#define __NR_set_mempolicy_portable (__NR_SYSCALL_BASE_portable+321)
#define __NR_openat_portable (__NR_SYSCALL_BASE_portable+322)
#define __NR_mkdirat_portable (__NR_SYSCALL_BASE_portable+323)
#define __NR_mknodat_portable (__NR_SYSCALL_BASE_portable+324)
#define __NR_fchownat_portable (__NR_SYSCALL_BASE_portable+325)
#define __NR_futimesat_portable (__NR_SYSCALL_BASE_portable+326)
#define __NR_fstatat64_portable (__NR_SYSCALL_BASE_portable+327)
#define __NR_unlinkat_portable (__NR_SYSCALL_BASE_portable+328)
#define __NR_renameat_portable (__NR_SYSCALL_BASE_portable+329)
#define __NR_linkat_portable (__NR_SYSCALL_BASE_portable+330)
#define __NR_symlinkat_portable (__NR_SYSCALL_BASE_portable+331)
#define __NR_readlinkat_portable (__NR_SYSCALL_BASE_portable+332)
#define __NR_fchmodat_portable (__NR_SYSCALL_BASE_portable+333)
#define __NR_faccessat_portable (__NR_SYSCALL_BASE_portable+334)
#define __NR_pselect6_portable (__NR_SYSCALL_BASE_portable+335)
#define __NR_ppoll_portable (__NR_SYSCALL_BASE_portable+336)
#define __NR_unshare_portable (__NR_SYSCALL_BASE_portable+337)
#define __NR_set_robust_list_portable (__NR_SYSCALL_BASE_portable+338)
#define __NR_get_robust_list_portable (__NR_SYSCALL_BASE_portable+339)
#define __NR_splice_portable (__NR_SYSCALL_BASE_portable+340)
#define __NR_arm_sync_file_range_portable (__NR_SYSCALL_BASE_portable+341)
#define __NR_tee_portable (__NR_SYSCALL_BASE_portable+342)
#define __NR_vmsplice_portable (__NR_SYSCALL_BASE_portable+343)
#define __NR_move_pages_portable (__NR_SYSCALL_BASE_portable+344)
#define __NR_getcpu_portable (__NR_SYSCALL_BASE_portable+345)
#define __NR_epoll_pwait_portable (__NR_SYSCALL_BASE_portable+346)
#define __NR_kexec_load_portable (__NR_SYSCALL_BASE_portable+347)
#define __NR_utimensat_portable (__NR_SYSCALL_BASE_portable+348)
#define __NR_signalfd_portable (__NR_SYSCALL_BASE_portable+349)
#define __NR_timerfd_create_portable (__NR_SYSCALL_BASE_portable+350)
#define __NR_eventfd_portable (__NR_SYSCALL_BASE_portable+351)
#define __NR_fallocate_portable (__NR_SYSCALL_BASE_portable+352)
#define __NR_timerfd_settime_portable (__NR_SYSCALL_BASE_portable+353)
#define __NR_timerfd_gettime_portable (__NR_SYSCALL_BASE_portable+354)
#define __NR_signalfd4_portable (__NR_SYSCALL_BASE_portable+355)
#define __NR_eventfd2_portable (__NR_SYSCALL_BASE_portable+356)
#define __NR_epoll_create1_portable (__NR_SYSCALL_BASE_portable+357)
#define __NR_dup3_portable (__NR_SYSCALL_BASE_portable+358)
#define __NR_pipe2_portable (__NR_SYSCALL_BASE_portable+359)
#define __NR_inotify_init1_portable (__NR_SYSCALL_BASE_portable+360)
#define __NR_preadv_portable (__NR_SYSCALL_BASE_portable+361)
#define __NR_pwritev_portable (__NR_SYSCALL_BASE_portable+362)
#define __NR_rt_tgsigqueueinfo_portable (__NR_SYSCALL_BASE_portable+363)
#define __NR_perf_event_open_portable (__NR_SYSCALL_BASE_portable+364)
#define __NR_recvmmsg_portable (__NR_SYSCALL_BASE_portable+365)
#define __NR_accept4_portable (__NR_SYSCALL_BASE_portable+366)
#define __NR_fanotify_init_portable (__NR_SYSCALL_BASE_portable+367)
#define __NR_fanotify_mark_portable (__NR_SYSCALL_BASE_portable+368)
#define __NR_prlimit64_portable (__NR_SYSCALL_BASE_portable+369)
#define __NR_name_to_handle_at_portable (__NR_SYSCALL_BASE_portable+370)
#define __NR_open_by_handle_at_portable (__NR_SYSCALL_BASE_portable+371)
#define __NR_clock_adjtime_portable (__NR_SYSCALL_BASE_portable+372)
#define __NR_syncfs_portable (__NR_SYSCALL_BASE_portable+373)
#define __NR_sendmmsg_portable (__NR_SYSCALL_BASE_portable+374)
#define __NR_setns_portable (__NR_SYSCALL_BASE_portable+375)
#define __NR_process_vm_readv_portable (__NR_SYSCALL_BASE_portable+376)
#define __NR_process_vm_writev_portable (__NR_SYSCALL_BASE_portable+377)
#define __ARM_NR_BASE_portable (__NR_SYSCALL_BASE_portable+0x0f0000)
#define __ARM_NR_breakpoint_portable (__ARM_NR_BASE_portable+1)
#define __ARM_NR_cacheflush_portable (__ARM_NR_BASE_portable+2)
#define __ARM_NR_usr26_portable (__ARM_NR_BASE_portable+3)
#define __ARM_NR_usr32_portable (__ARM_NR_BASE_portable+4)
#define __ARM_NR_set_tls_portable (__ARM_NR_BASE_portable+5)
/* Apparently these are not callable using syscall on ARM... */
#undef __NR_time_portable
#undef __NR_umount_portable
#undef __NR_stime_portable
#undef __NR_alarm_portable
#undef __NR_utime_portable
#undef __NR_getrlimit_portable
#undef __NR_select_portable
#undef __NR_readdir_portable
#undef __NR_mmap_portable
#undef __NR_socketcall_portable
#undef __NR_syscall_portable
#undef __NR_ipc_portable
#endif

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012, The Android Open Source Project
* Copyright 2014, 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.
@@ -17,17 +17,49 @@
#ifndef _EPOLL_PORTABLE_H_
#define _EPOLL_PORTABLE_H_
/*
* GDK's compiler generates paddings to guarantee 8-byte alignment on
* struct and 64bit POD types. If compilers on your platform have no such
* alignment rule, please use the following struct and convert it into your
* native struct form.
*/
#include <portability.h>
#include <signal.h>
#include <stdint.h>
#include <sys/epoll.h>
struct epoll_event_portable
{
unsigned int events;
unsigned char __padding[4];
uint32_t events;
uint8_t __padding[4];
epoll_data_t data;
};
int WRAP(epoll_ctl)(int epfd, int op, int fd, struct epoll_event_portable *event)
{
struct epoll_event machine_epoll_event;
machine_epoll_event.events = event->events;
machine_epoll_event.data = event->data;
return REAL(epoll_ctl)(epfd, op, fd, &machine_epoll_event);
}
int WRAP(epoll_wait)(int epfd, struct epoll_event_portable *events, int max, int timeout)
{
struct epoll_event machine_epoll_event;
int ret = REAL(epoll_wait)(epfd, &machine_epoll_event, max, timeout);
events->events = machine_epoll_event.events;
events->data = machine_epoll_event.data;
return ret;
}
int WRAP(epoll_pwait)(int fd, struct epoll_event_portable* events, int max_events, int timeout, const sigset_t* ss)
{
struct epoll_event machine_epoll_event;
int ret = REAL(epoll_pwait)(fd, &machine_epoll_event, max_events, timeout, ss);
events->events = machine_epoll_event.events;
events->data = machine_epoll_event.data;
return ret;
}
#endif /* _EPOLL_PORTABLE_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012, The Android Open Source Project
* Copyright 2014, 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.
@@ -18,13 +18,10 @@
#define _ERRNO_PORTABLE_H_
#include <portability.h>
#include <errno.h>
#include <pthread.h>
#include <string.h>
/*
* Derived from development/ndk/platforms/android-3/include/asm-generic/errno.h
* NOTE:
* Base errno #defines from 1...35 are ARCH independent and not defined;
* they are defined in ./asm-generic/errno-base.h
*/
#define EDEADLK_PORTABLE 35
#define ENAMETOOLONG_PORTABLE 36
#define ENOLCK_PORTABLE 37
@@ -126,10 +123,350 @@
#define EOWNERDEAD_PORTABLE 130
#define ENOTRECOVERABLE_PORTABLE 131
#define ERFKILL_PORTABLE 132
#define EHWPOISON_PORTABLE 133
extern __hidden int errno_ntop(int native_errno);
extern __hidden int errno_pton(int native_errno);
extern volatile int* REAL(__errno)();
extern volatile int* REAL(__errno)(void);
static int errno_ntop(int native_errno)
{
switch (native_errno) {
case ENAMETOOLONG: return ENAMETOOLONG_PORTABLE;
case ENOLCK: return ENOLCK_PORTABLE;
case ENOSYS: return ENOSYS_PORTABLE;
case ENOTEMPTY: return ENOTEMPTY_PORTABLE;
case ELOOP: return ELOOP_PORTABLE;
case EWOULDBLOCK: return EWOULDBLOCK_PORTABLE;
case ENOMSG: return ENOMSG_PORTABLE;
case EIDRM: return EIDRM_PORTABLE;
case ECHRNG: return ECHRNG_PORTABLE;
case EL2NSYNC: return EL2NSYNC_PORTABLE;
case EL3HLT: return EL3HLT_PORTABLE;
case EL3RST: return EL3RST_PORTABLE;
case ELNRNG: return ELNRNG_PORTABLE;
case EUNATCH: return EUNATCH_PORTABLE;
case ENOCSI: return ENOCSI_PORTABLE;
case EL2HLT: return EL2HLT_PORTABLE;
case EBADE: return EBADE_PORTABLE;
case EBADR: return EBADR_PORTABLE;
case EXFULL: return EXFULL_PORTABLE;
case ENOANO: return ENOANO_PORTABLE;
case EBADRQC: return EBADRQC_PORTABLE;
case EBADSLT: return EBADSLT_PORTABLE;
case EDEADLOCK: return EDEADLOCK_PORTABLE;
case EBFONT: return EBFONT_PORTABLE;
case ENOSTR: return ENOSTR_PORTABLE;
case ENODATA: return ENODATA_PORTABLE;
case ETIME: return ETIME_PORTABLE;
case ENOSR: return ENOSR_PORTABLE;
case ENONET: return ENONET_PORTABLE;
case ENOPKG: return ENOPKG_PORTABLE;
case EREMOTE: return EREMOTE_PORTABLE;
case ENOLINK: return ENOLINK_PORTABLE;
case EADV: return EADV_PORTABLE;
case ESRMNT: return ESRMNT_PORTABLE;
case ECOMM: return ECOMM_PORTABLE;
case EPROTO: return EPROTO_PORTABLE;
case EMULTIHOP: return EMULTIHOP_PORTABLE;
case EDOTDOT: return EDOTDOT_PORTABLE;
case EBADMSG: return EBADMSG_PORTABLE;
case EOVERFLOW: return EOVERFLOW_PORTABLE;
case ENOTUNIQ: return ENOTUNIQ_PORTABLE;
case EBADFD: return EBADFD_PORTABLE;
case EREMCHG: return EREMCHG_PORTABLE;
case ELIBACC: return ELIBACC_PORTABLE;
case ELIBBAD: return ELIBBAD_PORTABLE;
case ELIBSCN: return ELIBSCN_PORTABLE;
case ELIBMAX: return ELIBMAX_PORTABLE;
case ELIBEXEC: return ELIBEXEC_PORTABLE;
case EILSEQ: return EILSEQ_PORTABLE;
case ERESTART: return ERESTART_PORTABLE;
case ESTRPIPE: return ESTRPIPE_PORTABLE;
case EUSERS: return EUSERS_PORTABLE;
case ENOTSOCK: return ENOTSOCK_PORTABLE;
case EDESTADDRREQ: return EDESTADDRREQ_PORTABLE;
case EMSGSIZE: return EMSGSIZE_PORTABLE;
case EPROTOTYPE: return EPROTOTYPE_PORTABLE;
case ENOPROTOOPT: return ENOPROTOOPT_PORTABLE;
case EPROTONOSUPPORT: return EPROTONOSUPPORT_PORTABLE;
case ESOCKTNOSUPPORT: return ESOCKTNOSUPPORT_PORTABLE;
case EOPNOTSUPP: return EOPNOTSUPP_PORTABLE;
case EPFNOSUPPORT: return EPFNOSUPPORT_PORTABLE;
case EAFNOSUPPORT: return EAFNOSUPPORT_PORTABLE;
case EADDRINUSE: return EADDRINUSE_PORTABLE;
case EADDRNOTAVAIL: return EADDRNOTAVAIL_PORTABLE;
case ENETDOWN: return ENETDOWN_PORTABLE;
case ENETUNREACH: return ENETUNREACH_PORTABLE;
case ENETRESET: return ENETRESET_PORTABLE;
case ECONNABORTED: return ECONNABORTED_PORTABLE;
case ECONNRESET: return ECONNRESET_PORTABLE;
case ENOBUFS: return ENOBUFS_PORTABLE;
case EISCONN: return EISCONN_PORTABLE;
case ENOTCONN: return ENOTCONN_PORTABLE;
case ESHUTDOWN: return ESHUTDOWN_PORTABLE;
case ETOOMANYREFS: return ETOOMANYREFS_PORTABLE;
case ETIMEDOUT: return ETIMEDOUT_PORTABLE;
case ECONNREFUSED: return ECONNREFUSED_PORTABLE;
case EHOSTDOWN: return EHOSTDOWN_PORTABLE;
case EHOSTUNREACH: return EHOSTUNREACH_PORTABLE;
case EALREADY: return EALREADY_PORTABLE;
case EINPROGRESS: return EINPROGRESS_PORTABLE;
case ESTALE: return ESTALE_PORTABLE;
case EUCLEAN: return EUCLEAN_PORTABLE;
case ENOTNAM: return ENOTNAM_PORTABLE;
case ENAVAIL: return ENAVAIL_PORTABLE;
case EISNAM: return EISNAM_PORTABLE;
case EREMOTEIO: return EREMOTEIO_PORTABLE;
case EDQUOT: return EDQUOT_PORTABLE;
case ENOMEDIUM: return ENOMEDIUM_PORTABLE;
case EMEDIUMTYPE: return EMEDIUMTYPE_PORTABLE;
case ECANCELED: return ECANCELED_PORTABLE;
case ENOKEY: return ENOKEY_PORTABLE;
case EKEYEXPIRED: return EKEYEXPIRED_PORTABLE;
case EKEYREVOKED: return EKEYREVOKED_PORTABLE;
case EKEYREJECTED: return EKEYREJECTED_PORTABLE;
case EOWNERDEAD: return EOWNERDEAD_PORTABLE;
case ENOTRECOVERABLE: return ENOTRECOVERABLE_PORTABLE;
}
return native_errno;
}
static int errno_pton(int portable_errno)
{
switch (portable_errno) {
case ENAMETOOLONG_PORTABLE: return ENAMETOOLONG;
case ENOLCK_PORTABLE: return ENOLCK;
case ENOSYS_PORTABLE: return ENOSYS;
case ENOTEMPTY_PORTABLE: return ENOTEMPTY;
case ELOOP_PORTABLE: return ELOOP;
case EWOULDBLOCK_PORTABLE: return EWOULDBLOCK;
case ENOMSG_PORTABLE: return ENOMSG;
case EIDRM_PORTABLE: return EIDRM;
case ECHRNG_PORTABLE: return ECHRNG;
case EL2NSYNC_PORTABLE: return EL2NSYNC;
case EL3HLT_PORTABLE: return EL3HLT;
case EL3RST_PORTABLE: return EL3RST;
case ELNRNG_PORTABLE: return ELNRNG;
case EUNATCH_PORTABLE: return EUNATCH;
case ENOCSI_PORTABLE: return ENOCSI;
case EL2HLT_PORTABLE: return EL2HLT;
case EBADE_PORTABLE: return EBADE;
case EBADR_PORTABLE: return EBADR;
case EXFULL_PORTABLE: return EXFULL;
case ENOANO_PORTABLE: return ENOANO;
case EBADRQC_PORTABLE: return EBADRQC;
case EBADSLT_PORTABLE: return EBADSLT;
case EDEADLOCK_PORTABLE: return EDEADLOCK;
case EBFONT_PORTABLE: return EBFONT;
case ENOSTR_PORTABLE: return ENOSTR;
case ENODATA_PORTABLE: return ENODATA;
case ETIME_PORTABLE: return ETIME;
case ENOSR_PORTABLE: return ENOSR;
case ENONET_PORTABLE: return ENONET;
case ENOPKG_PORTABLE: return ENOPKG;
case EREMOTE_PORTABLE: return EREMOTE;
case ENOLINK_PORTABLE: return ENOLINK;
case EADV_PORTABLE: return EADV;
case ESRMNT_PORTABLE: return ESRMNT;
case ECOMM_PORTABLE: return ECOMM;
case EPROTO_PORTABLE: return EPROTO;
case EMULTIHOP_PORTABLE: return EMULTIHOP;
case EDOTDOT_PORTABLE: return EDOTDOT;
case EBADMSG_PORTABLE: return EBADMSG;
case EOVERFLOW_PORTABLE: return EOVERFLOW;
case ENOTUNIQ_PORTABLE: return ENOTUNIQ;
case EBADFD_PORTABLE: return EBADFD;
case EREMCHG_PORTABLE: return EREMCHG;
case ELIBACC_PORTABLE: return ELIBACC;
case ELIBBAD_PORTABLE: return ELIBBAD;
case ELIBSCN_PORTABLE: return ELIBSCN;
case ELIBMAX_PORTABLE: return ELIBMAX;
case ELIBEXEC_PORTABLE: return ELIBEXEC;
case EILSEQ_PORTABLE: return EILSEQ;
case ERESTART_PORTABLE: return ERESTART;
case ESTRPIPE_PORTABLE: return ESTRPIPE;
case EUSERS_PORTABLE: return EUSERS;
case ENOTSOCK_PORTABLE: return ENOTSOCK;
case EDESTADDRREQ_PORTABLE: return EDESTADDRREQ;
case EMSGSIZE_PORTABLE: return EMSGSIZE;
case EPROTOTYPE_PORTABLE: return EPROTOTYPE;
case ENOPROTOOPT_PORTABLE: return ENOPROTOOPT;
case EPROTONOSUPPORT_PORTABLE: return EPROTONOSUPPORT;
case ESOCKTNOSUPPORT_PORTABLE: return ESOCKTNOSUPPORT;
case EOPNOTSUPP_PORTABLE: return EOPNOTSUPP;
case EPFNOSUPPORT_PORTABLE: return EPFNOSUPPORT;
case EAFNOSUPPORT_PORTABLE: return EAFNOSUPPORT;
case EADDRINUSE_PORTABLE: return EADDRINUSE;
case EADDRNOTAVAIL_PORTABLE: return EADDRNOTAVAIL;
case ENETDOWN_PORTABLE: return ENETDOWN;
case ENETUNREACH_PORTABLE: return ENETUNREACH;
case ENETRESET_PORTABLE: return ENETRESET;
case ECONNABORTED_PORTABLE: return ECONNABORTED;
case ECONNRESET_PORTABLE: return ECONNRESET;
case ENOBUFS_PORTABLE: return ENOBUFS;
case EISCONN_PORTABLE: return EISCONN;
case ENOTCONN_PORTABLE: return ENOTCONN;
case ESHUTDOWN_PORTABLE: return ESHUTDOWN;
case ETOOMANYREFS_PORTABLE: return ETOOMANYREFS;
case ETIMEDOUT_PORTABLE: return ETIMEDOUT;
case ECONNREFUSED_PORTABLE: return ECONNREFUSED;
case EHOSTDOWN_PORTABLE: return EHOSTDOWN;
case EHOSTUNREACH_PORTABLE: return EHOSTUNREACH;
case EALREADY_PORTABLE: return EALREADY;
case EINPROGRESS_PORTABLE: return EINPROGRESS;
case ESTALE_PORTABLE: return ESTALE;
case EUCLEAN_PORTABLE: return EUCLEAN;
case ENOTNAM_PORTABLE: return ENOTNAM;
case ENAVAIL_PORTABLE: return ENAVAIL;
case EISNAM_PORTABLE: return EISNAM;
case EREMOTEIO_PORTABLE: return EREMOTEIO;
case EDQUOT_PORTABLE: return EDQUOT;
case ENOMEDIUM_PORTABLE: return ENOMEDIUM;
case EMEDIUMTYPE_PORTABLE: return EMEDIUMTYPE;
case ECANCELED_PORTABLE: return ECANCELED;
case ENOKEY_PORTABLE: return ENOKEY;
case EKEYEXPIRED_PORTABLE: return EKEYEXPIRED;
case EKEYREVOKED_PORTABLE: return EKEYREVOKED;
case EKEYREJECTED_PORTABLE: return EKEYREJECTED;
case EOWNERDEAD_PORTABLE: return EOWNERDEAD;
case ENOTRECOVERABLE_PORTABLE: return ENOTRECOVERABLE;
}
return portable_errno;
}
/* Key for the thread-specific portable errno */
static pthread_key_t errno_key;
/* Once-only initialisation of the key */
static pthread_once_t errno_key_once = PTHREAD_ONCE_INIT;
/* Free the thread-specific portable errno */
static void errno_key_destroy(void *buf)
{
if (buf)
free(buf);
}
/* Allocate the key */
static void errno_key_create(void)
{
pthread_key_create(&errno_key, errno_key_destroy);
}
struct errno_state {
int pshadow; /* copy of last portable errno */
int perrno; /* portable errno that may be modified by app */
};
/* Return the thread-specific portable errno */
static struct errno_state *errno_key_data(void)
{
struct errno_state *data;
static struct errno_state errno_state;
pthread_once(&errno_key_once, errno_key_create);
data = (struct errno_state *)pthread_getspecific(errno_key);
if (data == NULL) {
data = malloc(sizeof(struct errno_state));
pthread_setspecific(errno_key, data);
}
if (data == NULL)
data = &errno_state;
return data;
}
/*
* Attempt to return a thread specific location containnig the portable errno.
* This can be assigned to without affecting the native errno. If the key
* allocation fails fall back to using the native errno location.
*/
volatile int* WRAP(__errno)()
{
struct errno_state *p;
int save_errno;
/* pthread_* calls may modify errno so use a copy */
save_errno = *REAL(__errno)();
p = errno_key_data();
ALOGV(" ");
ALOGV("%s(): { save_errno = errno:%d, (p:%p)->{pshadow:%d, perrno:%d}", __func__,
save_errno, p, p->pshadow, p->perrno);
if (save_errno == 0 && p->pshadow != p->perrno) {
/*
* portable errno has changed but native hasn't
* - copy portable error back to native
*/
p->pshadow = p->perrno;
save_errno = errno_pton(p->perrno);
}
else if (save_errno != 0 && p->pshadow == p->perrno) {
/*
* Native errno has changed but portable hasn't
* - copy native error to portable.
*/
p->pshadow = p->perrno = errno_ntop(save_errno);
save_errno = 0;
}
else if (save_errno != 0 && p->pshadow != p->perrno) {
/*
* Both native and portable errno values have changed
* so give priority to native errno
* - copy native error to portable
*/
p->pshadow = p->perrno = errno_ntop(save_errno);
save_errno = 0;
}
ALOGV("%s: new save_errno:%d p:%p->{pshadow:%d, perrno:%d}", __func__,
save_errno, p, p->pshadow, p->perrno);
*REAL(__errno)() = save_errno;
ALOGV("%s: return (&p->perrno):%p; }", __func__, &p->perrno);
/* return pointer to the modifiable portable errno value */
return &p->perrno;
}
/* set portable errno */
void WRAP(__set_errno)(int portable_errno)
{
struct errno_state *p;
int save_errno;
/* pthread_* calls may modify errno so use a copy */
save_errno = *REAL(__errno)();
p = errno_key_data();
ALOGV("%s(): { save_errno = errno:%d, p:%p->{pshadow:%d, perrno:%d}", __func__,
save_errno, p, p->pshadow, p->perrno);
p->pshadow = p->perrno = portable_errno;
save_errno = errno_pton(portable_errno);
ALOGV("%s: new save_errno:%d, p:%p->{pshadow:%d, perrno:%d}", __func__,
save_errno, p, p->pshadow, p->perrno);
*REAL(__errno)() = save_errno;
ALOGV("%s: return; }", __func__);
}
extern char* REAL(strerror)(int);
char *WRAP(strerror)(int errnum)
{
return REAL(strerror)(errno_p2on(errnum));
}
/* BSD style strerror_r */
int WRAP(strerror_r)(int errnum, char *buf, size_t buflen)
{
return REAL(strerror_r)(errno_pton(errnum), buf, buflen);
}
#endif /* _ERRNO_PORTABLE_H */

View File

@@ -1,63 +0,0 @@
/*
* Derived from bionic/libc/include/sys/eventfd.h
*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_EVENTFD_PORTABLE_H
#define _SYS_EVENTFD_PORTABLE_H
#include <portability.h>
#include <sys/cdefs.h>
#include <fcntl_portable.h>
__BEGIN_DECLS
/*
* EFD_SEMAPHORE is defined in recent linux kernels;
* but isn't mentioned elsewhere. See linux 3.4
* include/linux/eventfd.h for example.
*/
#define EFD_SEMAPHORE (1 << 0)
#define EFD_SEMAPHORE_PORTABLE EFD_SEMAPHORE
#define EFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
#define EFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
/* type of event counter */
typedef uint64_t eventfd_portable_t;
extern int WRAP(eventfd)(unsigned int initval, int flags);
#if 0
/* Compatibility with GLibc; libportable versions don't appear to be necessary */
extern int eventfd_read(int fd, eventfd_t *counter);
extern int eventfd_write(int fd, const eventfd_t counter);
#endif
__END_DECLS
#endif /* _SYS_EVENTFD_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012, The Android Open Source Project
* Copyright 2014, 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.
@@ -16,150 +16,71 @@
#ifndef _FCNTL_PORTABLE_H_
#define _FCNTL_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/fcntl.h */
/* NB x86 does not have these and only uses the generic definitions. */
#define O_DIRECTORY_PORTABLE 040000
#define O_NOFOLLOW_PORTABLE 0100000
#define O_DIRECT_PORTABLE 0200000
#define O_LARGEFILE_PORTABLE 0400000
/* Derived from development/ndk/platforms/android-3/include/asm-generic/fcntl.h */
#define O_ACCMODE_PORTABLE 00000003
#define O_RDONLY_PORTABLE 00000000
#define O_WRONLY_PORTABLE 00000001
#define O_RDWR_PORTABLE 00000002
#ifndef O_CREAT_PORTABLE
#define O_CREAT_PORTABLE 00000100
#endif
#ifndef O_EXCL_PORTABLE
#define O_EXCL_PORTABLE 00000200
#endif
#ifndef O_NOCTTY_PORTABLE
#define O_NOCTTY_PORTABLE 00000400
#endif
#ifndef O_TRUNC_PORTABLE
#define O_TRUNC_PORTABLE 00001000
#endif
#ifndef O_APPEND_PORTABLE
#define O_APPEND_PORTABLE 00002000
#endif
#ifndef O_NONBLOCK_PORTABLE
#define O_NONBLOCK_PORTABLE 00004000
#endif
#ifndef O_SYNC_PORTABLE
#define O_SYNC_PORTABLE 00010000
#endif
#ifndef FASYNC_PORTABLE
#define FASYNC_PORTABLE 00020000
#endif
#ifndef O_DIRECT_PORTABLE
#define O_DIRECT_PORTABLE 00040000
#endif
#ifndef O_LARGEFILE_PORTABLE
#define O_LARGEFILE_PORTABLE 00100000
#endif
#ifndef O_DIRECTORY_PORTABLE
#define O_DIRECTORY_PORTABLE 00200000
#endif
#ifndef O_NOFOLLOW_PORTABLE
#define O_NOFOLLOW_PORTABLE 00400000
#endif
#ifndef O_NOATIME_PORTABLE
#define O_NOATIME_PORTABLE 01000000
#endif
#ifndef O_NDELAY_PORTABLE
#define O_NDELAY_PORTABLE O_NONBLOCK_PORTABLE
#endif
/* From Bionic libc/kernel/common/asm-generic/fcntl.h */
#ifndef O_CLOEXEC_PORTABLE
#define O_CLOEXEC_PORTABLE 02000000
#endif
#include <portability.h>
#include <fcntl.h>
#include <stdarg.h>
#ifndef __ARCH_FLOCK64_PAD
#define __ARCH_FLOCK64_PAD
#endif
#define O_DIRECTORY_PORTABLE 040000
#define O_NOFOLLOW_PORTABLE 0100000
#define O_DIRECT_PORTABLE 0200000
#define O_LARGEFILE_PORTABLE 0400000
/*
* For use with F_GETLK and F_SETLK
*/
struct flock_portable {
short l_type;
short l_whence;
off_t l_start;
off_t l_len;
pid_t l_pid;
__ARCH_FLOCK64_PAD
};
static int flags_p2n(int p_flags)
{
int machine_flags = p_flags;
if (p_flags & O_DIRECTORY_PORTABLE) {
machine_flags ^= O_DIRECTORY_PORTABLE;
machine_flags |= O_DIRECTORY;
}
if (p_flags & O_NOFOLLOW_PORTABLE) {
machine_flags ^= O_NOFOLLOW_PORTABLE;
machine_flags |= O_NOFOLLOW;
}
if (p_flags & O_DIRECT_PORTABLE) {
machine_flags ^= O_DIRECT_PORTABLE;
machine_flags |= O_DIRECT;
}
if (p_flags & O_LARGEFILE_PORTABLE) {
machine_flags ^= O_LARGEFILE_PORTABLE;
machine_flags |= O_LARGEFILE;
}
/*
* For use with F_GETLK64 and F_SETLK64
*/
struct flock64_portable {
short l_type;
short l_whence;
unsigned char __padding[4];
loff_t l_start;
loff_t l_len;
pid_t l_pid;
__ARCH_FLOCK64_PAD
};
return machine_flags;
}
#if 0
/*
* The X86 Version is
*/
struct flock64 {
short l_type;
short l_whence;
loff_t l_start;
loff_t l_len;
pid_t l_pid;
__ARCH_FLOCK64_PAD
};
#endif /* 0 */
#define FLAGS_VAARGS_TRANSLATE \
flags = flags_p2n(flags); \
mode_t mode = 0; \
if ((flags & O_CREAT) != 0) { \
va_list args; \
va_start(args, flags); \
mode = (mode_t) va_arg(args, int); \
va_end(args);\
}
#ifndef F_DUPFD_PORTABLE
#define F_DUPFD_PORTABLE 0
#define F_GETFD_PORTABLE 1
#define F_SETFD_PORTABLE 2
#define F_GETFL_PORTABLE 3
#define F_SETFL_PORTABLE 4
#endif
int WRAP(openat)(int fd, const char* path, int flags, ...)
{
FLAGS_VAARGS_TRANSLATE
return REAL(openat)(fd, path, flags, mode);
}
#ifndef F_GETLK_PORTABLE
#define F_GETLK_PORTABLE 5
#define F_SETLK_PORTABLE 6
#define F_SETLKW_PORTABLE 7
#endif
int WRAP(openat64)(int fd, const char* path, int flags, ...)
{
FLAGS_VAARGS_TRANSLATE
return REAL(openat64)(fd, path, flags, mode);
}
#ifndef F_SETOWN_PORTABLE
#define F_SETOWN_PORTABLE 8
#define F_GETOWN_PORTABLE 9
#endif
int WRAP(open)(const char* path, int flags, ...)
{
FLAGS_VAARGS_TRANSLATE
return REAL(open)(path, flags, mode);
}
#ifndef F_SETSIG_PORTABLE
#define F_SETSIG_PORTABLE 10
#define F_GETSIG_PORTABLE 11
#endif
#ifndef F_GETLK64_PORTABLE
#define F_GETLK64_PORTABLE 12
#define F_SETLK64_PORTABLE 13
#define F_SETLKW64_PORTABLE 14
#endif
/* This constant seems to be the same for all ARCH's */
#define F_LINUX_SPECIFIC_BASE_PORTABLE 1024
#define F_SETLEASE_PORTABLE (F_LINUX_SPECIFIC_BASE+0) /* 1024 */
#define F_GETLEASE_PORTABLE (F_LINUX_SPECIFIC_BASE+1) /* 1025 */
#define F_NOTIFY_PORTABLE (F_LINUX_SPECIFIC_BASE+2) /* 1026 */
/* Currently these are only supported by X86_64 */
#define F_CANCELLK_PORTABLE (F_LINUX_SPECIFIC_BASE+5) /* 1029 */
#define F_DUPFD_CLOEXEC_PORTABLE (F_LINUX_SPECIFIC_BASE+6) /* 1030 */
#endif /* _FCNTL_PORTABLE_H */
int WRAP(open64)(const char* path, int flags, ...)
{
FLAGS_VAARGS_TRANSLATE
return REAL(open64)(path, flags, mode);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013, The Android Open Source Project
* Copyright 2014, 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.
@@ -17,14 +17,15 @@
#ifndef _FENV_PORTABLE_H_
#define _FENV_PORTABLE_H_
#include <sys/types.h>
#include <fenv.h>
#include <portability.h>
#include <stdint.h>
#include <stdlib.h>
#ifdef __LP64__
typedef struct {
unsigned char a[28]; // x86_64 largest size
unsigned char a[128];
} fenv_t_portable;
typedef __uint32_t fexcept_t_portable;
#endif
typedef uint32_t fexcept_t_portable;
/* Exception flags. */
#define FE_INVALID_PORTABLE 0x01
@@ -41,4 +42,154 @@ typedef __uint32_t fexcept_t_portable;
#define FE_DOWNWARD_PORTABLE 0x2
#define FE_TOWARDZERO_PORTABLE 0x3
static inline int target_change_except(int flags)
{
int targetflags = 0;
if (flags & FE_INVALID_PORTABLE)
targetflags |= FE_INVALID;
if (flags & FE_DIVBYZERO_PORTABLE)
targetflags |= FE_DIVBYZERO;
if (flags & FE_OVERFLOW_PORTABLE)
targetflags |= FE_OVERFLOW;
if (flags & FE_UNDERFLOW_PORTABLE)
targetflags |= FE_UNDERFLOW;
if (flags & FE_INEXACT_PORTABLE)
targetflags |= FE_INEXACT;
return targetflags;
}
static inline int target_change_rounding(int flags)
{
int targetflags = 0;
switch(flags)
{
case FE_TONEAREST_PORTABLE:
targetflags = FE_TONEAREST;
break;
case FE_DOWNWARD_PORTABLE:
targetflags = FE_DOWNWARD;
break;
case FE_UPWARD_PORTABLE:
targetflags = FE_UPWARD;
break;
case FE_TOWARDZERO_PORTABLE:
targetflags = FE_TOWARDZERO;
break;
}
return targetflags;
}
static inline int target_get_except(int targetflags)
{
int flags = 0;
if (targetflags & FE_INVALID)
flags |= FE_INVALID_PORTABLE;
if (targetflags & FE_DIVBYZERO)
flags |= FE_DIVBYZERO_PORTABLE;
if (targetflags & FE_OVERFLOW)
flags |= FE_OVERFLOW_PORTABLE;
if (targetflags & FE_UNDERFLOW)
flags |= FE_UNDERFLOW_PORTABLE;
if (targetflags & FE_INEXACT)
flags |= FE_INEXACT_PORTABLE;
return flags;
}
static inline int target_get_rounding(int targetflags)
{
int flags = 0;
switch(targetflags)
{
case FE_TONEAREST:
flags = FE_TONEAREST_PORTABLE;
break;
case FE_DOWNWARD:
flags = FE_DOWNWARD_PORTABLE;
break;
case FE_UPWARD:
flags = FE_UPWARD_PORTABLE;
break;
case FE_TOWARDZERO:
flags = FE_TOWARDZERO_PORTABLE;
break;
}
return flags;
}
int WRAP(fegetenv)(fenv_t_portable* __envp) {
return REAL(fegetenv)((fenv_t*) __envp);
}
int WRAP(fesetenv)(const fenv_t_portable* __envp) {
return REAL(fesetenv)((fenv_t*) __envp);
}
int WRAP(feclearexcept)(int __excepts) {
__excepts = target_change_except(__excepts);
return REAL(feclearexcept)(__excepts);
}
int WRAP(fegetexceptflag)(fexcept_t_portable* __flagp, int __excepts) {
__excepts = target_change_except(__excepts);
int ret = REAL(fegetexceptflag)((fexcept_t*) __flagp, __excepts);
*__flagp = target_get_except(*__flagp);
return ret;
}
int WRAP(fesetexceptflag)(const fexcept_t_portable* __flagp, int __excepts) {
__excepts = target_change_except(__excepts);
return REAL(fesetexceptflag)((const fexcept_t*) __flagp, __excepts);
}
int WRAP(feraiseexcept)(int __excepts) {
__excepts = target_change_except(__excepts);
return REAL(feraiseexcept)(__excepts);
}
int WRAP(fetestexcept)(int __excepts) {
__excepts = target_change_except(__excepts);
return target_get_except(REAL(fetestexcept)(__excepts));
}
int WRAP(fegetround)(void) {
int rounding = REAL(fegetround)();
return target_get_rounding(rounding);
}
int WRAP(fesetround)(int __round) {
__round = target_change_rounding(__round);
return REAL(fesetround)(__round);
}
int WRAP(feholdexcept)(fenv_t_portable* __envp) {
memset(__envp, '\0', sizeof(__envp));
fenv_t env;
int ret = REAL(feholdexcept)(&env);
memcpy(__envp, &env, sizeof(env));
return ret;
}
int WRAP(feupdateenv)(const fenv_t_portable* __envp) {
fenv_t env;
memcpy(&env, __envp, sizeof(env));
return REAL(feupdateenv)(&env);
}
int WRAP(feenableexcept)(int __excepts) {
__excepts = target_change_except(__excepts);
return REAL(feenableexcept)(__excepts);
}
int WRAP(fedisableexcept)(int __excepts) {
__excepts = target_change_except(__excepts);
return REAL(fedisableexcept)(__excepts);
}
#endif /* _FENV_PORTABLE_H_ */

View File

@@ -1,44 +0,0 @@
/*
* 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 _FILEFD_PORTABLE_H_
#define _FILEFD_PORTABLE_H_
/*
* Maintaining a list of special file descriptors in lib-portable
* which are maintained across a execve() via environment variables.
* See portable/arch-mips/filefd.c for details.
*/
enum filefd_type {
UNUSED_FD_TYPE = 0,
EVENT_FD_TYPE,
INOTIFY_FD_TYPE,
SIGNAL_FD_TYPE,
TIMER_FD_TYPE,
MAX_FD_TYPE
};
extern __hidden void filefd_opened(int fd, enum filefd_type fd_type);
extern __hidden void filefd_closed(int fd);
extern __hidden void filefd_CLOEXEC_enabled(int fd);
extern __hidden void filefd_CLOEXEC_disabled(int fd);
extern __hidden void filefd_disable_mapping(void);
extern int WRAP(close)(int fd);
extern int WRAP(read)(int fd, void *buf, size_t count);
extern int WRAP(pipe2)(int pipefd[2], int portable_flags);
#endif /* _FILEFD_PORTABLE_H_ */

View File

@@ -1,51 +0,0 @@
/*
* Derived from bionic/libc/include/sys/eventfd.h
*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_INOTIFY_PORTABLE_H
#define _SYS_INOTIFY_PORTABLE_H
#include <portability.h>
#include <sys/cdefs.h>
#include <fcntl.h>
#include <fcntl_portable.h>
__BEGIN_DECLS
#define IN_CLOEXEC O_CLOEXEC
#define IN_NONBLOCK O_NONBLOCK
#define IN_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
#define IN_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
extern int WRAP(inotify_init1)(int flags);
__END_DECLS
#endif /* _SYS_INOTIFY_H */

View File

@@ -1,230 +0,0 @@
/*
* 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 _IOCTLS_PORTABLE_H_
#define _IOCTLS_PORTABLE_H_
/*
* Derived from development/ndk/platforms/android-3/include/asm-generic/ioctl.h
*/
#define _IOC_NRBITS_PORTABLE 8
#define _IOC_TYPEBITS_PORTABLE 8
#define _IOC_SIZEBITS_PORTABLE 14
#define _IOC_DIRBITS_PORTABLE 2
#define _IOC_NRMASK_PORTABLE ((1 << _IOC_NRBITS_PORTABLE)-1)
#define _IOC_TYPEMASK_PORTABLE ((1 << _IOC_TYPEBITS_PORTABLE)-1)
#define _IOC_SIZEMASK_PORTABLE ((1 << _IOC_SIZEBITS_PORTABLE)-1)
#define _IOC_DIRMASK_PORTABLE ((1 << _IOC_DIRBITS_PORTABLE)-1)
#define _IOC_NRSHIFT_PORTABLE 0
#define _IOC_TYPESHIFT_PORTABLE (_IOC_NRSHIFT_PORTABLE+_IOC_NRBITS_PORTABLE)
#define _IOC_SIZESHIFT_PORTABLE (_IOC_TYPESHIFT_PORTABLE+_IOC_TYPEBITS_PORTABLE)
#define _IOC_DIRSHIFT_PORTABLE (_IOC_SIZESHIFT_PORTABLE+_IOC_SIZEBITS_PORTABLE)
#define _IOC_NONE_PORTABLE 0U
#define _IOC_WRITE_PORTABLE 1U
#define _IOC_READ_PORTABLE 2U
#define _IOC_PORTABLE(dir, type, nr, size) ( \
((dir) << _IOC_DIRSHIFT_PORTABLE) | \
((type) << _IOC_TYPESHIFT_PORTABLE) | \
((nr) << _IOC_NRSHIFT_PORTABLE) | \
((size) << _IOC_SIZESHIFT_PORTABLE) \
)
extern unsigned int __invalid_size_argument_for_IOC;
#define _IOC_TYPECHECK_PORTABLE(t) ( \
(sizeof(t) == sizeof(t[1]) && sizeof(t) < (1 << _IOC_SIZEBITS_PORTABLE)) ? \
sizeof(t) : \
__invalid_size_argument_for_IOC \
)
#define _IO_PORTABLE(type, nr) _IOC_PORTABLE(_IOC_NONE_PORTABLE, (type), (nr), 0)
#define _IOR_PORTABLE(type, nr, size) \
_IOC_PORTABLE(_IOC_READ_PORTABLE, (type), (nr), (_IOC_TYPECHECK_PORTABLE(size)))
#define _IOW_PORTABLE(type, nr, size) \
_IOC_PORTABLE(_IOC_WRITE_PORTABLE, (type), (nr), (_IOC_TYPECHECK_PORTABLE(size)))
#define _IOWR_PORTABLE(type, nr, size) \
IOC_PORTABLE(_IOC_READ_PORTABLE | \
_IOC_WRITE_PORTABLE, (type), (nr), (IOC_TYPECHECK_PORTABLE(size)) )
/*
* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/ioctls.h
*/
#define TCGETS_PORTABLE 0x5401
#define TCSETS_PORTABLE 0x5402
#define TCSETSW_PORTABLE 0x5403
#define TCSETSF_PORTABLE 0x5404
#define TCGETA_PORTABLE 0x5405
#define TCSETA_PORTABLE 0x5406
#define TCSETAW_PORTABLE 0x5407
#define TCSETAF_PORTABLE 0x5408
#define TCSBRK_PORTABLE 0x5409
#define TCXONC_PORTABLE 0x540A
#define TCFLSH_PORTABLE 0x540B
#define TIOCEXCL_PORTABLE 0x540C
#define TIOCNXCL_PORTABLE 0x540D
#define TIOCSCTTY_PORTABLE 0x540E
#define TIOCGPGRP_PORTABLE 0x540F
#define TIOCSPGRP_PORTABLE 0x5410
#define TIOCOUTQ_PORTABLE 0x5411
#define TIOCSTI_PORTABLE 0x5412
#define TIOCGWINSZ_PORTABLE 0x5413
#define TIOCSWINSZ_PORTABLE 0x5414
#define TIOCMGET_PORTABLE 0x5415
#define TIOCMBIS_PORTABLE 0x5416
#define TIOCMBIC_PORTABLE 0x5417
#define TIOCMSET_PORTABLE 0x5418
#define TIOCGSOFTCAR_PORTABLE 0x5419
#define TIOCSSOFTCAR_PORTABLE 0x541A
#define FIONREAD_PORTABLE 0x541B
#define TIOCINQ_PORTABLE FIONREAD_PORTABLE
#define TIOCLINUX_PORTABLE 0x541C
#define TIOCCONS_PORTABLE 0x541D
#define TIOCGSERIAL_PORTABLE 0x541E
#define TIOCSSERIAL_PORTABLE 0x541F
#define TIOCPKT_PORTABLE 0x5420
#define FIONBIO_PORTABLE 0x5421
#define TIOCNOTTY_PORTABLE 0x5422
#define TIOCSETD_PORTABLE 0x5423
#define TIOCGETD_PORTABLE 0x5424
#define TCSBRKP_PORTABLE 0x5425
#define TIOCSBRK_PORTABLE 0x5427
#define TIOCCBRK_PORTABLE 0x5428
#define TIOCGSID_PORTABLE 0x5429
#define TIOCGPTN_PORTABLE _IOR_PORTABLE('T',0x30, unsigned int)
#define TIOCSPTLCK_PORTABLE _IOW_PORTABLE('T',0x31, int)
#define FIONCLEX_PORTABLE 0x5450
#define FIOCLEX_PORTABLE 0x5451
#define FIOASYNC_PORTABLE 0x5452
#define TIOCSERCONFIG_PORTABLE 0x5453
#define TIOCSERGWILD_PORTABLE 0x5454
#define TIOCSERSWILD_PORTABLE 0x5455
#define TIOCGLCKTRMIOS_PORTABLE 0x5456
#define TIOCSLCKTRMIOS_PORTABLE 0x5457
#define TIOCSERGSTRUCT_PORTABLE 0x5458
#define TIOCSERGETLSR_PORTABLE 0x5459
#define TIOCSERGETMULTI_PORTABLE 0x545A
#define TIOCSERSETMULTI_PORTABLE 0x545B
#define TIOCMIWAIT_PORTABLE 0x545C
#define TIOCGICOUNT_PORTABLE 0x545D
#define FIOQSIZE_PORTABLE 0x545E /* x86 differs here */
#define TIOCPKT_DATA_PORTABLE 0
#define TIOCPKT_FLUSHREAD_PORTABLE 1
#define TIOCPKT_FLUSHWRITE_PORTABLE 2
#define TIOCPKT_STOP_PORTABLE 4
#define TIOCPKT_START_PORTABLE 8
#define TIOCPKT_NOSTOP_PORTABLE 16
#define TIOCPKT_DOSTOP_PORTABLE 32
#define TIOCSER_TEMT_PORTABLE 0x01
/*
* Derived from development/ndk/platforms/android-3/include/sys/ioctl_compat.h
*/
struct tchars_portable {
char t_intrc; /* interrupt */
char t_quitc; /* quit */
char t_startc; /* start output */
char t_stopc; /* stop output */
char t_eofc; /* end-of-file */
char t_brkc; /* input delimiter (like nl) */
};
struct ltchars_portable {
char t_suspc; /* stop process signal */
char t_dsuspc; /* delayed stop process signal */
char t_rprntc; /* reprint line */
char t_flushc; /* flush output (toggles) */
char t_werasc; /* word erase */
char t_lnextc; /* literal next character */
};
struct sgttyb_portable {
char sg_ispeed; /* input speed */
char sg_ospeed; /* output speed */
char sg_erase; /* erase character */
char sg_kill; /* kill character */
short sg_flags; /* mode flags */
};
#ifdef USE_OLD_TTY
# define TIOCGETD_PORTABLE _IOR_PORTABLE('t', 0, int) /* get line discipline */
# define TIOCSETD_PORTABLE _IOW_PORTABLE('t', 1, int) /* set line discipline */
#else
# define OTIOCGETD_PORTABLE _IOR_PORTABLE('t', 0, int) /* get line discipline */
# define OTIOCSETD_PORTABLE _IOW_PORTABLE('t', 1, int) /* set line discipline */
#endif
/* hang up on last close */
#define TIOCHPCL_PORTABLE _IO_PORTABLE('t', 2)
/* get parameters -- gtty */
#define TIOCGETP_PORTABLE _IOR_PORTABLE('t', 8,struct sgttyb_portable)
/* set parameters -- stty */
#define TIOCSETP_PORTABLE _IOW_PORTABLE('t', 9,struct sgttyb_portable)
/* as above, but no flushtty*/
#define TIOCSETN_PORTABLE _IOW_PORTABLE('t',10,struct sgttyb_portable)
/* set special characters */
#define TIOCSETC_PORTABLE _IOW_PORTABLE('t',17,struct tchars_portable)
/* get special characters */
#define TIOCGETC_PORTABLE _IOR_PORTABLE('t',18,struct tchars_portable)
/* bis local mode bits */
#define TIOCLBIS_PORTABLE _IOW_PORTABLE('t', 127, int)
/* bic local mode bits */
#define TIOCLBIC_PORTABLE _IOW_PORTABLE('t', 126, int)
/* set entire local mode word */
#define TIOCLSET_PORTABLE _IOW_PORTABLE('t', 125, int)
/* get local modes */
#define TIOCLGET_PORTABLE _IOR_PORTABLE('t', 124, int)
/* set local special chars*/
#define TIOCSLTC_PORTABLE _IOW_PORTABLE('t',117,struct ltchars_portable)
/* get local special chars*/
#define TIOCGLTC_PORTABLE _IOR_PORTABLE('t',116,struct ltchars_portable)
/* for hp300 -- sans int arg */
#define OTIOCCONS_PORTABLE _IO_PORTABLE('t', 98)
/*
* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/sockios.h
*/
#define FIOSETOWN_PORTABLE 0x8901
#define SIOCSPGRP_PORTABLE 0x8902
#define FIOGETOWN_PORTABLE 0x8903
#define SIOCGPGRP_PORTABLE 0x8904
#define SIOCATMARK_PORTABLE 0x8905
#define SIOCGSTAMP_PORTABLE 0x8906
#endif /* _IOCTLS_PORTABLE_H */

View File

@@ -1,101 +0,0 @@
/*
* ALOG Levels: F - Fatal, E - Error, W - Warning, I - Info, D - Debug, V - Verbose
*
* Using them to work within the Android logcat logging mechanism:
*
* % logcat '*:v' [To display Verbose Logging]
* % logcat 'fcntl_portable:v' [To display just this fcntl logging]
*
* NOTE: This assumes you only use the 'PORTABLE_TAG'; which is the default.
* For debugging LTP it's been helpful to include the LTP program being tested;
* which is enabled below with #define EXTENDED_LOGGING.
*
* Logging routines also support ALOG*_IF() and ASSERT(); For details See:
*
* ${ANDROID_TOP}/system/core/include/cutils/log.h
* and
* http://developer.android.com/tools/debugging/debugging-log.html
*
* ALOGV is turned off by release builds: Use the #define below with LOG_NDEBUG=0 to enable.
*
* Strace works fine with ALOG out if a large max string size is used via the -s option;
* Example:
*
* strace -s 132 ./sigaction01
*
* writev(3, [{"\2", 1},
* {"./sigaction01`signal_portable\0", 30},
* {"sigaction_portable(portable_signum:10:'SIGUSR1_PORTABLE:10', ...
* {"map_portable_sigset_to_mips(portable_sigset:0x7fe47a0c, ...
* ...
*/
/*
* Enable LOG_NDEBUG to have debug code visible in logcat output by default.
* Also possible via the Lib-Portable Android.mk file. Example:
*
* # Have logging permanently enable during development.
* LOCAL_CFLAGS += -DLOG_NDEBUG=0
*/
// # define LOG_NDEBUG 0
// #define EXTENDED_LOGGING /* Include the current program name in the LOG_TAG */
#ifdef EXTENDED_LOGGING
/*
* Inline function to put the current program name
* and this library into the logcat prefix. Example:
*
* V/./sigaction01`signal_portable(605): sigaction_portable(... ) {
* -----------------------------
*
* Disabled by default in AOSP, enable by removing the // above.
* Useful when debugging more than one program; For example LTP has thousands.
*/
#define MAX_TAG_LEN 128
static char my_portable_tag[MAX_TAG_LEN + 1];
static inline char *portable_tag() {
extern char *__progname;
if (my_portable_tag[0] == '\000') {
strncat(&my_portable_tag[0], __progname, MAX_TAG_LEN);
strncat(&my_portable_tag[0], ".", MAX_TAG_LEN - strlen(my_portable_tag));
strncat(&my_portable_tag[0], PORTABLE_TAG, MAX_TAG_LEN - strlen(my_portable_tag));
}
return my_portable_tag;
}
#define LOG_TAG portable_tag()
#else /* !EXTENDED_LOGGING */
#define LOG_TAG PORTABLE_TAG
#endif
/*
* Override LOG_PRI() defined in ${AOSP}/system/core/include/cutils/log.h
* to preserve the value of errno while logging.
*/
#define LOG_PRI(priority, tag, ...) ({ \
int _errno = *REAL(__errno)(); \
int _rv = android_printLog(priority, tag, __VA_ARGS__); \
*REAL(__errno)() = _errno; \
_rv; /* Returned to caller */ \
})
#if !defined(__HOST__)
#include <cutils/log.h>
# define PERROR(str) { \
ALOGE("%s: PERROR('%s'): errno:%d:'%s'", __func__, str, *REAL(__errno)(), strerror(errno)); \
}
# define ASSERT(cond) ALOG_ASSERT(cond, "assertion failed:(%s), file: %s, line: %d:%s", \
#cond, __FILE__, __LINE__, __func__);
#else
#include <assert.h>
# define PERROR(str) fprintf(stderr, "%s: PERROR('%s'): errno:%d:'%s'", __func__, str, *REAL(__errno)(), strerror(*REAL(__errno)()))
# define ASSERT(cond) assert(cond)
# define ALOGV(a,...)
# define ALOGW(a,...)
# define ALOGE(a,...)
#endif

View File

@@ -1,64 +0,0 @@
/*
* 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 _MMAN_PORTABLE_H_
#define _MMAN_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/include/asm-generic/mman.h */
#define PROT_READ_PORTABLE 0x1
#define PROT_WRITE_PORTABLE 0x2
#define PROT_EXEC_PORTABLE 0x4
#define PROT_SEM_PORTABLE 0x8
#define PROT_NONE_PORTABLE 0x0
#define PROT_GROWSDOWN_PORTABLE 0x01000000
#define PROT_GROWSUP_PORTABLE 0x02000000
#define MAP_SHARED_PORTABLE 0x01
#define MAP_PRIVATE_PORTABLE 0x02
#define MAP_TYPE_PORTABLE 0x0f
#define MAP_FIXED_PORTABLE 0x10
#define MAP_ANONYMOUS_PORTABLE 0x20
#define MS_ASYNC_PORTABLE 1
#define MS_INVALIDATE_PORTABLE 2
#define MS_SYNC_PORTABLE 4
#define MADV_NORMAL_PORTABLE 0
#define MADV_RANDOM_PORTABLE 1
#define MADV_SEQUENTIAL_PORTABLE 2
#define MADV_WILLNEED_PORTABLE 3
#define MADV_DONTNEED_PORTABLE 4
#define MADV_REMOVE_PORTABLE 9
#define MADV_DONTFORK_PORTABLE 10
#define MADV_DOFORK_PORTABLE 11
#define MAP_ANON_PORTABLE MAP_ANONYMOUS_PORTABLE
#define MAP_FILE_PORTABLE 0
/* Derived from development/ndk/platforms/android-3/include/asm-generic/mman.h */
#define MAP_GROWSDOWN_PORTABLE 0x0100
#define MAP_DENYWRITE_PORTABLE 0x0800
#define MAP_EXECUTABLE_PORTABLE 0x1000
#define MAP_LOCKED_PORTABLE 0x2000
#define MAP_NORESERVE_PORTABLE 0x4000
#define MAP_POPULATE_PORTABLE 0x8000
#define MAP_NONBLOCK_PORTABLE 0x10000
#define MCL_CURRENT_PORTABLE 1
#define MCL_FUTURE_PORTABLE 2
#endif /* _MMAN_PORTABLE_H */

View File

@@ -1,281 +0,0 @@
/*
* Derived from android-14/arch-arm/usr/include/netdb.h
*-
* Copyright (c) 1980, 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* -
* Portions Copyright (c) 1993 by Digital Equipment Corporation.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies, and that
* the name of Digital Equipment Corporation not be used in advertising or
* publicity pertaining to distribution of the document or software without
* specific, written prior permission.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
* CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
* -
* --Copyright--
*/
/*
* @(#)netdb.h 8.1 (Berkeley) 6/2/93
* From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $
* $FreeBSD: /repoman/r/ncvs/src/include/netdb.h,v 1.41 2006/04/15 16:20:26 ume Exp $
*/
#ifndef _NETDB_PORTABLE_H_
#define _NETDB_PORTABLE_H_
#if 0
/*
* Most of the declararitions are not needed for addrinfo mapping.
* Diff of mips and arm code running through cpp show only the
* values of ai_socktype being different.
*/
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/socket.h>
#ifndef _PATH_HEQUIV
# define _PATH_HEQUIV "/system/etc/hosts.equiv"
#endif
#define _PATH_HOSTS "/system/etc/hosts"
#define _PATH_NETWORKS "/system/etc/networks"
#define _PATH_PROTOCOLS "/system/etc/protocols"
#define _PATH_SERVICES "/system/etc/services"
#define MAXHOSTNAMELEN 256
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
* use in system calls).
*/
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses from name server */
#define h_addr h_addr_list[0] /* address, for backward compatibility */
};
struct netent {
char *n_name; /* official name of net */
char **n_aliases; /* alias list */
int n_addrtype; /* net address type */
uint32_t n_net; /* network # */
};
struct servent {
char *s_name; /* official service name */
char **s_aliases; /* alias list */
int s_port; /* port # */
char *s_proto; /* protocol to use */
};
struct protoent {
char *p_name; /* official protocol name */
char **p_aliases; /* alias list */
int p_proto; /* protocol # */
};
#endif
/*
* For mapping MIPS and ARM these structures differ only in the
* ai_socktype values.
*/
struct addrinfo_portable {
int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
int ai_family; /* PF_xxx */
int ai_socktype; /* SOCK_xxx */
int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
socklen_t ai_addrlen; /* length of ai_addr */
char *ai_canonname; /* canonical name for hostname */
struct sockaddr *ai_addr; /* binary address */
struct addrinfo *ai_next; /* next structure in linked list */
};
#if 0
/*
* Error return codes from gethostbyname() and gethostbyaddr()
* (left in h_errno).
*/
#define NETDB_INTERNAL -1 /* see errno */
#define NETDB_SUCCESS 0 /* no problem */
#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */
#define TRY_AGAIN 2 /* Non-Authoritative Host not found, or SERVERFAIL */
#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
/*
* Error return codes from getaddrinfo()
*/
#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */
#define EAI_AGAIN 2 /* temporary failure in name resolution */
#define EAI_BADFLAGS 3 /* invalid value for ai_flags */
#define EAI_FAIL 4 /* non-recoverable failure in name resolution */
#define EAI_FAMILY 5 /* ai_family not supported */
#define EAI_MEMORY 6 /* memory allocation failure */
#define EAI_NODATA 7 /* no address associated with hostname */
#define EAI_NONAME 8 /* hostname nor servname provided, or not known */
#define EAI_SERVICE 9 /* servname not supported for ai_socktype */
#define EAI_SOCKTYPE 10 /* ai_socktype not supported */
#define EAI_SYSTEM 11 /* system error returned in errno */
#define EAI_BADHINTS 12 /* invalid value for hints */
#define EAI_PROTOCOL 13 /* resolved protocol is unknown */
#define EAI_OVERFLOW 14 /* argument buffer overflow */
#define EAI_MAX 15
/*
* Flag values for getaddrinfo()
*/
#define AI_PASSIVE 0x00000001 /* get address to use bind() */
#define AI_CANONNAME 0x00000002 /* fill ai_canonname */
#define AI_NUMERICHOST 0x00000004 /* prevent host name resolution */
#define AI_NUMERICSERV 0x00000008 /* prevent service name resolution */
/* valid flags for addrinfo (not a standard def, apps should not use it) */
#define AI_MASK \
(AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | \
AI_ADDRCONFIG)
#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */
#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */
/* special recommended flags for getipnodebyname */
#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
/*
* Constants for getnameinfo()
*/
#define NI_MAXHOST 1025
#define NI_MAXSERV 32
/*
* Flag values for getnameinfo()
*/
#define NI_NOFQDN 0x00000001
#define NI_NUMERICHOST 0x00000002
#define NI_NAMEREQD 0x00000004
#define NI_NUMERICSERV 0x00000008
#define NI_DGRAM 0x00000010
#if 0 /* obsolete */
#define NI_WITHSCOPEID 0x00000020
#endif
/*
* Scope delimit character
*/
#define SCOPE_DELIMITER '%'
__BEGIN_DECLS
/* BIONIC-BEGIN */
#define h_errno (*__get_h_errno())
int* __get_h_errno(void);
/* BIONIC-END */
void endservent(void);
struct hostent *gethostbyaddr(const char *, int, int);
struct hostent *gethostbyname(const char *);
int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *gethostbyname2(const char *, int);
struct hostent *gethostent(void);
struct netent *getnetbyaddr(uint32_t, int);
struct netent *getnetbyname(const char *);
struct protoent *getprotobyname(const char *);
struct protoent *getprotobynumber(int);
struct servent *getservbyname(const char *, const char *);
struct servent *getservbyport(int, const char *);
struct servent *getservent(void);
void herror(const char *);
const char *hstrerror(int);
#endif
int WRAP(getaddrinfo)(const char *, const char *, struct addrinfo_portable *,
struct addrinfo_portable **);
void WRAP(freeaddrinfo)(struct addrinfo_portable *);
#if 0 /* Not needed for addrinfo mapping */
int getnameinfo(const struct sockaddr *, socklen_t, char *, size_t, char *, size_t, int);
const char *gai_strerror(int);
void setservent(int);
#if 0 /* MISSING FROM BIONIC */
void endhostent(void);
void endnetent(void);
void endnetgrent(void);
void endprotoent(void);
void freehostent(struct hostent *);
int gethostbyaddr_r(const char *, int, int, struct hostent *, char *, size_t,
struct hostent **, int *);
int gethostbyname2_r(const char *, int, struct hostent *, char *, size_t,
struct hostent **, int *);
int gethostent_r(struct hostent *, char *, size_t, struct hostent **, int *);
struct hostent *getipnodebyaddr(const void *, size_t, int, int *);
struct hostent *getipnodebyname(const char *, int, int, int *);
int getnetbyaddr_r(uint32_t, int, struct netent *, char *, size_t, struct netent**, int *);
int getnetbyname_r(const char *, struct netent *, char *, size_t, struct netent **, int *);
int getnetent_r(struct netent *, char *, size_t, struct netent **, int *);
int getnetgrent(char **, char **, char **);
int getprotobyname_r(const char *, struct protoent *, char *, size_t, struct protoent **);
int getprotobynumber_r(int, struct protoent *, char *, size_t, struct protoent **);
struct protoent *getprotoent(void);
int getprotoent_r(struct protoent *, char *, size_t, struct protoent **);
int innetgr(const char *, const char *, const char *, const char *);
void sethostent(int);
void setnetent(int);
void setprotoent(int);
struct netent *getnetent(void);
void setnetgrent(const char *);
#endif /* MISSING FROM BIONIC */
#endif /* Not needed for addrinfo mapping */
__END_DECLS
#endif /* !_NETDB_H_ */

View File

@@ -1,37 +0,0 @@
/*
* 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 _POLL_PORTABLE_H_
#define _POLL_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/poll.h */
#define POLLIN_PORTABLE 0x0001
#define POLLPRI_PORTABLE 0x0002
#define POLLOUT_PORTABLE 0x0004
#define POLLERR_PORTABLE 0x0008
#define POLLHUP_PORTABLE 0x0010
#define POLLNVAL_PORTABLE 0x0020
#define POLLRDNORM_PORTABLE 0x0040
#define POLLRDBAND_PORTABLE 0x0080
#define POLLWRNORM_PORTABLE 0x0100
#define POLLWRBAND_PORTABLE 0x0200
#define POLLMSG_PORTABLE 0x0400
#define POLLREMOVE_PORTABLE 0x1000
#define POLLRDHUP_PORTABLE 0x2000
#endif /* _POLL_PORTABLE_H_ */

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012, The Android Open Source Project
* Copyright 2014, 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.
@@ -17,34 +17,22 @@
#ifndef _PORTABILITY_H_
#define _PORTABILITY_H_
#include <stdint.h>
#include "asm-generic/portability.h"
/*
* Common portability helper routines
*/
/*
* Check a portable pointer before we access it
* Well behaved programs should not be passing bad pointers
* to the kernel but this routine can be used to check a pointer
* if we need to use it before calling the kernel
*
* It does not catch every possible case but it is sufficient for LTP
*/
inline static int invalid_pointer(void *p)
{
return p == 0
|| p == (void *)-1
#ifdef __mips__
|| (intptr_t)p < 0
#endif
;
}
/*
* Hidden functions are exposed while linking the libportable shared object
* but are not exposed thereafter.
*/
#define __hidden __attribute__((visibility("hidden")))
#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 resolves undefined symbol to __wrap_symbol,
* and undefined __real_symbol to the original symbol
*/
#define WRAP(f) __wrap_ ## f
#define REAL(f) __real_ ## f
#endif
#endif /* _PORTABILITY_H_ */

View File

@@ -1,65 +0,0 @@
/*
* 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 _RESOURCE_PORTABLE_H_
#define _RESOURCE_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/include/asm-generic/resource.h */
#define RLIMIT_CPU_PORTABLE 0
#define RLIMIT_FSIZE_PORTABLE 1
#define RLIMIT_DATA_PORTABLE 2
#define RLIMIT_STACK_PORTABLE 3
#define RLIMIT_CORE_PORTABLE 4
#ifndef RLIMIT_RSS_PORTABLE
#define RLIMIT_RSS_PORTABLE 5
#endif
#ifndef RLIMIT_NPROC_PORTABLE
#define RLIMIT_NPROC_PORTABLE 6
#endif
#ifndef RLIMIT_NOFILE_PORTABLE
#define RLIMIT_NOFILE_PORTABLE 7
#endif
#ifndef RLIMIT_MEMLOCK_PORTABLE
#define RLIMIT_MEMLOCK_PORTABLE 8
#endif
#ifndef RLIMIT_AS_PORTABLE
#define RLIMIT_AS_PORTABLE 9
#endif
#define RLIMIT_LOCKS_PORTABLE 10
#define RLIMIT_SIGPENDING_PORTABLE 11
#define RLIMIT_MSGQUEUE_PORTABLE 12
#define RLIMIT_NICE_PORTABLE 13
#define RLIMIT_RTPRIO_PORTABLE 14
#define RLIMIT_RTTIME_PORTABLE 15
#define RLIM_NLIMITS_PORTABLE 16
#ifndef RLIM_INFINITY_PORTABLE
#define RLIM_INFINITY_PORTABLE (~0UL)
#endif
#ifndef _STK_LIM_MAX_PORTABLE
#define _STK_LIM_MAX_PORTABLE RLIM_INFINITY_PORTABLE
#endif
#endif /* _RESOURCE_PORTABLE_H_ */

View File

@@ -1,198 +0,0 @@
/*
* Derived from gdk/platforms/android-14/arch-arm/usr/include/signal.h
*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SIGNAL_PORTABLE_H_
#define _SIGNAL_PORTABLE_H_
#include <portability.h>
#include <sys/cdefs.h>
#include <limits.h> /* For LONG_BIT */
#include <string.h> /* For memset() */
#include <signal.h>
#include <time.h>
#include <sys/types.h>
#include <asm/signal_portable.h>
#include <asm/sigcontext_portable.h>
#define __ARCH_SI_UID_T __kernel_uid32_t
#include <asm/siginfo_portable.h>
#undef __ARCH_SI_UID_T
__BEGIN_DECLS
typedef int sig_atomic_t;
#if 0
/* _NSIG is used by the SIGRTMAX definition under <asm/signal.h>, however
* its definition is part of a #if __KERNEL__ .. #endif block in the original
* kernel headers and is thus not part of our cleaned-up versions.
*
* Looking at the current kernel sources, it is defined as 64 for all
* architectures except for the 'mips' one which set it to 128.
*/
#ifndef _NSIG_PORTABLE
# define _NSIG_PORTABLE 64
#endif
#endif
extern const char * const sys_siglist[];
extern const char * const sys_signame[];
static __inline__ int WRAP(sigismember)(sigset_portable_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
return (int)((local_set[signum/LONG_BIT] >> (signum%LONG_BIT)) & 1);
}
static __inline__ int WRAP(sigaddset)(sigset_portable_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
local_set[signum/LONG_BIT] |= 1UL << (signum%LONG_BIT);
return 0;
}
static __inline__ int WRAP(sigdelset)(sigset_portable_t *set, int signum)
{
unsigned long *local_set = (unsigned long *)set;
signum--;
local_set[signum/LONG_BIT] &= ~(1UL << (signum%LONG_BIT));
return 0;
}
static __inline__ int WRAP(sigemptyset)(sigset_portable_t *set)
{
memset(set, 0, sizeof *set);
return 0;
}
static __inline__ int WRAP(sigfillset)(sigset_portable_t *set)
{
memset(set, ~0, sizeof *set);
return 0;
}
/* compatibility types */
typedef void (*sig_portable_t)(int);
typedef sig_portable_t sighandler_portable_t;
/* Extended compatibility types, for processing a siginfo_t argument */
typedef void (*sig3_portable_t)(int, siginfo_portable_t *, void *);
typedef sig3_portable_t sig3handler_portable_t;
/* differentiater between sysv and bsd behaviour 8*/
extern __sighandler_t sysv_signal(int, __sighandler_portable_t);
extern __sighandler_t bsd_signal(int, __sighandler_portable_t);
#if 0
/* the default is bsd */
static __inline__ __sighandler_portable_t WRAP(signal)(int s, sighandler_portable_t f)
{
return bsd_signal(s,f);
}
#endif
/* the portable mapped syscall itself */
extern __sighandler_portable_t WRAP(__signal)(int, __sighandler_portable_t);
extern int WRAP(sigprocmask)(int, const sigset_portable_t *, sigset_portable_t *);
extern int WRAP(sigaction)(int, const struct sigaction_portable *,
struct sigaction_portable *);
extern int WRAP(sigpending)(sigset_portable_t *);
extern int WRAP(sigsuspend)(const sigset_portable_t *);
extern int WRAP(sigwait)(const sigset_portable_t *set, int *sig);
extern int WRAP(siginterrupt)(int sig, int flag);
extern int WRAP(raise)(int);
extern int WRAP(kill)(pid_t, int);
extern int WRAP(killpg)(int pgrp, int sig);
extern int WRAP(tkill)(int tid, int portable_signum);
extern int WRAP(sigaltstack)(const portable_stack_t *ss, portable_stack_t *oss);
extern int WRAP(timer_create)(clockid_t, struct sigevent *, timer_t *);
#if 0
extern int WRAP(signalfd)(int fd, const sigset_portable_t *portable_sigmask, int flags);
#endif
extern __hidden int do_signalfd4_portable(int fd, const sigset_portable_t *portable_sigmask,
int portable_sigsetsize, int flags);
extern __hidden int read_signalfd_mapper(int fd, void *buf, size_t count);
extern __hidden char *map_portable_signum_to_name(int portable_signum);
extern __hidden char *map_mips_signum_to_name(int mips_signum);
extern __hidden int signum_pton(int portable_signum);
extern __hidden int signum_ntop(int mips_signum);
typedef int (*sigmask_fn)(int, const sigset_t *, sigset_t *);
typedef int (*rt_sigmask_fn)(int, const sigset_t *, sigset_t *, size_t);
typedef int (*sigaction_fn)(int, const struct sigaction *, struct sigaction *);
typedef int (*rt_sigaction_fn)(int, const struct sigaction *, struct sigaction *, size_t);
extern __hidden int do_sigmask(int portable_how, const sigset_portable_t *portable_sigset,
sigset_portable_t *portable_oldset, sigmask_fn fn,
rt_sigmask_fn rt_fn);
/* These functions are called from syscall.c and experimental Bionic linker. */
extern int WRAP(__rt_sigaction)(int portable_signum,
const struct sigaction_portable *act,
struct sigaction_portable *oldact,
size_t sigsetsize);
extern int WRAP(__rt_sigprocmask)(int portable_how,
const sigset_portable_t *portable_sigset,
sigset_portable_t *portable_oldset,
size_t sigsetsize);
extern int WRAP(__rt_sigtimedwait)(const sigset_portable_t *portable_sigset,
siginfo_portable_t *portable_siginfo,
const struct timespec *timeout,
size_t portable_sigsetsize);
/* These functions are only called from syscall.c; not experimental Bionic linker. */
extern __hidden int WRAP(rt_sigqueueinfo)(pid_t pid, int sig, siginfo_portable_t *uinfo);
extern __hidden int WRAP(rt_tgsigqueueinfo)(pid_t tgid, pid_t pid, int sig,
siginfo_portable_t *uinfo);
/* Called by clone when memory and signal handlers aren't compatable. */
extern __hidden void signal_disable_mapping(void);
__END_DECLS
#endif /* _SIGNAL_PORTABLE_H_ */

View File

@@ -1,60 +0,0 @@
/*
* Derived from Goldfish include/linux/signalfd.h
*
* Copyright (C) 2007 Davide Libenzi <davidel@xmailserver.org>
*
*/
#ifndef _LINUX_SIGNALFD_PORTABLE_H
#define _LINUX_SIGNALFD_PORTABLE_H
#include <linux/types.h>
#include <fcntl.h>
/* Flags for signalfd4. */
#define SFD_CLOEXEC O_CLOEXEC
#define SFD_NONBLOCK O_NONBLOCK
/* For O_CLOEXEC_PORTABLE and O_NONBLOCK_PORTABLE */
#include "fcntl_portable.h"
#define SFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
#define SFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
/*
* This structure is the same for Native and Portable.
* However for MIPS ssi_signo and ssi_errno differ in their
* values and need to be mapped.
*/
struct signalfd_siginfo {
__u32 ssi_signo;
__s32 ssi_errno;
__s32 ssi_code;
__u32 ssi_pid;
__u32 ssi_uid;
__s32 ssi_fd;
__u32 ssi_tid;
__u32 ssi_band;
__u32 ssi_overrun;
__u32 ssi_trapno;
__s32 ssi_status;
__s32 ssi_int;
__u64 ssi_ptr;
__u64 ssi_utime;
__u64 ssi_stime;
__u64 ssi_addr;
/*
* Pad structure to 128 bytes. Remember to update the
* pad size when you add new members. We use a fixed
* size structure to avoid compatibility problems with
* future versions, and we leave extra space for additional
* members. We use fixed size members because this structure
* comes out of a read(2) and we really don't want to have
* a compat (sp?) on read(2).
*/
__u8 __pad[48];
};
#endif /* _LINUX_SIGNALFD_PORTABLE_H */

View File

@@ -1,75 +0,0 @@
/*
* 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 _SOCKET_PORTABLE_H_
#define _SOCKET_PORTABLE_H_
/* Derived from development/ndk/platforms/android-3/include/sys/socket.h */
#define SOCK_STREAM_PORTABLE 1
#define SOCK_DGRAM_PORTABLE 2
#define SOCK_RAW_PORTABLE 3
#define SOCK_RDM_PORTABLE 4
#define SOCK_SEQPACKET_PORTABLE 5
#define SOCK_PACKET_PORTABLE 10
/* Derived from development/ndk/platforms/android-3/arch-arm/include/asm/socket.h */
#define SOL_SOCKET_PORTABLE 1
#define SO_DEBUG_PORTABLE 1
#define SO_REUSEADDR_PORTABLE 2
#define SO_TYPE_PORTABLE 3
#define SO_ERROR_PORTABLE 4
#define SO_DONTROUTE_PORTABLE 5
#define SO_BROADCAST_PORTABLE 6
#define SO_SNDBUF_PORTABLE 7
#define SO_RCVBUF_PORTABLE 8
#define SO_SNDBUFFORCE_PORTABLE 32
#define SO_RCVBUFFORCE_PORTABLE 33
#define SO_KEEPALIVE_PORTABLE 9
#define SO_OOBINLINE_PORTABLE 10
#define SO_NO_CHECK_PORTABLE 11
#define SO_PRIORITY_PORTABLE 12
#define SO_LINGER_PORTABLE 13
#define SO_BSDCOMPAT_PORTABLE 14
#define SO_PASSCRED_PORTABLE 16
#define SO_PEERCRED_PORTABLE 17
#define SO_RCVLOWAT_PORTABLE 18
#define SO_SNDLOWAT_PORTABLE 19
#define SO_RCVTIMEO_PORTABLE 20
#define SO_SNDTIMEO_PORTABLE 21
#define SO_SECURITY_AUTHENTICATION_PORTABLE 22
#define SO_SECURITY_ENCRYPTION_TRANSPORT_PORTABLE 23
#define SO_SECURITY_ENCRYPTION_NETWORK_PORTABLE 24
#define SO_BINDTODEVICE_PORTABLE 25
#define SO_ATTACH_FILTER_PORTABLE 26
#define SO_DETACH_FILTER_PORTABLE 27
#define SO_PEERNAME_PORTABLE 28
#define SO_TIMESTAMP_PORTABLE 29
#define SCM_TIMESTAMP_PORTABLE SO_TIMESTAMP_PORTABLE
#define SO_ACCEPTCONN_PORTABLE 30
#define SO_PEERSEC_PORTABLE 31
#define SO_PASSSEC_PORTABLE 34
#endif /* _SOCKET_PORTABLE_H */

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012, The Android Open Source Project
* Copyright 2014, 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.
@@ -17,23 +17,23 @@
#ifndef _STAT_PORTABLE_H_
#define _STAT_PORTABLE_H_
#include <portability.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#ifdef __LP64__
#define __STAT64_BODY_PORTABLE \
unsigned long st_dev; \
unsigned long st_ino; \
unsigned int st_mode; \
unsigned int st_nlink; \
uid_t st_uid; \
gid_t st_gid; \
unsigned long st_mode; \
unsigned long st_nlink; \
uid_t st_uid; /* 32-bit uid_t */ \
unsigned char padding[4]; \
gid_t st_gid; /* 32-bit gid_t */ \
unsigned char padding2[4]; \
unsigned long st_rdev; \
unsigned long __pad1; \
long st_size; \
int st_blksize; \
int __pad2; \
long st_blksize; \
long st_blocks; \
long st_atime; \
unsigned long st_atime_nsec; \
@@ -41,166 +41,82 @@
unsigned long st_mtime_nsec; \
long st_ctime; \
unsigned long st_ctime_nsec; \
unsigned int __unused4; \
unsigned int __unused5; \
unsigned long __unused_for_largest_size; \
unsigned char padding3[8];
struct stat_portable { __STAT64_BODY_PORTABLE };
struct stat64_portable { __STAT64_BODY_PORTABLE };
#define stat64_portable stat_portable
static inline
void stat_ntop(struct stat *n_stat, struct stat_portable *p_stat)
static inline void stat_n2p(struct stat* pn, struct stat_portable* pp)
{
memset(p_stat, '\0', sizeof(struct stat_portable));
p_stat->st_dev = n_stat->st_dev;
p_stat->st_ino = n_stat->st_ino;
p_stat->st_mode = n_stat->st_mode;
p_stat->st_nlink = n_stat->st_nlink;
p_stat->st_uid = n_stat->st_uid;
p_stat->st_gid = n_stat->st_gid;
p_stat->st_rdev = n_stat->st_rdev;
p_stat->st_size = n_stat->st_size;
p_stat->st_blksize = n_stat->st_blksize;
p_stat->st_blocks = n_stat->st_blocks;
p_stat->st_atime = n_stat->st_atime;
p_stat->st_atime_nsec = n_stat->st_atime_nsec;
p_stat->st_mtime = n_stat->st_mtime;
p_stat->st_mtime_nsec = n_stat->st_mtime_nsec;
p_stat->st_ctime = n_stat->st_ctime;
p_stat->st_ctime_nsec = n_stat->st_ctime_nsec;
memset(pp, '\0', sizeof(struct stat_portable));
pp->st_dev = pn->st_dev;
pp->st_ino = pn->st_ino;
pp->st_mode = pn->st_mode;
pp->st_nlink = pn->st_nlink;
pp->st_uid = pn->st_uid;
pp->st_gid = pn->st_gid;
pp->st_rdev = pn->st_rdev;
pp->st_size = pn->st_size;
pp->st_blksize = pn->st_blksize;
pp->st_blocks = pn->st_blocks;
pp->st_atime = pn->st_atime;
pp->st_atime_nsec = pn->st_atime_nsec;
pp->st_mtime = pn->st_mtime;
pp->st_mtime_nsec = pn->st_mtime_nsec;
pp->st_ctime = pn->st_ctime;
pp->st_ctime_nsec = pn->st_ctime_nsec;
}
#else // ! __LP64__
/* It's easy to change kernel to support stat */
struct stat_portable {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
unsigned char __pad4[4];
long long st_size;
unsigned long st_blksize;
unsigned char __pad5[4];
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
/*
The X86 Version is
struct stat {
unsigned long long st_dev;
unsigned char __pad0[4];
unsigned long __st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long long st_rdev;
unsigned char __pad3[4];
long long st_size;
unsigned long st_blksize;
unsigned long long st_blocks;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
};
*/
/*
The MIPS Version is
struct stat {
unsigned long st_dev;
unsigned long __pad0[3];
unsigned long long st_ino;
unsigned int st_mode;
unsigned int st_nlink;
unsigned long st_uid;
unsigned long st_gid;
unsigned long st_rdev;
unsigned long __pad1[3];
long long st_size;
unsigned long st_atime;
unsigned long st_atime_nsec;
unsigned long st_mtime;
unsigned long st_mtime_nsec;
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long st_blksize;
unsigned long __pad2;
unsigned long long st_blocks;
};
*/
static inline void stat_ntop(struct stat *n_stat, struct stat_portable *p_stat)
int WRAP(fstat)(int a, struct stat_portable* p)
{
memset(p_stat, '\0', sizeof(struct stat_portable));
p_stat->st_dev = n_stat->st_dev;
#if defined(__mips__)
/* MIPS doesn't have __st_ino */
p_stat->__st_ino = 0;
#else
p_stat->__st_ino = n_stat->__st_ino;
#endif
p_stat->st_mode = n_stat->st_mode;
p_stat->st_nlink = n_stat->st_nlink;
p_stat->st_uid = n_stat->st_uid;
p_stat->st_gid = n_stat->st_gid;
p_stat->st_rdev = n_stat->st_rdev;
p_stat->st_size = n_stat->st_size;
p_stat->st_blksize = n_stat->st_blksize;
p_stat->st_blocks = n_stat->st_blocks;
p_stat->st_atime = n_stat->st_atime;
p_stat->st_atime_nsec = n_stat->st_atime_nsec;
p_stat->st_mtime = n_stat->st_mtime;
p_stat->st_mtime_nsec = n_stat->st_mtime_nsec;
p_stat->st_ctime = n_stat->st_ctime;
p_stat->st_ctime_nsec = n_stat->st_ctime_nsec;
p_stat->st_ino = n_stat->st_ino;
struct stat target_stat_obj;
int ret = REAL(fstat)(a, &target_stat_obj);
stat_n2p(&target_stat_obj, p);
return ret;
}
#endif // __LP64__
int WRAP(fstat64)(int a, struct stat64_portable* p)
{
return WRAP(fstat)(a, p);
}
int WRAP(fstatat)(int a, const char* p1, struct stat_portable* p2, int b)
{
struct stat target_stat_obj;
int ret = REAL(fstatat)(a, p1, &target_stat_obj, b);
stat_n2p(&target_stat_obj, p2);
return ret;
}
int WRAP(fstatat64)(int a, const char* b, struct stat64_portable* c, int d)
{
return WRAP(fstatat)(a, b, c, d);
}
int WRAP(lstat)(const char* a, struct stat_portable* p)
{
struct stat target_stat_obj;
int ret = REAL(lstat)(a, &target_stat_obj);
stat_n2p(&target_stat_obj, p);
return ret;
}
int WRAP(lstat64)(const char* a, struct stat64_portable* p)
{
return WRAP(lstat)(a, p);
}
int WRAP(stat)(const char* a, struct stat_portable* p)
{
struct stat target_stat_obj;
int ret = REAL(stat)(a, &target_stat_obj);
stat_n2p(&target_stat_obj, p);
return ret;
}
int WRAP(stat64)(const char* a, struct stat64_portable* p)
{
return WRAP(stat)(a, p);
}
#endif /* _STAT_PORTABLE_H */

View File

@@ -1,56 +0,0 @@
/*
* 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 _STATFS_PORTABLE_H_
#define _STATFS_PORTABLE_H_
#include <sys/vfs.h>
/* It's easy to change kernel to support statfs */
struct statfs_portable {
uint32_t f_type;
uint32_t f_bsize;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_bavail;
uint64_t f_files;
uint64_t f_ffree;
__fsid_t f_fsid;
uint32_t f_namelen;
uint32_t f_frsize;
uint32_t f_flags;
uint32_t f_spare[4];
};
/*
The MIPS Version is
struct statfs {
uint32_t f_type;
uint32_t f_bsize;
uint32_t f_frsize;
uint32_t __pad;
uint64_t f_blocks;
uint64_t f_bfree;
uint64_t f_files;
uint64_t f_ffree;
uint64_t f_bavail;
__fsid_t f_fsid;
uint32_t f_namelen;
uint32_t f_flags;
uint32_t f_spare[5];
};
*/
#endif /* _STATFS_PORTABLE_H_ */

View File

@@ -1,30 +0,0 @@
/*
* Copyright 2014, 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 _STDARG_PORTABLE_H_
#define _STDARG_PORTABLE_H_
// The elements are not important. This struct should be interpreted
// differently by all targets.
typedef struct va_list_portable {
void *ptr1;
void *ptr2;
void *ptr3;
int offset1;
int offset2;
} va_list_portable;
#endif /* _STDARG_PORTABLE_H_ */

View File

@@ -1,51 +0,0 @@
/*
* Derived from bionic/libc/include/sys/eventfd.h
*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SYS_TIMERFD_PORTABLE_H
#define _SYS_TIMERFD_PORTABLE_H
#include <portability.h>
#include <sys/cdefs.h>
#include <fcntl.h>
#include <fcntl_portable.h>
__BEGIN_DECLS
#define TFD_CLOEXEC O_CLOEXEC
#define TFD_NONBLOCK O_NONBLOCK
#define TFD_CLOEXEC_PORTABLE O_CLOEXEC_PORTABLE
#define TFD_NONBLOCK_PORTABLE O_NONBLOCK_PORTABLE
extern int WRAP(timerfd_create)(int clockid, int flags);
__END_DECLS
#endif /* _SYS_TIMERFD_H */

View File

@@ -14,15 +14,15 @@
* limitations under the License.
*/
#ifndef _VFS_PORTABLE_H
#define _VFS_PORTABLE_H
#ifndef _VFS_PORTABLE_H_
#define _VFS_PORTABLE_H_
#include <portability.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/vfs.h>
/* The kernel's __kernel_fsid_t has a 'val' member but glibc uses '__val'. */
typedef struct { int __val[2]; } __fsid_t_portable;
typedef __fsid_t_portable fsid_t_portable;
typedef __fsid_t fsid_t;
#define __STATFS64_BODY_PORTABLE \
uint64_t f_type; \
@@ -32,65 +32,63 @@ typedef __fsid_t_portable fsid_t_portable;
uint64_t f_bavail; \
uint64_t f_files; \
uint64_t f_ffree; \
fsid_t_portable f_fsid; \
fsid_t f_fsid; \
uint64_t f_namelen; \
uint64_t f_frsize; \
uint64_t f_flags; \
uint64_t f_spare[5]; \
uint64_t f_spare[5];
struct statfs_portable { __STATFS64_BODY_PORTABLE };
struct statfs64_portable { __STATFS64_BODY_PORTABLE };
#define statfs64_portable statfs_portable
static inline
void statfs_ntop(struct statfs *n_statfs, struct statfs_portable *p_statfs) {
memset(p_statfs, 0, sizeof(struct statfs_portable));
p_statfs->f_type = n_statfs->f_type;
p_statfs->f_bsize = n_statfs->f_bsize;
p_statfs->f_blocks = n_statfs->f_blocks;
p_statfs->f_bfree = n_statfs->f_bfree;
p_statfs->f_bavail = n_statfs->f_bavail;
p_statfs->f_files = n_statfs->f_files;
p_statfs->f_ffree = n_statfs->f_ffree;
memcpy(&p_statfs->f_fsid, &n_statfs->f_fsid, sizeof(int)*2);
p_statfs->f_namelen = n_statfs->f_namelen;
p_statfs->f_frsize = n_statfs->f_frsize;
p_statfs->f_flags = n_statfs->f_flags;
#undef __STATFS64_BODY_PORTABLE
static void statfs_n2p(const struct statfs* pn, struct statfs_portable* pp)
{
memset(pp, '\0', sizeof(struct statfs_portable));
pp->f_type = pn->f_type;
pp->f_bsize = pn->f_bsize;
pp->f_blocks = pn->f_blocks;
pp->f_bfree = pn->f_bfree;
pp->f_bavail = pn->f_bavail;
pp->f_files = pn->f_files;
pp->f_ffree = pn->f_ffree;
memcpy(&pp->f_fsid, &pn->f_fsid, sizeof(int)*2);
pp->f_namelen = pn->f_namelen;
pp->f_frsize = pn->f_frsize;
pp->f_flags = pn->f_flags;
#ifdef __mips__
memcpy(&p_statfs->f_spare, &n_statfs->f_spare, 4);
memcpy(&pp->f_spare, &pn->f_spare, 4);
#else
memcpy(&p_statfs->f_spare, &n_statfs->f_spare, 5);
memcpy(&pp->f_spare, &pn->f_spare, 5);
#endif
}
static inline
int WRAP(statfs)(const char* path, struct statfs_portable* stat) {
struct statfs native_stat;
int ret = REAL(statfs)(path, &native_stat);
statfs_ntop(&native_stat, stat);
int WRAP(statfs)(const char* path, struct statfs_portable* stat)
{
struct statfs target_stat;
int ret = REAL(statfs)(path, &target_stat);
statfs_n2p(&target_stat, stat);
return ret;
}
static inline
int WRAP(statfs64)(const char* path, struct statfs64_portable* stat) {
return WRAP(statfs)(path, (struct statfs_portable*)stat);
int WRAP(statfs64)(const char* path, struct statfs64_portable* stat)
{
return WRAP(statfs)(path, stat);
}
static inline
int WRAP(fstatfs)(int fd, struct statfs_portable* stat) {
struct statfs native_stat;
int ret = REAL(fstatfs)(fd, &native_stat);
statfs_ntop(&native_stat, stat);
int WRAP(fstatfs)(int fd, struct statfs_portable* stat)
{
struct statfs target_stat;
int ret = REAL(fstatfs)(fd, &target_stat);
statfs_n2p(&target_stat, stat);
return ret;
}
static inline
int WRAP(fstatfs64)(int fd, struct statfs64_portable* stat) {
return WRAP(fstatfs)(fd, (struct statfs_portable*)stat);
int WRAP(fstatfs64)(int fd, struct statfs64_portable* stat)
{
return WRAP(fstatfs)(fd, stat);
}
#endif
#endif /* _VFS_PORTABLE_H */