diff options
author | Shih-wei Liao <sliao@google.com> | 2012-02-05 23:16:33 -0800 |
---|---|---|
committer | Shih-wei Liao <sliao@google.com> | 2012-02-05 23:33:39 -0800 |
commit | 4a0f056e6e94fe257cf9e503ccacbbc6bf598218 (patch) | |
tree | 357e2056bac5fb8c51eaded34ebcbfabb6c06844 | |
parent | ef09ef41ce1e43f76d391c32c1ea0985a2d2db7f (diff) | |
download | gdk-4a0f056e6e94fe257cf9e503ccacbbc6bf598218.tar.gz |
Import additional NDK header files
Change-Id: I18a9d019ec7769cc6c4b1ccaa88f6a62627a7083
Author: Chris Dearman <chris@mips.com>
-rw-r--r-- | headers/include/fcntl.h | 54 | ||||
-rw-r--r-- | headers/include/sys/linux-unistd.h | 212 | ||||
-rw-r--r-- | headers/include/unistd.h | 211 |
3 files changed, 477 insertions, 0 deletions
diff --git a/headers/include/fcntl.h b/headers/include/fcntl.h new file mode 100644 index 0000000..7219dd7 --- /dev/null +++ b/headers/include/fcntl.h @@ -0,0 +1,54 @@ +/* + * 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 _FCNTL_H +#define _FCNTL_H + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <linux/fcntl.h> +#include <unistd.h> /* this is not required, but makes client code much happier */ + +__BEGIN_DECLS + +#ifndef O_ASYNC +#define O_ASYNC FASYNC +#endif + +#ifndef O_CLOEXEC +#define O_CLOEXEC 02000000 +#endif + +extern int open(const char* path, int mode, ...); +extern int openat(int fd, const char* path, int mode, ...); +extern int unlinkat(int dirfd, const char *pathname, int flags); +extern int fcntl(int fd, int command, ...); +extern int creat(const char* path, mode_t mode); + +__END_DECLS + +#endif /* _FCNTL_H */ diff --git a/headers/include/sys/linux-unistd.h b/headers/include/sys/linux-unistd.h new file mode 100644 index 0000000..23853da --- /dev/null +++ b/headers/include/sys/linux-unistd.h @@ -0,0 +1,212 @@ +/* auto-generated by gensyscalls.py, do not touch */ +#ifndef _BIONIC_LINUX_UNISTD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +void _exit (int); +void _exit_thread (int); +pid_t __fork (void); +pid_t _waitpid (pid_t, int*, int, struct rusage*); +int __waitid (int, pid_t, struct siginfo_t*, int,void*); +pid_t __sys_clone (int, void*, int*, void*, int*); +int execve (const char*, char* const*, char* const*); +int __setuid (uid_t); +uid_t getuid (void); +gid_t getgid (void); +uid_t geteuid (void); +gid_t getegid (void); +uid_t getresuid (void); +gid_t getresgid (void); +pid_t gettid (void); +int getgroups (int, gid_t *); +pid_t getpgid (pid_t); +pid_t getppid (void); +pid_t setsid (void); +int setgid (gid_t); +int seteuid (uid_t); +int __setreuid (uid_t, uid_t); +int __setresuid (uid_t, uid_t, uid_t); +int setresgid (gid_t, gid_t, gid_t); +void* __brk (void*); +int kill (pid_t, int); +int tkill (pid_t tid, int sig); +int __ptrace (int request, int pid, void* addr, void* data); +int __set_thread_area (void* user_desc); +int __getpriority (int, int); +int setpriority (int, int, int); +int setrlimit (int resource, const struct rlimit *rlp); +int getrlimit (int resource, struct rlimit *rlp); +int getrusage (int who, struct rusage* r_usage); +int setgroups (int, const gid_t *); +pid_t getpgrp (void); +int setpgid (pid_t, pid_t); +pid_t vfork (void); +int setregid (gid_t, gid_t); +int chroot (const char *); +int prctl (int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5); +int capget (cap_user_header_t header, cap_user_data_t data); +int capset (cap_user_header_t header, const cap_user_data_t data); +int sigaltstack (const stack_t*, stack_t*); +int acct (const char* filepath); +ssize_t read (int, void*, size_t); +ssize_t write (int, const void*, size_t); +ssize_t __pread64 (int, void *, size_t, off_t, off_t); +ssize_t __pwrite64 (int, void *, size_t, off_t, off_t); +int __open (const char*, int, mode_t); +int __openat (int, const char*, int, mode_t); +int close (int); +int creat (const char*, mode_t); +off_t lseek (int, off_t, int); +int __llseek (int, unsigned long, unsigned long, loff_t*, int); +pid_t getpid (void); +void * mmap (void *, size_t, int, int, int, long); +void * __mmap2 (void*, size_t, int, int, int, long); +int munmap (void *, size_t); +void * mremap (void *, size_t, size_t, unsigned long); +int msync (const void *, size_t, int); +int mprotect (const void *, size_t, int); +int madvise (const void *, size_t, int); +int mlock (const void *addr, size_t len); +int munlock (const void *addr, size_t len); +int mincore (void* start, size_t length, unsigned char* vec); +int __ioctl (int, int, void *); +int readv (int, const struct iovec *, int); +int writev (int, const struct iovec *, int); +int __fcntl (int, int, void*); +int flock (int, int); +int fchmod (int, mode_t); +int dup (int); +int pipe (int *); +int pipe2 (int *, int); +int dup2 (int, int); +int select (int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *); +int ftruncate (int, off_t); +int getdents (unsigned int, struct dirent *, unsigned int); +int fsync (int); +int fdatasync (int); +int fchown (int, uid_t, gid_t); +void sync (void); +int __fcntl64 (int, int, void *); +int __fstatfs64 (int, size_t, struct statfs *); +ssize_t sendfile (int out_fd, int in_fd, off_t *offset, size_t count); +int fstatat (int dirfd, const char *path, struct stat *buf, int flags); +int mkdirat (int dirfd, const char *pathname, mode_t mode); +int fchownat (int dirfd, const char *path, uid_t owner, gid_t group, int flags); +int fchmodat (int dirfd, const char *path, mode_t mode, int flags); +int renameat (int olddirfd, const char *oldpath, int newdirfd, const char *newpath); +int link (const char*, const char*); +int unlink (const char*); +int unlinkat (int, const char *, int); +int chdir (const char*); +int mknod (const char*, mode_t, dev_t); +int chmod (const char*,mode_t); +int chown (const char *, uid_t, gid_t); +int lchown (const char*, uid_t, gid_t); +int mount (const char*, const char*, const char*, unsigned long, const void*); +int umount (const char*); +int umount2 (const char*, int); +int fstat (int, struct stat*); +int stat (const char *, struct stat *); +int lstat (const char *, struct stat *); +int mkdir (const char *, mode_t); +int readlink (const char *, char *, size_t); +int rmdir (const char *); +int rename (const char *, const char *); +int __getcwd (char * buf, size_t size); +int access (const char *, int); +int symlink (const char *, const char *); +int fchdir (int); +int truncate (const char*, off_t); +int __statfs64 (const char *, size_t, struct statfs *); +int pause (void); +int gettimeofday (struct timeval*, struct timezone*); +int settimeofday (const struct timeval*, const struct timezone*); +clock_t times (struct tms *); +int nanosleep (const struct timespec *, struct timespec *); +int clock_gettime (clockid_t clk_id, struct timespec *tp); +int clock_settime (clockid_t clk_id, const struct timespec *tp); +int clock_getres (clockid_t clk_id, struct timespec *res); +int clock_nanosleep (const struct timespec *req, struct timespec *rem); +int getitimer (int, const struct itimerval *); +int setitimer (int, const struct itimerval *, struct itimerval *); +int __timer_create (clockid_t clockid, struct sigevent *evp, timer_t *timerid); +int __timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*); +int __timer_gettime (timer_t, struct itimerspec*); +int __timer_getoverrun (timer_t); +int __timer_delete (timer_t); +int utimes (const char*, const struct timeval tvp[2]); +int sigaction (int, const struct sigaction *, struct sigaction *); +int sigprocmask (int, const sigset_t *, sigset_t *); +int __sigsuspend (int unused1, int unused2, unsigned mask); +int __rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize); +int __rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize); +int __rt_sigtimedwait (const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size); +int sigpending (sigset_t *); +int socket (int, int, int); +int socketpair (int, int, int, int*); +int bind (int, struct sockaddr *, int); +int connect (int, struct sockaddr *, socklen_t); +int listen (int, int); +int accept (int, struct sockaddr *, socklen_t *); +int getsockname (int, struct sockaddr *, socklen_t *); +int getpeername (int, struct sockaddr *, socklen_t *); +int sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t); +int recvfrom (int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *); +int shutdown (int, int); +int setsockopt (int, int, int, const void *, socklen_t); +int getsockopt (int, int, int, void *, socklen_t *); +int sendmsg (int, const struct msghdr *, unsigned int); +int recvmsg (int, struct msghdr *, unsigned int); +int socket (int, int, int); +int bind (int, struct sockaddr *, int); +int connect (int, struct sockaddr *, socklen_t); +int listen (int, int); +int accept (int, struct sockaddr *, socklen_t *); +int getsockname (int, struct sockaddr *, socklen_t *); +int getpeername (int, struct sockaddr *, socklen_t *); +int socketpair (int, int, int, int*); +int sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t); +int recvfrom (int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *); +int shutdown (int, int); +int setsockopt (int, int, int, const void *, socklen_t); +int getsockopt (int, int, int, void *, socklen_t *); +int sendmsg (int, const struct msghdr *, unsigned int); +int recvmsg (int, struct msghdr *, unsigned int); +int __socketcall (int, unsigned long*); +int sched_setscheduler (pid_t pid, int policy, const struct sched_param *param); +int sched_getscheduler (pid_t pid); +int sched_yield (void); +int sched_setparam (pid_t pid, const struct sched_param *param); +int sched_getparam (pid_t pid, struct sched_param *param); +int sched_get_priority_max (int policy); +int sched_get_priority_min (int policy); +int sched_rr_get_interval (pid_t pid, struct timespec *interval); +int ioprio_set (int which, int who, int ioprio); +int ioprio_get (int which, int who); +int uname (struct utsname *); +pid_t __wait4 (pid_t pid, int *status, int options, struct rusage *rusage); +mode_t umask (mode_t); +int __reboot (int, int, int, void *); +int __syslog (int, char *, int); +int init_module (void *, unsigned long, const char *); +int delete_module (const char*, unsigned int); +int klogctl (int, char *, int); +int sysinfo (struct sysinfo *); +int futex (void *, int, int, void *, void *, int); +int epoll_create (int size); +int epoll_ctl (int epfd, int op, int fd, struct epoll_event *event); +int epoll_wait (int epfd, struct epoll_event *events, int max, int timeout); +int inotify_init (void); +int inotify_add_watch (int, const char *, unsigned int); +int inotify_rm_watch (int, unsigned int); +int poll (struct pollfd *, unsigned int, long); +int eventfd (unsigned int, int); +int __set_tls (void*); +int cacheflush (long start, long end, long flags); +#ifdef __cplusplus +} +#endif + +#endif /* _BIONIC_LINUX_UNISTD_H_ */ diff --git a/headers/include/unistd.h b/headers/include/unistd.h new file mode 100644 index 0000000..21154ad --- /dev/null +++ b/headers/include/unistd.h @@ -0,0 +1,211 @@ +/* + * 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 _UNISTD_H_ +#define _UNISTD_H_ + +#include <stddef.h> +#include <sys/cdefs.h> +#include <sys/types.h> +#include <sys/select.h> +#include <sys/sysconf.h> +#include <linux/capability.h> +#include <pathconf.h> + +__BEGIN_DECLS + +/* Standard file descriptor numbers. */ +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 + +/* Values for whence in fseek and lseek */ +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 + +extern char **environ; +extern __noreturn void _exit(int); + +extern pid_t fork(void); +extern pid_t vfork(void); +extern pid_t getpid(void); +extern pid_t gettid(void); +extern pid_t getpgid(pid_t); +extern int setpgid(pid_t, pid_t); +extern pid_t getppid(void); +extern pid_t getpgrp(void); +extern int setpgrp(void); +extern pid_t setsid(void); + +extern int execv(const char *, char * const *); +extern int execvp(const char *, char * const *); +extern int execve(const char *, char * const *, char * const *); +extern int execl(const char *, const char *, ...); +extern int execlp(const char *, const char *, ...); +extern int execle(const char *, const char *, ...); +extern int capget(cap_user_header_t hdrp, cap_user_data_t datap); +extern int capset(cap_user_header_t hdrp, const cap_user_data_t datap); +extern int prctl(int option, unsigned long arg2, unsigned long arg3, + unsigned long arg4, unsigned long arg5); + +extern int nice(int); + +extern int setuid(uid_t); +extern uid_t getuid(void); +extern int seteuid(uid_t); +extern uid_t geteuid(void); +extern int setgid(gid_t); +extern gid_t getgid(void); +extern int setegid(gid_t); +extern gid_t getegid(void); +extern int getgroups(int, gid_t *); +extern int setgroups(size_t, const gid_t *); +extern int setreuid(uid_t, uid_t); +extern int setregid(gid_t, gid_t); +extern int setresuid(uid_t, uid_t, uid_t); +extern int setresgid(gid_t, gid_t, gid_t); +extern int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid); +extern int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid); +extern int issetugid(void); +extern char* getlogin(void); +extern char* getusershell(void); +extern void setusershell(void); +extern void endusershell(void); + + + +/* Macros for access() */ +#define R_OK 4 /* Read */ +#define W_OK 2 /* Write */ +#define X_OK 1 /* Execute */ +#define F_OK 0 /* Existence */ + +extern int access(const char *, int); +extern int link(const char *, const char *); +extern int unlink(const char *); +extern int chdir(const char *); +extern int fchdir(int); +extern int rmdir(const char *); +extern int pipe(int *); +#ifdef _GNU_SOURCE /* GLibc compatibility */ +extern int pipe2(int *, int); +#endif +extern int chroot(const char *); +extern int symlink(const char *, const char *); +extern int readlink(const char *, char *, size_t); +extern int chown(const char *, uid_t, gid_t); +extern int fchown(int, uid_t, gid_t); +extern int lchown(const char *, uid_t, gid_t); +extern int truncate(const char *, off_t); +extern char *getcwd(char *, size_t); + +extern int sync(void); + +extern int close(int); +extern off_t lseek(int, off_t, int); +extern loff_t lseek64(int, loff_t, int); + +extern ssize_t read(int, void *, size_t); +extern ssize_t write(int, const void *, size_t); +extern ssize_t pread(int, void *, size_t, off_t); +extern ssize_t pwrite(int, const void *, size_t, off_t); + +extern int dup(int); +extern int dup2(int, int); +extern int fcntl(int, int, ...); +extern int ioctl(int, int, ...); +extern int flock(int, int); +extern int fsync(int); +extern int fdatasync(int); +extern int ftruncate(int, off_t); + +extern int pause(void); +extern unsigned int alarm(unsigned int); +extern unsigned int sleep(unsigned int); +extern int usleep(unsigned long); + +extern int gethostname(char *, size_t); + +extern int getdtablesize(void); + +extern void *__brk(void *); +extern int brk(void *); +extern void *sbrk(ptrdiff_t); + +extern int getopt(int, char * const *, const char *); +extern char *optarg; +extern int optind, opterr, optopt; + +extern int isatty(int); +extern char* ttyname(int); +extern int ttyname_r(int, char*, size_t); + +extern int acct(const char* filepath); + +static __inline__ int getpagesize(void) { + extern unsigned int __page_size; + return __page_size; +} +static __inline__ int __getpageshift(void) { + extern unsigned int __page_shift; + return __page_shift; +} + +extern int sysconf(int name); + +extern int daemon(int, int); + +/* A special syscall that is only available on the ARM, not x86 function. */ +extern int cacheflush(long start, long end, long flags); + +extern pid_t tcgetpgrp(int fd); +extern int tcsetpgrp(int fd, pid_t _pid); + +#if 0 /* MISSING FROM BIONIC */ +extern pid_t getsid(pid_t); +extern int execvpe(const char *, char * const *, char * const *); +extern int execlpe(const char *, const char *, ...); +extern int getfsuid(uid_t); +extern int setfsuid(uid_t); +extern int getlogin_r(char* name, size_t namesize); +extern int sethostname(const char *, size_t); +extern int getdomainname(char *, size_t); +extern int setdomainname(const char *, size_t); +#endif /* MISSING */ + +/* Used to retry syscalls that can return EINTR. */ +#define TEMP_FAILURE_RETRY(exp) ({ \ + typeof (exp) _rc; \ + do { \ + _rc = (exp); \ + } while (_rc == -1 && errno == EINTR); \ + _rc; }) + +__END_DECLS + +#endif /* _UNISTD_H_ */ |