typedef intmax_t atomic_max_t;
typedef uintmax_t uatomic_max_t;
-#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
- (abort(), 0)
+#define __arch_compare_and_exchange_val_8_acq(mem, newval, oldval) \
+ (abort(), 0)
-#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
- (abort(), 0)
+#define __arch_compare_and_exchange_val_16_acq(mem, newval, oldval) \
+ (abort(), 0)
-#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
- ({ \
- __typeof__(*(mem)) __prev; \
- __asm__ __volatile__( \
- "/* __arch_compare_and_exchange_val_32_acq */\n" \
- "1: ssrf 5\n" \
- " ld.w %[result], %[m]\n" \
- " cp.w %[result], %[old]\n" \
- " brne 2f\n" \
- " stcond %[m], %[new]\n" \
- " brne 1b\n" \
- "2:" \
- : [result] "=&r"(__result), [m] "=m"(*(mem)) \
- : "m"(*(mem)), [old] "ir"(oldval), \
- [new] "r"(newval) \
- : "memory", "cc"); \
- __prev; \
- })
+#define __arch_compare_and_exchange_val_32_acq(mem, newval, oldval) \
+ ({ \
+ __typeof__(*(mem)) __prev; \
+ __asm__ __volatile__( \
+ "/* __arch_compare_and_exchange_val_32_acq */\n" \
+ "1: ssrf 5\n" \
+ " ld.w %[result], %[m]\n" \
+ " cp.w %[result], %[old]\n" \
+ " brne 2f\n" \
+ " stcond %[m], %[new]\n" \
+ " brne 1b\n" \
+ "2:" \
+ : [result] "=&r"(__result), [m] "=m"(*(mem)) \
+ : "m"(*(mem)), [old] "ir"(oldval), \
+ [new] "r"(newval) \
+ : "memory", "cc"); \
+ __prev; \
+ })
-#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
- (abort(), 0)
+#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval) \
+ (abort(), 0)
-#define __arch_exchange_32_acq(mem, newval) \
- ({ \
- __typeof__(*(mem)) __oldval; \
- __asm__ __volatile__( \
- "/*__arch_exchange_32_acq */\n" \
- " xchg %[old], %[m], %[new]" \
- : [old] "=&r"(__oldval) \
- : [m] "r"(mem), [new] "r"(newval) \
- : "memory"); \
- __oldval; \
- })
+#define __arch_exchange_32_acq(mem, newval) \
+ ({ \
+ __typeof__(*(mem)) __oldval; \
+ __asm__ __volatile__( \
+ "/*__arch_exchange_32_acq */\n" \
+ " xchg %[old], %[m], %[new]" \
+ : [old] "=&r"(__oldval) \
+ : [m] "r"(mem), [new] "r"(newval) \
+ : "memory"); \
+ __oldval; \
+ })
-#define __arch_atomic_exchange_and_add_32(mem, value) \
- ({ \
- __typeof__(*(mem)) __oldval, __tmp; \
- __asm__ __volatile__( \
- "/* __arch_atomic_exchange_and_add_32 */\n" \
- "1: ssrf 5\n" \
- " ld.w %[old], %[m]\n" \
- " add %[tmp], %[old], %[val]\n" \
- " stcond %[m], %[tmp]\n" \
- " brne 1b" \
- : [old] "=&r"(__oldval), [tmp] "=&r"(__tmp), \
- [m] "=m"(*(mem)) \
- : "m"(*(mem)), [val] "r"(value) \
- : "memory", "cc"); \
- __oldval; \
- })
+#define __arch_atomic_exchange_and_add_32(mem, value) \
+ ({ \
+ __typeof__(*(mem)) __oldval, __tmp; \
+ __asm__ __volatile__( \
+ "/* __arch_atomic_exchange_and_add_32 */\n" \
+ "1: ssrf 5\n" \
+ " ld.w %[old], %[m]\n" \
+ " add %[tmp], %[old], %[val]\n" \
+ " stcond %[m], %[tmp]\n" \
+ " brne 1b" \
+ : [old] "=&r"(__oldval), [tmp] "=&r"(__tmp), \
+ [m] "=m"(*(mem)) \
+ : "m"(*(mem)), [val] "r"(value) \
+ : "memory", "cc"); \
+ __oldval; \
+ })
-#define __arch_atomic_decrement_if_positive_32(mem) \
- ({ \
- __typeof__(*(mem)) __oldval, __tmp; \
- __asm__ __volatile__( \
- "/* __arch_atomic_decrement_if_positive_32 */\n" \
- "1: ssrf 5\n" \
- " ld.w %[old], %[m]\n" \
- " sub %[tmp], %[old], 1\n" \
- " brlt 2f\n" \
- " stcond %[m], %[tmp]\n" \
- " brne 1b" \
- "2:" \
- : [old] "=&r"(__oldval), [tmp] "=&r"(__tmp), \
- [m] "=m"(*(mem)) \
- : "m"(*(mem)) \
- : "memory", "cc"); \
- __oldval; \
- })
+#define __arch_atomic_decrement_if_positive_32(mem) \
+ ({ \
+ __typeof__(*(mem)) __oldval, __tmp; \
+ __asm__ __volatile__( \
+ "/* __arch_atomic_decrement_if_positive_32 */\n" \
+ "1: ssrf 5\n" \
+ " ld.w %[old], %[m]\n" \
+ " sub %[tmp], %[old], 1\n" \
+ " brlt 2f\n" \
+ " stcond %[m], %[tmp]\n" \
+ " brne 1b" \
+ "2:" \
+ : [old] "=&r"(__oldval), [tmp] "=&r"(__tmp), \
+ [m] "=m"(*(mem)) \
+ : "m"(*(mem)) \
+ : "memory", "cc"); \
+ __oldval; \
+ })
-#define atomic_exchange_acq(mem, newval) \
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_exchange_32_acq(mem, newval); \
- })
+#define atomic_exchange_acq(mem, newval) \
+ ({ \
+ if (sizeof(*(mem)) != 4) \
+ abort(); \
+ __arch_exchange_32_acq(mem, newval); \
+ })
-#define atomic_exchange_and_add(mem, newval) \
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_atomic_exchange_and_add_32(mem, newval); \
- })
+#define atomic_exchange_and_add(mem, newval) \
+ ({ \
+ if (sizeof(*(mem)) != 4) \
+ abort(); \
+ __arch_atomic_exchange_and_add_32(mem, newval); \
+ })
-#define atomic_decrement_if_positive(mem) \
- ({ \
- if (sizeof(*(mem)) != 4) \
- abort(); \
- __arch_atomic_decrement_if_positive_32(mem); \
- })
+#define atomic_decrement_if_positive(mem) \
+ ({ \
+ if (sizeof(*(mem)) != 4) \
+ abort(); \
+ __arch_atomic_decrement_if_positive_32(mem); \
+ })
#endif /* _AVR32_BITS_ATOMIC_H */
static __inline unsigned short int
__bswap_16 (unsigned short int __bsx)
{
- return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
+ return ((((__bsx) >> 8) & 0xff) | (((__bsx) & 0xff) << 8));
}
#endif
__bswap_32 (unsigned int __bsx)
{
return ((((__bsx) & 0xff000000) >> 24) | (((__bsx) & 0x00ff0000) >> 8) |
- (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
+ (((__bsx) & 0x0000ff00) << 8) | (((__bsx) & 0x000000ff) << 24));
}
#endif
#if defined __GNUC__
/* Swap bytes in 64 bit value. */
-# define __bswap_constant_64(x) \
- ((((x) & 0xff00000000000000ull) >> 56) \
- | (((x) & 0x00ff000000000000ull) >> 40) \
- | (((x) & 0x0000ff0000000000ull) >> 24) \
- | (((x) & 0x000000ff00000000ull) >> 8) \
- | (((x) & 0x00000000ff000000ull) << 8) \
- | (((x) & 0x0000000000ff0000ull) << 24) \
- | (((x) & 0x000000000000ff00ull) << 40) \
- | (((x) & 0x00000000000000ffull) << 56))
+# define __bswap_constant_64(x) \
+ ((((x) & 0xff00000000000000ull) >> 56) \
+ | (((x) & 0x00ff000000000000ull) >> 40) \
+ | (((x) & 0x0000ff0000000000ull) >> 24) \
+ | (((x) & 0x000000ff00000000ull) >> 8) \
+ | (((x) & 0x00000000ff000000ull) << 8) \
+ | (((x) & 0x0000000000ff0000ull) << 24) \
+ | (((x) & 0x000000000000ff00ull) << 40) \
+ | (((x) & 0x00000000000000ffull) << 56))
-# define __bswap_64(x) \
- (__extension__ \
- ({ \
- union { \
- __extension__ unsigned long long int __ll; \
- unsigned int __l[2]; \
- } __w, __r; \
- if (__builtin_constant_p(x)) \
- __r.__ll = __bswap_constant_64(x); \
- else { \
- __w.__ll = (x); \
- __r.__l[0] = __bswap_32(__w.__l[1]); \
- __r.__l[1] = __bswap_32(__w.__l[0]); \
- } \
- __r.__ll; \
- }))
+# define __bswap_64(x) \
+ (__extension__ \
+ ({ \
+ union { \
+ __extension__ unsigned long long int __ll; \
+ unsigned int __l[2]; \
+ } __w, __r; \
+ if (__builtin_constant_p(x)) \
+ __r.__ll = __bswap_constant_64(x); \
+ else { \
+ __w.__ll = (x); \
+ __r.__l[0] = __bswap_32(__w.__l[1]); \
+ __r.__l[1] = __bswap_32(__w.__l[0]); \
+ } \
+ __r.__ll; \
+ }))
#endif
#endif /* _BITS_BYTESWAP_H */
* open/fcntl - O_SYNC is only implemented on blocks devices and on files
* located on an ext2 file system
*/
-#define O_ACCMODE 00000003
-#define O_RDONLY 00000000
-#define O_WRONLY 00000001
-#define O_RDWR 00000002
-#define O_CREAT 00000100 /* not fcntl */
-#define O_EXCL 00000200 /* not fcntl */
-#define O_NOCTTY 00000400 /* not fcntl */
-#define O_TRUNC 00001000 /* not fcntl */
-#define O_APPEND 00002000
-#define O_NONBLOCK 00004000
-#define O_NDELAY O_NONBLOCK
-#define O_SYNC 00010000
-#define O_ASYNC 00020000
+#define O_ACCMODE 00000003
+#define O_RDONLY 00000000
+#define O_WRONLY 00000001
+#define O_RDWR 00000002
+#define O_CREAT 00000100 /* not fcntl */
+#define O_EXCL 00000200 /* not fcntl */
+#define O_NOCTTY 00000400 /* not fcntl */
+#define O_TRUNC 00001000 /* not fcntl */
+#define O_APPEND 00002000
+#define O_NONBLOCK 00004000
+#define O_NDELAY O_NONBLOCK
+#define O_SYNC 00010000
+#define O_ASYNC 00020000
#ifdef __USE_GNU
-# define O_DIRECT 00040000 /* must be a directory */
-# define O_DIRECTORY 00200000 /* direct disk access */
-# define O_NOFOLLOW 00400000 /* don't follow links */
-# define O_NOATIME 01000000 /* don't set atime */
+# define O_DIRECT 00040000 /* must be a directory */
+# define O_DIRECTORY 00200000 /* direct disk access */
+# define O_NOFOLLOW 00400000 /* don't follow links */
+# define O_NOATIME 01000000 /* don't set atime */
#endif
#ifdef __USE_LARGEFILE64
-# define O_LARGEFILE 00100000
+# define O_LARGEFILE 00100000
#endif
/* For now Linux has synchronisity options for data and read operations.
We define the symbols here but let them do the same as O_SYNC since
- this is a superset. */
+ this is a superset. */
#if defined __USE_POSIX199309 || defined __USE_UNIX98
-# define O_DSYNC O_SYNC /* Synchronize data. */
-# define O_RSYNC O_SYNC /* Synchronize read operations. */
+# define O_DSYNC O_SYNC /* Synchronize data. */
+# define O_RSYNC O_SYNC /* Synchronize read operations. */
#endif
-#define F_DUPFD 0 /* dup */
-#define F_GETFD 1 /* get close_on_exec */
-#define F_SETFD 2 /* set/clear close_on_exec */
-#define F_GETFL 3 /* get file->f_flags */
-#define F_SETFL 4 /* set file->f_flags */
+#define F_DUPFD 0 /* dup */
+#define F_GETFD 1 /* get close_on_exec */
+#define F_SETFD 2 /* set/clear close_on_exec */
+#define F_GETFL 3 /* get file->f_flags */
+#define F_SETFL 4 /* set file->f_flags */
#ifndef __USE_FILE_OFFSET64
-# define F_GETLK 5
-# define F_SETLK 6
-# define F_SETLKW 7
+# define F_GETLK 5
+# define F_SETLK 6
+# define F_SETLKW 7
#else
-# define F_GETLK F_GETLK64
-# define F_SETLK F_SETLK64
-# define F_SETLKW F_SETLKW64
+# define F_GETLK F_GETLK64
+# define F_SETLK F_SETLK64
+# define F_SETLKW F_SETLKW64
#endif
-#define F_GETLK64 12 /* using 'struct flock64' */
-#define F_SETLK64 13
-#define F_SETLKW64 14
+#define F_GETLK64 12 /* using 'struct flock64' */
+#define F_SETLK64 13
+#define F_SETLKW64 14
#if defined __USE_BSD || defined __USE_XOPEN2K
-# define F_SETOWN 8 /* for sockets. */
-# define F_GETOWN 9 /* for sockets. */
+# define F_SETOWN 8 /* for sockets. */
+# define F_GETOWN 9 /* for sockets. */
#endif
#ifdef __USE_GNU
-# define F_SETSIG 10 /* for sockets. */
-# define F_GETSIG 11 /* for sockets. */
+# define F_SETSIG 10 /* for sockets. */
+# define F_GETSIG 11 /* for sockets. */
#endif
#ifdef __USE_GNU
-# define F_SETLEASE 1024 /* Set a lease. */
-# define F_GETLEASE 1025 /* Enquire what lease is active. */
-# define F_NOTIFY 1026 /* Request notfications on a directory. */
+# define F_SETLEASE 1024 /* Set a lease. */
+# define F_GETLEASE 1025 /* Enquire what lease is active. */
+# define F_NOTIFY 1026 /* Request notfications on a directory. */
#endif
/* for F_[GET|SET]FL */
-#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
+#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
/* for posix fcntl() and lockf() */
-#define F_RDLCK 0
-#define F_WRLCK 1
-#define F_UNLCK 2
+#define F_RDLCK 0
+#define F_WRLCK 1
+#define F_UNLCK 2
/* for old implementation of bsd flock () */
-#define F_EXLCK 4 /* or 3 */
-#define F_SHLCK 8 /* or 4 */
+#define F_EXLCK 4 /* or 3 */
+#define F_SHLCK 8 /* or 4 */
/* for leases */
-#define F_INPROGRESS 16
+#define F_INPROGRESS 16
#ifdef __USE_BSD
/* operations for bsd flock(), also used by the kernel implementation */
-# define LOCK_SH 1 /* shared lock */
-# define LOCK_EX 2 /* exclusive lock */
-# define LOCK_NB 4 /* or'd with one of the above to prevent
- blocking */
-# define LOCK_UN 8 /* remove lock */
+# define LOCK_SH 1 /* shared lock */
+# define LOCK_EX 2 /* exclusive lock */
+# define LOCK_NB 4 /* or'd with one of the above to prevent
+ blocking */
+# define LOCK_UN 8 /* remove lock */
#endif
#ifdef __USE_GNU
-# define LOCK_MAND 32 /* This is a mandatory flock */
-# define LOCK_READ 64 /* ... Which allows concurrent
- read operations */
-# define LOCK_WRITE 128 /* ... Which allows concurrent
- write operations */
-# define LOCK_RW 192 /* ... Which allows concurrent
- read & write ops */
+# define LOCK_MAND 32 /* This is a mandatory flock */
+# define LOCK_READ 64 /* ... Which allows concurrent
+ read operations */
+# define LOCK_WRITE 128 /* ... Which allows concurrent
+ write operations */
+# define LOCK_RW 192 /* ... Which allows concurrent
+ read & write ops */
#endif
#ifdef __USE_GNU
/* Types of directory notifications that may be requested with F_NOTIFY. */
-# define DN_ACCESS 0x00000001 /* File accessed. */
-# define DN_MODIFY 0x00000002 /* File modified. */
-# define DN_CREATE 0x00000004 /* File created. */
-# define DN_DELETE 0x00000008 /* File removed. */
-# define DN_RENAME 0x00000010 /* File renamed. */
-# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
-# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
+# define DN_ACCESS 0x00000001 /* File accessed. */
+# define DN_MODIFY 0x00000002 /* File modified. */
+# define DN_CREATE 0x00000004 /* File created. */
+# define DN_DELETE 0x00000008 /* File removed. */
+# define DN_RENAME 0x00000010 /* File renamed. */
+# define DN_ATTRIB 0x00000020 /* File changed attibutes. */
+# define DN_MULTISHOT 0x80000000 /* Don't remove notifier. */
#endif
struct flock {
- short l_type;
- short l_whence;
+ short l_type;
+ short l_whence;
#ifndef __USE_FILE_OFFSET64
- __off_t l_start;
- __off_t l_len;
+ __off_t l_start;
+ __off_t l_len;
#else
- __off64_t l_start;
- __off64_t l_len;
+ __off64_t l_start;
+ __off64_t l_len;
#endif
- __pid_t l_pid;
+ __pid_t l_pid;
};
#ifdef __USE_LARGEFILE64
struct flock64 {
- short l_type;
- short l_whence;
- __off64_t l_start;
- __off64_t l_len;
- __pid_t l_pid;
+ short l_type;
+ short l_whence;
+ __off64_t l_start;
+ __off64_t l_len;
+ __pid_t l_pid;
};
#endif
*/
struct kernel_stat {
- unsigned long st_dev;
- unsigned long st_ino;
- unsigned short st_mode;
- unsigned short st_nlink;
- unsigned short st_uid;
- unsigned short st_gid;
- unsigned long st_rdev;
- unsigned long st_size;
- unsigned long st_blksize;
- unsigned long st_blocks;
- 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 __unused4;
- unsigned long __unused5;
+ unsigned long st_dev;
+ unsigned long st_ino;
+ unsigned short st_mode;
+ unsigned short st_nlink;
+ unsigned short st_uid;
+ unsigned short st_gid;
+ unsigned long st_rdev;
+ unsigned long st_size;
+ unsigned long st_blksize;
+ unsigned long st_blocks;
+ 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 __unused4;
+ unsigned long __unused5;
};
#define STAT_HAVE_NSEC 1
struct kernel_stat64 {
- unsigned long long st_dev;
+ unsigned long long st_dev;
- unsigned long long st_ino;
- unsigned int st_mode;
- unsigned int st_nlink;
+ unsigned long long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
- unsigned long st_uid;
- unsigned long st_gid;
+ unsigned long st_uid;
+ unsigned long st_gid;
- unsigned long long st_rdev;
+ unsigned long long st_rdev;
- long long st_size;
- unsigned long __pad1;
- unsigned long st_blksize;
+ long long st_size;
+ unsigned long __pad1;
+ unsigned long st_blksize;
- unsigned long long st_blocks;
+ unsigned long long st_blocks;
- unsigned long st_atime;
- unsigned long st_atime_nsec;
+ unsigned long st_atime;
+ unsigned long st_atime_nsec;
- unsigned long st_mtime;
- unsigned long st_mtime_nsec;
+ unsigned long st_mtime;
+ unsigned long st_mtime_nsec;
- unsigned long st_ctime;
- unsigned long st_ctime_nsec;
+ unsigned long st_ctime;
+ unsigned long st_ctime_nsec;
- unsigned long __unused1;
- unsigned long __unused2;
+ unsigned long __unused1;
+ unsigned long __unused2;
};
#endif /* _BITS_STAT_STRUCT_H */
* assume GCC is being used.
*/
-typedef unsigned long __kernel_dev_t;
-typedef unsigned long __kernel_ino_t;
-typedef unsigned short __kernel_mode_t;
-typedef unsigned short __kernel_nlink_t;
-typedef long __kernel_off_t;
-typedef int __kernel_pid_t;
-typedef unsigned short __kernel_ipc_pid_t;
-typedef unsigned int __kernel_uid_t;
-typedef unsigned int __kernel_gid_t;
-typedef unsigned long __kernel_size_t;
-typedef long __kernel_ssize_t;
-typedef int __kernel_ptrdiff_t;
-typedef long __kernel_time_t;
-typedef long __kernel_suseconds_t;
-typedef long __kernel_clock_t;
-typedef int __kernel_timer_t;
-typedef int __kernel_clockid_t;
-typedef int __kernel_daddr_t;
-typedef char * __kernel_caddr_t;
-typedef unsigned short __kernel_uid16_t;
-typedef unsigned short __kernel_gid16_t;
-typedef unsigned int __kernel_uid32_t;
-typedef unsigned int __kernel_gid32_t;
-typedef unsigned short __kernel_old_uid_t;
-typedef unsigned short __kernel_old_gid_t;
-typedef unsigned short __kernel_old_dev_t;
+typedef unsigned long __kernel_dev_t;
+typedef unsigned long __kernel_ino_t;
+typedef unsigned short __kernel_mode_t;
+typedef unsigned short __kernel_nlink_t;
+typedef long __kernel_off_t;
+typedef int __kernel_pid_t;
+typedef unsigned short __kernel_ipc_pid_t;
+typedef unsigned int __kernel_uid_t;
+typedef unsigned int __kernel_gid_t;
+typedef unsigned long __kernel_size_t;
+typedef long __kernel_ssize_t;
+typedef int __kernel_ptrdiff_t;
+typedef long __kernel_time_t;
+typedef long __kernel_suseconds_t;
+typedef long __kernel_clock_t;
+typedef int __kernel_timer_t;
+typedef int __kernel_clockid_t;
+typedef int __kernel_daddr_t;
+typedef char * __kernel_caddr_t;
+typedef unsigned short __kernel_uid16_t;
+typedef unsigned short __kernel_gid16_t;
+typedef unsigned int __kernel_uid32_t;
+typedef unsigned int __kernel_gid32_t;
+typedef unsigned short __kernel_old_uid_t;
+typedef unsigned short __kernel_old_gid_t;
+typedef unsigned short __kernel_old_dev_t;
#ifdef __GNUC__
-typedef long long __kernel_loff_t;
+typedef long long __kernel_loff_t;
#endif
typedef struct {
#if defined(__USE_ALL)
- int val[2];
+ int val[2];
#else
- int __val[2];
+ int __val[2];
#endif
} __kernel_fsid_t;
without PROT_READ. The only guarantees are that no writing will be
allowed without PROT_WRITE and no access will be allowed for PROT_NONE. */
-#define PROT_READ 0x1 /* Page can be read. */
-#define PROT_WRITE 0x2 /* Page can be written. */
-#define PROT_EXEC 0x4 /* Page can be executed. */
-#define PROT_NONE 0x0 /* Page can not be accessed. */
-#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
- growsdown vma (mprotect only). */
-#define PROT_GROWSUP 0x02000000 /* Extend change to start of
- growsup vma (mprotect only). */
+#define PROT_READ 0x1 /* Page can be read. */
+#define PROT_WRITE 0x2 /* Page can be written. */
+#define PROT_EXEC 0x4 /* Page can be executed. */
+#define PROT_NONE 0x0 /* Page can not be accessed. */
+#define PROT_GROWSDOWN 0x01000000 /* Extend change to start of
+ growsdown vma (mprotect only). */
+#define PROT_GROWSUP 0x02000000 /* Extend change to start of
+ growsup vma (mprotect only). */
/* Sharing types (must choose one and only one of these). */
-#define MAP_SHARED 0x01 /* Share changes. */
-#define MAP_PRIVATE 0x02 /* Changes are private. */
+#define MAP_SHARED 0x01 /* Share changes. */
+#define MAP_PRIVATE 0x02 /* Changes are private. */
#ifdef __USE_MISC
-# define MAP_TYPE 0x0f /* Mask for type of mapping. */
+# define MAP_TYPE 0x0f /* Mask for type of mapping. */
#endif
/* Other flags. */
-#define MAP_FIXED 0x10 /* Interpret addr exactly. */
+#define MAP_FIXED 0x10 /* Interpret addr exactly. */
#ifdef __USE_MISC
-# define MAP_FILE 0
-# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
-# define MAP_ANON MAP_ANONYMOUS
+# define MAP_FILE 0
+# define MAP_ANONYMOUS 0x20 /* Don't use a file. */
+# define MAP_ANON MAP_ANONYMOUS
#endif
/* These are Linux-specific. */
#ifdef __USE_MISC
-# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
-# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
-# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
-# define MAP_LOCKED 0x2000 /* Lock the mapping. */
-# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
-# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
-# define MAP_NONBLOCK 0x10000 /* do not block on IO */
+# define MAP_GROWSDOWN 0x0100 /* Stack-like segment. */
+# define MAP_DENYWRITE 0x0800 /* ETXTBSY */
+# define MAP_EXECUTABLE 0x1000 /* Mark it as an executable. */
+# define MAP_LOCKED 0x2000 /* Lock the mapping. */
+# define MAP_NORESERVE 0x4000 /* Don't check for reservations. */
+# define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
+# define MAP_NONBLOCK 0x10000 /* do not block on IO */
#endif
/* Flags to `msync'. */
-#define MS_ASYNC 1 /* Sync memory asynchronously. */
-#define MS_SYNC 4 /* Synchronous memory sync. */
-#define MS_INVALIDATE 2 /* Invalidate the caches. */
+#define MS_ASYNC 1 /* Sync memory asynchronously. */
+#define MS_SYNC 4 /* Synchronous memory sync. */
+#define MS_INVALIDATE 2 /* Invalidate the caches. */
/* Flags for `mlockall'. */
-#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
-#define MCL_FUTURE 2 /* Lock all additions to address
- space. */
+#define MCL_CURRENT 1 /* Lock all currently mapped pages. */
+#define MCL_FUTURE 2 /* Lock all additions to address
+ space. */
/* Flags for `mremap'. */
#ifdef __USE_GNU
-# define MREMAP_MAYMOVE 1
-# define MREMAP_FIXED 2
+# define MREMAP_MAYMOVE 1
+# define MREMAP_FIXED 2
#endif
/* Advise to `madvise'. */
#ifdef __USE_BSD
-# define MADV_NORMAL 0 /* No further special treatment. */
-# define MADV_RANDOM 1 /* Expect random page references. */
-# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define MADV_WILLNEED 3 /* Will need these pages. */
-# define MADV_DONTNEED 4 /* Don't need these pages. */
-# define MADV_REMOVE 9 /* Remove these pages and resources. */
-# define MADV_DONTFORK 10 /* Do not inherit across fork. */
-# define MADV_DOFORK 11 /* Do inherit across fork. */
+# define MADV_NORMAL 0 /* No further special treatment. */
+# define MADV_RANDOM 1 /* Expect random page references. */
+# define MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define MADV_WILLNEED 3 /* Will need these pages. */
+# define MADV_DONTNEED 4 /* Don't need these pages. */
+# define MADV_REMOVE 9 /* Remove these pages and resources. */
+# define MADV_DONTFORK 10 /* Do not inherit across fork. */
+# define MADV_DOFORK 11 /* Do inherit across fork. */
#endif
/* The POSIX people had to invent similar names for the same things. */
#ifdef __USE_XOPEN2K
-# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
-# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
-# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
-# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
-# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
+# define POSIX_MADV_NORMAL 0 /* No further special treatment. */
+# define POSIX_MADV_RANDOM 1 /* Expect random page references. */
+# define POSIX_MADV_SEQUENTIAL 2 /* Expect sequential page references. */
+# define POSIX_MADV_WILLNEED 3 /* Will need these pages. */
+# define POSIX_MADV_DONTNEED 4 /* Don't need these pages. */
#endif
* archive for more details.
*/
#ifndef _BITS_SETJMP_H
-#define _BITS_SETJMP_H 1
+#define _BITS_SETJMP_H 1
#if !defined _SETJMP_H && !defined _PTHREAD_H
# error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
typedef int __jmp_buf[11];
#endif
-#define __JMP_BUF_SP 4
+#define __JMP_BUF_SP 4
/* Test if longjmp to JMPBUF would unwind the frame containing a local
variable at ADDRESS. */
of the processor. */
#ifndef _STACKINFO_H
-#define _STACKINFO_H 1
+#define _STACKINFO_H 1
/* On AVR32 the stack grows down. */
-#define _STACK_GROWS_DOWN 1
+#define _STACK_GROWS_DOWN 1
#endif /* stackinfo.h */
#define SYS_ify(syscall_name) (__NR_##syscall_name)
#undef _syscall0
-#define _syscall0(type,name) \
- type name(void) \
- { \
- return (type)(INLINE_SYSCALL(name, 0)); \
- }
+#define _syscall0(type,name) \
+ type name(void) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 0)); \
+ }
#undef _syscall1
-#define _syscall1(type,name,type1,arg1) \
- type name(type1 arg1) \
- { \
- return (type)(INLINE_SYSCALL(name, 1, arg1)); \
- }
+#define _syscall1(type,name,type1,arg1) \
+ type name(type1 arg1) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 1, arg1)); \
+ }
#undef _syscall2
-#define _syscall2(type,name,type1,arg1,type2,arg2) \
- type name(type1 arg1, type2 arg2) \
- { \
- return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
- }
+#define _syscall2(type,name,type1,arg1,type2,arg2) \
+ type name(type1 arg1, type2 arg2) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 2, arg1, arg2)); \
+ }
#undef _syscall3
-#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
- type name(type1 arg1, type2 arg2, type3 arg3) \
- { \
- return (type)(INLINE_SYSCALL(name, 3, arg1, \
- arg2, arg3)); \
- }
+#define _syscall3(type,name,type1,arg1,type2,arg2,type3,arg3) \
+ type name(type1 arg1, type2 arg2, type3 arg3) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 3, arg1, \
+ arg2, arg3)); \
+ }
#undef _syscall4
-#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
- type4,arg4) \
- type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
- { \
- return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
- arg3, arg4)); \
- }
+#define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3, \
+ type4,arg4) \
+ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 4, arg1, arg2, \
+ arg3, arg4)); \
+ }
#undef _syscall5
-#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
- type4,arg4,type5,arg5) \
- type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
- type5 arg5) \
- { \
- return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
- arg3, arg4, arg5)); \
- }
+#define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3, \
+ type4,arg4,type5,arg5) \
+ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
+ type5 arg5) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 5, arg1, arg2, \
+ arg3, arg4, arg5)); \
+ }
#undef _syscall6
-#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
- type4,arg4,type5,arg5,type6,arg6) \
- type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
- type5 arg5, type6 arg6) \
- { \
- return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
- arg4, arg5, arg6)); \
- }
+#define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3, \
+ type4,arg4,type5,arg5,type6,arg6) \
+ type name(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \
+ type5 arg5, type6 arg6) \
+ { \
+ return (type)(INLINE_SYSCALL(name, 6, arg1, arg2, arg3, \
+ arg4, arg5, arg6)); \
+ }
#undef unlikely
#define unlikely(x) __builtin_expect((x), 0)
#undef INLINE_SYSCALL
-#define INLINE_SYSCALL(name, nr, args...) \
- ({ \
- unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
- if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
- __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
- _sys_result = (unsigned int) -1; \
- } \
- (int) _sys_result; \
- })
+#define INLINE_SYSCALL(name, nr, args...) \
+ ({ \
+ unsigned _sys_result = INTERNAL_SYSCALL(name, , nr, args); \
+ if (unlikely(INTERNAL_SYSCALL_ERROR_P(_sys_result, ))) { \
+ __set_errno(INTERNAL_SYSCALL_ERRNO(_sys_result, )); \
+ _sys_result = (unsigned int) -1; \
+ } \
+ (int) _sys_result; \
+ })
#undef INTERNAL_SYSCALL_DECL
#define INTERNAL_SYSCALL_DECL(err) do { } while(0)
#undef INTERNAL_SYSCALL
-#define INTERNAL_SYSCALL(name, err, nr, args...) \
- ({ \
- register int _a1 asm ("r12"); \
- register int _scno asm("r8") = SYS_ify(name); \
- LOAD_ARGS_##nr (args); \
- asm volatile ("scall /* syscall " #name " */" \
- : "=r" (_a1) \
- : "r"(_scno) ASM_ARGS_##nr \
- : "cc", "memory"); \
- _a1; \
- })
+#define INTERNAL_SYSCALL(name, err, nr, args...) \
+ ({ \
+ register int _a1 asm ("r12"); \
+ register int _scno asm("r8") = SYS_ify(name); \
+ LOAD_ARGS_##nr (args); \
+ asm volatile ("scall /* syscall " #name " */" \
+ : "=r" (_a1) \
+ : "r"(_scno) ASM_ARGS_##nr \
+ : "cc", "memory"); \
+ _a1; \
+ })
#undef INTERNAL_SYSCALL_ERROR_P
-#define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((unsigned int)(val) >= 0xfffff001U)
+#define INTERNAL_SYSCALL_ERROR_P(val, err) \
+ ((unsigned int)(val) >= 0xfffff001U)
#undef INTERNAL_SYSCALL_ERRNO
#define INTERNAL_SYSCALL_ERRNO(val, errr) (-(val))
#define LOAD_ARGS_0() do { } while(0)
#define ASM_ARGS_0
-#define LOAD_ARGS_1(a1) \
- _a1 = (int) (a1); \
- LOAD_ARGS_0()
-#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
-#define LOAD_ARGS_2(a1, a2) \
- register int _a2 asm("r11") = (int)(a2); \
- LOAD_ARGS_1(a1)
-#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
-#define LOAD_ARGS_3(a1, a2, a3) \
- register int _a3 asm("r10") = (int)(a3); \
- LOAD_ARGS_2(a1, a2)
-#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
-#define LOAD_ARGS_4(a1, a2, a3, a4) \
- register int _a4 asm("r9") = (int)(a4); \
- LOAD_ARGS_3(a1, a2, a3)
-#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
-#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
- register int _a5 asm("r5") = (int)(a5); \
- LOAD_ARGS_4(a1, a2, a3, a4)
-#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
-#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
- register int _a6 asm("r3") = (int)(a6); \
- LOAD_ARGS_5(a1, a2, a3, a4, a5)
-#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
+#define LOAD_ARGS_1(a1) \
+ _a1 = (int) (a1); \
+ LOAD_ARGS_0()
+#define ASM_ARGS_1 ASM_ARGS_0, "r"(_a1)
+#define LOAD_ARGS_2(a1, a2) \
+ register int _a2 asm("r11") = (int)(a2); \
+ LOAD_ARGS_1(a1)
+#define ASM_ARGS_2 ASM_ARGS_1, "r"(_a2)
+#define LOAD_ARGS_3(a1, a2, a3) \
+ register int _a3 asm("r10") = (int)(a3); \
+ LOAD_ARGS_2(a1, a2)
+#define ASM_ARGS_3 ASM_ARGS_2, "r"(_a3)
+#define LOAD_ARGS_4(a1, a2, a3, a4) \
+ register int _a4 asm("r9") = (int)(a4); \
+ LOAD_ARGS_3(a1, a2, a3)
+#define ASM_ARGS_4 ASM_ARGS_3, "r"(_a4)
+#define LOAD_ARGS_5(a1, a2, a3, a4, a5) \
+ register int _a5 asm("r5") = (int)(a5); \
+ LOAD_ARGS_4(a1, a2, a3, a4)
+#define ASM_ARGS_5 ASM_ARGS_4, "r"(_a5)
+#define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6) \
+ register int _a6 asm("r3") = (int)(a6); \
+ LOAD_ARGS_5(a1, a2, a3, a4, a5)
+#define ASM_ARGS_6 ASM_ARGS_5, "r"(_a6)
#endif /* __ASSEMBLER__ */
#endif /* _BITS_SYSCALLS_H */
-#define __WORDSIZE 32
+#define __WORDSIZE 32