OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [include/] [posix.h] - Blame information for rev 775

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 757 jeremybenn
// posix.h -- Helper functions for POSIX-flavored OSs.
2
 
3
/* Copyright (C) 2000, 2002, 2003, 2006, 2010  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_POSIX_H__
12
#define __JV_POSIX_H__
13
 
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
18
 
19
#include <time.h>
20
#include <sys/types.h>
21
 
22
#ifdef HAVE_SYS_TIME_H
23
#include <sys/time.h>
24
#endif
25
 
26
#ifdef HAVE_SYS_SELECT_H
27
#include <sys/select.h>
28
#endif
29
 
30
#ifdef HAVE_SYS_SOCKET_H
31
#include <sys/socket.h>
32
#endif
33
 
34
#ifdef HAVE_UNISTD_H
35
#include <unistd.h>
36
#endif
37
 
38
#include <fcntl.h>
39
 
40
/* The header file <sys/rw_lock.h> needs to be included before javaprims.h
41
   on HP-UX 11 to avoid a compilation error.  */
42
#ifdef HAVE_SYS_RW_LOCK_H
43
#include <sys/rw_lock.h>
44
#endif
45
 
46
#include <gcj/cni.h>
47
#include <java/util/Properties.h>
48
 
49
// Prefix and suffix for shared libraries.
50
#define _Jv_platform_solib_prefix "lib"
51
#if defined(__APPLE__) && defined(__MACH__)
52
#define _Jv_platform_solib_suffix ".dylib"
53
#elif defined(HPUX) && defined(HP_PA)
54
#define _Jv_platform_solib_suffix ".sl"
55
#else
56
#define _Jv_platform_solib_suffix ".so"
57
#endif
58
 
59
#if __MACH__ && (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1060)
60
#  undef _Unwind_FindEnclosingFunction
61
#  define _Unwind_FindEnclosingFunction(PC) _darwin10_Unwind_FindEnclosingFunction(PC)
62
#endif
63
 
64
// Some POSIX systems don't have O_SYNC and O_DYSNC so we define them here.
65
// Needed in java/io/natFileDescriptorPosix.cc.
66
#if !defined (O_SYNC) && defined (O_FSYNC)
67
#define O_SYNC O_FSYNC
68
#endif
69
#if !defined (O_DSYNC) && defined (O_FSYNC)
70
#define O_DSYNC O_FSYNC
71
#endif
72
// If O_DSYNC is still not defined, use O_SYNC (needed for newlib)
73
#if !defined (O_DSYNC) 
74
#define O_DSYNC O_SYNC
75
#endif
76
 
77
// Name of the Process implementation.
78
#ifdef ECOS
79
#define _Jv_platform_process ::java::lang::EcosProcess
80
#else
81
#define _Jv_platform_process ::java::lang::PosixProcess
82
#endif
83
 
84
// Separator for file name components.
85
#define _Jv_platform_file_separator ((jchar) '/')
86
// Separator for path components.
87
#define _Jv_platform_path_separator ((jchar) ':')
88
 
89
// List of names for `JNI_OnLoad'.
90
#define _Jv_platform_onload_names { "JNI_OnLoad", NULL }
91
 
92
// Type of libffi ABI used by JNICALL methods.  NOTE: This must agree
93
// with the JNICALL definition in jni.h
94
#define _Jv_platform_ffi_abi FFI_DEFAULT_ABI
95
 
96
#ifndef DISABLE_JAVA_NET
97
#include <java/net/InetAddress.h>
98
#endif
99
 
100
extern int _Jv_select (int n, fd_set *, fd_set *, fd_set *, struct timeval *);
101
extern jlong _Jv_platform_gettimeofday ();
102
extern jlong _Jv_platform_nanotime ();
103
extern void _Jv_platform_initialize (void);
104
extern void _Jv_platform_initProperties (java::util::Properties*);
105
 
106
#ifdef JV_HASH_SYNCHRONIZATION
107
#ifndef HAVE_USLEEP_DECL
108
extern "C" int usleep (useconds_t useconds);
109
#endif /* not HAVE_USLEEP_DECL */
110
 
111
inline void
112
_Jv_platform_usleep (unsigned long usecs)
113
{
114
  usleep (usecs);
115
}
116
#endif /* JV_HASH_SYNCHRONIZATION */
117
 
118
#ifndef DISABLE_JAVA_NET
119
 
120
#ifndef HAVE_SOCKLEN_T
121
#define socklen_t int
122
#endif
123
 
124
static inline int
125
_Jv_socket (int domain, int type, int protocol)
126
{
127
  return ::socket (domain, type, protocol);
128
}
129
 
130
#undef socket
131
 
132
inline int
133
_Jv_connect (jint fd, sockaddr *ptr, int len)
134
{
135
   return ::connect (fd, ptr, len);
136
}
137
 
138
#undef connect
139
 
140
inline int
141
_Jv_close (jint fd)
142
{
143
  return ::close (fd);
144
}
145
 
146
#undef close
147
 
148
// Avoid macro definitions of bind from system headers, e.g. on
149
// Solaris 7 with _XOPEN_SOURCE.  FIXME
150
inline int
151
_Jv_bind (int fd, struct sockaddr *addr, int addrlen)
152
{
153
  return ::bind (fd, addr, addrlen);
154
}
155
 
156
#undef bind
157
 
158
// Same problem with accept on Tru64 UNIX with _POSIX_PII_SOCKET
159
inline int
160
_Jv_accept (int fd, struct sockaddr *addr, socklen_t *addrlen)
161
{
162
  return ::accept (fd, addr, addrlen);
163
}
164
 
165
#undef accept
166
 
167
inline int
168
_Jv_listen (int fd, int backlog)
169
{
170
  return ::listen (fd, backlog);
171
}
172
 
173
#undef listen
174
 
175
inline int
176
_Jv_write(int s, void *buf, int len)
177
{
178
  return ::write (s, buf, len);
179
}
180
 
181
#undef write
182
 
183
inline int
184
_Jv_read(int s, void *buf, int len)
185
{
186
  return ::read (s, buf, len);
187
}
188
 
189
#undef read
190
 
191
#endif /* DISABLE_JAVA_NET */
192
 
193
// Wraps ::pipe
194
static inline int
195
_Jv_pipe (int filedes[2])
196
{
197
  return ::pipe (filedes);
198
}
199
 
200
// Forward declaration.  See java-stack.h for definition.
201
struct _Jv_AddrInfo;
202
 
203
// Given an address, determine the executable or shared object that defines
204
// it and the nearest named symbol.
205
extern int _Jv_platform_dladdr (void *addr, _Jv_AddrInfo *info);
206
 
207
#endif /* __JV_POSIX_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.