History log of /libcore/luni/src/test/java/libcore/io/OsTest.java
Revision Date Author Comments
0c2a90d87ef38e2b756057c32b9db414a140cfe3 26-May-2016 Narayan Kamath <narayan@google.com> OsTest: Explicitly delete temporary files.

Don't rely on temporary directory cleanup.

bug: 28946760
Change-Id: I2cded2d0ffe6ea05008295460f8e16b09f8ad6f4
9ae30e796640d1fe4141050ea8a9ed7b2b86b0ce 16-May-2016 Narayan Kamath <narayan@google.com> Add Libcore.os.realpath.

bug: 28740848
Change-Id: I6a965ace64d82cded67882e91860f4fb298a9a51
fb34431c917d206542a3eeb42338f8fb42fc40a9 30-Mar-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Handle recvfrom() returning 0.

According to the Linux man page, recvfrom() can return 0 when the peer has performed an orderly shutdown. This also happens when other thread uses a shutdown function on a socket file descriptor.

libcore.io.Posix#recvfrom was treating this case as a success and
was trying to interpret unpopulated sockaddr structure, throwing
IllegalArgumentException in result.

DatagramChannel#receive in same case would return
last previously seen SocketAddress.

This change makes sure that libcore.io.Posix#recvfrom and
java.nio.channels.DatagramChannel handle this case correctly.

Bug: 27294715
Bug: 27233089
Change-Id: I1ec58327efbe9ea6b8d36716756a02987e3b9897
(cherry picked from commit 6e888e9390649a9ab2557da5b28bb75be39e1b74)
035c578a39be09822a0402c850ed3e793956c913 08-Feb-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> SocketImpl#getFileDescriptor shouldn't be public

It's protected, as it was before openJdk switch. Added
hidden public method getFD$ for tests.

Bug: 26689841
Change-Id: I7e4149a5100b448e8729536f9718a35707a1c290
(cherry picked from commit 5dfeb54cb55eab53e5307e205a16b59e1da5ab07)
5dfeb54cb55eab53e5307e205a16b59e1da5ab07 08-Feb-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> SocketImpl#getFileDescriptor shouldn't be public

It's protected, as it was before openJdk switch. Added
hidden public method getFD$ for tests.

Bug: 26689841
Change-Id: I7e4149a5100b448e8729536f9718a35707a1c290
b0ff23bbf588d76541eed5f98be94785dcba6b98 08-Feb-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> SocketImpl#getFileDescriptor shouldn't be public

It's protected, as it was before openJdk switch. Added
hidden public method getFD$ for tests.

Bug: 26689841
Change-Id: I7e4149a5100b448e8729536f9718a35707a1c290
f7ab2bc37debba91864bfec6572a3e7bbe994c58 06-May-2015 Piotr Jastrzebski <haaawk@google.com> Use OpenJdk implementation of java.net.*

- Add FileURLConnection.
- NetworkUtilities : Update field names in JNI.
- Suppress a few libcore tests that rely on internal implementation
details.
- Remove code that loads the net library (not needed on android).
- DatagramSocket : Add setNetworkInterface method.
- HttpCookie : make parse & field public
- Inet4Address / Inet6Address : Add getAddressInternal.
- InetAddress : Add methods required by frameworks/base, particularly
those required to deal with net-ids and scope ids.
- URI : Add UriCodec static members for AUTHORITY_ENCODER and friends.
- URL : Add toUriLenient
- URLStreamHandler : Add a toExternalForm variant that optionally
escapes illegal chars.
- Inet4AddressImpl.c : Unconditionally define HAS_GLIBC_GETHOSTBY_R

Change-Id: Ic51f863941f5d954ed6cf86309cc610e711d54bd
b4af0b52e1190846edde87f352ca722a7d9e0259 11-Aug-2015 Lorenzo Colitti <lorenzo@google.com> Properly restore errno if NET_FAILURE_RETRY fails.

If NET_FAILURE_RETRY fails, it throws an exception. In all but
one codepath, that exception ends up being passed back to Java
land immediately, so it doesn't matter what errno is set to.

