OpenVAS Manager  7.0.3~git
utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int openvas_usleep (unsigned int)
 Sleep for some number of microseconds, handling interrupts. More...
 
int openvas_sleep (unsigned int)
 Sleep for some number of seconds, handling interrupts. More...
 

Function Documentation

◆ openvas_sleep()

int openvas_sleep ( unsigned int  seconds)

Sleep for some number of seconds, handling interrupts.

Parameters
[in]secondsNumber of seconds.
Returns
0 success, -1 error (with errno set).

Definition at line 70 of file utils.c.

71 {
72  return openvas_usleep (seconds * 1000000);
73 }
int openvas_usleep(unsigned int microseconds)
Sleep for some number of microseconds, handling interrupts.
Definition: utils.c:39

References openvas_usleep().

Here is the call graph for this function:

◆ openvas_usleep()

int openvas_usleep ( unsigned int  microseconds)

Sleep for some number of microseconds, handling interrupts.

Parameters
[in]microsecondsNumber of microseconds.
Returns
0 success, -1 error (with errno set).

Definition at line 39 of file utils.c.

40 {
41  struct timespec a, b, *requested, *remaining;
42  int ret;
43 
44  requested = &a;
45  remaining = &b;
46 
47  requested->tv_sec = microseconds / 1000000;
48  requested->tv_nsec = (microseconds % 1000000) * 1000;
49 
50  while ((ret = nanosleep (requested, remaining)) && (errno == EINTR))
51  {
52  struct timespec *temp;
53  temp = requested;
54  requested = remaining;
55  remaining = temp;
56  }
57  if (ret)
58  return -1;
59  return 0;
60 }

Referenced by openvas_scanner_is_loading(), openvas_sleep(), sql_bind_blob(), sql_bind_double(), sql_bind_int64(), sql_bind_text(), sql_exec_internal(), sql_prepare_internal(), and sql_reset().

Here is the caller graph for this function: