From 6437eac15a5b595ab26ef51834509c44695eb7e4 Mon Sep 17 00:00:00 2001 From: Raghu Gandham Date: Thu, 2 Aug 2012 16:50:10 -0700 Subject: [PATCH] MIPS support to sys/ headers Change-Id: I32207a1d918e4842da341f6b242ae39c69a83b03 --- libc/include/sys/_sigdefs.h | 31 ++++++++++++++++++++++++++++++ libc/include/sys/ioctl_compat.h | 6 ++++++ libc/include/sys/socket.h | 10 ++++++++++ libc/include/sys/stat.h | 34 +++++++++++++++++++++++++++++++++ libc/include/sys/vfs.h | 17 +++++++++++++++++ 5 files changed, 98 insertions(+) diff --git a/libc/include/sys/_sigdefs.h b/libc/include/sys/_sigdefs.h index 6822c2558..6b47a035d 100644 --- a/libc/include/sys/_sigdefs.h +++ b/libc/include/sys/_sigdefs.h @@ -41,15 +41,45 @@ __BIONIC_SIGDEF(QUIT,3,"Quit") __BIONIC_SIGDEF(ILL,4,"Illegal instruction") __BIONIC_SIGDEF(TRAP,5,"Trap") __BIONIC_SIGDEF(ABRT,6,"Aborted") +#ifdef __mips__ +__BIONIC_SIGDEF(EMT,7,"EMT") +#else __BIONIC_SIGDEF(BUS,7,"Bus error") +#endif __BIONIC_SIGDEF(FPE,8,"Floating point exception") __BIONIC_SIGDEF(KILL,9,"Killed") +#ifdef __mips__ +__BIONIC_SIGDEF(BUS,10,"Bus error") +#else __BIONIC_SIGDEF(USR1,10,"User signal 1") +#endif __BIONIC_SIGDEF(SEGV,11,"Segmentation fault") +#ifdef __mips__ +__BIONIC_SIGDEF(SYS,12,"Bad system call") +#else __BIONIC_SIGDEF(USR2,12,"User signal 2") +#endif __BIONIC_SIGDEF(PIPE,13,"Broken pipe") __BIONIC_SIGDEF(ALRM,14,"Alarm clock") __BIONIC_SIGDEF(TERM,15,"Terminated") +#ifdef __mips__ +__BIONIC_SIGDEF(USR1,16,"User signal 1") +__BIONIC_SIGDEF(USR2,17,"User signal 2") +__BIONIC_SIGDEF(CHLD,18,"Child exited") +__BIONIC_SIGDEF(PWR,19,"Power failure") +__BIONIC_SIGDEF(WINCH,20,"Window size changed") +__BIONIC_SIGDEF(URG,21,"Urgent I/O condition") +__BIONIC_SIGDEF(IO,22,"I/O possible") +__BIONIC_SIGDEF(STOP,23,"Stopped (signal)") +__BIONIC_SIGDEF(TSTP,24,"Stopped") +__BIONIC_SIGDEF(CONT,25,"Continue") +__BIONIC_SIGDEF(TTIN,26,"Stopped (tty input)") +__BIONIC_SIGDEF(TTOU,27,"Stopped (tty output)") +__BIONIC_SIGDEF(VTALRM,28,"Virtual timer expired") +__BIONIC_SIGDEF(PROF,29,"Profiling timer expired") +__BIONIC_SIGDEF(XCPU,30,"CPU time limit exceeded") +__BIONIC_SIGDEF(XFSZ,31,"File size limit exceeded") +#else __BIONIC_SIGDEF(STKFLT,16,"Stack fault") __BIONIC_SIGDEF(CHLD,17,"Child exited") __BIONIC_SIGDEF(CONT,18,"Continue") @@ -66,5 +96,6 @@ __BIONIC_SIGDEF(WINCH,28,"Window size changed") __BIONIC_SIGDEF(IO,29,"I/O possible") __BIONIC_SIGDEF(PWR,30,"Power failure") __BIONIC_SIGDEF(SYS,31,"Bad system call") +#endif #undef __BIONIC_SIGDEF diff --git a/libc/include/sys/ioctl_compat.h b/libc/include/sys/ioctl_compat.h index cab5c80a5..d9ba4c7f6 100644 --- a/libc/include/sys/ioctl_compat.h +++ b/libc/include/sys/ioctl_compat.h @@ -42,6 +42,7 @@ /*#include */ /*#include */ +#if !defined(__mips__) struct tchars { char t_intrc; /* interrupt */ char t_quitc; /* quit */ @@ -73,6 +74,7 @@ struct sgttyb { short sg_flags; /* mode flags */ }; #endif +#endif #ifdef USE_OLD_TTY # undef TIOCGETD @@ -84,9 +86,11 @@ struct sgttyb { # define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ #endif #define TIOCHPCL _IO('t', 2) /* hang up on last close */ +#if !defined(__mips__) #define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ #define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ #define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/ +#endif #define TIOCSETC _IOW('t',17,struct tchars)/* set special characters */ #define TIOCGETC _IOR('t',18,struct tchars)/* get special characters */ #if 0 @@ -158,8 +162,10 @@ struct sgttyb { #define LPENDIN (PENDIN>>16) #define LDECCTQ (DECCTQ>>16) #define LNOFLSH (NOFLSH>>16) +#if !defined(__mips__) #define TIOCSLTC _IOW('t',117,struct ltchars)/* set local special chars*/ #define TIOCGLTC _IOR('t',116,struct ltchars)/* get local special chars*/ +#endif #define OTIOCCONS _IO('t', 98) /* for hp300 -- sans int arg */ #define OTTYDISC 0 #define NETLDISC 1 diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h index 208663ea2..f6acee8d5 100644 --- a/libc/include/sys/socket.h +++ b/libc/include/sys/socket.h @@ -34,12 +34,22 @@ __BEGIN_DECLS +#ifdef __mips__ +#define SOCK_DGRAM 1 +#define SOCK_STREAM 2 +#define SOCK_RAW 3 +#define SOCK_RDM 4 +#define SOCK_SEQPACKET 5 +#define SOCK_DCCP 6 +#define SOCK_PACKET 10 +#else #define SOCK_STREAM 1 #define SOCK_DGRAM 2 #define SOCK_RAW 3 #define SOCK_RDM 4 #define SOCK_SEQPACKET 5 #define SOCK_PACKET 10 +#endif #ifdef __i386__ # define __socketcall extern __attribute__((__cdecl__)) diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h index 87fcfd07d..bee648e99 100644 --- a/libc/include/sys/stat.h +++ b/libc/include/sys/stat.h @@ -41,6 +41,39 @@ __BEGIN_DECLS * Note: The kernel zero's the padded region because glibc might read them * in the hope that the kernel has stretched to using larger sizes. */ +#ifdef __mips__ +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; +}; +#else struct stat { unsigned long long st_dev; unsigned char __pad0[4]; @@ -70,6 +103,7 @@ struct stat { unsigned long long st_ino; }; +#endif /* For compatibility with GLibc, we provide macro aliases * for the non-Posix nano-seconds accessors. diff --git a/libc/include/sys/vfs.h b/libc/include/sys/vfs.h index 4adaf5fd7..d14944dc9 100644 --- a/libc/include/sys/vfs.h +++ b/libc/include/sys/vfs.h @@ -35,6 +35,22 @@ __BEGIN_DECLS /* note: this corresponds to the kernel's statfs64 type */ +#ifdef __mips__ +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; + __kernel_fsid_t f_fsid; + uint32_t f_namelen; + uint32_t f_spare[6]; +}; +#else struct statfs { uint32_t f_type; uint32_t f_bsize; @@ -48,6 +64,7 @@ struct statfs { uint32_t f_frsize; uint32_t f_spare[5]; }; +#endif #define ADFS_SUPER_MAGIC 0xadf5 #define AFFS_SUPER_MAGIC 0xADFF