However, in the case where we need to retry the socket call with
a sockaddr_in (i.e., NET_IPV4_FALLBACK), we clear the exception
and march on. This means that if errno is touched by
throwErrnoException (strace showed this happening, for example,
if futex() returns EAGAIN), we don't retry the socket call and
instead return the previous EAFNOSUPPORT error to the caller.

Also modify IO_FAILURE_RETRY for consistency.

Bug: 23088314
Change-Id: Ib92771ba2001c2696f83f61f48bd137a7a91a880
2492e430396dc297b2fb784c46d343c3f457fc7d 10-Jul-2015 Neil Fuller <nfuller@google.com> Add tests for unlink

This change also contains some indentation fixes and a rename
of assertPartial to assertStartsWith.

Bug: 3106438
Change-Id: Ibeacefbdfaeaa32945ef46e84fcd5e415e957b57
0ab1a26ca767ae36fbbe27b62893670b208fa494 07-Jul-2015 Neil Fuller <nfuller@google.com> Rearrange how AF_UNIX sockets are handled for accept()

Contains the following changes:
1) Introduction of UnixSocketAddress / removal of InetUnixAddress.
2) Os/Posix classes now take SocketAddress instead of InetSocketAddress.
3) Removal of native code that dealt with InetUnixAddress.
4) Introduction of OsConstants.UNIX_PATH_MAX to hold the maximum sun_path
size.
5) Update tests.

Bug: 3106438
Change-Id: I47a3618387f21599bfbfd0dc9a821839bf47b39b
90246a0ae7117d780e077c9e84cdb73ff5b44af7 02-Jul-2015 Jeff Sharkey <jsharkey@android.com> Add getxattr/setxattr/removexattr syscalls.

Bug: 20275572

(cherry picked from commit 82d076b51f6fe7c1cbd1f37414be36eaaa9b0e56)

Change-Id: Ifb808e69dddb88eba253ddf4273013828eab16f6
82d076b51f6fe7c1cbd1f37414be36eaaa9b0e56 02-Jul-2015 Jeff Sharkey <jsharkey@android.com> Add getxattr/setxattr/removexattr syscalls.

Bug: 20275572
Change-Id: I958056f757f095ad6278624e293a5583d9cee822
bf9a16e6edb7fe8e36fe2ea83efaceaa8eb538cd 17-Mar-2015 Lorenzo Colitti <lorenzo@google.com> Remove a superfluous cast.

Change-Id: I1b4b9d9160a66d0ce9aa2449526041d1c75d545d
f5fc4ade3ab082f545e2aafdb1942c1f14e0df5d 13-Mar-2015 Lorenzo Colitti <lorenzo@google.com> Also support IPv4 fallback in the SocketAddress version of sendto.

Change-Id: I90bbc9661b0a48bb19c9c1c5aa4cd493f4dff2fa
00bb2a5e5d619cbfd172793ca9bf7130192765eb 12-Mar-2015 Lorenzo Colitti <lorenzo@google.com> Support packet sockets in libcore.

Bug: 19704592
Change-Id: Ic424e4c36f6de028df4a3095f57a08b68da78033
a8b7587c5001db3489c64ac1d16c254a683f76bd 11-Mar-2015 Lorenzo Colitti <lorenzo@google.com> Add a version of sendto that takes a SocketAddress.

Only the byte[] version for now. The ByteBuffer version will be
added later.

Bug: 19704592
Change-Id: I35c5f305b5828ff3315e42aae72aa4b01839e2fc
b2a9923fa2006e384013734d3e1c6a7fbe3d9074 16-Jan-2015 Lorenzo Colitti <lorenzo@google.com> Make it possible to use AF_INET sockets created by libcore.

Currently, it's possible to create AF_INET sockets using:

