summaryrefslogtreecommitdiff
path: root/libc/sysdeps
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2006-11-04 19:54:32 +0000
committerEric Andersen <andersen@codepoet.org>2006-11-04 19:54:32 +0000
commitb56362fde867f487068901d41a19cb1d95bf364b (patch)
tree8d44e6f499b8fc792dccac00ccf7758fe5e03c9a /libc/sysdeps
parentc4ae8409ba034fcd7092d891381c3711e62d5b25 (diff)
mips64 patch from Atsushi Nemoto:
Adjust for mips64 kernel.
Diffstat (limited to 'libc/sysdeps')
-rw-r--r--libc/sysdeps/linux/mips/bits/fcntl.h18
-rw-r--r--libc/sysdeps/linux/mips/bits/kernel_stat.h56
-rw-r--r--libc/sysdeps/linux/mips/bits/siginfo.h3
-rw-r--r--libc/sysdeps/linux/mips/bits/stat.h62
4 files changed, 130 insertions, 9 deletions
diff --git a/libc/sysdeps/linux/mips/bits/fcntl.h b/libc/sysdeps/linux/mips/bits/fcntl.h
index 1f615b476..08c868696 100644
--- a/libc/sysdeps/linux/mips/bits/fcntl.h
+++ b/libc/sysdeps/linux/mips/bits/fcntl.h
@@ -62,7 +62,11 @@
#endif
#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 0x2000 /* Allow large file opens. */
+# if __WORDSIZE == 64
+# define O_LARGEFILE 0
+# else
+# define O_LARGEFILE 0x2000 /* Allow large file opens. */
+# endif
#endif
/* Values for the second argument to `fcntl'. */
@@ -81,9 +85,15 @@
# define F_SETLKW F_SETLKW64 /* Set record locking info (blocking). */
#endif
-#define F_GETLK64 33 /* Get record locking info. */
-#define F_SETLK64 34 /* Set record locking info (non-blocking). */
-#define F_SETLKW64 35 /* Set record locking info (blocking). */
+#if __WORDSIZE == 64
+# define F_GETLK64 14 /* Get record locking info. */
+# define F_SETLK64 6 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 7 /* Set record locking info (blocking). */
+#else
+# define F_GETLK64 33 /* Get record locking info. */
+# define F_SETLK64 34 /* Set record locking info (non-blocking). */
+# define F_SETLKW64 35 /* Set record locking info (blocking). */
+#endif
#if defined __USE_BSD || defined __USE_UNIX98
# define F_SETOWN 24 /* Get owner of socket (receiver of SIGIO). */
diff --git a/libc/sysdeps/linux/mips/bits/kernel_stat.h b/libc/sysdeps/linux/mips/bits/kernel_stat.h
index 2bce38884..529894264 100644
--- a/libc/sysdeps/linux/mips/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/mips/bits/kernel_stat.h
@@ -5,9 +5,57 @@
* struct kernel_stat should look like... It turns out each arch has a
* different opinion on the subject... */
-#if __WORDSIZE == 64
-#define kernel_stat kernel_stat64
-#else
+#include <sgidefs.h>
+
+#if _MIPS_SIM == _MIPS_SIM_ABI64
+/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+struct kernel_stat {
+ __kernel_dev_t st_dev;
+ unsigned int st_pad1[3];
+ __kernel_ino_t st_ino;
+ __kernel_mode_t st_mode;
+ __kernel_nlink_t st_nlink;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
+ __kernel_dev_t st_rdev;
+ unsigned int st_pad2[3];
+ __kernel_off_t st_size;
+ unsigned int st_atime;
+ unsigned int reserved0;
+ unsigned int st_mtime;
+ unsigned int reserved1;
+ unsigned int st_ctime;
+ unsigned int reserved2;
+ unsigned int st_blksize;
+ unsigned int reserved3;
+ unsigned long st_blocks;
+};
+#define kernel_stat64 kernel_stat
+#elif _MIPS_SIM == _MIPS_SIM_NABI32
+/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+struct kernel_stat {
+ unsigned int st_dev;
+ unsigned int st_pad1[3];
+ unsigned long long st_ino;
+ __kernel_mode_t st_mode;
+ __kernel_nlink_t st_nlink;
+ __kernel_uid_t st_uid;
+ __kernel_gid_t st_gid;
+ unsigned int st_rdev;
+ unsigned int st_pad2[3];
+ unsigned long long st_size;
+ unsigned int st_atime;
+ unsigned int reserved0;
+ unsigned int st_mtime;
+ unsigned int reserved1;
+ unsigned int st_ctime;
+ unsigned int reserved2;
+ unsigned int st_blksize;
+ unsigned int reserved3;
+ unsigned long long st_blocks;
+};
+#define kernel_stat64 kernel_stat
+#else /* O32 */
struct kernel_stat {
__kernel_dev_t st_dev;
long st_pad1[3];
@@ -30,7 +78,6 @@ struct kernel_stat {
long st_blocks;
long st_pad4[14];
};
-#endif
struct kernel_stat64 {
unsigned long st_dev;
@@ -53,6 +100,7 @@ struct kernel_stat64 {
unsigned long st_pad2;
long long st_blocks;
};
+#endif /* O32 */
#endif /* _BITS_STAT_STRUCT_H */
diff --git a/libc/sysdeps/linux/mips/bits/siginfo.h b/libc/sysdeps/linux/mips/bits/siginfo.h
index 787e36513..ba3e1f630 100644
--- a/libc/sysdeps/linux/mips/bits/siginfo.h
+++ b/libc/sysdeps/linux/mips/bits/siginfo.h
@@ -265,7 +265,8 @@ enum
/* Structure to transport application-defined values with signals. */
# define __SIGEV_MAX_SIZE 64
-# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE / sizeof (int)) - 3)
+# define __SIGEV_HEAD_SIZE (sizeof(long) + 2*sizeof(int))
+# define __SIGEV_PAD_SIZE ((__SIGEV_MAX_SIZE - __SIGEV_HEAD_SIZE) / sizeof (int))
/* Forward declaration of the `pthread_attr_t' type. */
struct __pthread_attr_s;
diff --git a/libc/sysdeps/linux/mips/bits/stat.h b/libc/sysdeps/linux/mips/bits/stat.h
index bb4076f05..0bbc84ea4 100644
--- a/libc/sysdeps/linux/mips/bits/stat.h
+++ b/libc/sysdeps/linux/mips/bits/stat.h
@@ -20,6 +20,8 @@
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
+#include <sgidefs.h>
+
/* Versions of the `struct stat' data structure. */
#define _STAT_VER_LINUX_OLD 1
#define _STAT_VER_KERNEL 1
@@ -33,6 +35,7 @@
#define _MKNOD_VER _MKNOD_VER_LINUX /* The bits defined below. */
+#if _MIPS_SIM == _MIPS_SIM_ABI32
/* Structure describing file characteristics. */
struct stat
{
@@ -76,8 +79,38 @@ struct stat
#endif
long int st_pad5[14];
};
+#else /* N32 || N64 */
+/* The memory layout is the same as of struct stat64 of the 32-bit kernel. */
+struct stat {
+ unsigned int st_dev;
+ int st_pad1[3];
+ __ino_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ unsigned int st_rdev; /* Device number, if device. */
+ int st_pad2[3];
+ __off_t st_size; /* Size of file, in bytes. */
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and
+ * st_ctime but we don't have it under Linux.
+ */
+ int st_atime;
+ int reserved0; /* Reserved for st_atime expansion */
+ int st_mtime;
+ int reserved1; /* Reserved for st_mtime expansion */
+ int st_ctime;
+ int reserved2; /* Reserved for st_ctime expansion */
+ int st_blksize; /* Optimal block size for I/O. */
+ int st_pad3;
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+ int st_pad4[14];
+};
+#endif /* N32 || N64 */
#ifdef __USE_LARGEFILE64
+#if _MIPS_SIM == _MIPS_SIM_ABI32
struct stat64
{
__dev_t st_dev;
@@ -105,6 +138,35 @@ struct stat64
__blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */
long int st_pad4[14];
};
+#else /* N32 || N64 */
+/* stat64 of N32/N64 is just an alias of stat syscall. */
+struct stat64 {
+ unsigned int st_dev;
+ int st_pad1[3];
+ __ino_t st_ino; /* File serial number. */
+ __mode_t st_mode; /* File mode. */
+ __nlink_t st_nlink; /* Link count. */
+ __uid_t st_uid; /* User ID of the file's owner. */
+ __gid_t st_gid; /* Group ID of the file's group.*/
+ unsigned int st_rdev; /* Device number, if device. */
+ int st_pad2[3];
+ __off_t st_size; /* Size of file, in bytes. */
+ /*
+ * Actually this should be timestruc_t st_atime, st_mtime and
+ * st_ctime but we don't have it under Linux.
+ */
+ int st_atime;
+ int reserved0; /* Reserved for st_atime expansion */
+ int st_mtime;
+ int reserved1; /* Reserved for st_mtime expansion */
+ int st_ctime;
+ int reserved2; /* Reserved for st_ctime expansion */
+ int st_blksize; /* Optimal block size for I/O. */
+ int st_pad3;
+ __blkcnt_t st_blocks; /* Number of 512-byte blocks allocated. */
+ int st_pad4[14];
+};
+#endif /* N32 || N64 */
#endif
/* Tell code we have these members. */