1 /*
2 *
3 * Copyright (c) 2003 The Regents of the University of California. All
4 * rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * - Neither the name of the University nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 */
30
31
32 /* $Id: cygwin_compat.h,v 1.3 2006-02-07 02:16:11 jelson Exp $ */
33
34 #if defined(__CYGWIN__) && !defined(__CYGWIN_COMPAT_H__)
35 #define __CYGWIN_COMPAT_H__
36
37 #include <stdint.h>
38
39 typedef long long int loff_t;
40
41 #define uint32_t __uint32_t
42 #define int32_t __int32_t
43 //typedef __uint32_t uint32_t
44
45 #define __STRING(expr) #expr
46
47
48 /* ioctl stuff */
49 #ifndef IOCPARM_MASK
50 #define IOCPARM_MASK 0x7f
51 #define IOC_VOID 0x20000000
52 #define IOC_OUT 0x40000000
53 #define IOC_IN 0x80000000
54 #define IOC_INOUT (IOC_IN|IOC_OUT)
55 #endif /* IOCPARM_MASK */
56
57 #ifndef _IO
58 #define _IO(x,y) (IOC_VOID|((x)<<8)|(y))
59 #define _IOR(x,y,t) (IOC_OUT|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
60 #define _IOW(x,y,t) (IOC_IN|(((long)sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))
61 #define _IOWR(x,y,t) (IOC_INOUT|(((long)sizeof(t)&IOCPARM_MASK)<<16|(x<<8)|y))
62 #endif /* _IO */
63
64 // _IOC(x, y, t) is _IOC(type, nr, size)
65 #ifndef _IOC_READ
66 #define _IOC_READ IOC_IN
67 #define _IOC_WRITE IOC_OUT
68 #endif /* _IOC_READ */
69
70 #ifndef _IOC_DIR
71 #define _IOC_DIR(t) ((t) & (IOC_VOID|IOC_OUT|IOC_IN))
72 #define _IOC_TYPE(x) (((x) >> 8) & 0xff)
73 #define _IOC_NR(y) ((y) & 0xff)
74 #define _IOC_SIZE(t) (((t) >> 16) & IOCPARM_MASK)
75 #endif /* _IOC_DIR */
76
77
78 #endif /* __CYGWIN_COMPAT_H__ */
79
80
81
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.