hotspot/src/os/windows/vm/hpi_windows.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-2005 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
// Win32 delegates these to the HPI.  Solaris provides its own
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
// implementation without using the HPI (for Interrupitble I/O).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
// HPI_FileInterface
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
HPIDECL(close, "close", _file, Close, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
        (int fd),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
        ("fd = %d", fd),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
        (fd));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
HPIDECL(read, "read", _file, Read, size_t, "%ld",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
        (int fd, void *buf, unsigned int nBytes),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
        ("fd = %d, buf = %p, nBytes = %u", fd, buf, nBytes),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
        (fd, buf, nBytes));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
HPIDECL(write, "write", _file, Write, size_t, "%ld",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
        (int fd, const void *buf, unsigned int nBytes),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
        ("fd = %d, buf = %p, nBytes = %u", fd, buf, nBytes),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
        (fd, buf, nBytes));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
// HPI_SocketInterface
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
HPIDECL(socket_close, "socket_close", _socket, Close, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
        (int fd),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
        ("fd = %d", fd),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
        (fd));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
HPIDECL(socket_available, "socket_available", _socket, Available,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
        (int fd, jint *pbytes),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
        ("fd = %d, pbytes = %p", fd, pbytes),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
        (fd, pbytes));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
HPIDECL(socket, "socket", _socket, Socket, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
        (int domain, int type, int protocol),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
        ("domain = %d, type = %d, protocol = %d", domain, type, protocol),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
        (domain, type, protocol));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
HPIDECL(listen, "listen", _socket, Listen, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
        (int fd, int count),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
        ("fd = %d, count = %d", fd, count),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
        (fd, count));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
HPIDECL(connect, "connect", _socket, Connect, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
        (int fd, struct sockaddr *him, int len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
        ("fd = %d, him = %p, len = %d", fd, him, len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
        (fd, him, len));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
HPIDECL(accept, "accept", _socket, Accept, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
        (int fd, struct sockaddr *him, int *len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
        ("fd = %d, him = %p, len = %p", fd, him, len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
        (fd, him, len));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
HPIDECL(sendto, "sendto", _socket, SendTo, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
        (int fd, char *buf, int len, int flags,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
         struct sockaddr *to, int tolen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
        ("fd = %d, buf = %p, len = %d, flags = %d, to = %p, tolen = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
         fd, buf, len, flags, to, tolen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
        (fd, buf, len, flags, to, tolen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
HPIDECL(recvfrom, "recvfrom", _socket, RecvFrom, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
        (int fd, char *buf, int nbytes, int flags,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
         struct sockaddr *from, int *fromlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
        ("fd = %d, buf = %p, len = %d, flags = %d, frm = %p, frmlen = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
         fd, buf, nbytes, flags, from, fromlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
        (fd, buf, nbytes, flags, from, fromlen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
HPIDECL(recv, "recv", _socket, Recv, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
        (int fd, char *buf, int nBytes, int flags),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
        ("fd = %d, buf = %p, nBytes = %d, flags = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
         fd, buf, nBytes, flags),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
        (fd, buf, nBytes, flags));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
HPIDECL(send, "send", _socket, Send, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
        (int fd, char *buf, int nBytes, int flags),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
        ("fd = %d, buf = %p, nBytes = %d, flags = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
         fd, buf, nBytes, flags),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
        (fd, buf, nBytes, flags));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
768
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   105
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
   106
  return send(fd, buf, nBytes, flags);
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   107
}
d0bebc7eefc2 6718676: putback for 6604014 is incomplete
never
parents: 1
diff changeset
   108
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
HPIDECL(timeout, "timeout", _socket, Timeout, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
        (int fd, long timeout),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
        ("fd = %d, timeout = %ld", fd, timeout),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
        (fd, timeout));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
HPIDECL(get_host_by_name, "get_host_by_name", _socket, GetHostByName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
        struct hostent *, "(struct hostent *)%p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
        (char *name),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
        ("%s", name),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
        (name));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
HPIDECL(socket_shutdown, "socket_shutdown", _socket, SocketShutdown,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
        (int fd, int howto),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
        ("fd = %d, howto = %d", fd, howto),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
        (fd, howto));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
HPIDECL(bind, "bind", _socket, Bind,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
        (int fd, struct sockaddr *him, int len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
        ("fd = %d, him = %p, len = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
         fd, him, len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
        (fd, him, len));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
HPIDECL(get_sock_name, "get_sock_name", _socket, GetSocketName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
        int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
        (int fd, struct sockaddr *him, int *len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
        ("fd = %d, him = %p, len = %p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
         fd, him, len),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
        (fd, him, len));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
HPIDECL(get_host_name, "get_host_name", _socket, GetHostName, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
        (char *hostname, int namelen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
        ("hostname = %p, namelen = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
         hostname, namelen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
        (hostname, namelen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
HPIDECL(get_host_by_addr, "get_host_by_addr", _socket, GetHostByAddr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
        struct hostent *, "(struct hostent *)%p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
        (const char* name, int len, int type),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
        ("name = %p, len = %d, type = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
         name, len, type),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
        (name, len, type));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
HPIDECL(get_sock_opt, "get_sock_opt", _socket, SocketGetOption, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
        (int fd, int level, int optname, char *optval, int* optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
        ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
         fd, level, optname, optval, optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
        (fd, level, optname, optval, optlen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
HPIDECL(set_sock_opt, "set_sock_opt", _socket, SocketSetOption, int, "%d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
        (int fd, int level, int optname, const char *optval, int optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
        ("fd = %d, level = %d, optname = %d, optval = %p, optlen = %d",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
         fd, level, optname, optval, optlen),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
        (fd, level, optname, optval, optlen));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
HPIDECL(get_proto_by_name, "get_proto_by_name", _socket, GetProtoByName,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
        struct protoent *, "(struct protoent *)%p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
        (char* name),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
        ("name = %p",
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
         name),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
        (name));