hotspot/src/os/solaris/vm/hpi_solaris.hpp
author never
Tue, 24 Jun 2008 16:00:14 -0700
changeset 768 d0bebc7eefc2
parent 1 489c9b5090e2
child 5547 f4b087cbb361
permissions -rw-r--r--
6718676: putback for 6604014 is incomplete Reviewed-by: kvn, jrose
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2007 Sun Microsystems, Inc.  All Rights Reserved.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// Parts of the HPI interface for which the HotSparc does not use the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
// HPI (because the interruptible IO mechanims used are different).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
//
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
#include <sys/socket.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
#include <sys/poll.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
#include <sys/filio.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
#include <unistd.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#include <netdb.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
#include <setjmp.h>
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
// HPI_FileInterface
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
// Many system calls can be interrupted by signals and must be restarted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// Restart support was added without disturbing the extent of thread
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
// interruption support.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
inline int    hpi::close(int fd) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  RESTARTABLE_RETURN_INT(::close(fd));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
inline size_t hpi::read(int fd, void *buf, unsigned int nBytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  INTERRUPTIBLE_RETURN_INT(::read(fd, buf, nBytes), os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
inline size_t hpi::write(int fd, const void *buf, unsigned int nBytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  INTERRUPTIBLE_RETURN_INT(::write(fd, buf, nBytes), os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
// HPI_SocketInterface
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
inline int    hpi::socket_close(int fd) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  RESTARTABLE_RETURN_INT(::close(fd));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
inline int    hpi::socket(int domain, int type, int protocol) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  return ::socket(domain, type, protocol);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
inline int    hpi::recv(int fd, char *buf, int nBytes, int flags) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  INTERRUPTIBLE_RETURN_INT(::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
inline int    hpi::send(int fd, char *buf, int nBytes, int flags) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    74
inline int    hpi::raw_send(int fd, char *buf, int nBytes, int flags) {
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    75
  RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    76
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
    77
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
// As both poll and select can be interrupted by signals, we have to be
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
// prepared to restart the system call after updating the timeout, unless
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
// a poll() is done with timeout == -1, in which case we repeat with this
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
// "wait forever" value.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
inline int    hpi::timeout(int fd, long timeout) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
  int res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  struct timeval t;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  julong prevtime, newtime;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  static const char* aNull = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  struct pollfd pfd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  pfd.fd = fd;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  pfd.events = POLLIN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  gettimeofday(&t, &aNull);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  prevtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec / 1000;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  for(;;) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    INTERRUPTIBLE_NORESTART(::poll(&pfd, 1, timeout), res, os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    if(res == OS_ERR && errno == EINTR) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
        if(timeout != -1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
            gettimeofday(&t, &aNull);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
            newtime = ((julong)t.tv_sec * 1000)  +  t.tv_usec /1000;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
            timeout -= newtime - prevtime;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
            if(timeout <= 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
              return OS_OK;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
            prevtime = newtime;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    } else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
      return res;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
inline int    hpi::listen(int fd, int count) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  if (fd < 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    return OS_ERR;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  return ::listen(fd, count);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
inline int
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
hpi::connect(int fd, struct sockaddr *him, int len) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  do {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    int _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
                            os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    // Depending on when thread interruption is reset, _result could be
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    // one of two values when errno == EINTR
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    if (((_result == OS_INTRPT) || (_result == OS_ERR)) && (errno == EINTR)) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
      /* restarting a connect() changes its errno semantics */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
      INTERRUPTIBLE(::connect(fd, him, len), _result,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
                      os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
      /* undo these changes */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
      if (_result == OS_ERR) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
        if (errno == EALREADY) errno = EINPROGRESS; /* fall through */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
        else if (errno == EISCONN) { errno = 0; return OS_OK; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    return _result;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  } while(false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
inline int    hpi::accept(int fd, struct sockaddr *him, int *len) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  if (fd < 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    return OS_ERR;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him, (socklen_t*) len), os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
inline int    hpi::recvfrom(int fd, char *buf, int nBytes, int flags,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
                            sockaddr *from, int *fromlen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  //%%note jvm_r11
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen), os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
inline int    hpi::sendto(int fd, char *buf, int len, int flags,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
                          struct sockaddr *to, int tolen) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  //%%note jvm_r11
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, (unsigned int) flags, to, tolen),os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
inline int    hpi::socket_available(int fd, jint *pbytes) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  if (fd < 0)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
    return OS_OK;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  int ret;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  //%% note ioctl can return 0 when successful, JVM_SocketAvailable
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
  // is expected to return 0 on failure and 1 on success to the jdk.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  return (ret == OS_ERR) ? 0 : 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
HPIDECL(socket_shutdown, "socket_shutdown", _socket, SocketShutdown,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
        (int fd, int howto),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
        ("fd = %d, howto = %d", fd, howto),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
        (fd, howto));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
        */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
inline int hpi::socket_shutdown(int fd, int howto){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  return ::shutdown(fd, howto);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
HPIDECL(bind, "bind", _socket, Bind,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
        (int fd, struct sockaddr *him, int len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
        ("fd = %d, him = %p, len = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
         fd, him, len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
        (fd, him, len));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
*/
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
inline int hpi::bind(int fd, struct sockaddr *him, int len){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),os::Solaris::clear_interrupted);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
HPIDECL(get_sock_name, "get_sock_name", _socket, GetSocketName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
        (int fd, struct sockaddr *him, int *len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
        ("fd = %d, him = %p, len = %p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
         fd, him, len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
        (fd, him, len));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
        */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
inline int hpi::get_sock_name(int fd, struct sockaddr *him, int *len){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
  return ::getsockname(fd, him, (socklen_t*) len);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
HPIDECL(get_host_name, "get_host_name", _socket, GetHostName, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
        (char *hostname, int namelen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
        ("hostname = %p, namelen = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
         hostname, namelen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
        (hostname, namelen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
        */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
inline int hpi::get_host_name(char* name, int namelen){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  return ::gethostname(name, namelen);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
HPIDECL(get_sock_opt, "get_sock_opt", _socket, SocketGetOption, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
        (int fd, int level, int optname, char *optval, int* optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
        ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
         fd, level, optname, optval, optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
        (fd, level, optname, optval, optlen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
        */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
inline int hpi::get_sock_opt(int fd, int level, int optname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
                             char *optval, int* optlen){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  return ::getsockopt(fd, level, optname, optval, (socklen_t*) optlen);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
HPIDECL(set_sock_opt, "set_sock_opt", _socket, SocketSetOption, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
        (int fd, int level, int optname, const char *optval, int optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
        ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
         fd, level, optname, optval, optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
        (fd, level, optname, optval, optlen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
        */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
inline int hpi::set_sock_opt(int fd, int level, int optname,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
                             const char *optval, int optlen){
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  return ::setsockopt(fd, level, optname, optval, optlen);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
//Reconciliation History
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
// 1.3 98/10/21 18:17:14 hpi_win32.hpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
// 1.6 99/06/28 11:01:36 hpi_win32.hpp
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
//End