/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#include <stdlib.h>
#include <unistd.h>
#include <semaphore.h>
+#include <time.h>
#include <lustre/lustreapi.h>
int save_errno;
int verbose = 0;
int gid = 0;
+ struct timespec ts;
if (argc < 3) {
fprintf(stderr, usage, argv[0]);
printf("PAUSING\n");
fflush(stdout);
}
- while (sem_wait(&sem) == -1 && errno == EINTR);
+ len = atoi(commands+1);
+ if (len <= 0)
+ len = 3600; /* 1 hour */
+ ts.tv_sec = time(NULL) + len;
+ ts.tv_nsec = 0;
+ while (sem_timedwait(&sem, &ts) < 0 && errno == EINTR);
break;
case 'c':
if (close(fd) == -1) {