summaryrefslogtreecommitdiffstats
path: root/dalvik
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2011-05-18 18:21:17 -0700
committerElliott Hughes <enh@google.com>2011-05-19 10:30:29 -0700
commit23ec09188303a874b3b391f96ae0a29af002bff9 (patch)
tree25d0b7b0d8074fb60241ef64d4974bbfd11a65c1 /dalvik
parent7a891b5c83357dbeea2bbe4a5335ae685501e21c (diff)
downloadlibcore-23ec09188303a874b3b391f96ae0a29af002bff9.zip
libcore-23ec09188303a874b3b391f96ae0a29af002bff9.tar.gz
libcore-23ec09188303a874b3b391f96ae0a29af002bff9.tar.bz2
Implement recvfrom(2).
This one's a little bit hairy because of multiple return values. Bug: 3107501 Change-Id: I3bd35647d94bb6bc2192d6f31a39ecca07a3926e
Diffstat (limited to 'dalvik')
-rw-r--r--dalvik/src/main/java/dalvik/system/BlockGuard.java29
1 files changed, 3 insertions, 26 deletions
diff --git a/dalvik/src/main/java/dalvik/system/BlockGuard.java b/dalvik/src/main/java/dalvik/system/BlockGuard.java
index fe9b650..c25b5be 100644
--- a/dalvik/src/main/java/dalvik/system/BlockGuard.java
+++ b/dalvik/src/main/java/dalvik/system/BlockGuard.java
@@ -25,12 +25,11 @@ import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.SocketImpl;
-
import libcore.io.ErrnoException;
import libcore.io.Libcore;
import libcore.io.StructLinger;
+import libcore.util.EmptyArray;
import org.apache.harmony.luni.platform.INetworkSystem;
-
import static libcore.io.OsConstants.*;
/**
@@ -219,8 +218,8 @@ public final class BlockGuard {
throws IOException {
if (!TAG_SOCKETS) return;
- final byte[] tagBytes = tag != null ? tag.getBytes() : new byte[0];
- final byte[] uidBytes = uid != -1 ? Integer.toString(uid).getBytes() : new byte[0];
+ final byte[] tagBytes = tag != null ? tag.getBytes() : EmptyArray.BYTE;
+ final byte[] uidBytes = uid != -1 ? Integer.toString(uid).getBytes() : EmptyArray.BYTE;
final ByteArrayOutputStream buffer = new ByteArrayOutputStream(
4 + tagBytes.length + uidBytes.length);
@@ -261,27 +260,5 @@ public final class BlockGuard {
mNetwork.accept(serverFd, newSocket, clientFd);
tagSocketFd(clientFd);
}
-
- public int read(FileDescriptor aFD, byte[] data, int offset, int count) throws IOException {
- BlockGuard.getThreadPolicy().onNetwork();
- return mNetwork.read(aFD, data, offset, count);
- }
-
- public int readDirect(FileDescriptor aFD, int address, int count) throws IOException {
- BlockGuard.getThreadPolicy().onNetwork();
- return mNetwork.readDirect(aFD, address, count);
- }
-
- public int recv(FileDescriptor fd, DatagramPacket packet, byte[] data, int offset,
- int length, boolean peek, boolean connected) throws IOException {
- BlockGuard.getThreadPolicy().onNetwork();
- return mNetwork.recv(fd, packet, data, offset, length, peek, connected);
- }
-
- public int recvDirect(FileDescriptor fd, DatagramPacket packet, int address, int offset,
- int length, boolean peek, boolean connected) throws IOException {
- BlockGuard.getThreadPolicy().onNetwork();
- return mNetwork.recvDirect(fd, packet, address, offset, length, peek, connected);
- }
}
}