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