1 // posix.h -- Helper functions for POSIX-flavored OSs.
3 /* Copyright (C) 2000, 2002, 2003 Free Software Foundation
5 This file is part of libgcj.
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 #ifndef __JV_POSIX_H__
12 #define __JV_POSIX_H__
14 /* Required on Tru64 UNIX V4/V5 so <sys/socket.h> defines prototypes of
15 socket functions with socklen_t instead of size_t. This must be defined
16 early so <standards.h> defines the correct version of __PIIX. */
17 #define _POSIX_PII_SOCKET
20 #include <sys/types.h>
22 #ifdef HAVE_SYS_TIME_H
26 #ifdef HAVE_SYS_SELECT_H
27 #include <sys/select.h>
30 #ifdef HAVE_SYS_SOCKET_H
31 #include <sys/socket.h>
41 #include <java/util/Properties.h>
43 // Prefix and suffix for shared libraries.
44 #define _Jv_platform_solib_prefix "lib"
45 #define _Jv_platform_solib_suffix ".so"
47 #ifndef DISABLE_JAVA_NET
48 #include <java/net/InetAddress.h>
51 extern int _Jv_select (int n
, fd_set
*, fd_set
*, fd_set
*, struct timeval
*);
52 extern jlong
_Jv_platform_gettimeofday ();
53 extern void _Jv_platform_initialize (void);
54 extern void _Jv_platform_initProperties (java::util::Properties
*);
57 _Jv_platform_close_on_exec (jint fd
)
60 ::fcntl (fd
, F_SETFD
, FD_CLOEXEC
);
65 #ifdef JV_HASH_SYNCHRONIZATION
67 _Jv_platform_usleep (unsigned long usecs
)
71 #endif /* JV_HASH_SYNCHRONIZATION */
73 #ifndef DISABLE_JAVA_NET
75 #ifndef HAVE_SOCKLEN_T
80 _Jv_socket (int domain
, int type
, int protocol
)
82 return ::socket (domain
, type
, protocol
);
88 _Jv_connect (jint fd
, sockaddr
*ptr
, int len
)
90 return ::connect (fd
, ptr
, len
);
103 // Avoid macro definitions of bind from system headers, e.g. on
104 // Solaris 7 with _XOPEN_SOURCE. FIXME
106 _Jv_bind (int fd
, struct sockaddr
*addr
, int addrlen
)
108 return ::bind (fd
, addr
, addrlen
);
113 // Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
115 _Jv_accept (int fd
, struct sockaddr
*addr
, socklen_t
*addrlen
)
117 return ::accept (fd
, addr
, addrlen
);
123 _Jv_listen (int fd
, int backlog
)
125 return ::listen (fd
, backlog
);
131 _Jv_write(int s
, void *buf
, int len
)
133 return ::write (s
, buf
, len
);
139 _Jv_read(int s
, void *buf
, int len
)
141 return ::read (s
, buf
, len
);
146 #endif /* DISABLE_JAVA_NET */
148 #endif /* __JV_POSIX_H__ */