return 0;
}
- for (;;)
- {
- tv.tv_sec = pp->host.wait;
- tv.tv_usec = 0;
- if (IOMGR_Select(0, 0, 0, 0, &tv))
- break;
- }
+ fsprobe_Wait(0);
probeComplete();
return(0);
}
return (0);
} /*fsprobe_ForceProbeNow */
+
+/*------------------------------------------------------------------------
+ * [exported] fsprobe_Wait
+ *
+ * Description:
+ * Wait for the collection to complete.
+ *
+ * Arguments:
+ * int sleep_secs : time to wait in seconds. 0 means sleep forever.
+ *
+ * Returns:
+ * 0 on success,
+ * Error value otherwise.
+ *
+ * Environment:
+ * The module must have been initialized.
+ *
+ * Side Effects:
+ * As advertised.
+ *------------------------------------------------------------------------*/
+int
+fsprobe_Wait(int sleep_secs)
+{
+ int code;
+ struct timeval tv;
+
+ if (sleep_secs == 0) {
+ while (1) {
+ tv.tv_sec = 30;
+ tv.tv_usec = 0;
+ code = IOMGR_Select(0, 0, 0, 0, &tv);
+ if (code != 0)
+ break;
+ }
+ } else {
+ tv.tv_sec = sleep_secs;
+ tv.tv_usec = 0;
+ code = IOMGR_Select(0, 0, 0, 0, &tv);
+ }
+ return code;
+}
* with the fsprobe connection array.
*/
+extern int fsprobe_Wait(int);
+
#endif /* __fsprobe_h */
afs_int32 code; /*Return code */
struct sockaddr_in FSSktArray[3]; /*socket array */
struct hostent *he; /*Host entry */
- struct timeval tv; /*Time structure */
int sleep_secs; /*Number of seconds to sleep */
printf("\n\nTest of the fsprobe facility.\n\n");
("Fsprobe service started, main thread sleeping for %d seconds...\n",
sleep_secs);
- /*
- * Let's just fall asleep for a while, then we'll clean up.
- */
- tv.tv_sec = sleep_secs;
- tv.tv_usec = 0;
- code = IOMGR_Select(0, /*Num fds */
- 0, /*Descriptors ready for reading */
- 0, /*Descriptors ready for writing */
- 0, /*Descriptors with exceptional conditions */
- &tv); /*Timeout structure */
- if (code) {
- fprintf(stderr, "[%s] IOMGR_Select() returned non-zero value: %d\n",
- rn, code);
- }
+ fsprobe_Wait(sleep_secs);
/*
* We're all done. Clean up, put the last nail in Rx, then
struct mini_line *curr_line; /*Ptr to current line */
int i; /*Generic loop variable */
int mini_line_bytes; /*Num bytes in mini_lines */
- struct timeval tv; /*Time structure */
int linenum; /*Current mini-line number */
#if 0
PROCESS pid; /*Main LWP process ID */
scout_CleanExit(code);
}
- /*
- * We fall into a loop, sleeping forever.
- */
- while (1) {
- tv.tv_sec = 60 * 60; /*Sleep for an hour at a time */
- tv.tv_usec = 0;
- select(0, /*Num fds */
- 0, /*Descriptors ready for reading */
- 0, /*Descriptors ready for writing */
- 0, /*Descriptors with exceptional conditions */
- &tv); /*Timeout structure */
- } /*Sleep forever */
+ fsprobe_Wait(0); /* sleep forever */
#if 0
/*
return (0);
#endif /* 0 */
+ return 0;
} /*execute_scout */
/*------------------------------------------------------------------------