1 /* $OpenBSD: linux_types.h,v 1.8 2005/05/19 18:27:28 mickey Exp $ */
2 /* $NetBSD: linux_types.h,v 1.5 1996/05/20 01:59:28 fvdl Exp $ */
3
4 /*
5 * Copyright (c) 1995 Frank van der Linden
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed for the NetBSD Project
19 * by Frank van der Linden
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #ifndef _LINUX_TYPES_H
36 #define _LINUX_TYPES_H
37
38 typedef struct {
39 long val[2];
40 } linux_fsid_t;
41
42 typedef unsigned short linux_uid_t;
43 typedef unsigned short linux_gid_t;
44 typedef unsigned short linux_dev_t;
45 typedef unsigned long long linux_ino64_t;
46 typedef unsigned long linux_ino_t;
47 typedef unsigned short linux_mode_t;
48 typedef unsigned short linux_nlink_t;
49 typedef long linux_time_t;
50 typedef long linux_clock_t;
51 typedef long long linux_off64_t;
52 typedef long linux_off_t;
53 typedef u_int64_t linux_loff_t;
54 typedef int linux_pid_t;
55
56 struct linux_statfs {
57 long l_ftype;
58 long l_fbsize;
59 long l_fblocks;
60 long l_fbfree;
61 long l_fbavail;
62 long l_ffiles;
63 long l_fffree;
64 linux_fsid_t l_ffsid;
65 long l_fnamelen;
66 long l_fspare[6];
67 };
68
69 /*
70 * Structure for uname(2)
71 */
72 struct linux_utsname {
73 char l_sysname[65];
74 char l_nodename[65];
75 char l_release[65];
76 char l_version[65];
77 char l_machine[65];
78 char l_domainname[65];
79 };
80
81 struct linux_oldutsname {
82 char l_sysname[65];
83 char l_nodename[65];
84 char l_release[65];
85 char l_version[65];
86 char l_machine[65];
87 };
88
89 struct linux_oldoldutsname {
90 char l_sysname[9];
91 char l_nodename[9];
92 char l_release[9];
93 char l_version[9];
94 char l_machine[9];
95 };
96
97 /*
98 * Passed to the mmap() system call
99 */
100 struct linux_mmap {
101 caddr_t lm_addr;
102 int lm_len;
103 int lm_prot;
104 int lm_flags;
105 int lm_fd;
106 int lm_pos;
107 };
108
109 /*
110 * Passed to the select() system call
111 */
112 struct linux_select {
113 int nfds;
114 fd_set *readfds;
115 fd_set *writefds;
116 fd_set *exceptfds;
117 struct timeval *timeout;
118 };
119
120 struct linux_stat {
121 linux_dev_t lst_dev;
122 unsigned short pad1;
123 linux_ino_t lst_ino;
124 linux_mode_t lst_mode;
125 linux_nlink_t lst_nlink;
126 linux_uid_t lst_uid;
127 linux_gid_t lst_gid;
128 linux_dev_t lst_rdev;
129 unsigned short pad2;
130 linux_off_t lst_size;
131 unsigned long lst_blksize;
132 unsigned long lst_blocks;
133 linux_time_t lst_atime;
134 unsigned long unused1;
135 linux_time_t lst_mtime;
136 unsigned long unused2;
137 linux_time_t lst_ctime;
138 unsigned long unused3;
139 unsigned long unused4;
140 unsigned long unused5;
141 };
142
143 struct linux_tms {
144 linux_clock_t ltms_utime;
145 linux_clock_t ltms_stime;
146 linux_clock_t ltms_cutime;
147 linux_clock_t ltms_cstime;
148 };
149
150 struct linux_utimbuf {
151 linux_time_t l_actime;
152 linux_time_t l_modtime;
153 };
154
155 struct linux___sysctl {
156 int *name;
157 int namelen;
158 void *old;
159 size_t *oldlenp;
160 void *new;
161 size_t newlen;
162 unsigned long __unused0[4];
163 };
164
165 /* This matches struct stat64 in glibc2.1, hence the absolutely
166 * insane amounts of padding around dev_t's.
167 */
168 struct linux_stat64 {
169 unsigned long long lst_dev;
170 unsigned int __pad1;
171
172 #define LINUX_STAT64_HAS_BROKEN_ST_INO 1
173 unsigned int __lst_ino;
174 unsigned int lst_mode;
175 unsigned int lst_nlink;
176
177 unsigned int lst_uid;
178 unsigned int lst_gid;
179
180 unsigned long long lst_rdev;
181 unsigned int __pad2;
182
183 long long lst_size;
184 unsigned int lst_blksize;
185
186 unsigned long long lst_blocks; /* Number 512-byte blocks allocated. */
187
188 unsigned int lst_atime;
189 unsigned int __unused1;
190
191 unsigned int lst_mtime;
192 unsigned int __unused2;
193
194 unsigned int lst_ctime;
195 unsigned int __unused3; /* will be high 32 bits of ctime someday */
196
197 unsigned long long lst_ino;
198 };
199
200 #endif /* !_LINUX_TYPES_H */