src/java.base/macosx/native/libnio/ch/KQueueArrayWrapper.c
changeset 48848 81f3a5eaecb0
parent 47216 71c04702a3d5
equal deleted inserted replaced
48847:da4b1106787e 48848:81f3a5eaecb0
     1 /*
     1 /*
     2  * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    32 
    32 
    33 #include "jni.h"
    33 #include "jni.h"
    34 #include "jni_util.h"
    34 #include "jni_util.h"
    35 #include "jvm.h"
    35 #include "jvm.h"
    36 #include "jlong.h"
    36 #include "jlong.h"
       
    37 #include "nio_util.h"
    37 
    38 
    38 #include <sys/types.h>
    39 #include <sys/types.h>
    39 #include <sys/event.h>
    40 #include <sys/event.h>
    40 #include <sys/time.h>
    41 #include <sys/time.h>
    41 
    42 
   151         tsp = &ts;
   152         tsp = &ts;
   152     } else {
   153     } else {
   153         tsp = NULL;
   154         tsp = NULL;
   154     }
   155     }
   155 
   156 
   156     result = kevent(kq, NULL, 0, kevs, kevCount, tsp);
   157     RESTARTABLE(kevent(kq, NULL, 0, kevs, kevCount, tsp), result);
   157 
       
   158     if (result < 0) {
   158     if (result < 0) {
   159         if (errno == EINTR) {
   159         JNU_ThrowIOExceptionWithLastError(env,
   160             // ignore EINTR, pretend nothing was selected
   160             "KQueueArrayWrapper: kevent poll failed");
   161             result = 0;
       
   162         } else {
       
   163             JNU_ThrowIOExceptionWithLastError(env, "KQueueArrayWrapper: kqueue failed");
       
   164         }
       
   165     }
   161     }
   166 
   162 
   167     return result;
   163     return result;
   168 }
   164 }
   169 
   165