Define mode_t via __mode_t

Use __uint32_t to avoid the use of GCC-specific _ST_INT32.

Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
This commit is contained in:
Sebastian Huber 2016-04-15 13:44:15 +02:00 committed by Corinna Vinschen
parent e77040b2bf
commit eba91a5d0a
4 changed files with 23 additions and 49 deletions

View File

@ -56,6 +56,22 @@ typedef unsigned short __ino_t;
#endif
#endif
#ifndef __machine_mode_t_defined
#if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
typedef int __mode_t;
#else
#if defined(__sparc__) && !defined(__sparc_v9__)
#ifdef __svr4__
typedef unsigned long __mode_t;
#else
typedef unsigned short __mode_t;
#endif
#else
typedef __uint32_t __mode_t;
#endif
#endif
#endif
#ifndef __machine_off64_t_defined
__extension__ typedef long long _off64_t;
#endif

View File

@ -59,27 +59,8 @@ typedef quad_t * qaddr_t;
#include <sys/_types.h>
#include <sys/_stdint.h>
#ifdef __i386__
#if defined (GO32) || defined (__MSDOS__)
#define __MS_types__
#endif
#endif
# include <stddef.h>
/* To ensure the stat struct's layout doesn't change when sizeof(int), etc.
changes, we assume sizeof short and long never change and have all types
used to define struct stat use them and not int where possible.
Where not possible, _ST_INTxx are used. It would be preferable to not have
such assumptions, but until the extra fluff is necessary, it's avoided.
No 64 bit targets use stat yet. What to do about them is postponed
until necessary. */
#ifdef __GNUC__
#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
#else
#define _ST_INT32
#endif
#if __BSD_VISIBLE
#include <sys/select.h>
# define physadr physadr_t
@ -144,7 +125,8 @@ typedef __ino_t ino_t; /* inode number */
#define _INO_T_DECLARED
#endif
#ifdef __MS_types__
#if defined(__i386__) && (defined(GO32) || defined(__MSDOS__))
typedef char * addr_t;
typedef unsigned long vm_offset_t;
typedef unsigned long vm_size_t;
@ -159,7 +141,7 @@ typedef unsigned int u_int32_t;
typedef long long int64_t;
typedef unsigned long long u_int64_t;
typedef int32_t register_t;
#endif /* __MS_types__ */
#endif /* __i386__ && (GO32 || __MSDOS__) */
/*
* All these should be machine specific - right now they are all broken.
@ -190,10 +172,6 @@ typedef __pid_t pid_t; /* process id */
#define _PID_T_DECLARED
#endif
#if defined(__rtems__)
typedef _mode_t mode_t;
#endif
#ifndef _KEY_T_DECLARED
typedef __key_t key_t; /* IPC key */
#define _KEY_T_DECLARED
@ -204,29 +182,13 @@ typedef _ssize_t ssize_t;
#define _SSIZE_T_DECLARED
#endif
#if !defined(__CYGWIN__) && !defined(__rtems__)
#ifdef __MS_types__
typedef char * addr_t;
typedef int mode_t;
#else
#if defined (__sparc__) && !defined (__sparc_v9__)
#ifdef __svr4__
typedef unsigned long mode_t;
#else
typedef unsigned short mode_t;
#ifndef _MODE_T_DECLARED
typedef __mode_t mode_t; /* permissions */
#define _MODE_T_DECLARED
#endif
#else
typedef unsigned int mode_t _ST_INT32;
#endif
#endif /* ! __MS_types__ */
#endif /*__CYGWIN__*/
typedef unsigned short nlink_t;
#undef __MS_types__
#undef _ST_INT32
#ifndef __clockid_t_defined
typedef _CLOCKID_T_ clockid_t;
#define __clockid_t_defined

View File

@ -22,7 +22,7 @@ typedef _off_t _fpos_t;
typedef unsigned long __ino_t;
#define __machine_ino_t_defined
typedef __uint32_t _mode_t;
typedef __uint32_t __mode_t;
#define __machine_mode_t_defined
#endif /* _MACHINE__TYPES_H */

View File

@ -104,10 +104,6 @@ typedef __int32_t register_t;
typedef char *addr_t;
#endif
#ifndef __mode_t_defined
#define __mode_t_defined
typedef unsigned mode_t;
#endif
#endif /*__BIT_TYPES_DEFINED*/
#if !defined(__INSIDE_CYGWIN__) || !defined(__cplusplus)