Adding in the rest of build 38.
[nativeclient.git] / include / win / port_win.h
blob0c677a032ab1f9b60cedfe892c3c4de29786197d
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 //arguments processing
66 int ffs(int x);
67 int getopt(int argc, char *argv[], char *optstring);
68 extern char *optarg; // global argument pointer
69 extern int optind; // global argv index
72 /*************************** stdio.h ********************/
73 #ifndef NULL
74 #ifdef __cplusplus
75 #define NULL 0
76 #else
77 #define NULL ((void *)0)
78 #endif
79 #endif
81 /* Seek method constants */
82 #define SEEK_CUR 1
83 #define SEEK_END 2
84 #define SEEK_SET 0
86 /************************************************************/
88 /* missing from Windows <errno.h> */
89 #define EDQUOT 122 /* Quota exceeded */
92 struct timezone {
93 int tz_minuteswest;
94 int tz_dsttime;
97 /* missing from win stdio.h and fcntl.h */
99 /* from bits/fcntl.h */
100 #define O_ACCMODE 0003
102 /* from linux/limits.h, via sys/param.h */
103 #define PATH_MAX 4096
105 #endif /* NATIVE_CLIENT_INCLUDE_WIN_PORT_WIN_H_ */