annotate src/solaris/native/sun/nio/ch/UnixAsynchronousSocketChannelImpl.c @ 3261:a06412e13bf7

6962318: Update copyright year Reviewed-by: xdono
author ohair
date Tue, 28 Dec 2010 15:53:50 -0800
parents 871cffb21423
children
rev   line source
alanb@893 1 /*
ohair@3261 2 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
alanb@893 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
alanb@893 4 *
alanb@893 5 * This code is free software; you can redistribute it and/or modify it
alanb@893 6 * under the terms of the GNU General Public License version 2 only, as
ohair@2362 7 * published by the Free Software Foundation. Oracle designates this
alanb@893 8 * particular file as subject to the "Classpath" exception as provided
ohair@2362 9 * by Oracle in the LICENSE file that accompanied this code.
alanb@893 10 *
alanb@893 11 * This code is distributed in the hope that it will be useful, but WITHOUT
alanb@893 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
alanb@893 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
alanb@893 14 * version 2 for more details (a copy is included in the LICENSE file that
alanb@893 15 * accompanied this code).
alanb@893 16 *
alanb@893 17 * You should have received a copy of the GNU General Public License version
alanb@893 18 * 2 along with this work; if not, write to the Free Software Foundation,
alanb@893 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
alanb@893 20 *
ohair@2362 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@2362 22 * or visit www.oracle.com if you need additional information or have any
ohair@2362 23 * questions.
alanb@893 24 */
alanb@893 25
alanb@893 26 #include <sys/types.h>
alanb@893 27 #include <sys/socket.h>
alanb@893 28
alanb@893 29 #include "jni.h"
alanb@893 30 #include "jni_util.h"
alanb@893 31 #include "net_util.h"
alanb@893 32 #include "jlong.h"
alanb@893 33 #include "sun_nio_ch_UnixAsynchronousSocketChannelImpl.h"
alanb@893 34 #include "nio_util.h"
alanb@893 35 #include "nio.h"
alanb@893 36
alanb@893 37
alanb@893 38 JNIEXPORT void JNICALL
alanb@893 39 Java_sun_nio_ch_UnixAsynchronousSocketChannelImpl_checkConnect(JNIEnv *env,
alanb@893 40 jobject this, int fd)
alanb@893 41 {
alanb@893 42 int error = 0;
alanb@2884 43 socklen_t arglen = sizeof(error);
alanb@893 44 int result;
alanb@893 45
alanb@2884 46 result = getsockopt(fd, SOL_SOCKET, SO_ERROR, &error, &arglen);
alanb@893 47 if (result < 0) {
alanb@893 48 JNU_ThrowIOExceptionWithLastError(env, "getsockopt");
alanb@893 49 } else {
alanb@893 50 if (error)
alanb@893 51 handleSocketError(env, error);
alanb@893 52 }
alanb@893 53 }