mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8217461: (ch) Add Net.available to return the number of bytes in the socket input buffer
Reviewed-by: clanger, michaelm
This commit is contained in:
parent
aa5637f24e
commit
755872aa82
8 changed files with 52 additions and 17 deletions
|
@ -123,12 +123,10 @@ int getDefaultScopeID(JNIEnv *env) {
|
|||
} while((_result == -1) && (errno == EINTR)); \
|
||||
} while(0)
|
||||
|
||||
int NET_SocketAvailable(int s, jint *pbytes) {
|
||||
int NET_SocketAvailable(int s, int *pbytes) {
|
||||
int result;
|
||||
RESTARTABLE(ioctl(s, FIONREAD, pbytes), result);
|
||||
// note: ioctl can return 0 when successful, NET_SocketAvailable
|
||||
// is expected to return 0 on failure and 1 on success.
|
||||
return (result == -1) ? 0 : 1;
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __solaris__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue