Lines Matching refs:fd

36     private FileDescriptor tagSocket(FileDescriptor fd) throws ErrnoException {
38 SocketTagger.get().tag(fd);
39 return fd;
45 private void untagSocket(FileDescriptor fd) throws ErrnoException {
47 SocketTagger.get().untag(fd);
53 @Override public FileDescriptor accept(FileDescriptor fd, InetSocketAddress peerAddress) throws ErrnoException, SocketException {
55 return tagSocket(os.accept(fd, peerAddress));
58 @Override public void close(FileDescriptor fd) throws ErrnoException {
60 if (S_ISSOCK(Libcore.os.fstat(fd).st_mode)) {
61 if (isLingerSocket(fd)) {
62 // If the fd is a socket with SO_LINGER set, we might block indefinitely.
67 untagSocket(fd);
75 os.close(fd);
78 private static boolean isLingerSocket(FileDescriptor fd) throws ErrnoException {
79 StructLinger linger = Libcore.os.getsockoptLinger(fd, SOL_SOCKET, SO_LINGER);
83 @Override public void connect(FileDescriptor fd, InetAddress address, int port) throws ErrnoException, SocketException {
85 os.connect(fd, address, port);
90 @Override public void fdatasync(FileDescriptor fd) throws ErrnoException {
92 os.fdatasync(fd);
95 @Override public void fsync(FileDescriptor fd) throws ErrnoException {
97 os.fsync(fd);
100 @Override public void ftruncate(FileDescriptor fd, long length) throws ErrnoException {
102 os.ftruncate(fd, length);
122 @Override public int pread(FileDescriptor fd, ByteBuffer buffer, long offset) throws ErrnoException {
124 return os.pread(fd, buffer, offset);
127 @Override public int pread(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset) throws ErrnoException {
129 return os.pread(fd, bytes, byteOffset, byteCount, offset);
132 @Override public int pwrite(FileDescriptor fd, ByteBuffer buffer, long offset) throws ErrnoException {
134 return os.pwrite(fd, buffer, offset);
137 @Override public int pwrite(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, long offset) throws ErrnoException {
139 return os.pwrite(fd, bytes, byteOffset, byteCount, offset);
142 @Override public int read(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException {
144 return os.read(fd, buffer);
147 @Override public int read(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException {
149 return os.read(fd, bytes, byteOffset, byteCount);
152 @Override public int readv(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException {
154 return os.readv(fd, buffers, offsets, byteCounts);
157 @Override public int recvfrom(FileDescriptor fd, ByteBuffer buffer, int flags, InetSocketAddress srcAddress) throws ErrnoException, SocketException {
159 return os.recvfrom(fd, buffer, flags, srcAddress);
162 @Override public int recvfrom(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetSocketAddress srcAddress) throws ErrnoException, SocketException {
164 return os.recvfrom(fd, bytes, byteOffset, byteCount, flags, srcAddress);
167 @Override public int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException {
169 return os.sendto(fd, buffer, flags, inetAddress, port);
172 @Override public int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException {
177 return os.sendto(fd, bytes, byteOffset, byteCount, flags, inetAddress, port);
190 @Override public int write(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException {
192 return os.write(fd, buffer);
195 @Override public int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException {
197 return os.write(fd, bytes, byteOffset, byteCount);
200 @Override public int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException {
202 return os.writev(fd, buffers, offsets, byteCounts);