-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/ctrlctu.c,v 6.12 2002-10-09 12:42:17 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/ctrlctu.c,v 6.13 2003-02-21 18:58:44 sailer Exp $";
#define _XOPEN_SOURCE
+#define _POSIX_C_SOURCE 199506L
#define SYSLOG_NAMES
#include <unistd.h>
-#include <stddef.h>
#include <errno.h>
+#include <stddef.h>
#include <setjmp.h>
-#include <stdlib.h>
-#include <stdio.h>
#include <signal.h>
-
+#include <stdio.h>
+#include <stdlib.h>
#include <syslog.h>
-
+#include <time.h>
#include "worker.h"
unsigned long value;
int oper;
unsigned long *ctuEnabled;
+ struct timespec t1 = {1, 0};
+ struct timespec t3 = {3, 0};
openlog(argv[0], LOG_PID|LOG_PERROR, LOG_LOCAL0);
setlogmask(LOG_UPTO(LOG_INFO));
-
-
isStandalone = 1;
priority = 0;
while ((i = getopt(argc, argv, "ap:v:")) != -1) {
}
Worker_initEnd(worker);
- sleep(1);
+ nanosleep(&t1, NULL);
system("dtuctrl -t ctu reset");
system("dtuctrl -t ctu start");
(*ctuEnabled) = 1;
if (0 == setjmp(terminateJmp)) {
pause();
}
- sleep(3);
+ nanosleep(&t3, NULL);
system("dtuctrl -t ctu stop");
(*ctuEnabled) = 0;
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/sniff.c,v 6.6 2002-10-28 07:41:18 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/sniff.c,v 6.7 2003-02-21 18:58:44 sailer Exp $";
#define SYSLOG_NAMES
#define _GNU_SOURCE
#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
#include <rpc/rpc.h>
-
+#include <stdio.h>
+#include <stdlib.h>
#include <syslog.h>
-
+#include <time.h>
#include "online.h"
CLIENT *cl;
char *server;
int i;
+ struct timespec t = {5, 0};
struct rpc_err rpcErrS, *rpcErr = &rpcErrS;
rpcevt rpcEvtS, *rpcEvt = &rpcEvtS;
if (NULL == (cl = clnt_create(server, DAQPROG, DAQVERS, "tcp"))) {
syslog(LOG_INFO, "online server not running, trying to connect");
syslog(LOG_DEBUG, "%s, %d: %s", __FILE__, __LINE__, clnt_spcreateerror(server));
- sleep(5);
+ nanosleep(&t, NULL);
} else {
do {
if (NULL == (rpcEvt = onlineevt_1(NULL, cl))) {
-static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.16 2003-02-07 11:44:20 hadaq Exp $";
+static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/worker.c,v 6.17 2003-02-21 18:58:44 sailer Exp $";
#define _POSIX_C_SOURCE 199309L
#include <unistd.h>
{
int retVal;
Worker myS, *my = &myS;
+ struct timespec t = {1, 0};
strcpy(my->name, argv[0]);
#ifndef WORKER_NEW_PROTOCOL
sigsuspend(sigMask); /* child to initialize */
if (sigReceived == SIGCHLD) {
- sleep(1);
+ nanosleep(&t, NULL);
wait(NULL);
syslog(LOG_DEBUG,
"%s:%d: %s", __FILE__, __LINE__, strerror(errno));
}
closeStatShm(my);
}
- sleep(1);
+ nanosleep(&t, NULL);
}
if (i == timeout) {
retVal = -1;
void Worker_stop(const char *name, int timeout)
{
Worker myS, *my = &myS;
+ struct timespec t = {1, 0};
strcpy(my->name, name);
my->pid = my->statistics[0].value;
if (my->pid > 0) {
if (0 == kill(my->pid, SIGTERM)) {
- sleep(1); /* LynxOS had problem without this */
+ nanosleep(&t, NULL); /* LynxOS had problem without this */
waitpid(my->pid, NULL, 0);
}
}