Libcore.os.socket(AF_INET, ...

but such sockets can't be used for anything, because os.bind()
and os.connect() automatically convert IPv4 addresses to
IPv4-mapped addresses (e.g., 192.0.2.1 to ::ffff:192.0.2.1),
and passing a sockaddr_in6 to a system call on an AF_INET socket
causes the kernel to return EAFNOSUPPORT.

When this happens, retry using an unmapped IPv4 address. We
could also call getsockopt(SOL_SOCKET, SO_DOMAIN) before every
system call and pass in the appropriate socket address
structure, but that would cause these socket functions to make
two system calls instead of one and would probably halve the
performance of sendto(). This way, there's only one system call
for most sockets (including all AF_INET6 sockets created in
Java), and two system calls only in the rare case of a socket
that's explicitly created as AF_INET.

Bug: 18558481
Bug: 19704592
Change-Id: I71b3728b6a72b742e156d4c60db65e88b9a9e51e
8f5b46d72e5c1b1b1dd4357580c4fb5a60e3f4de 26-Jan-2015 Erik Kline <ek@google.com> Add support for netlink sockets and addresses.

Additionally:
- support bind and connect calls with SocketAddresses
- getsockname and getpeername can return a NetlinkSocketAddress

Developed in conjunction with:
https://android-review.googlesource.com/135490

Bug: 18581716
Change-Id: I760a06cdb9bdb26c734fb02cf668a94de982e2b6
c8d9ea662de6f4856b28907b4119087cfc5a44d2 16-Jan-2015 Narayan Kamath <narayan@google.com> Add fcntlInt.

Hidden for now, for use from the frameworks.

Change-Id: I30d95b28ecbc422aaa5bf28fb2f288c3ca026493
d9f7e57f5d09b587d8c8d1bd42b895f7de8fbf54 09-Dec-2014 Narayan Kamath <narayan@google.com> Update ByteBuffer positions in Posix.* functions.

Also add tests in libcore.io.OsTest and update (and simplify)
callers that were updating the position themselves.

bug: 18641009

(cherry picked from commit f3b61eaf1931ae8393e54202a717334a4971ebdf)

Change-Id: I8a810b2dfde7c13278807381bdfe7f532a3481a0
f3b61eaf1931ae8393e54202a717334a4971ebdf 09-Dec-2014 Narayan Kamath <narayan@google.com> Update ByteBuffer positions in Posix.* functions.

Also add tests in libcore.io.OsTest and update (and simplify)
callers that were updating the position themselves.

bug: 18641009

Change-Id: Ie0bbde767489eec1a6ef0158f2b14853d4612f18
5d930cadc8f62aee5f18e7921296fe66a54f18ab 24-Apr-2014 Elliott Hughes <enh@google.com> Groundwork towards making the Libcore.os functionality public.

Change-Id: Ie700aa16d91fba53fc5eb2555829cb74d84b12ad
b274574b7e2681f4411852af9857b4540bf75841 02-Aug-2013 Elliott Hughes <enh@google.com> If libcore wants ASCII casing, it needs to ask for it like everyone else.

http://elliotth.blogspot.com/2012/01/beware-convenience-methods.html

Bug: https://code.google.com/p/android/issues/detail?id=58359
Change-Id: I597b2ac940f17b5b2bc176e390dc4b63fe0a4e72
763f8ed6195707d0c30bfae1ca8a3bb886b746cc 29-Mar-2013 Elliott Hughes <enh@google.com> Add strsignal(3) to Libcore.os.

Bug: 8322568
Change-Id: Iab9a782181a663719b88f090f474b66d24b69258
482a3fc5635ac431b8a7476d7fe3397af4c2e8ec 21-Mar-2013 Elliott Hughes <enh@google.com> Add support for Unix domain sockets.

Bug: 6513075
Change-Id: I0b0166f59745ac8175b39d7796c093041b2df4fd
9c8130231a0e1c2a5ded68e99f782427bb5326fa 11-Aug-2011 Elliott Hughes <enh@google.com> Use Libcore.os.fstat to recognize socket FileDescriptors in BlockGuard.

Exception throwing is pretty slow, and BlockGuard's isLingerSocket
causes us to throw whenever we close a non-socket fd. Avoid that
by adding a cheap test for socket fds and only calling isLingerSocket
on socket fds.

Bug: 4972558
Change-Id: Ib18d6c0c091cb366f953d7467e83fad570bb3457