]> git.ipfire.org Git - thirdparty/gcc.git/blame - libjava/include/posix.h
Remove obsolete Tru64 UNIX V5.1B support
[thirdparty/gcc.git] / libjava / include / posix.h
CommitLineData
f536cd95
TT
1// posix.h -- Helper functions for POSIX-flavored OSs.
2
5c30094f 3/* Copyright (C) 2000, 2002, 2003, 2006, 2010, 2012 Free Software Foundation
f536cd95
TT
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
60678e47
BM
11#ifndef __JV_POSIX_H__
12#define __JV_POSIX_H__
13
f536cd95
TT
14#include <time.h>
15#include <sys/types.h>
16
17#ifdef HAVE_SYS_TIME_H
18#include <sys/time.h>
19#endif
20
21#ifdef HAVE_SYS_SELECT_H
22#include <sys/select.h>
23#endif
24
c3e0633c
MK
25#ifdef HAVE_SYS_SOCKET_H
26#include <sys/socket.h>
27#endif
28
f536cd95
TT
29#ifdef HAVE_UNISTD_H
30#include <unistd.h>
31#endif
32
0c1fcb02
TT
33#include <fcntl.h>
34
5920d981
JDA
35/* The header file <sys/rw_lock.h> needs to be included before javaprims.h
36 on HP-UX 11 to avoid a compilation error. */
37#ifdef HAVE_SYS_RW_LOCK_H
38#include <sys/rw_lock.h>
39#endif
40
8eeda6e0 41#include <gcj/cni.h>
455cd615 42#include <java/util/Properties.h>
8eeda6e0 43
78bb0444
TT
44// Prefix and suffix for shared libraries.
45#define _Jv_platform_solib_prefix "lib"
4148df12 46#if defined(__APPLE__) && defined(__MACH__)
dcde9775 47#define _Jv_platform_solib_suffix ".dylib"
68bfb94e
AT
48#elif defined(HPUX) && defined(HP_PA)
49#define _Jv_platform_solib_suffix ".sl"
dcde9775 50#else
78bb0444 51#define _Jv_platform_solib_suffix ".so"
dcde9775 52#endif
78bb0444 53
e2a1fcf0
IS
54#if __MACH__ && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060)
55# undef _Unwind_FindEnclosingFunction
56# define _Unwind_FindEnclosingFunction(PC) _darwin10_Unwind_FindEnclosingFunction(PC)
4546b861
JH
57#endif
58
49c72d22
LR
59// Some POSIX systems don't have O_SYNC and O_DYSNC so we define them here.
60// Needed in java/io/natFileDescriptorPosix.cc.
61#if !defined (O_SYNC) && defined (O_FSYNC)
62#define O_SYNC O_FSYNC
63#endif
64#if !defined (O_DSYNC) && defined (O_FSYNC)
65#define O_DSYNC O_FSYNC
66#endif
248e983e
MK
67// If O_DSYNC is still not defined, use O_SYNC (needed for newlib)
68#if !defined (O_DSYNC)
69#define O_DSYNC O_SYNC
70#endif
49c72d22 71
97b8365c
TT
72// Name of the Process implementation.
73#ifdef ECOS
74#define _Jv_platform_process ::java::lang::EcosProcess
75#else
76#define _Jv_platform_process ::java::lang::PosixProcess
77#endif
78
2b7f1f8f
TT
79// Separator for file name components.
80#define _Jv_platform_file_separator ((jchar) '/')
81// Separator for path components.
82#define _Jv_platform_path_separator ((jchar) ':')
83
84// List of names for `JNI_OnLoad'.
85#define _Jv_platform_onload_names { "JNI_OnLoad", NULL }
86
87// Type of libffi ABI used by JNICALL methods. NOTE: This must agree
88// with the JNICALL definition in jni.h
89#define _Jv_platform_ffi_abi FFI_DEFAULT_ABI
90
d1bf262d
MK
91#ifndef DISABLE_JAVA_NET
92#include <java/net/InetAddress.h>
93#endif
94
f536cd95 95extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
8eeda6e0 96extern jlong _Jv_platform_gettimeofday ();
e59a1e40 97extern jlong _Jv_platform_nanotime ();
73272ce6 98extern void _Jv_platform_initialize (void);
455cd615 99extern void _Jv_platform_initProperties (java::util::Properties*);
8eeda6e0 100
6ec62897 101#ifdef JV_HASH_SYNCHRONIZATION
6b3517ea
RO
102#ifndef HAVE_USLEEP_DECL
103extern "C" int usleep (useconds_t useconds);
104#endif /* not HAVE_USLEEP_DECL */
105
35a94bdc
TT
106inline void
107_Jv_platform_usleep (unsigned long usecs)
108{
109 usleep (usecs);
110}
6ec62897 111#endif /* JV_HASH_SYNCHRONIZATION */
35a94bdc 112
d1bf262d
MK
113#ifndef DISABLE_JAVA_NET
114
32e098dd
AT
115#ifndef HAVE_SOCKLEN_T
116#define socklen_t int
117#endif
118
c3e0633c
MK
119static inline int
120_Jv_socket (int domain, int type, int protocol)
121{
122 return ::socket (domain, type, protocol);
123}
124
a191802c
RO
125#undef socket
126
c3e0633c
MK
127inline int
128_Jv_connect (jint fd, sockaddr *ptr, int len)
129{
130 return ::connect (fd, ptr, len);
131}
132
a191802c
RO
133#undef connect
134
c3e0633c
MK
135inline int
136_Jv_close (jint fd)
137{
138 return ::close (fd);
139}
140
a191802c
RO
141#undef close
142
c3e0633c
MK
143// Avoid macro definitions of bind from system headers, e.g. on
144// Solaris 7 with _XOPEN_SOURCE. FIXME
145inline int
146_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
147{
148 return ::bind (fd, addr, addrlen);
149}
150
a191802c
RO
151#undef bind
152
c3e0633c
MK
153inline int
154_Jv_listen (int fd, int backlog)
155{
156 return ::listen (fd, backlog);
157}
158
a191802c
RO
159#undef listen
160
c3e0633c
MK
161inline int
162_Jv_write(int s, void *buf, int len)
163{
164 return ::write (s, buf, len);
165}
166
a191802c
RO
167#undef write
168
c3e0633c
MK
169inline int
170_Jv_read(int s, void *buf, int len)
171{
172 return ::read (s, buf, len);
173}
e59ff7e9 174
a191802c
RO
175#undef read
176
e59ff7e9
MK
177#endif /* DISABLE_JAVA_NET */
178
ef050c9e
ME
179// Wraps ::pipe
180static inline int
181_Jv_pipe (int filedes[2])
182{
183 return ::pipe (filedes);
184}
185
33792684
RM
186// Forward declaration. See java-stack.h for definition.
187struct _Jv_AddrInfo;
188
189// Given an address, determine the executable or shared object that defines
190// it and the nearest named symbol.
d25f0ebc 191extern int _Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info);
33792684 192
e59ff7e9 193#endif /* __JV_POSIX_H__ */