Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/solaris/native/java/net/net_util_md.h
+++ new/src/solaris/native/java/net/net_util_md.h
1 1 /*
2 2 * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation. Sun designates this
8 8 * particular file as subject to the "Classpath" exception as provided
9 9 * by Sun in the LICENSE file that accompanied this code.
10 10 *
11 11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 14 * version 2 for more details (a copy is included in the LICENSE file that
15 15 * accompanied this code).
16 16 *
17 17 * You should have received a copy of the GNU General Public License version
18 18 * 2 along with this work; if not, write to the Free Software Foundation,
19 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 20 *
21 21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 23 * have any questions.
24 24 */
25 25
26 26 #ifndef NET_UTILS_MD_H
27 27 #define NET_UTILS_MD_H
28 28
29 29 #include <sys/socket.h>
30 30 #include <sys/types.h>
31 31 #include <netdb.h>
32 32 #include <netinet/in.h>
33 33 #include <unistd.h>
34 34
35 35 #ifndef USE_SELECT
36 36 #include <sys/poll.h>
37 37 #endif
38 38
39 39
40 40 #ifdef __linux__
41 41 extern int NET_Timeout(int s, long timeout);
42 42 extern int NET_Read(int s, void* buf, size_t len);
43 43 extern int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
44 44 struct sockaddr *from, int *fromlen);
45 45 extern int NET_ReadV(int s, const struct iovec * vector, int count);
46 46 extern int NET_Send(int s, void *msg, int len, unsigned int flags);
47 47 extern int NET_SendTo(int s, const void *msg, int len, unsigned int
48 48 flags, const struct sockaddr *to, int tolen);
49 49 extern int NET_Writev(int s, const struct iovec * vector, int count);
50 50 extern int NET_Connect(int s, struct sockaddr *addr, int addrlen);
51 51 extern int NET_Accept(int s, struct sockaddr *addr, int *addrlen);
52 52 extern int NET_SocketClose(int s);
53 53 extern int NET_Dup2(int oldfd, int newfd);
54 54
55 55 #ifdef USE_SELECT
56 56 extern int NET_Select(int s, fd_set *readfds, fd_set *writefds,
57 57 fd_set *exceptfds, struct timeval *timeout);
58 58 #else
59 59 extern int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout);
60 60 #endif
61 61
62 62 #else
63 63
64 64 #define NET_Timeout JVM_Timeout
65 65 #define NET_Read JVM_Read
66 66 #define NET_RecvFrom JVM_RecvFrom
67 67 #define NET_ReadV readv
68 68 #define NET_Send JVM_Send
69 69 #define NET_SendTo JVM_SendTo
70 70 #define NET_WriteV writev
71 71 #define NET_Connect JVM_Connect
72 72 #define NET_Accept JVM_Accept
73 73 #define NET_SocketClose JVM_SocketClose
74 74 #define NET_Dup2 dup2
75 75 #define NET_Select select
76 76 #define NET_Poll poll
77 77
78 78 #endif
79 79
80 80 #if defined(__linux__) && defined(AF_INET6)
81 81 int getDefaultIPv6Interface(struct in6_addr *target_addr);
82 82 #endif
83 83
84 84
85 85 /* needed from libsocket on Solaris 8 */
86 86
87 87 typedef int (*getaddrinfo_f)(const char *nodename, const char *servname,
88 88 const struct addrinfo *hints, struct addrinfo **res);
89 89
90 90 typedef void (*freeaddrinfo_f)(struct addrinfo *);
91 91
92 92 typedef int (*getnameinfo_f)(const struct sockaddr *, size_t,
93 93 char *, size_t, char *, size_t, int);
94 94
95 95 extern getaddrinfo_f getaddrinfo_ptr;
96 96 extern freeaddrinfo_f freeaddrinfo_ptr;
97 97 extern getnameinfo_f getnameinfo_ptr;
98 98
99 99 /* do we have address translation support */
100 100
101 101 extern jboolean NET_addrtransAvailable();
102 102
103 103 #define NET_WAIT_READ 0x01
↓ open down ↓ |
103 lines elided |
↑ open up ↑ |
104 104 #define NET_WAIT_WRITE 0x02
105 105 #define NET_WAIT_CONNECT 0x04
106 106
107 107 extern jint NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout);
108 108
109 109 /************************************************************************
110 110 * Macros and constants
111 111 */
112 112
113 113 /*
114 - * Its safe to increase the buffer to 8K, this gives a 5-20%
115 - * performance boost on volano and overall socket performance.
114 + * On 64-bit JDKs we use a much larger stack and heap buffer.
116 115 */
116 +#ifdef _LP64
117 +#define MAX_BUFFER_LEN 65536
118 +#define MAX_HEAP_BUFFER_LEN 131072
119 +#else
117 120 #define MAX_BUFFER_LEN 8192
118 121 #define MAX_HEAP_BUFFER_LEN 65536
122 +#endif
119 123
120 124 #ifdef AF_INET6
121 125
122 126 #define SOCKADDR union { \
123 127 struct sockaddr_in him4; \
124 128 struct sockaddr_in6 him6; \
125 129 }
126 130
127 131 #define SOCKADDR_LEN (ipv6_available() ? sizeof(SOCKADDR) : \
128 132 sizeof(struct sockaddr_in))
129 133
130 134 #else
131 135
132 136 #define SOCKADDR union { struct sockaddr_in him4 }
133 137 #define SOCKADDR_LEN sizeof(SOCKADDR)
134 138
135 139 #endif
136 140
137 141 /************************************************************************
138 142 * Utilities
139 143 */
140 144 #ifdef __linux__
141 145 extern int kernelIsV22();
142 146 extern int kernelIsV24();
143 147 #endif
144 148
145 149 void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name,
146 150 const char *defaultDetail);
147 151
148 152
149 153 #endif /* NET_UTILS_MD_H */
↓ open down ↓ |
21 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX