| 1 | /* $NetBSD: linux_types.h,v 1.31 2013/11/18 01:32:52 chs Exp $ */ |
| 2 | |
| 3 | /*- |
| 4 | * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * This code is derived from software contributed to The NetBSD Foundation |
| 8 | * by Frank van der Linden and Eric Haszlakiewicz. |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or without |
| 11 | * modification, are permitted provided that the following conditions |
| 12 | * are met: |
| 13 | * 1. Redistributions of source code must retain the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer. |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in the |
| 17 | * documentation and/or other materials provided with the distribution. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
| 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 | * POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef _LINUX_TYPES_H |
| 33 | #define _LINUX_TYPES_H |
| 34 | |
| 35 | #if defined(__i386__) |
| 36 | #include <compat/linux/arch/i386/linux_types.h> |
| 37 | #elif defined(__alpha__) |
| 38 | #include <compat/linux/arch/alpha/linux_types.h> |
| 39 | #elif defined(__powerpc__) |
| 40 | #include <compat/linux/arch/powerpc/linux_types.h> |
| 41 | #elif defined(__arm__) |
| 42 | #include <compat/linux/arch/arm/linux_types.h> |
| 43 | #elif defined(__m68k__) |
| 44 | #include <compat/linux/arch/m68k/linux_types.h> |
| 45 | #elif defined(__mips__) |
| 46 | #include <compat/linux/arch/mips/linux_types.h> |
| 47 | #elif defined(__amd64__) |
| 48 | #include <compat/linux/arch/amd64/linux_types.h> |
| 49 | #else |
| 50 | typedef unsigned long linux_clock_t; |
| 51 | typedef long linux_time_t; |
| 52 | typedef long linux_suseconds_t; |
| 53 | #endif |
| 54 | |
| 55 | typedef unsigned short linux_gid16_t; |
| 56 | typedef unsigned short linux_uid16_t; |
| 57 | typedef unsigned short linux_umode_t; |
| 58 | |
| 59 | /* |
| 60 | * From Linux include/asm-.../posix_types.h |
| 61 | */ |
| 62 | typedef struct { |
| 63 | int val[2]; |
| 64 | } linux_fsid_t; |
| 65 | |
| 66 | /* |
| 67 | * Structure for uname(2) |
| 68 | */ |
| 69 | struct linux_utsname { |
| 70 | char l_sysname[65]; |
| 71 | char l_nodename[65]; |
| 72 | char l_release[65]; |
| 73 | char l_version[65]; |
| 74 | char l_machine[65]; |
| 75 | char l_domainname[65]; |
| 76 | }; |
| 77 | |
| 78 | extern char linux_sysname[]; |
| 79 | extern char linux_release[]; |
| 80 | extern char linux_version[]; |
| 81 | extern char linux_machine[]; |
| 82 | |
| 83 | struct linux_tms { |
| 84 | linux_clock_t ltms_utime; |
| 85 | linux_clock_t ltms_stime; |
| 86 | linux_clock_t ltms_cutime; |
| 87 | linux_clock_t ltms_cstime; |
| 88 | }; |
| 89 | |
| 90 | struct linux_timeval { |
| 91 | linux_time_t tv_sec; |
| 92 | linux_suseconds_t tv_usec; |
| 93 | }; |
| 94 | |
| 95 | struct linux_utimbuf { |
| 96 | linux_time_t l_actime; |
| 97 | linux_time_t l_modtime; |
| 98 | }; |
| 99 | |
| 100 | struct linux___sysctl { |
| 101 | int *name; |
| 102 | int nlen; |
| 103 | void *oldval; |
| 104 | size_t *oldlenp; |
| 105 | void *newval; |
| 106 | size_t newlen; |
| 107 | unsigned long __unused0[4]; |
| 108 | }; |
| 109 | |
| 110 | #include <compat/linux/common/linux_siginfo.h> |
| 111 | |
| 112 | /* |
| 113 | * Generic statfs structure from Linux include/asm-generic/statfs.h |
| 114 | * Linux/x86_64 uses different (fully 64bit) struct statfs. |
| 115 | */ |
| 116 | #ifdef LINUX_STATFS_64BIT |
| 117 | struct linux_statfs { |
| 118 | long l_ftype; |
| 119 | long l_fbsize; |
| 120 | long l_fblocks; |
| 121 | long l_fbfree; |
| 122 | long l_fbavail; |
| 123 | long l_ffiles; |
| 124 | long l_fffree; |
| 125 | linux_fsid_t l_ffsid; |
| 126 | long l_fnamelen; |
| 127 | long l_ffrsize; |
| 128 | long l_fspare[5]; |
| 129 | }; |
| 130 | |
| 131 | struct linux_statfs64 { |
| 132 | long l_ftype; |
| 133 | long l_fbsize; |
| 134 | long l_fblocks; |
| 135 | long l_fbfree; |
| 136 | long l_fbavail; |
| 137 | long l_ffiles; |
| 138 | long l_fffree; |
| 139 | linux_fsid_t l_ffsid; |
| 140 | long l_fnamelen; |
| 141 | long l_ffrsize; |
| 142 | long l_fspare[5]; |
| 143 | }; |
| 144 | #else /* !LINUX_STATFS_64BIT */ |
| 145 | struct linux_statfs { |
| 146 | u_int32_t l_ftype; |
| 147 | u_int32_t l_fbsize; |
| 148 | u_int32_t l_fblocks; |
| 149 | u_int32_t l_fbfree; |
| 150 | u_int32_t l_fbavail; |
| 151 | u_int32_t l_ffiles; |
| 152 | u_int32_t l_fffree; |
| 153 | linux_fsid_t l_ffsid; |
| 154 | u_int32_t l_fnamelen; |
| 155 | u_int32_t l_ffrsize; |
| 156 | u_int32_t l_fspare[5]; |
| 157 | }; |
| 158 | |
| 159 | struct linux_statfs64 { |
| 160 | u_int32_t l_ftype; |
| 161 | u_int32_t l_fbsize; |
| 162 | u_int64_t l_fblocks; |
| 163 | u_int64_t l_fbfree; |
| 164 | u_int64_t l_fbavail; |
| 165 | u_int64_t l_ffiles; |
| 166 | u_int64_t l_fffree; |
| 167 | linux_fsid_t l_ffsid; |
| 168 | u_int32_t l_fnamelen; |
| 169 | u_int32_t l_ffrsize; |
| 170 | u_int32_t l_fspare[5]; |
| 171 | }; |
| 172 | #endif /* !LINUX_STATFS_64BIT */ |
| 173 | |
| 174 | #endif /* !_LINUX_TYPES_H */ |
| 175 | |