< prev index next >

src/java.base/windows/native/libnio/ch/WindowsSelectorImpl.c

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 30,39 **** --- 30,40 ---- /* This number should be equal to WindowsSelectorImpl.MAX_SELECTABLE_FDS */ /* This definition MUST precede the inclusion of winsock2.h */ #define FD_SETSIZE 1024 + #include <limits.h> #include <stdlib.h> #include <winsock2.h> #include "jvm.h" #include "jni.h"
*** 73,85 **** tv = &zerotime; } else if (timeout < 0) { tv = NULL; } else { tv = &timevalue; ! tv->tv_sec = (long)(timeout / 1000); tv->tv_usec = (long)((timeout % 1000) * 1000); } /* Set FD_SET structures required for select */ for (i = 0; i < numfds; i++) { if (fds[i].events & POLLIN) { readfds.fd_array[read_count] = fds[i].fd; --- 74,96 ---- tv = &zerotime; } else if (timeout < 0) { tv = NULL; } else { tv = &timevalue; ! jlong sec = timeout / 1000; ! // ! // struct timeval members are signed 32-bit integers so the ! // signed 64-bit jlong needs to clamped ! // ! if (sec > INT_MAX) { ! tv->tv_sec = INT_MAX; ! tv->tv_usec = 0; ! } else { ! tv->tv_sec = (long)sec; tv->tv_usec = (long)((timeout % 1000) * 1000); } + } /* Set FD_SET structures required for select */ for (i = 0; i < numfds; i++) { if (fds[i].events & POLLIN) { readfds.fd_array[read_count] = fds[i].fd;
< prev index next >