aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-22 10:38:37 -0500
commitfcc9d2e5a6c89d22b8b773a64fb4ad21ac318446 (patch)
treea57612d1888735a2ec7972891b68c1ac5ec8faea /include/asm-generic
parent8dea78da5cee153b8af9c07a2745f6c55057fe12 (diff)
Added missing tegra files.HEADmaster
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/Kbuild34
-rw-r--r--include/asm-generic/auxvec.h8
-rw-r--r--include/asm-generic/errno-base.h39
-rw-r--r--include/asm-generic/errno.h113
-rw-r--r--include/asm-generic/fcntl.h200
-rw-r--r--include/asm-generic/ioctls.h114
-rw-r--r--include/asm-generic/ipcbuf.h34
-rw-r--r--include/asm-generic/mman-common.h54
-rw-r--r--include/asm-generic/mman.h19
-rw-r--r--include/asm-generic/msgbuf.h47
-rw-r--r--include/asm-generic/poll.h37
-rw-r--r--include/asm-generic/posix_types.h165
-rw-r--r--include/asm-generic/sembuf.h38
-rw-r--r--include/asm-generic/setup.h6
-rw-r--r--include/asm-generic/shmbuf.h59
-rw-r--r--include/asm-generic/shmparam.h6
-rw-r--r--include/asm-generic/signal-defs.h28
-rw-r--r--include/asm-generic/socket.h67
-rw-r--r--include/asm-generic/sockios.h13
-rw-r--r--include/asm-generic/stat.h72
-rw-r--r--include/asm-generic/swab.h18
-rw-r--r--include/asm-generic/system.h141
-rw-r--r--include/asm-generic/termbits.h199
-rw-r--r--include/asm-generic/types.h15
-rw-r--r--include/asm-generic/ucontext.h12
25 files changed, 1538 insertions, 0 deletions
diff --git a/include/asm-generic/Kbuild b/include/asm-generic/Kbuild
new file mode 100644
index 00000000000..53f91b1ae53
--- /dev/null
+++ b/include/asm-generic/Kbuild
@@ -0,0 +1,34 @@
1header-y += auxvec.h
2header-y += bitsperlong.h
3header-y += errno-base.h
4header-y += errno.h
5header-y += fcntl.h
6header-y += int-l64.h
7header-y += int-ll64.h
8header-y += ioctl.h
9header-y += ioctls.h
10header-y += ipcbuf.h
11header-y += mman-common.h
12header-y += mman.h
13header-y += msgbuf.h
14header-y += param.h
15header-y += poll.h
16header-y += posix_types.h
17header-y += resource.h
18header-y += sembuf.h
19header-y += setup.h
20header-y += shmbuf.h
21header-y += shmparam.h
22header-y += siginfo.h
23header-y += signal-defs.h
24header-y += signal.h
25header-y += socket.h
26header-y += sockios.h
27header-y += stat.h
28header-y += statfs.h
29header-y += swab.h
30header-y += termbits.h
31header-y += termios.h
32header-y += types.h
33header-y += ucontext.h
34header-y += unistd.h
diff --git a/include/asm-generic/auxvec.h b/include/asm-generic/auxvec.h
new file mode 100644
index 00000000000..b99573b0ad1
--- /dev/null
+++ b/include/asm-generic/auxvec.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_GENERIC_AUXVEC_H
2#define __ASM_GENERIC_AUXVEC_H
3/*
4 * Not all architectures need their own auxvec.h, the most
5 * common definitions are already in linux/auxvec.h.
6 */
7
8#endif /* __ASM_GENERIC_AUXVEC_H */
diff --git a/include/asm-generic/errno-base.h b/include/asm-generic/errno-base.h
new file mode 100644
index 00000000000..65115978510
--- /dev/null
+++ b/include/asm-generic/errno-base.h
@@ -0,0 +1,39 @@
1#ifndef _ASM_GENERIC_ERRNO_BASE_H
2#define _ASM_GENERIC_ERRNO_BASE_H
3
4#define EPERM 1 /* Operation not permitted */
5#define ENOENT 2 /* No such file or directory */
6#define ESRCH 3 /* No such process */
7#define EINTR 4 /* Interrupted system call */
8#define EIO 5 /* I/O error */
9#define ENXIO 6 /* No such device or address */
10#define E2BIG 7 /* Argument list too long */
11#define ENOEXEC 8 /* Exec format error */
12#define EBADF 9 /* Bad file number */
13#define ECHILD 10 /* No child processes */
14#define EAGAIN 11 /* Try again */
15#define ENOMEM 12 /* Out of memory */
16#define EACCES 13 /* Permission denied */
17#define EFAULT 14 /* Bad address */
18#define ENOTBLK 15 /* Block device required */
19#define EBUSY 16 /* Device or resource busy */
20#define EEXIST 17 /* File exists */
21#define EXDEV 18 /* Cross-device link */
22#define ENODEV 19 /* No such device */
23#define ENOTDIR 20 /* Not a directory */
24#define EISDIR 21 /* Is a directory */
25#define EINVAL 22 /* Invalid argument */
26#define ENFILE 23 /* File table overflow */
27#define EMFILE 24 /* Too many open files */
28#define ENOTTY 25 /* Not a typewriter */
29#define ETXTBSY 26 /* Text file busy */
30#define EFBIG 27 /* File too large */
31#define ENOSPC 28 /* No space left on device */
32#define ESPIPE 29 /* Illegal seek */
33#define EROFS 30 /* Read-only file system */
34#define EMLINK 31 /* Too many links */
35#define EPIPE 32 /* Broken pipe */
36#define EDOM 33 /* Math argument out of domain of func */
37#define ERANGE 34 /* Math result not representable */
38
39#endif
diff --git a/include/asm-generic/errno.h b/include/asm-generic/errno.h
new file mode 100644
index 00000000000..a1331ce5044
--- /dev/null
+++ b/include/asm-generic/errno.h
@@ -0,0 +1,113 @@
1#ifndef _ASM_GENERIC_ERRNO_H
2#define _ASM_GENERIC_ERRNO_H
3
4#include <asm-generic/errno-base.h>
5
6#define EDEADLK 35 /* Resource deadlock would occur */
7#define ENAMETOOLONG 36 /* File name too long */
8#define ENOLCK 37 /* No record locks available */
9#define ENOSYS 38 /* Function not implemented */
10#define ENOTEMPTY 39 /* Directory not empty */
11#define ELOOP 40 /* Too many symbolic links encountered */
12#define EWOULDBLOCK EAGAIN /* Operation would block */
13#define ENOMSG 42 /* No message of desired type */
14#define EIDRM 43 /* Identifier removed */
15#define ECHRNG 44 /* Channel number out of range */
16#define EL2NSYNC 45 /* Level 2 not synchronized */
17#define EL3HLT 46 /* Level 3 halted */
18#define EL3RST 47 /* Level 3 reset */
19#define ELNRNG 48 /* Link number out of range */
20#define EUNATCH 49 /* Protocol driver not attached */
21#define ENOCSI 50 /* No CSI structure available */
22#define EL2HLT 51 /* Level 2 halted */
23#define EBADE 52 /* Invalid exchange */
24#define EBADR 53 /* Invalid request descriptor */
25#define EXFULL 54 /* Exchange full */
26#define ENOANO 55 /* No anode */
27#define EBADRQC 56 /* Invalid request code */
28#define EBADSLT 57 /* Invalid slot */
29
30#define EDEADLOCK EDEADLK
31
32#define EBFONT 59 /* Bad font file format */
33#define ENOSTR 60 /* Device not a stream */
34#define ENODATA 61 /* No data available */
35#define ETIME 62 /* Timer expired */
36#define ENOSR 63 /* Out of streams resources */
37#define ENONET 64 /* Machine is not on the network */
38#define ENOPKG 65 /* Package not installed */
39#define EREMOTE 66 /* Object is remote */
40#define ENOLINK 67 /* Link has been severed */
41#define EADV 68 /* Advertise error */
42#define ESRMNT 69 /* Srmount error */
43#define ECOMM 70 /* Communication error on send */
44#define EPROTO 71 /* Protocol error */
45#define EMULTIHOP 72 /* Multihop attempted */
46#define EDOTDOT 73 /* RFS specific error */
47#define EBADMSG 74 /* Not a data message */
48#define EOVERFLOW 75 /* Value too large for defined data type */
49#define ENOTUNIQ 76 /* Name not unique on network */
50#define EBADFD 77 /* File descriptor in bad state */
51#define EREMCHG 78 /* Remote address changed */
52#define ELIBACC 79 /* Can not access a needed shared library */
53#define ELIBBAD 80 /* Accessing a corrupted shared library */
54#define ELIBSCN 81 /* .lib section in a.out corrupted */
55#define ELIBMAX 82 /* Attempting to link in too many shared libraries */
56#define ELIBEXEC 83 /* Cannot exec a shared library directly */
57#define EILSEQ 84 /* Illegal byte sequence */
58#define ERESTART 85 /* Interrupted system call should be restarted */
59#define ESTRPIPE 86 /* Streams pipe error */
60#define EUSERS 87 /* Too many users */
61#define ENOTSOCK 88 /* Socket operation on non-socket */
62#define EDESTADDRREQ 89 /* Destination address required */
63#define EMSGSIZE 90 /* Message too long */
64#define EPROTOTYPE 91 /* Protocol wrong type for socket */
65#define ENOPROTOOPT 92 /* Protocol not available */
66#define EPROTONOSUPPORT 93 /* Protocol not supported */
67#define ESOCKTNOSUPPORT 94 /* Socket type not supported */
68#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
69#define EPFNOSUPPORT 96 /* Protocol family not supported */
70#define EAFNOSUPPORT 97 /* Address family not supported by protocol */
71#define EADDRINUSE 98 /* Address already in use */
72#define EADDRNOTAVAIL 99 /* Cannot assign requested address */
73#define ENETDOWN 100 /* Network is down */
74#define ENETUNREACH 101 /* Network is unreachable */
75#define ENETRESET 102 /* Network dropped connection because of reset */
76#define ECONNABORTED 103 /* Software caused connection abort */
77#define ECONNRESET 104 /* Connection reset by peer */
78#define ENOBUFS 105 /* No buffer space available */
79#define EISCONN 106 /* Transport endpoint is already connected */
80#define ENOTCONN 107 /* Transport endpoint is not connected */
81#define ESHUTDOWN 108 /* Cannot send after transport endpoint shutdown */
82#define ETOOMANYREFS 109 /* Too many references: cannot splice */
83#define ETIMEDOUT 110 /* Connection timed out */
84#define ECONNREFUSED 111 /* Connection refused */
85#define EHOSTDOWN 112 /* Host is down */
86#define EHOSTUNREACH 113 /* No route to host */
87#define EALREADY 114 /* Operation already in progress */
88#define EINPROGRESS 115 /* Operation now in progress */
89#define ESTALE 116 /* Stale NFS file handle */
90#define EUCLEAN 117 /* Structure needs cleaning */
91#define ENOTNAM 118 /* Not a XENIX named type file */
92#define ENAVAIL 119 /* No XENIX semaphores available */
93#define EISNAM 120 /* Is a named type file */
94#define EREMOTEIO 121 /* Remote I/O error */
95#define EDQUOT 122 /* Quota exceeded */
96
97#define ENOMEDIUM 123 /* No medium found */
98#define EMEDIUMTYPE 124 /* Wrong medium type */
99#define ECANCELED 125 /* Operation Canceled */
100#define ENOKEY 126 /* Required key not available */
101#define EKEYEXPIRED 127 /* Key has expired */
102#define EKEYREVOKED 128 /* Key has been revoked */
103#define EKEYREJECTED 129 /* Key was rejected by service */
104
105/* for robust mutexes */
106#define EOWNERDEAD 130 /* Owner died */
107#define ENOTRECOVERABLE 131 /* State not recoverable */
108
109#define ERFKILL 132 /* Operation not possible due to RF-kill */
110
111#define EHWPOISON 133 /* Memory page has hardware error */
112
113#endif
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h
new file mode 100644
index 00000000000..84793c7025e
--- /dev/null
+++ b/include/asm-generic/fcntl.h
@@ -0,0 +1,200 @@
1#ifndef _ASM_GENERIC_FCNTL_H
2#define _ASM_GENERIC_FCNTL_H
3
4#include <linux/types.h>
5
6/*
7 * FMODE_EXEC is 0x20
8 * FMODE_NONOTIFY is 0x1000000
9 * These cannot be used by userspace O_* until internal and external open
10 * flags are split.
11 * -Eric Paris
12 */
13
14/*
15 * When introducing new O_* bits, please check its uniqueness in fcntl_init().
16 */
17
18#define O_ACCMODE 00000003
19#define O_RDONLY 00000000
20#define O_WRONLY 00000001
21#define O_RDWR 00000002
22#ifndef O_CREAT
23#define O_CREAT 00000100 /* not fcntl */
24#endif
25#ifndef O_EXCL
26#define O_EXCL 00000200 /* not fcntl */
27#endif
28#ifndef O_NOCTTY
29#define O_NOCTTY 00000400 /* not fcntl */
30#endif
31#ifndef O_TRUNC
32#define O_TRUNC 00001000 /* not fcntl */
33#endif
34#ifndef O_APPEND
35#define O_APPEND 00002000
36#endif
37#ifndef O_NONBLOCK
38#define O_NONBLOCK 00004000
39#endif
40#ifndef O_DSYNC
41#define O_DSYNC 00010000 /* used to be O_SYNC, see below */
42#endif
43#ifndef FASYNC
44#define FASYNC 00020000 /* fcntl, for BSD compatibility */
45#endif
46#ifndef O_DIRECT
47#define O_DIRECT 00040000 /* direct disk access hint */
48#endif
49#ifndef O_LARGEFILE
50#define O_LARGEFILE 00100000
51#endif
52#ifndef O_DIRECTORY
53#define O_DIRECTORY 00200000 /* must be a directory */
54#endif
55#ifndef O_NOFOLLOW
56#define O_NOFOLLOW 00400000 /* don't follow links */
57#endif
58#ifndef O_NOATIME
59#define O_NOATIME 01000000
60#endif
61#ifndef O_CLOEXEC
62#define O_CLOEXEC 02000000 /* set close_on_exec */
63#endif
64
65/*
66 * Before Linux 2.6.33 only O_DSYNC semantics were implemented, but using
67 * the O_SYNC flag. We continue to use the existing numerical value
68 * for O_DSYNC semantics now, but using the correct symbolic name for it.
69 * This new value is used to request true Posix O_SYNC semantics. It is
70 * defined in this strange way to make sure applications compiled against
71 * new headers get at least O_DSYNC semantics on older kernels.
72 *
73 * This has the nice side-effect that we can simply test for O_DSYNC
74 * wherever we do not care if O_DSYNC or O_SYNC is used.
75 *
76 * Note: __O_SYNC must never be used directly.
77 */
78#ifndef O_SYNC
79#define __O_SYNC 04000000
80#define O_SYNC (__O_SYNC|O_DSYNC)
81#endif
82
83#ifndef O_PATH
84#define O_PATH 010000000
85#endif
86
87#ifndef O_NDELAY
88#define O_NDELAY O_NONBLOCK
89#endif
90
91#define F_DUPFD 0 /* dup */
92#define F_GETFD 1 /* get close_on_exec */
93#define F_SETFD 2 /* set/clear close_on_exec */
94#define F_GETFL 3 /* get file->f_flags */
95#define F_SETFL 4 /* set file->f_flags */
96#ifndef F_GETLK
97#define F_GETLK 5
98#define F_SETLK 6
99#define F_SETLKW 7
100#endif
101#ifndef F_SETOWN
102#define F_SETOWN 8 /* for sockets. */
103#define F_GETOWN 9 /* for sockets. */
104#endif
105#ifndef F_SETSIG
106#define F_SETSIG 10 /* for sockets. */
107#define F_GETSIG 11 /* for sockets. */
108#endif
109
110#ifndef CONFIG_64BIT
111#ifndef F_GETLK64
112#define F_GETLK64 12 /* using 'struct flock64' */
113#define F_SETLK64 13
114#define F_SETLKW64 14
115#endif
116#endif
117
118#ifndef F_SETOWN_EX
119#define F_SETOWN_EX 15
120#define F_GETOWN_EX 16
121#endif
122
123#define F_OWNER_TID 0
124#define F_OWNER_PID 1
125#define F_OWNER_PGRP 2
126
127struct f_owner_ex {
128 int type;
129 __kernel_pid_t pid;
130};
131
132/* for F_[GET|SET]FL */
133#define FD_CLOEXEC 1 /* actually anything with low bit set goes */
134
135/* for posix fcntl() and lockf() */
136#ifndef F_RDLCK
137#define F_RDLCK 0
138#define F_WRLCK 1
139#define F_UNLCK 2
140#endif
141
142/* for old implementation of bsd flock () */
143#ifndef F_EXLCK
144#define F_EXLCK 4 /* or 3 */
145#define F_SHLCK 8 /* or 4 */
146#endif
147
148/* for leases */
149#ifndef F_INPROGRESS
150#define F_INPROGRESS 16
151#endif
152
153/* operations for bsd flock(), also used by the kernel implementation */
154#define LOCK_SH 1 /* shared lock */
155#define LOCK_EX 2 /* exclusive lock */
156#define LOCK_NB 4 /* or'd with one of the above to prevent
157 blocking */
158#define LOCK_UN 8 /* remove lock */
159
160#define LOCK_MAND 32 /* This is a mandatory flock ... */
161#define LOCK_READ 64 /* which allows concurrent read operations */
162#define LOCK_WRITE 128 /* which allows concurrent write operations */
163#define LOCK_RW 192 /* which allows concurrent read & write ops */
164
165#define F_LINUX_SPECIFIC_BASE 1024
166
167#ifndef HAVE_ARCH_STRUCT_FLOCK
168#ifndef __ARCH_FLOCK_PAD
169#define __ARCH_FLOCK_PAD
170#endif
171
172struct flock {
173 short l_type;
174 short l_whence;
175 __kernel_off_t l_start;
176 __kernel_off_t l_len;
177 __kernel_pid_t l_pid;
178 __ARCH_FLOCK_PAD
179};
180#endif
181
182#ifndef CONFIG_64BIT
183
184#ifndef HAVE_ARCH_STRUCT_FLOCK64
185#ifndef __ARCH_FLOCK64_PAD
186#define __ARCH_FLOCK64_PAD
187#endif
188
189struct flock64 {
190 short l_type;
191 short l_whence;
192 __kernel_loff_t l_start;
193 __kernel_loff_t l_len;
194 __kernel_pid_t l_pid;
195 __ARCH_FLOCK64_PAD
196};
197#endif
198#endif /* !CONFIG_64BIT */
199
200#endif /* _ASM_GENERIC_FCNTL_H */
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h
new file mode 100644
index 00000000000..199975fac39
--- /dev/null
+++ b/include/asm-generic/ioctls.h
@@ -0,0 +1,114 @@
1#ifndef __ASM_GENERIC_IOCTLS_H
2#define __ASM_GENERIC_IOCTLS_H
3
4#include <linux/ioctl.h>
5
6/*
7 * These are the most common definitions for tty ioctl numbers.
8 * Most of them do not use the recommended _IOC(), but there is
9 * probably some source code out there hardcoding the number,
10 * so we might as well use them for all new platforms.
11 *
12 * The architectures that use different values here typically
13 * try to be compatible with some Unix variants for the same
14 * architecture.
15 */
16
17/* 0x54 is just a magic number to make these relatively unique ('T') */
18
19#define TCGETS 0x5401
20#define TCSETS 0x5402
21#define TCSETSW 0x5403
22#define TCSETSF 0x5404
23#define TCGETA 0x5405
24#define TCSETA 0x5406
25#define TCSETAW 0x5407
26#define TCSETAF 0x5408
27#define TCSBRK 0x5409
28#define TCXONC 0x540A
29#define TCFLSH 0x540B
30#define TIOCEXCL 0x540C
31#define TIOCNXCL 0x540D
32#define TIOCSCTTY 0x540E
33#define TIOCGPGRP 0x540F
34#define TIOCSPGRP 0x5410
35#define TIOCOUTQ 0x5411
36#define TIOCSTI 0x5412
37#define TIOCGWINSZ 0x5413
38#define TIOCSWINSZ 0x5414
39#define TIOCMGET 0x5415
40#define TIOCMBIS 0x5416
41#define TIOCMBIC 0x5417
42#define TIOCMSET 0x5418
43#define TIOCGSOFTCAR 0x5419
44#define TIOCSSOFTCAR 0x541A
45#define FIONREAD 0x541B
46#define TIOCINQ FIONREAD
47#define TIOCLINUX 0x541C
48#define TIOCCONS 0x541D
49#define TIOCGSERIAL 0x541E
50#define TIOCSSERIAL 0x541F
51#define TIOCPKT 0x5420
52#define FIONBIO 0x5421
53#define TIOCNOTTY 0x5422
54#define TIOCSETD 0x5423
55#define TIOCGETD 0x5424
56#define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */
57#define TIOCSBRK 0x5427 /* BSD compatibility */
58#define TIOCCBRK 0x5428 /* BSD compatibility */
59#define TIOCGSID 0x5429 /* Return the session ID of FD */
60#define TCGETS2 _IOR('T', 0x2A, struct termios2)
61#define TCSETS2 _IOW('T', 0x2B, struct termios2)
62#define TCSETSW2 _IOW('T', 0x2C, struct termios2)
63#define TCSETSF2 _IOW('T', 0x2D, struct termios2)
64#define TIOCGRS485 0x542E
65#ifndef TIOCSRS485
66#define TIOCSRS485 0x542F
67#endif
68#define TIOCGPTN _IOR('T', 0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
69#define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */
70#define TIOCGDEV _IOR('T', 0x32, unsigned int) /* Get primary device node of /dev/console */
71#define TCGETX 0x5432 /* SYS5 TCGETX compatibility */
72#define TCSETX 0x5433
73#define TCSETXF 0x5434
74#define TCSETXW 0x5435
75#define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */
76#define TIOCVHANGUP 0x5437
77
78#define FIONCLEX 0x5450
79#define FIOCLEX 0x5451
80#define FIOASYNC 0x5452
81#define TIOCSERCONFIG 0x5453
82#define TIOCSERGWILD 0x5454
83#define TIOCSERSWILD 0x5455
84#define TIOCGLCKTRMIOS 0x5456
85#define TIOCSLCKTRMIOS 0x5457
86#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
87#define TIOCSERGETLSR 0x5459 /* Get line status register */
88#define TIOCSERGETMULTI 0x545A /* Get multiport config */
89#define TIOCSERSETMULTI 0x545B /* Set multiport config */
90
91#define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */
92#define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */
93
94/*
95 * Some arches already define FIOQSIZE due to a historical
96 * conflict with a Hayes modem-specific ioctl value.
97 */
98#ifndef FIOQSIZE
99# define FIOQSIZE 0x5460
100#endif
101
102/* Used for packet mode */
103#define TIOCPKT_DATA 0
104#define TIOCPKT_FLUSHREAD 1
105#define TIOCPKT_FLUSHWRITE 2
106#define TIOCPKT_STOP 4
107#define TIOCPKT_START 8
108#define TIOCPKT_NOSTOP 16
109#define TIOCPKT_DOSTOP 32
110#define TIOCPKT_IOCTL 64
111
112#define TIOCSER_TEMT 0x01 /* Transmitter physically empty */
113
114#endif /* __ASM_GENERIC_IOCTLS_H */
diff --git a/include/asm-generic/ipcbuf.h b/include/asm-generic/ipcbuf.h
new file mode 100644
index 00000000000..76982b2a1b5
--- /dev/null
+++ b/include/asm-generic/ipcbuf.h
@@ -0,0 +1,34 @@
1#ifndef __ASM_GENERIC_IPCBUF_H
2#define __ASM_GENERIC_IPCBUF_H
3
4/*
5 * The generic ipc64_perm structure:
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * ipc64_perm was originally meant to be architecture specific, but
10 * everyone just ended up making identical copies without specific
11 * optimizations, so we may just as well all use the same one.
12 *
13 * Pad space is left for:
14 * - 32-bit mode_t on architectures that only had 16 bit
15 * - 32-bit seq
16 * - 2 miscellaneous 32-bit values
17 */
18
19struct ipc64_perm {
20 __kernel_key_t key;
21 __kernel_uid32_t uid;
22 __kernel_gid32_t gid;
23 __kernel_uid32_t cuid;
24 __kernel_gid32_t cgid;
25 __kernel_mode_t mode;
26 /* pad if mode_t is u16: */
27 unsigned char __pad1[4 - sizeof(__kernel_mode_t)];
28 unsigned short seq;
29 unsigned short __pad2;
30 unsigned long __unused1;
31 unsigned long __unused2;
32};
33
34#endif /* __ASM_GENERIC_IPCBUF_H */
diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
new file mode 100644
index 00000000000..787abbb6d86
--- /dev/null
+++ b/include/asm-generic/mman-common.h
@@ -0,0 +1,54 @@
1#ifndef __ASM_GENERIC_MMAN_COMMON_H
2#define __ASM_GENERIC_MMAN_COMMON_H
3
4/*
5 Author: Michael S. Tsirkin <mst@mellanox.co.il>, Mellanox Technologies Ltd.
6 Based on: asm-xxx/mman.h
7*/
8
9#define PROT_READ 0x1 /* page can be read */
10#define PROT_WRITE 0x2 /* page can be written */
11#define PROT_EXEC 0x4 /* page can be executed */
12#define PROT_SEM 0x8 /* page may be used for atomic ops */
13#define PROT_NONE 0x0 /* page can not be accessed */
14#define PROT_GROWSDOWN 0x01000000 /* mprotect flag: extend change to start of growsdown vma */
15#define PROT_GROWSUP 0x02000000 /* mprotect flag: extend change to end of growsup vma */
16
17#define MAP_SHARED 0x01 /* Share changes */
18#define MAP_PRIVATE 0x02 /* Changes are private */
19#define MAP_TYPE 0x0f /* Mask for type of mapping */
20#define MAP_FIXED 0x10 /* Interpret addr exactly */
21#define MAP_ANONYMOUS 0x20 /* don't use a file */
22#ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
23# define MAP_UNINITIALIZED 0x4000000 /* For anonymous mmap, memory could be uninitialized */
24#else
25# define MAP_UNINITIALIZED 0x0 /* Don't support this flag */
26#endif
27
28#define MS_ASYNC 1 /* sync memory asynchronously */
29#define MS_INVALIDATE 2 /* invalidate the caches */
30#define MS_SYNC 4 /* synchronous memory sync */
31
32#define MADV_NORMAL 0 /* no further special treatment */
33#define MADV_RANDOM 1 /* expect random page references */
34#define MADV_SEQUENTIAL 2 /* expect sequential page references */
35#define MADV_WILLNEED 3 /* will need these pages */
36#define MADV_DONTNEED 4 /* don't need these pages */
37
38/* common parameters: try to keep these consistent across architectures */
39#define MADV_REMOVE 9 /* remove these pages & resources */
40#define MADV_DONTFORK 10 /* don't inherit across fork */
41#define MADV_DOFORK 11 /* do inherit across fork */
42#define MADV_HWPOISON 100 /* poison a page for testing */
43#define MADV_SOFT_OFFLINE 101 /* soft offline page for testing */
44
45#define MADV_MERGEABLE 12 /* KSM may merge identical pages */
46#define MADV_UNMERGEABLE 13 /* KSM may not merge identical pages */
47
48#define MADV_HUGEPAGE 14 /* Worth backing with hugepages */
49#define MADV_NOHUGEPAGE 15 /* Not worth backing with hugepages */
50
51/* compatibility flags */
52#define MAP_FILE 0
53
54#endif /* __ASM_GENERIC_MMAN_COMMON_H */
diff --git a/include/asm-generic/mman.h b/include/asm-generic/mman.h
new file mode 100644
index 00000000000..32c8bd6a196
--- /dev/null
+++ b/include/asm-generic/mman.h
@@ -0,0 +1,19 @@
1#ifndef __ASM_GENERIC_MMAN_H
2#define __ASM_GENERIC_MMAN_H
3
4#include <asm-generic/mman-common.h>
5
6#define MAP_GROWSDOWN 0x0100 /* stack-like segment */
7#define MAP_DENYWRITE 0x0800 /* ETXTBSY */
8#define MAP_EXECUTABLE 0x1000 /* mark it as an executable */
9#define MAP_LOCKED 0x2000 /* pages are locked */
10#define MAP_NORESERVE 0x4000 /* don't check for reservations */
11#define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */
12#define MAP_NONBLOCK 0x10000 /* do not block on IO */
13#define MAP_STACK 0x20000 /* give out an address that is best suited for process/thread stacks */
14#define MAP_HUGETLB 0x40000 /* create a huge page mapping */
15
16#define MCL_CURRENT 1 /* lock all current mappings */
17#define MCL_FUTURE 2 /* lock all future mappings */
18
19#endif /* __ASM_GENERIC_MMAN_H */
diff --git a/include/asm-generic/msgbuf.h b/include/asm-generic/msgbuf.h
new file mode 100644
index 00000000000..aec850d9159
--- /dev/null
+++ b/include/asm-generic/msgbuf.h
@@ -0,0 +1,47 @@
1#ifndef __ASM_GENERIC_MSGBUF_H
2#define __ASM_GENERIC_MSGBUF_H
3
4#include <asm/bitsperlong.h>
5/*
6 * generic msqid64_ds structure.
7 *
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * msqid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first three padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 * Pad space is left for:
20 * - 64-bit time_t to solve y2038 problem
21 * - 2 miscellaneous 32-bit values
22 */
23
24struct msqid64_ds {
25 struct ipc64_perm msg_perm;
26 __kernel_time_t msg_stime; /* last msgsnd time */
27#if __BITS_PER_LONG != 64
28 unsigned long __unused1;
29#endif
30 __kernel_time_t msg_rtime; /* last msgrcv time */
31#if __BITS_PER_LONG != 64
32 unsigned long __unused2;
33#endif
34 __kernel_time_t msg_ctime; /* last change time */
35#if __BITS_PER_LONG != 64
36 unsigned long __unused3;
37#endif
38 unsigned long msg_cbytes; /* current number of bytes on queue */
39 unsigned long msg_qnum; /* number of messages in queue */
40 unsigned long msg_qbytes; /* max number of bytes on queue */
41 __kernel_pid_t msg_lspid; /* pid of last msgsnd */
42 __kernel_pid_t msg_lrpid; /* last receive pid */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47#endif /* __ASM_GENERIC_MSGBUF_H */
diff --git a/include/asm-generic/poll.h b/include/asm-generic/poll.h
new file mode 100644
index 00000000000..44bce836d35
--- /dev/null
+++ b/include/asm-generic/poll.h
@@ -0,0 +1,37 @@
1#ifndef __ASM_GENERIC_POLL_H
2#define __ASM_GENERIC_POLL_H
3
4/* These are specified by iBCS2 */
5#define POLLIN 0x0001
6#define POLLPRI 0x0002
7#define POLLOUT 0x0004
8#define POLLERR 0x0008
9#define POLLHUP 0x0010
10#define POLLNVAL 0x0020
11
12/* The rest seem to be more-or-less nonstandard. Check them! */
13#define POLLRDNORM 0x0040
14#define POLLRDBAND 0x0080
15#ifndef POLLWRNORM
16#define POLLWRNORM 0x0100
17#endif
18#ifndef POLLWRBAND
19#define POLLWRBAND 0x0200
20#endif
21#ifndef POLLMSG
22#define POLLMSG 0x0400
23#endif
24#ifndef POLLREMOVE
25#define POLLREMOVE 0x1000
26#endif
27#ifndef POLLRDHUP
28#define POLLRDHUP 0x2000
29#endif
30
31struct pollfd {
32 int fd;
33 short events;
34 short revents;
35};
36
37#endif /* __ASM_GENERIC_POLL_H */
diff --git a/include/asm-generic/posix_types.h b/include/asm-generic/posix_types.h
new file mode 100644
index 00000000000..3dab00860e7
--- /dev/null
+++ b/include/asm-generic/posix_types.h
@@ -0,0 +1,165 @@
1#ifndef __ASM_GENERIC_POSIX_TYPES_H
2#define __ASM_GENERIC_POSIX_TYPES_H
3
4#include <asm/bitsperlong.h>
5/*
6 * This file is generally used by user-level software, so you need to
7 * be a little careful about namespace pollution etc.
8 *
9 * First the types that are often defined in different ways across
10 * architectures, so that you can override them.
11 */
12
13#ifndef __kernel_ino_t
14typedef unsigned long __kernel_ino_t;
15#endif
16
17#ifndef __kernel_mode_t
18typedef unsigned int __kernel_mode_t;
19#endif
20
21#ifndef __kernel_nlink_t
22typedef unsigned long __kernel_nlink_t;
23#endif
24
25#ifndef __kernel_pid_t
26typedef int __kernel_pid_t;
27#endif
28
29#ifndef __kernel_ipc_pid_t
30typedef int __kernel_ipc_pid_t;
31#endif
32
33#ifndef __kernel_uid_t
34typedef unsigned int __kernel_uid_t;
35typedef unsigned int __kernel_gid_t;
36#endif
37
38#ifndef __kernel_suseconds_t
39typedef long __kernel_suseconds_t;
40#endif
41
42#ifndef __kernel_daddr_t
43typedef int __kernel_daddr_t;
44#endif
45
46#ifndef __kernel_uid32_t
47typedef __kernel_uid_t __kernel_uid32_t;
48typedef __kernel_gid_t __kernel_gid32_t;
49#endif
50
51#ifndef __kernel_old_uid_t
52typedef __kernel_uid_t __kernel_old_uid_t;
53typedef __kernel_gid_t __kernel_old_gid_t;
54#endif
55
56#ifndef __kernel_old_dev_t
57typedef unsigned int __kernel_old_dev_t;
58#endif
59
60/*
61 * Most 32 bit architectures use "unsigned int" size_t,
62 * and all 64 bit architectures use "unsigned long" size_t.
63 */
64#ifndef __kernel_size_t
65#if __BITS_PER_LONG != 64
66typedef unsigned int __kernel_size_t;
67typedef int __kernel_ssize_t;
68typedef int __kernel_ptrdiff_t;
69#else
70typedef unsigned long __kernel_size_t;
71typedef long __kernel_ssize_t;
72typedef long __kernel_ptrdiff_t;
73#endif
74#endif
75
76/*
77 * anything below here should be completely generic
78 */
79typedef long __kernel_off_t;
80typedef long long __kernel_loff_t;
81typedef long __kernel_time_t;
82typedef long __kernel_clock_t;
83typedef int __kernel_timer_t;
84typedef int __kernel_clockid_t;
85typedef char * __kernel_caddr_t;
86typedef unsigned short __kernel_uid16_t;
87typedef unsigned short __kernel_gid16_t;
88
89typedef struct {
90 int val[2];
91} __kernel_fsid_t;
92
93#ifdef __KERNEL__
94
95#undef __FD_SET
96static inline void __FD_SET(unsigned long __fd, __kernel_fd_set *__fdsetp)
97{
98 unsigned long __tmp = __fd / __NFDBITS;
99 unsigned long __rem = __fd % __NFDBITS;
100 __fdsetp->fds_bits[__tmp] |= (1UL<<__rem);
101}
102
103#undef __FD_CLR
104static inline void __FD_CLR(unsigned long __fd, __kernel_fd_set *__fdsetp)
105{
106 unsigned long __tmp = __fd / __NFDBITS;
107 unsigned long __rem = __fd % __NFDBITS;
108 __fdsetp->fds_bits[__tmp] &= ~(1UL<<__rem);
109}
110
111#undef __FD_ISSET
112static inline int __FD_ISSET(unsigned long __fd, const __kernel_fd_set *__p)
113{
114 unsigned long __tmp = __fd / __NFDBITS;
115 unsigned long __rem = __fd % __NFDBITS;
116 return (__p->fds_bits[__tmp] & (1UL<<__rem)) != 0;
117}
118
119/*
120 * This will unroll the loop for the normal constant case (8 ints,
121 * for a 256-bit fd_set)
122 */
123#undef __FD_ZERO
124static inline void __FD_ZERO(__kernel_fd_set *__p)
125{
126 unsigned long *__tmp = __p->fds_bits;
127 int __i;
128
129 if (__builtin_constant_p(__FDSET_LONGS)) {
130 switch (__FDSET_LONGS) {
131 case 16:
132 __tmp[ 0] = 0; __tmp[ 1] = 0;
133 __tmp[ 2] = 0; __tmp[ 3] = 0;
134 __tmp[ 4] = 0; __tmp[ 5] = 0;
135 __tmp[ 6] = 0; __tmp[ 7] = 0;
136 __tmp[ 8] = 0; __tmp[ 9] = 0;
137 __tmp[10] = 0; __tmp[11] = 0;
138 __tmp[12] = 0; __tmp[13] = 0;
139 __tmp[14] = 0; __tmp[15] = 0;
140 return;
141
142 case 8:
143 __tmp[ 0] = 0; __tmp[ 1] = 0;
144 __tmp[ 2] = 0; __tmp[ 3] = 0;
145 __tmp[ 4] = 0; __tmp[ 5] = 0;
146 __tmp[ 6] = 0; __tmp[ 7] = 0;
147 return;
148
149 case 4:
150 __tmp[ 0] = 0; __tmp[ 1] = 0;
151 __tmp[ 2] = 0; __tmp[ 3] = 0;
152 return;
153 }
154 }
155 __i = __FDSET_LONGS;
156 while (__i) {
157 __i--;
158 *__tmp = 0;
159 __tmp++;
160 }
161}
162
163#endif /* __KERNEL__ */
164
165#endif /* __ASM_GENERIC_POSIX_TYPES_H */
diff --git a/include/asm-generic/sembuf.h b/include/asm-generic/sembuf.h
new file mode 100644
index 00000000000..4cb2c13e509
--- /dev/null
+++ b/include/asm-generic/sembuf.h
@@ -0,0 +1,38 @@
1#ifndef __ASM_GENERIC_SEMBUF_H
2#define __ASM_GENERIC_SEMBUF_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * The semid64_ds structure for x86 architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * semid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first two padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 * Pad space is left for:
20 * - 64-bit time_t to solve y2038 problem
21 * - 2 miscellaneous 32-bit values
22 */
23struct semid64_ds {
24 struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
25 __kernel_time_t sem_otime; /* last semop time */
26#if __BITS_PER_LONG != 64
27 unsigned long __unused1;
28#endif
29 __kernel_time_t sem_ctime; /* last change time */
30#if __BITS_PER_LONG != 64
31 unsigned long __unused2;
32#endif
33 unsigned long sem_nsems; /* no. of semaphores in array */
34 unsigned long __unused3;
35 unsigned long __unused4;
36};
37
38#endif /* __ASM_GENERIC_SEMBUF_H */
diff --git a/include/asm-generic/setup.h b/include/asm-generic/setup.h
new file mode 100644
index 00000000000..6fc26a51003
--- /dev/null
+++ b/include/asm-generic/setup.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_GENERIC_SETUP_H
2#define __ASM_GENERIC_SETUP_H
3
4#define COMMAND_LINE_SIZE 512
5
6#endif /* __ASM_GENERIC_SETUP_H */
diff --git a/include/asm-generic/shmbuf.h b/include/asm-generic/shmbuf.h
new file mode 100644
index 00000000000..5768fa60ac8
--- /dev/null
+++ b/include/asm-generic/shmbuf.h
@@ -0,0 +1,59 @@
1#ifndef __ASM_GENERIC_SHMBUF_H
2#define __ASM_GENERIC_SHMBUF_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * The shmid64_ds structure for x86 architecture.
8 * Note extra padding because this structure is passed back and forth
9 * between kernel and user space.
10 *
11 * shmid64_ds was originally meant to be architecture specific, but
12 * everyone just ended up making identical copies without specific
13 * optimizations, so we may just as well all use the same one.
14 *
15 * 64 bit architectures typically define a 64 bit __kernel_time_t,
16 * so they do not need the first two padding words.
17 * On big-endian systems, the padding is in the wrong place.
18 *
19 *
20 * Pad space is left for:
21 * - 64-bit time_t to solve y2038 problem
22 * - 2 miscellaneous 32-bit values
23 */
24
25struct shmid64_ds {
26 struct ipc64_perm shm_perm; /* operation perms */
27 size_t shm_segsz; /* size of segment (bytes) */
28 __kernel_time_t shm_atime; /* last attach time */
29#if __BITS_PER_LONG != 64
30 unsigned long __unused1;
31#endif
32 __kernel_time_t shm_dtime; /* last detach time */
33#if __BITS_PER_LONG != 64
34 unsigned long __unused2;
35#endif
36 __kernel_time_t shm_ctime; /* last change time */
37#if __BITS_PER_LONG != 64
38 unsigned long __unused3;
39#endif
40 __kernel_pid_t shm_cpid; /* pid of creator */
41 __kernel_pid_t shm_lpid; /* pid of last operator */
42 unsigned long shm_nattch; /* no. of current attaches */
43 unsigned long __unused4;
44 unsigned long __unused5;
45};
46
47struct shminfo64 {
48 unsigned long shmmax;
49 unsigned long shmmin;
50 unsigned long shmmni;
51 unsigned long shmseg;
52 unsigned long shmall;
53 unsigned long __unused1;
54 unsigned long __unused2;
55 unsigned long __unused3;
56 unsigned long __unused4;
57};
58
59#endif /* __ASM_GENERIC_SHMBUF_H */
diff --git a/include/asm-generic/shmparam.h b/include/asm-generic/shmparam.h
new file mode 100644
index 00000000000..51a3852de73
--- /dev/null
+++ b/include/asm-generic/shmparam.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_GENERIC_SHMPARAM_H
2#define __ASM_GENERIC_SHMPARAM_H
3
4#define SHMLBA PAGE_SIZE /* attach addr a multiple of this */
5
6#endif /* _ASM_GENERIC_SHMPARAM_H */
diff --git a/include/asm-generic/signal-defs.h b/include/asm-generic/signal-defs.h
new file mode 100644
index 00000000000..00f95df5429
--- /dev/null
+++ b/include/asm-generic/signal-defs.h
@@ -0,0 +1,28 @@
1#ifndef __ASM_GENERIC_SIGNAL_DEFS_H
2#define __ASM_GENERIC_SIGNAL_DEFS_H
3
4#include <linux/compiler.h>
5
6#ifndef SIG_BLOCK
7#define SIG_BLOCK 0 /* for blocking signals */
8#endif
9#ifndef SIG_UNBLOCK
10#define SIG_UNBLOCK 1 /* for unblocking signals */
11#endif
12#ifndef SIG_SETMASK
13#define SIG_SETMASK 2 /* for setting the signal mask */
14#endif
15
16#ifndef __ASSEMBLY__
17typedef void __signalfn_t(int);
18typedef __signalfn_t __user *__sighandler_t;
19
20typedef void __restorefn_t(void);
21typedef __restorefn_t __user *__sigrestore_t;
22
23#define SIG_DFL ((__force __sighandler_t)0) /* default signal handling */
24#define SIG_IGN ((__force __sighandler_t)1) /* ignore signal */
25#define SIG_ERR ((__force __sighandler_t)-1) /* error return from signal */
26#endif
27
28#endif /* __ASM_GENERIC_SIGNAL_DEFS_H */
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
new file mode 100644
index 00000000000..9a6115e7cf6
--- /dev/null
+++ b/include/asm-generic/socket.h
@@ -0,0 +1,67 @@
1#ifndef __ASM_GENERIC_SOCKET_H
2#define __ASM_GENERIC_SOCKET_H
3
4#include <asm/sockios.h>
5
6/* For setsockopt(2) */
7#define SOL_SOCKET 1
8
9#define SO_DEBUG 1
10#define SO_REUSEADDR 2
11#define SO_TYPE 3
12#define SO_ERROR 4
13#define SO_DONTROUTE 5
14#define SO_BROADCAST 6
15#define SO_SNDBUF 7
16#define SO_RCVBUF 8
17#define SO_SNDBUFFORCE 32
18#define SO_RCVBUFFORCE 33
19#define SO_KEEPALIVE 9
20#define SO_OOBINLINE 10
21#define SO_NO_CHECK 11
22#define SO_PRIORITY 12
23#define SO_LINGER 13
24#define SO_BSDCOMPAT 14
25/* To add :#define SO_REUSEPORT 15 */
26
27#ifndef SO_PASSCRED /* powerpc only differs in these */
28#define SO_PASSCRED 16
29#define SO_PEERCRED 17
30#define SO_RCVLOWAT 18
31#define SO_SNDLOWAT 19
32#define SO_RCVTIMEO 20
33#define SO_SNDTIMEO 21
34#endif
35
36/* Security levels - as per NRL IPv6 - don't actually do anything */
37#define SO_SECURITY_AUTHENTICATION 22
38#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
39#define SO_SECURITY_ENCRYPTION_NETWORK 24
40
41#define SO_BINDTODEVICE 25
42
43/* Socket filtering */
44#define SO_ATTACH_FILTER 26
45#define SO_DETACH_FILTER 27
46
47#define SO_PEERNAME 28
48#define SO_TIMESTAMP 29
49#define SCM_TIMESTAMP SO_TIMESTAMP
50
51#define SO_ACCEPTCONN 30
52
53#define SO_PEERSEC 31
54#define SO_PASSSEC 34
55#define SO_TIMESTAMPNS 35
56#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
57
58#define SO_MARK 36
59
60#define SO_TIMESTAMPING 37
61#define SCM_TIMESTAMPING SO_TIMESTAMPING
62
63#define SO_PROTOCOL 38
64#define SO_DOMAIN 39
65
66#define SO_RXQ_OVFL 40
67#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/asm-generic/sockios.h b/include/asm-generic/sockios.h
new file mode 100644
index 00000000000..9a61a369b90
--- /dev/null
+++ b/include/asm-generic/sockios.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_GENERIC_SOCKIOS_H
2#define __ASM_GENERIC_SOCKIOS_H
3
4/* Socket-level I/O control calls. */
5#define FIOSETOWN 0x8901
6#define SIOCSPGRP 0x8902
7#define FIOGETOWN 0x8903
8#define SIOCGPGRP 0x8904
9#define SIOCATMARK 0x8905
10#define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */
11#define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */
12
13#endif /* __ASM_GENERIC_SOCKIOS_H */
diff --git a/include/asm-generic/stat.h b/include/asm-generic/stat.h
new file mode 100644
index 00000000000..bd8cad21998
--- /dev/null
+++ b/include/asm-generic/stat.h
@@ -0,0 +1,72 @@
1#ifndef __ASM_GENERIC_STAT_H
2#define __ASM_GENERIC_STAT_H
3
4/*
5 * Everybody gets this wrong and has to stick with it for all
6 * eternity. Hopefully, this version gets used by new architectures
7 * so they don't fall into the same traps.
8 *
9 * stat64 is copied from powerpc64, with explicit padding added.
10 * stat is the same structure layout on 64-bit, without the 'long long'
11 * types.
12 *
13 * By convention, 64 bit architectures use the stat interface, while
14 * 32 bit architectures use the stat64 interface. Note that we don't
15 * provide an __old_kernel_stat here, which new architecture should
16 * not have to start with.
17 */
18
19#include <asm/bitsperlong.h>
20
21#define STAT_HAVE_NSEC 1
22
23struct stat {
24 unsigned long st_dev; /* Device. */
25 unsigned long st_ino; /* File serial number. */
26 unsigned int st_mode; /* File mode. */
27 unsigned int st_nlink; /* Link count. */
28 unsigned int st_uid; /* User ID of the file's owner. */
29 unsigned int st_gid; /* Group ID of the file's group. */
30 unsigned long st_rdev; /* Device number, if device. */
31 unsigned long __pad1;
32 long st_size; /* Size of file, in bytes. */
33 int st_blksize; /* Optimal block size for I/O. */
34 int __pad2;
35 long st_blocks; /* Number 512-byte blocks allocated. */
36 long st_atime; /* Time of last access. */
37 unsigned long st_atime_nsec;
38 long st_mtime; /* Time of last modification. */
39 unsigned long st_mtime_nsec;
40 long st_ctime; /* Time of last status change. */
41 unsigned long st_ctime_nsec;
42 unsigned int __unused4;
43 unsigned int __unused5;
44};
45
46/* This matches struct stat64 in glibc2.1. Only used for 32 bit. */
47#if __BITS_PER_LONG != 64 || defined(__ARCH_WANT_STAT64)
48struct stat64 {
49 unsigned long long st_dev; /* Device. */
50 unsigned long long st_ino; /* File serial number. */
51 unsigned int st_mode; /* File mode. */
52 unsigned int st_nlink; /* Link count. */
53 unsigned int st_uid; /* User ID of the file's owner. */
54 unsigned int st_gid; /* Group ID of the file's group. */
55 unsigned long long st_rdev; /* Device number, if device. */
56 unsigned long long __pad1;
57 long long st_size; /* Size of file, in bytes. */
58 int st_blksize; /* Optimal block size for I/O. */
59 int __pad2;
60 long long st_blocks; /* Number 512-byte blocks allocated. */
61 int st_atime; /* Time of last access. */
62 unsigned int st_atime_nsec;
63 int st_mtime; /* Time of last modification. */
64 unsigned int st_mtime_nsec;
65 int st_ctime; /* Time of last status change. */
66 unsigned int st_ctime_nsec;
67 unsigned int __unused4;
68 unsigned int __unused5;
69};
70#endif
71
72#endif /* __ASM_GENERIC_STAT_H */
diff --git a/include/asm-generic/swab.h b/include/asm-generic/swab.h
new file mode 100644
index 00000000000..a8e9029d9eb
--- /dev/null
+++ b/include/asm-generic/swab.h
@@ -0,0 +1,18 @@
1#ifndef _ASM_GENERIC_SWAB_H
2#define _ASM_GENERIC_SWAB_H
3
4#include <asm/bitsperlong.h>
5
6/*
7 * 32 bit architectures typically (but not always) want to
8 * set __SWAB_64_THRU_32__. In user space, this is only
9 * valid if the compiler supports 64 bit data types.
10 */
11
12#if __BITS_PER_LONG == 32
13#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
14#define __SWAB_64_THRU_32__
15#endif
16#endif
17
18#endif /* _ASM_GENERIC_SWAB_H */
diff --git a/include/asm-generic/system.h b/include/asm-generic/system.h
new file mode 100644
index 00000000000..215efa74f5a
--- /dev/null
+++ b/include/asm-generic/system.h
@@ -0,0 +1,141 @@
1/* Generic system definitions, based on MN10300 definitions.
2 *
3 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports.
5 *
6 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
7 * Written by David Howells (dhowells@redhat.com)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public Licence
11 * as published by the Free Software Foundation; either version
12 * 2 of the Licence, or (at your option) any later version.
13 */
14#ifndef __ASM_GENERIC_SYSTEM_H
15#define __ASM_GENERIC_SYSTEM_H
16
17#ifndef __ASSEMBLY__
18
19#include <linux/types.h>
20#include <linux/irqflags.h>
21
22#include <asm/cmpxchg-local.h>
23#include <asm/cmpxchg.h>
24
25struct task_struct;
26
27/* context switching is now performed out-of-line in switch_to.S */
28extern struct task_struct *__switch_to(struct task_struct *,
29 struct task_struct *);
30#define switch_to(prev, next, last) \
31 do { \
32 ((last) = __switch_to((prev), (next))); \
33 } while (0)
34
35#define arch_align_stack(x) (x)
36
37#define nop() asm volatile ("nop")
38
39#endif /* !__ASSEMBLY__ */
40
41/*
42 * Force strict CPU ordering.
43 * And yes, this is required on UP too when we're talking
44 * to devices.
45 *
46 * This implementation only contains a compiler barrier.
47 */
48
49#define mb() asm volatile ("": : :"memory")
50#define rmb() mb()
51#define wmb() asm volatile ("": : :"memory")
52
53#ifdef CONFIG_SMP
54#define smp_mb() mb()
55#define smp_rmb() rmb()
56#define smp_wmb() wmb()
57#else
58#define smp_mb() barrier()
59#define smp_rmb() barrier()
60#define smp_wmb() barrier()
61#endif
62
63#define set_mb(var, value) do { var = value; mb(); } while (0)
64#define set_wmb(var, value) do { var = value; wmb(); } while (0)
65
66#define read_barrier_depends() do {} while (0)
67#define smp_read_barrier_depends() do {} while (0)
68
69/*
70 * we make sure local_irq_enable() doesn't cause priority inversion
71 */
72#ifndef __ASSEMBLY__
73
74/* This function doesn't exist, so you'll get a linker error
75 * if something tries to do an invalid xchg(). */
76extern void __xchg_called_with_bad_pointer(void);
77
78static inline
79unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
80{
81 unsigned long ret, flags;
82
83 switch (size) {
84 case 1:
85#ifdef __xchg_u8
86 return __xchg_u8(x, ptr);
87#else
88 local_irq_save(flags);
89 ret = *(volatile u8 *)ptr;
90 *(volatile u8 *)ptr = x;
91 local_irq_restore(flags);
92 return ret;
93#endif /* __xchg_u8 */
94
95 case 2:
96#ifdef __xchg_u16
97 return __xchg_u16(x, ptr);
98#else
99 local_irq_save(flags);
100 ret = *(volatile u16 *)ptr;
101 *(volatile u16 *)ptr = x;
102 local_irq_restore(flags);
103 return ret;
104#endif /* __xchg_u16 */
105
106 case 4:
107#ifdef __xchg_u32
108 return __xchg_u32(x, ptr);
109#else
110 local_irq_save(flags);
111 ret = *(volatile u32 *)ptr;
112 *(volatile u32 *)ptr = x;
113 local_irq_restore(flags);
114 return ret;
115#endif /* __xchg_u32 */
116
117#ifdef CONFIG_64BIT
118 case 8:
119#ifdef __xchg_u64
120 return __xchg_u64(x, ptr);
121#else
122 local_irq_save(flags);
123 ret = *(volatile u64 *)ptr;
124 *(volatile u64 *)ptr = x;
125 local_irq_restore(flags);
126 return ret;
127#endif /* __xchg_u64 */
128#endif /* CONFIG_64BIT */
129
130 default:
131 __xchg_called_with_bad_pointer();
132 return x;
133 }
134}
135
136#define xchg(ptr, x) \
137 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
138
139#endif /* !__ASSEMBLY__ */
140
141#endif /* __ASM_GENERIC_SYSTEM_H */
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h
new file mode 100644
index 00000000000..232b4781aef
--- /dev/null
+++ b/include/asm-generic/termbits.h
@@ -0,0 +1,199 @@
1#ifndef __ASM_GENERIC_TERMBITS_H
2#define __ASM_GENERIC_TERMBITS_H
3
4#include <linux/posix_types.h>
5
6typedef unsigned char cc_t;
7typedef unsigned int speed_t;
8typedef unsigned int tcflag_t;
9
10#define NCCS 19
11struct termios {
12 tcflag_t c_iflag; /* input mode flags */
13 tcflag_t c_oflag; /* output mode flags */
14 tcflag_t c_cflag; /* control mode flags */
15 tcflag_t c_lflag; /* local mode flags */
16 cc_t c_line; /* line discipline */
17 cc_t c_cc[NCCS]; /* control characters */
18};
19
20struct termios2 {
21 tcflag_t c_iflag; /* input mode flags */
22 tcflag_t c_oflag; /* output mode flags */
23 tcflag_t c_cflag; /* control mode flags */
24 tcflag_t c_lflag; /* local mode flags */
25 cc_t c_line; /* line discipline */
26 cc_t c_cc[NCCS]; /* control characters */
27 speed_t c_ispeed; /* input speed */
28 speed_t c_ospeed; /* output speed */
29};
30
31struct ktermios {
32 tcflag_t c_iflag; /* input mode flags */
33 tcflag_t c_oflag; /* output mode flags */
34 tcflag_t c_cflag; /* control mode flags */
35 tcflag_t c_lflag; /* local mode flags */
36 cc_t c_line; /* line discipline */
37 cc_t c_cc[NCCS]; /* control characters */
38 speed_t c_ispeed; /* input speed */
39 speed_t c_ospeed; /* output speed */
40};
41
42/* c_cc characters */
43#define VINTR 0
44#define VQUIT 1
45#define VERASE 2
46#define VKILL 3
47#define VEOF 4
48#define VTIME 5
49#define VMIN 6
50#define VSWTC 7
51#define VSTART 8
52#define VSTOP 9
53#define VSUSP 10
54#define VEOL 11
55#define VREPRINT 12
56#define VDISCARD 13
57#define VWERASE 14
58#define VLNEXT 15
59#define VEOL2 16
60
61/* c_iflag bits */
62#define IGNBRK 0000001
63#define BRKINT 0000002
64#define IGNPAR 0000004
65#define PARMRK 0000010
66#define INPCK 0000020
67#define ISTRIP 0000040
68#define INLCR 0000100
69#define IGNCR 0000200
70#define ICRNL 0000400
71#define IUCLC 0001000
72#define IXON 0002000
73#define IXANY 0004000
74#define IXOFF 0010000
75#define IMAXBEL 0020000
76#define IUTF8 0040000
77
78/* c_oflag bits */
79#define OPOST 0000001
80#define OLCUC 0000002
81#define ONLCR 0000004
82#define OCRNL 0000010
83#define ONOCR 0000020
84#define ONLRET 0000040
85#define OFILL 0000100
86#define OFDEL 0000200
87#define NLDLY 0000400
88#define NL0 0000000
89#define NL1 0000400
90#define CRDLY 0003000
91#define CR0 0000000
92#define CR1 0001000
93#define CR2 0002000
94#define CR3 0003000
95#define TABDLY 0014000
96#define TAB0 0000000
97#define TAB1 0004000
98#define TAB2 0010000
99#define TAB3 0014000
100#define XTABS 0014000
101#define BSDLY 0020000
102#define BS0 0000000
103#define BS1 0020000
104#define VTDLY 0040000
105#define VT0 0000000
106#define VT1 0040000
107#define FFDLY 0100000
108#define FF0 0000000
109#define FF1 0100000
110
111/* c_cflag bit meaning */
112#define CBAUD 0010017
113#define B0 0000000 /* hang up */
114#define B50 0000001
115#define B75 0000002
116#define B110 0000003
117#define B134 0000004
118#define B150 0000005
119#define B200 0000006
120#define B300 0000007
121#define B600 0000010
122#define B1200 0000011
123#define B1800 0000012
124#define B2400 0000013
125#define B4800 0000014
126#define B9600 0000015
127#define B19200 0000016
128#define B38400 0000017
129#define EXTA B19200
130#define EXTB B38400
131#define CSIZE 0000060
132#define CS5 0000000
133#define CS6 0000020
134#define CS7 0000040
135#define CS8 0000060
136#define CSTOPB 0000100
137#define CREAD 0000200
138#define PARENB 0000400
139#define PARODD 0001000
140#define HUPCL 0002000
141#define CLOCAL 0004000
142#define CBAUDEX 0010000
143#define BOTHER 0010000
144#define B57600 0010001
145#define B115200 0010002
146#define B230400 0010003
147#define B460800 0010004
148#define B500000 0010005
149#define B576000 0010006
150#define B921600 0010007
151#define B1000000 0010010
152#define B1152000 0010011
153#define B1500000 0010012
154#define B2000000 0010013
155#define B2500000 0010014
156#define B3000000 0010015
157#define B3500000 0010016
158#define B4000000 0010017
159#define CIBAUD 002003600000 /* input baud rate */
160#define CMSPAR 010000000000 /* mark or space (stick) parity */
161#define CRTSCTS 020000000000 /* flow control */
162
163#define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */
164
165/* c_lflag bits */
166#define ISIG 0000001
167#define ICANON 0000002
168#define XCASE 0000004
169#define ECHO 0000010
170#define ECHOE 0000020
171#define ECHOK 0000040
172#define ECHONL 0000100
173#define NOFLSH 0000200
174#define TOSTOP 0000400
175#define ECHOCTL 0001000
176#define ECHOPRT 0002000
177#define ECHOKE 0004000
178#define FLUSHO 0010000
179#define PENDIN 0040000
180#define IEXTEN 0100000
181#define EXTPROC 0200000
182
183/* tcflow() and TCXONC use these */
184#define TCOOFF 0
185#define TCOON 1
186#define TCIOFF 2
187#define TCION 3
188
189/* tcflush() and TCFLSH use these */
190#define TCIFLUSH 0
191#define TCOFLUSH 1
192#define TCIOFLUSH 2
193
194/* tcsetattr uses these */
195#define TCSANOW 0
196#define TCSADRAIN 1
197#define TCSAFLUSH 2
198
199#endif /* __ASM_GENERIC_TERMBITS_H */
diff --git a/include/asm-generic/types.h b/include/asm-generic/types.h
new file mode 100644
index 00000000000..7a0f69e6c61
--- /dev/null
+++ b/include/asm-generic/types.h
@@ -0,0 +1,15 @@
1#ifndef _ASM_GENERIC_TYPES_H
2#define _ASM_GENERIC_TYPES_H
3/*
4 * int-ll64 is used practically everywhere now,
5 * so use it as a reasonable default.
6 */
7#include <asm-generic/int-ll64.h>
8
9#ifndef __ASSEMBLY__
10
11typedef unsigned short umode_t;
12
13#endif /* __ASSEMBLY__ */
14
15#endif /* _ASM_GENERIC_TYPES_H */
diff --git a/include/asm-generic/ucontext.h b/include/asm-generic/ucontext.h
new file mode 100644
index 00000000000..ad77343e8a9
--- /dev/null
+++ b/include/asm-generic/ucontext.h
@@ -0,0 +1,12 @@
1#ifndef __ASM_GENERIC_UCONTEXT_H
2#define __ASM_GENERIC_UCONTEXT_H
3
4struct ucontext {
5 unsigned long uc_flags;
6 struct ucontext *uc_link;
7 stack_t uc_stack;
8 struct sigcontext uc_mcontext;
9 sigset_t uc_sigmask; /* mask last for extensibility */
10};
11
12#endif /* __ASM_GENERIC_UCONTEXT_H */