Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/windows/native/sun/nio/ch/nio_util.h
32288 views
/*1* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425#include <winsock2.h>2627#include "jni.h"2829/**30* The maximum buffer size for WSASend/WSARecv. Microsoft recommendation for31* blocking operations is to use buffers no larger than 64k. We need the32* maximum to be less than 128k to support asynchronous close on Windows33* Server 2003 and newer editions of Windows.34*/35#define MAX_BUFFER_SIZE ((128*1024)-1)3637jint fdval(JNIEnv *env, jobject fdo);38jlong handleval(JNIEnv *env, jobject fdo);39jint convertReturnVal(JNIEnv *env, jint n, jboolean r);40jlong convertLongReturnVal(JNIEnv *env, jlong n, jboolean r);41jboolean purgeOutstandingICMP(JNIEnv *env, jclass clazz, jint fd);42jint handleSocketError(JNIEnv *env, int errorValue);4344#ifdef _WIN644546struct iovec {47jlong iov_base;48jint iov_len;49};5051#else5253struct iovec {54jint iov_base;55jint iov_len;56};5758#endif5960#ifndef POLLIN61/* WSAPoll()/WSAPOLLFD and the corresponding constants are only defined */62/* in Windows Vista / Windows Server 2008 and later. If we are on an */63/* older release we just use the Solaris constants as this was previously */64/* done in PollArrayWrapper.java. */65#define POLLIN 0x000166#define POLLOUT 0x000467#define POLLERR 0x000868#define POLLHUP 0x001069#define POLLNVAL 0x002070#define POLLCONN 0x000271#else72/* POLLCONN must not equal any of the other constants (see winsock2.h). */73#define POLLCONN 0x200074#endif757677