< prev index next >

src/java.base/solaris/native/libnet/solaris_close.c

Print this page




  25 
  26 #include <errno.h>
  27 #include <sys/socket.h>
  28 #include <stropts.h>
  29 #include <unistd.h>
  30 
  31 /* Support for restartable system calls on Solaris. */
  32 
  33 #define RESTARTABLE_RETURN_INT(_cmd) do {             \
  34     int _result;                                      \
  35     if (1) {                                          \
  36         do {                                          \
  37             _result = _cmd;                           \
  38         } while((_result == -1) && (errno == EINTR)); \
  39         return _result;                               \
  40     }                                                 \
  41 } while(0)
  42 
  43 int NET_Read(int s, void* buf, size_t len) {
  44     RESTARTABLE_RETURN_INT(recv(s, buf, len, 0));




  45 }
  46 
  47 int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
  48                  struct sockaddr *from, socklen_t *fromlen) {
  49     RESTARTABLE_RETURN_INT(recvfrom(s, buf, len, flags, from, fromlen));
  50 }
  51 
  52 int NET_ReadV(int s, const struct iovec * vector, int count) {
  53     RESTARTABLE_RETURN_INT(readv(s, vector, count));
  54 }
  55 
  56 int NET_WriteV(int s, const struct iovec * vector, int count) {
  57     RESTARTABLE_RETURN_INT(writev(s, vector, count));
  58 }
  59 
  60 int NET_Send(int s, void *msg, int len, unsigned int flags) {
  61     RESTARTABLE_RETURN_INT(send(s, msg, len, flags));
  62 }
  63 
  64 int NET_SendTo(int s, const void *msg, int len,  unsigned  int flags,




  25 
  26 #include <errno.h>
  27 #include <sys/socket.h>
  28 #include <stropts.h>
  29 #include <unistd.h>
  30 
  31 /* Support for restartable system calls on Solaris. */
  32 
  33 #define RESTARTABLE_RETURN_INT(_cmd) do {             \
  34     int _result;                                      \
  35     if (1) {                                          \
  36         do {                                          \
  37             _result = _cmd;                           \
  38         } while((_result == -1) && (errno == EINTR));      \
  39         return _result;                               \
  40     }                                                 \
  41 } while(0)
  42 
  43 int NET_Read(int s, void* buf, size_t len) {
  44     RESTARTABLE_RETURN_INT(recv(s, buf, len, 0));
  45 }
  46 
  47 int NET_NonBlockingRead(int s, void* buf, size_t len) {
  48     RESTARTABLE_RETURN_INT(recv(s, buf, len, MSG_DONTWAIT));
  49 }
  50 
  51 int NET_RecvFrom(int s, void *buf, int len, unsigned int flags,
  52                  struct sockaddr *from, socklen_t *fromlen) {
  53     RESTARTABLE_RETURN_INT(recvfrom(s, buf, len, flags, from, fromlen));
  54 }
  55 
  56 int NET_ReadV(int s, const struct iovec * vector, int count) {
  57     RESTARTABLE_RETURN_INT(readv(s, vector, count));
  58 }
  59 
  60 int NET_WriteV(int s, const struct iovec * vector, int count) {
  61     RESTARTABLE_RETURN_INT(writev(s, vector, count));
  62 }
  63 
  64 int NET_Send(int s, void *msg, int len, unsigned int flags) {
  65     RESTARTABLE_RETURN_INT(send(s, msg, len, flags));
  66 }
  67 
  68 int NET_SendTo(int s, const void *msg, int len,  unsigned  int flags,


< prev index next >