svn commit: trunk/uClibc/libc/sysdeps/linux/mips/bits
andersen at uclibc.org
andersen at uclibc.org
Sat Nov 4 11:54:32 PST 2006
Author: andersen
Date: 2006-11-04 11:54:32 -0800 (Sat, 04 Nov 2006)
New Revision: 16504
Log:
mips64 patch from Atsushi Nemoto:
Adjust for mips64 kernel.
Modified:
trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h
trunk/uClibc/libc/sysdeps/linux/mips/bits/kernel_stat.h
trunk/uClibc/libc/sysdeps/linux/mips/bits/siginfo.h
trunk/uClibc/libc/sysdeps/linux/mips/bits/stat.h
Changeset:
Modified: trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h 2006-11-04 19:53:15 UTC (rev 16503)
+++ trunk/uClibc/libc/sysdeps/linux/mips/bits/fcntl.h 2006-11-04 19:54:32 UTC (rev 16504)
@@ -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). */
Modified: trunk/uClibc/libc/sysdeps/linux/mips/bits/kernel_stat.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/mips/bits/kernel_stat.h 2006-11-04 19:53:15 UTC (rev 16503)
+++ trunk/uClibc/libc/sysdeps/linux/mips/bits/kernel_stat.h 2006-11-04 19:54:32 UTC (rev 16504)
@@ -5,11 +5,59 @@
* 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];
__kernel_ino_t st_ino;
__kernel_mode_t st_mode;
@@ -30,7 +78,6 @@
long st_blocks;
long st_pad4[14];
};
-#endif
struct kernel_stat64 {
unsigned long st_dev;
@@ -53,6 +100,7 @@
unsigned long st_pad2;
long long st_blocks;
};
+#endif /* O32 */
#endif /* _BITS_STAT_STRUCT_H */
Modified: trunk/uClibc/libc/sysdeps/linux/mips/bits/siginfo.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/mips/bits/siginfo.h 2006-11-04 19:53:15 UTC (rev 16503)
+++ trunk/uClibc/libc/sysdeps/linux/mips/bits/siginfo.h 2006-11-04 19:54:32 UTC (rev 16504)
@@ -265,7 +265,8 @@
/* 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;
Modified: trunk/uClibc/libc/sysdeps/linux/mips/bits/stat.h
===================================================================
--- trunk/uClibc/libc/sysdeps/linux/mips/bits/stat.h 2006-11-04 19:53:15 UTC (rev 16503)
+++ trunk/uClibc/libc/sysdeps/linux/mips/bits/stat.h 2006-11-04 19:54:32 UTC (rev 16504)
@@ -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 @@
#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 @@
__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. */
More information about the uClibc-cvs
mailing list