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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gnu/] [java/] [nio/] [channels/] [natFileChannelEcos.cc] - Blame information for rev 756

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 756 jeremybenn
// natFileDescriptor.cc - Native part of FileDescriptor class.
2
 
3
/* Copyright (C) 1998, 1999, 2001, 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
#include <config.h>
12
 
13
#include <errno.h>
14
#include <string.h>
15
#include <sys/types.h>
16
#include <sys/stat.h>
17
#include <sys/param.h>
18
 
19
#include <gcj/cni.h>
20
#include <jvm.h>
21
#include <java/io/FileDescriptor.h>
22
#include <java/io/SyncFailedException.h>
23
#include <java/io/IOException.h>
24
#include <java/io/EOFException.h>
25
#include <java/lang/ArrayIndexOutOfBoundsException.h>
26
#include <java/lang/NullPointerException.h>
27
#include <java/lang/String.h>
28
#include <java/io/FileNotFoundException.h>
29
#include <gnu/java/nio/MappedByteBufferImpl.h>
30
#include <java/nio/channels/FileChannel.h>
31
#include <java/nio/channels/FileLock.h>
32
#include <gnu/java/nio/channels/FileChannelImpl.h>
33
 
34
using gnu::gcj::RawData;
35
using java::io::IOException;
36
using gnu::java::nio::MappedByteBufferImpl;
37
using java::io::InterruptedIOException;
38
using java::io::FileNotFoundException;
39
using java::lang::ArrayIndexOutOfBoundsException;
40
using java::lang::NullPointerException;
41
using gnu::java::nio::channels::FileChannelImpl;
42
 
43
extern "C" void diag_write_char (char c);
44
 
45
static void
46
diag_write (char *data, int len)
47
{
48
  while (len > 0)
49
    {
50
      diag_write_char (*data++);
51
      len--;
52
    }
53
}
54
 
55
#define NO_FSYNC_MESSAGE "sync unsupported"
56
 
57
void
58
FileChannelImpl::init(void)
59
{
60
  in = new FileChannelImpl((jint) 0, FileChannelImpl::READ);
61
  out = new FileChannelImpl((jint) 1, FileChannelImpl::WRITE);
62
  err = new FileChannelImpl((jint) 2, FileChannelImpl::WRITE);
63
}
64
 
65
#if 0
66
jboolean
67
FileChannelImpl::valid (void)
68
{
69
  return true;
70
}
71
 
72
void
73
FileChannelImpl::sync (void)
74
{
75
  // Some files don't support fsync.  We don't bother reporting these
76
  // as errors.
77
#ifdef HAVE_FSYNC
78
#else
79
  throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE));
80
#endif
81
}
82
#endif
83
 
84
jint
85
FileChannelImpl::open (jstring, jint)
86
{
87
  return fd;
88
}
89
 
90
void
91
FileChannelImpl::write (jint)
92
{
93
  char d = (char) b;
94
  ::diag_write (&d, 1);
95
}
96
 
97
void
98
FileChannelImpl::write (jbyteArray b, jint offset, jint len)
99
{
100
  if (! b)
101
    throw new NullPointerException;
102
  if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b))
103
    throw new ArrayIndexOutOfBoundsException;
104
  char *bytes = (char *)elements (b) + offset;
105
  ::diag_write (bytes, len);
106
}
107
 
108
void
109
FileChannelImpl::implCloseChannel (void)
110
{
111
}
112
 
113
void
114
FileChannelImpl::implTruncate (jlong)
115
{
116
}
117
 
118
void
119
FileChannelImpl::seek (jlong)
120
{
121
}
122
 
123
jlong
124
FileChannelImpl::size (void)
125
{
126
  return 0;
127
}
128
 
129
jlong
130
FileChannelImpl::implPosition (void)
131
{
132
  return 0;
133
}
134
 
135
jint
136
FileChannelImpl::read (void)
137
{
138
  return 0;
139
}
140
 
141
jint
142
FileChannelImpl::read (jbyteArray buffer, jint offset, jint count)
143
{
144
  return 0;
145
}
146
 
147
jint
148
FileChannelImpl::available (void)
149
{
150
  return 0;
151
}
152
 
153
jboolean
154
FileChannelImpl::lock (jlong, jlong, jboolean, jboolean)
155
{
156
  throw new IOException (JvNewStringLatin1
157
    ("gnu.java.nio.FileChannelImpl.lock() not implemented"));
158
}
159
 
160
void
161
FileChannelImpl::unlock (jlong, jlong)
162
{
163
  throw new IOException (JvNewStringLatin1
164
    ("gnu.java.nio.channels.FileChannelImpl.unlock() not implemented"));
165
}
166
 
167
java::nio::MappedByteBuffer *
168
FileChannelImpl::mapImpl (jchar, jlong, jint)
169
{
170
  return NULL;
171
}
172
 
173
void
174
MappedByteBufferImpl::unmapImpl ()
175
{
176
}
177
 
178
void
179
MappedByteBufferImpl::loadImpl ()
180
{
181
}
182
 
183
jboolean
184
MappedByteBufferImpl::isLoadedImpl ()
185
{
186
  return true;
187
}
188
 
189
void
190
MappedByteBufferImpl::forceImpl ()
191
{
192
}

powered by: WebSVN 2.1.0

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