OSDN Git Service

2002-11-22 Michael Koch <konqueror@gmx.de>
[pf3gnuchains/gcc-fork.git] / libjava / include / win32.h
1 // win32.h -- Helper functions for Microsoft-flavored OSs.
2
3 /* Copyright (C) 2002  Free Software Foundation
4
5    This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
9 details.  */
10
11 #ifndef __JV_WIN32_H__
12 #define __JV_WIN32_H__
13
14 #include <windows.h>
15 #undef STRICT
16
17 #undef __INSIDE_CYGWIN__
18 #include <winsock.h>
19 #define IP_TOS 3
20 #include <gcj/cni.h>
21 #include <java/util/Properties.h>
22
23 #include <io.h>
24
25 #ifndef DISBALE_JAVA_NET
26
27 // these errors cannot occur on Win32
28 #define ENOTCONN 0
29 #define ECONNRESET 0
30
31 #ifndef ENOPROTOOPT
32 #define ENOPROTOOPT 109
33 #endif
34
35 #endif // DISBALE_JAVA_NET
36
37 extern void _Jv_platform_initialize (void);
38 extern void _Jv_platform_initProperties (java::util::Properties*);
39 extern jlong _Jv_platform_gettimeofday ();
40
41 inline void
42 _Jv_platform_close_on_exec (jint)
43 {
44   // Ignore.
45 }
46
47 #ifndef DISBALE_JAVA_NET
48
49 static inline int
50 _Jv_socket (int domain, int type, int protocol)
51 {
52   return ::socket (domain, type, protocol);
53 }
54
55 inline int
56 _Jv_connect (jint fd, sockaddr *ptr, int len)
57 {
58    return ::connect (fd, ptr, len);
59 }
60
61 inline int
62 _Jv_close (jint fd)
63 {
64   return ::closesocket (fd);
65 }
66
67 inline int
68 _Jv_bind (int fd, struct sockaddr *addr, int addrlen)
69 {
70   return ::bind (fd, addr, addrlen);
71 }
72
73 inline int
74 _Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
75 {
76   return ::accept (fd, addr, addrlen);
77 }
78
79 inline int
80 _Jv_listen (int fd, int backlog)
81 {
82   return ::listen (fd, backlog);
83 }
84
85 inline int
86 _Jv_write(int s, void *buf, int len)
87 {
88   return ::send (s, (char*) buf, len, 0);
89 }
90
91 inline int
92 _Jv_read(int s, void *buf, int len)
93 {
94   return ::recv (s, (char*) buf, len, 0);
95 }
96
97 #endif /* DISBALE_JAVA_NET */
98
99 #define HAVE_BACKTRACE
100
101 /* Store up to SIZE return address of the current program state in
102    ARRAY and return the exact number of values stored.  */
103 extern int backtrace (void **__array, int __size);
104
105 #endif /* __JV_WIN32_H__ */