Advertisement
Guest User

cat types.h

a guest
May 3rd, 2012
163
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cat /usr/include/sys/types.h
  2. /*
  3. * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
  4. *
  5. * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  6. *
  7. * This file contains Original Code and/or Modifications of Original Code
  8. * as defined in and that are subject to the Apple Public Source License
  9. * Version 2.0 (the 'License'). You may not use this file except in
  10. * compliance with the License. The rights granted to you under the License
  11. * may not be used to create, or enable the creation or redistribution of,
  12. * unlawful or unlicensed copies of an Apple operating system, or to
  13. * circumvent, violate, or enable the circumvention or violation of, any
  14. * terms of an Apple operating system software license agreement.
  15. *
  16. * Please obtain a copy of the License at
  17. * http://www.opensource.apple.com/apsl/ and read it before using this file.
  18. *
  19. * The Original Code and all software distributed under the License are
  20. * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  21. * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  22. * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
  24. * Please see the License for the specific language governing rights and
  25. * limitations under the License.
  26. *
  27. * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  28. */
  29. /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */
  30. /*
  31. * Copyright (c) 1982, 1986, 1991, 1993, 1994
  32. * The Regents of the University of California. All rights reserved.
  33. * (c) UNIX System Laboratories, Inc.
  34. * All or some portions of this file are derived from material licensed
  35. * to the University of California by American Telephone and Telegraph
  36. * Co. or Unix System Laboratories, Inc. and are reproduced herein with
  37. * the permission of UNIX System Laboratories, Inc.
  38. *
  39. * Redistribution and use in source and binary forms, with or without
  40. * modification, are permitted provided that the following conditions
  41. * are met:
  42. * 1. Redistributions of source code must retain the above copyright
  43. * notice, this list of conditions and the following disclaimer.
  44. * 2. Redistributions in binary form must reproduce the above copyright
  45. * notice, this list of conditions and the following disclaimer in the
  46. * documentation and/or other materials provided with the distribution.
  47. * 3. All advertising materials mentioning features or use of this software
  48. * must display the following acknowledgement:
  49. * This product includes software developed by the University of
  50. * California, Berkeley and its contributors.
  51. * 4. Neither the name of the University nor the names of its contributors
  52. * may be used to endorse or promote products derived from this software
  53. * without specific prior written permission.
  54. *
  55. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65. * SUCH DAMAGE.
  66. *
  67. * @(#)types.h 8.4 (Berkeley) 1/21/94
  68. */
  69.  
  70. #ifndef _SYS_TYPES_H_
  71. #define _SYS_TYPES_H_
  72.  
  73. #include <sys/appleapiopts.h>
  74.  
  75. #ifndef __ASSEMBLER__
  76. #include <sys/cdefs.h>
  77.  
  78. /* Machine type dependent parameters. */
  79. #include <machine/types.h>
  80. #include <sys/_types.h>
  81.  
  82. #include <machine/endian.h>
  83.  
  84. #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  85. typedef unsigned char u_char;
  86. typedef unsigned short u_short;
  87. typedef unsigned int u_int;
  88. #ifndef _U_LONG
  89. typedef unsigned long u_long;
  90. #define _U_LONG
  91. #endif
  92. typedef unsigned short ushort; /* Sys V compatibility */
  93. typedef unsigned int uint; /* Sys V compatibility */
  94. #endif
  95.  
  96. typedef u_int64_t u_quad_t; /* quads */
  97. typedef int64_t quad_t;
  98. typedef quad_t * qaddr_t;
  99.  
  100. typedef char * caddr_t; /* core address */
  101. typedef int32_t daddr_t; /* disk address */
  102.  
  103. #ifndef _DEV_T
  104. typedef __darwin_dev_t dev_t; /* device number */
  105. #define _DEV_T
  106. #endif
  107.  
  108. typedef u_int32_t fixpt_t; /* fixed point number */
  109.  
  110. #ifndef _BLKCNT_T
  111. typedef __darwin_blkcnt_t blkcnt_t;
  112. #define _BLKCNT_T
  113. #endif
  114.  
  115. #ifndef _BLKSIZE_T
  116. typedef __darwin_blksize_t blksize_t;
  117. #define _BLKSIZE_T
  118. #endif
  119.  
  120. #ifndef _GID_T
  121. typedef __darwin_gid_t gid_t;
  122. #define _GID_T
  123. #endif
  124.  
  125. #ifndef _IN_ADDR_T
  126. #define _IN_ADDR_T
  127. typedef __uint32_t in_addr_t; /* base type for internet address */
  128. #endif
  129.  
  130. #ifndef _IN_PORT_T
  131. #define _IN_PORT_T
  132. typedef __uint16_t in_port_t;
  133. #endif
  134.  
  135. #ifndef _INO_T
  136. typedef __darwin_ino_t ino_t; /* inode number */
  137. #define _INO_T
  138. #endif
  139.  
  140. #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  141. #ifndef _INO64_T
  142. typedef __darwin_ino64_t ino64_t; /* 64bit inode number */
  143. #define _INO64_T
  144. #endif
  145. #endif /* !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE) */
  146.  
  147. #ifndef _KEY_T
  148. #define _KEY_T
  149. typedef __int32_t key_t; /* IPC key (for Sys V IPC) */
  150. #endif
  151.  
  152. #ifndef _MODE_T
  153. typedef __darwin_mode_t mode_t;
  154. #define _MODE_T
  155. #endif
  156.  
  157. #ifndef _NLINK_T
  158. typedef __uint16_t nlink_t; /* link count */
  159. #define _NLINK_T
  160. #endif
  161.  
  162. #ifndef _ID_T
  163. #define _ID_T
  164. typedef __darwin_id_t id_t; /* can hold pid_t, gid_t, or uid_t */
  165. #endif
  166.  
  167. #ifndef _PID_T
  168. typedef __darwin_pid_t pid_t;
  169. #define _PID_T
  170. #endif
  171.  
  172. #ifndef _OFF_T
  173. typedef __darwin_off_t off_t;
  174. #define _OFF_T
  175. #endif
  176.  
  177. typedef int32_t segsz_t; /* segment size */
  178. typedef int32_t swblk_t; /* swap offset */
  179.  
  180. #ifndef _UID_T
  181. typedef __darwin_uid_t uid_t; /* user id */
  182. #define _UID_T
  183. #endif
  184.  
  185. #ifndef _ID_T
  186. typedef __darwin_id_t id_t;
  187. #define _ID_T
  188. #endif
  189.  
  190. #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  191. /* Major, minor numbers, dev_t's. */
  192. #if defined(__cplusplus)
  193. /*
  194. * These lowercase macros tend to match member functions in some C++ code,
  195. * so for C++, we must use inline functions instead.
  196. */
  197.  
  198. static inline __int32_t major(__uint32_t _x)
  199. {
  200. return (__int32_t)(((__uint32_t)_x >> 24) & 0xff);
  201. }
  202.  
  203. static inline __int32_t minor(__uint32_t _x)
  204. {
  205. return (__int32_t)((_x) & 0xffffff);
  206. }
  207.  
  208. static inline dev_t makedev(__uint32_t _major, __uint32_t _minor)
  209. {
  210. return (dev_t)(((_major) << 24) | (_minor));
  211. }
  212.  
  213. #else /* !__cplusplus */
  214.  
  215. #define major(x) ((int32_t)(((u_int32_t)(x) >> 24) & 0xff))
  216. #define minor(x) ((int32_t)((x) & 0xffffff))
  217. #define makedev(x,y) ((dev_t)(((x) << 24) | (y)))
  218.  
  219. #endif /* !__cplusplus */
  220. #endif /* !_POSIX_C_SOURCE */
  221.  
  222. #ifndef _CLOCK_T
  223. #define _CLOCK_T
  224. typedef __darwin_clock_t clock_t;
  225. #endif
  226.  
  227. #ifndef _SIZE_T
  228. #define _SIZE_T
  229. /* DO NOT REMOVE THIS COMMENT: fixincludes needs to see
  230. * _GCC_SIZE_T */
  231. typedef __darwin_size_t size_t;
  232. #endif
  233.  
  234. #ifndef _SSIZE_T
  235. #define _SSIZE_T
  236. typedef __darwin_ssize_t ssize_t;
  237. #endif
  238.  
  239. #ifndef _TIME_T
  240. #define _TIME_T
  241. typedef __darwin_time_t time_t;
  242. #endif
  243.  
  244. #ifndef _USECONDS_T
  245. #define _USECONDS_T
  246. typedef __darwin_useconds_t useconds_t;
  247. #endif
  248.  
  249. #ifndef _SUSECONDS_T
  250. #define _SUSECONDS_T
  251. typedef __darwin_suseconds_t suseconds_t;
  252. #endif
  253.  
  254. #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  255. /*
  256. * This code is present here in order to maintain historical backward
  257. * compatability, and is intended to be removed at some point in the
  258. * future; please include <sys/select.h> instead.
  259. */
  260. #define __need_fd_set
  261. #include <sys/_structs.h>
  262.  
  263. #define NBBY __DARWIN_NBBY /* bits in a byte */
  264. #define NFDBITS __DARWIN_NFDBITS /* bits per mask */
  265. #define howmany(x, y) __DARWIN_howmany(x, y) /* # y's == x bits? */
  266. typedef __int32_t fd_mask;
  267.  
  268. /*
  269. * Select uses bit masks of file descriptors in longs. These macros
  270. * manipulate such bit fields (the filesystem macros use chars). The
  271. * extra protection here is to permit application redefinition above
  272. * the default size.
  273. */
  274. #ifndef FD_SETSIZE
  275. #define FD_SETSIZE __DARWIN_FD_SETSIZE
  276. #endif /* FD_SETSIZE */
  277. #ifndef FD_SET
  278. #define FD_SET(n, p) __DARWIN_FD_SET(n, p)
  279. #endif /* FD_SET */
  280. #ifndef FD_CLR
  281. #define FD_CLR(n, p) __DARWIN_FD_CLR(n, p)
  282. #endif /* FD_CLR */
  283. #ifndef FD_ISSET
  284. #define FD_ISSET(n, p) __DARWIN_FD_ISSET(n, p)
  285. #endif /* FD_ISSET */
  286. #ifndef FD_ZERO
  287. #define FD_ZERO(p) __DARWIN_FD_ZERO(p)
  288. #endif /* FD_ZERO */
  289. #if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
  290. #ifndef FD_COPY
  291. #define FD_COPY(f, t) __DARWIN_FD_COPY(f, t)
  292. #endif /* FD_COPY */
  293. #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  294.  
  295.  
  296. #if defined(__STDC__) && defined(KERNEL)
  297. /*
  298. * Forward structure declarations for function prototypes. We include the
  299. * common structures that cross subsystem boundaries here; others are mostly
  300. * used in the same place that the structure is defined.
  301. */
  302. struct proc;
  303. struct pgrp;
  304. struct ucred;
  305. struct rusage;
  306. struct file;
  307. struct buf;
  308. struct tty;
  309. struct uio;
  310. #endif
  311.  
  312. #endif /* (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */
  313. #endif /* __ASSEMBLER__ */
  314.  
  315. #ifndef __POSIX_LIB__
  316.  
  317. #ifndef _PTHREAD_ATTR_T
  318. #define _PTHREAD_ATTR_T
  319. typedef __darwin_pthread_attr_t pthread_attr_t;
  320. #endif
  321. #ifndef _PTHREAD_COND_T
  322. #define _PTHREAD_COND_T
  323. typedef __darwin_pthread_cond_t pthread_cond_t;
  324. #endif
  325. #ifndef _PTHREAD_CONDATTR_T
  326. #define _PTHREAD_CONDATTR_T
  327. typedef __darwin_pthread_condattr_t pthread_condattr_t;
  328. #endif
  329. #ifndef _PTHREAD_MUTEX_T
  330. #define _PTHREAD_MUTEX_T
  331. typedef __darwin_pthread_mutex_t pthread_mutex_t;
  332. #endif
  333. #ifndef _PTHREAD_MUTEXATTR_T
  334. #define _PTHREAD_MUTEXATTR_T
  335. typedef __darwin_pthread_mutexattr_t pthread_mutexattr_t;
  336. #endif
  337. #ifndef _PTHREAD_ONCE_T
  338. #define _PTHREAD_ONCE_T
  339. typedef __darwin_pthread_once_t pthread_once_t;
  340. #endif
  341. #ifndef _PTHREAD_RWLOCK_T
  342. #define _PTHREAD_RWLOCK_T
  343. typedef __darwin_pthread_rwlock_t pthread_rwlock_t;
  344. #endif
  345. #ifndef _PTHREAD_RWLOCKATTR_T
  346. #define _PTHREAD_RWLOCKATTR_T
  347. typedef __darwin_pthread_rwlockattr_t pthread_rwlockattr_t;
  348. #endif
  349. #ifndef _PTHREAD_T
  350. #define _PTHREAD_T
  351. typedef __darwin_pthread_t pthread_t;
  352. #endif
  353.  
  354. #endif /* __POSIX_LIB__ */
  355.  
  356. #ifndef _PTHREAD_KEY_T
  357. #define _PTHREAD_KEY_T
  358. typedef __darwin_pthread_key_t pthread_key_t;
  359. #endif
  360.  
  361. /* statvfs and fstatvfs */
  362. #ifndef _FSBLKCNT_T
  363. #define _FSBLKCNT_T
  364. typedef __darwin_fsblkcnt_t fsblkcnt_t;
  365. #endif
  366.  
  367. #ifndef _FSFILCNT_T
  368. #define _FSFILCNT_T
  369. typedef __darwin_fsfilcnt_t fsfilcnt_t;
  370. #endif
  371.  
  372.  
  373. #endif /* !_SYS_TYPES_H_ */
Advertisement
RAW Paste Data Copied
Advertisement