Don't delete or unpack binutils and gcc: we get them from Git
[nativeclient.git] / include / win / port_win.h
blobb920b7330bd8b36704891f6366d1289ca2dc6fce
1 /*
2 * Copyright 2008, Google Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following disclaimer
13 * in the documentation and/or other materials provided with the
14 * distribution.
15 * * Neither the name of Google Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from
17 * this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef NATIVE_CLIENT_INCLUDE_WIN_PORT_WIN_H_
34 #define NATIVE_CLIENT_INCLUDE_WIN_PORT_WIN_H_
36 #pragma warning( disable : 4255 4668 4820 4826 4619)
37 /* TODO: disabled warnings about Windows-specific secure functions
38 * such as sprintf_s */
39 #pragma warning( disable : 4996)
40 #pragma warning( disable : 4127) /* conditional expression is constant */
41 #include <windows.h>
42 #include "native_client/include/elf.h"
44 // types missing on Windows
45 typedef long off_t;
46 //typedef __int64 intptr_t;
47 typedef unsigned int size_t;
48 typedef int ssize_t;
49 typedef unsigned int uint32_t;
50 typedef int int32_t;
51 typedef unsigned char uint8_t;
52 typedef unsigned int u_int32_t;
53 typedef unsigned short __uint16_t;
54 typedef unsigned short uint16_t;
55 typedef short int16_t;
56 typedef int mode_t;
57 typedef long _off_t;
58 typedef long int __loff_t;
59 typedef signed char int8_t;
60 typedef unsigned long DWORD;
61 typedef long clock_t;
62 typedef __int64 int64_t;
63 typedef unsigned __int64 uint64_t;
65 #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
66 /* only what we need so far */
67 # define UINT8_MAX (255)
68 #endif
70 //arguments processing
71 int ffs(int x);
72 int getopt(int argc, char *argv[], char *optstring);
73 extern char *optarg; // global argument pointer
74 extern int optind; // global argv index
77 /*************************** stdio.h ********************/
78 #ifndef NULL
79 #ifdef __cplusplus
80 #define NULL 0
81 #else
82 #define NULL ((void *)0)
83 #endif
84 #endif
86 /* Seek method constants */
87 #define SEEK_CUR 1
88 #define SEEK_END 2
89 #define SEEK_SET 0
91 /************************************************************/
93 /* missing from Windows <errno.h> */
94 #define EDQUOT 122 /* Quota exceeded */
97 struct timezone {
98 int tz_minuteswest;
99 int tz_dsttime;
102 /* missing from win stdio.h and fcntl.h */
104 /* from bits/fcntl.h */
105 #define O_ACCMODE 0003
107 /* from linux/limits.h, via sys/param.h */
108 #define PATH_MAX 4096
110 #endif /* NATIVE_CLIENT_INCLUDE_WIN_PORT_WIN_H_ */