Displaying 2 results from an estimated 2 matches for "belkin_wait".
2006 Jun 09
0
Cleaned up belkinunv diff
...original "shutdown and hope" behaviour. The code is now back in
upsdrv_shutdown() at the end and now looks like this:
upsdrv_shutdown()
/* decide if we're in waitonshutdown and set wos=1 if we are
... */
if (wos) {
/* waitonshutdown: prepare things for going into belkin_wait()
... */
belkin_wait()
upslogx(LOG_WARNING, " belkinunv: WARNING: An error occurred in wait
mode. Falling back to the original behaviour.");
} else {
upslogx(LOG_WARNING, "belkinunv: WARNING: You are using the -k
option, which is broken for this...
2011 Oct 03
2
patch: Replace many usleep and some sleep calls with nanosleep
...= write(fd, &buf[count], n-count);
if (r==-1 && errno==EAGAIN) {
/* non-blocking i/o, no data available */
- usleep(100000);
+ struct timespec delay = {0, 100e6}; nanosleep(&delay, NULL);
tries++;
} else if (r == -1) {
return -1;
@@ -752,6 +752,8 @@ static int belkin_wait(void)
int r;
int bs, ov, bl, st;
+ struct timespec delay = {1, 0};
+
/* read command line '-x' options */
val = getval("wait");
if (val) {
@@ -790,7 +792,7 @@ static int belkin_wait(void)
if (fd == -1) {
failcount++;
failerrno = errno;
- sleep(1);
+ nano...