nsprpub/pr/tests/selintr.c

Wed, 31 Dec 2014 07:53:36 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:53:36 +0100
branch
TOR_BUG_3246
changeset 5
4ab42b5ab56c
permissions
-rw-r--r--

Correct small whitespace inconsistency, lost while renaming variables.

michael@0 1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 /*
michael@0 7 * Test whether classic NSPR's select() wrapper properly blocks
michael@0 8 * the periodic SIGALRM clocks. On some platforms (such as
michael@0 9 * HP-UX and SINIX) an interrupted select() system call is
michael@0 10 * restarted with the originally specified timeout, ignoring
michael@0 11 * the time that has elapsed. If a select() call is interrupted
michael@0 12 * repeatedly, it will never time out. (See Bugzilla bug #39674.)
michael@0 13 */
michael@0 14
michael@0 15 #if !defined(XP_UNIX)
michael@0 16
michael@0 17 /*
michael@0 18 * This test is applicable to Unix only.
michael@0 19 */
michael@0 20
michael@0 21 int main()
michael@0 22 {
michael@0 23 return 0;
michael@0 24 }
michael@0 25
michael@0 26 #else /* XP_UNIX */
michael@0 27
michael@0 28 #include "nspr.h"
michael@0 29
michael@0 30 #include <sys/time.h>
michael@0 31 #include <stdio.h>
michael@0 32 #ifdef SYMBIAN
michael@0 33 #include <sys/select.h>
michael@0 34 #endif
michael@0 35
michael@0 36 int main(int argc, char **argv)
michael@0 37 {
michael@0 38 struct timeval timeout;
michael@0 39 int rv;
michael@0 40
michael@0 41 PR_SetError(0, 0); /* force NSPR to initialize */
michael@0 42 PR_EnableClockInterrupts();
michael@0 43
michael@0 44 /* 2 seconds timeout */
michael@0 45 timeout.tv_sec = 2;
michael@0 46 timeout.tv_usec = 0;
michael@0 47 rv = select(1, NULL, NULL, NULL, &timeout);
michael@0 48 printf("select returned %d\n", rv);
michael@0 49 return 0;
michael@0 50 }
michael@0 51
michael@0 52 #endif /* XP_UNIX */

mercurial