syslog-ng source
misc.h File Reference
#include "syslog-ng.h"
Include dependency graph for misc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define NSEC_PER_SEC   1000000000L
 
#define USEC_PER_SEC   1000000L
 
#define MSEC_PER_SEC   1000L
 
#define MSEC_TO_NSEC(msec)   ((gint64)(msec) * NSEC_PER_SEC / MSEC_PER_SEC)
 
#define MSEC_TO_USEC(msec)   ((gint64)(msec) * USEC_PER_SEC / MSEC_PER_SEC)
 
#define USEC_TO_NSEC(usec)   ((gint64)(usec) * NSEC_PER_SEC / USEC_PER_SEC)
 
#define USEC_TO_USEC(usec)   ((gint64)(usec) * USEC_PER_SEC / USEC_PER_SEC)
 

Functions

gboolean check_nanosleep (void)
 
void timespec_add_msec (struct timespec *ts, glong msec)
 
void timespec_add_usec (struct timespec *ts, gint64 usec)
 
glong timespec_diff_msec (const struct timespec *t1, const struct timespec *t2)
 
gint64 timespec_diff_usec (const struct timespec *t1, const struct timespec *t2)
 
gint64 timespec_diff_nsec (struct timespec *t1, struct timespec *t2)
 

Macro Definition Documentation

◆ MSEC_PER_SEC

#define MSEC_PER_SEC   1000L

◆ MSEC_TO_NSEC

#define MSEC_TO_NSEC (   msec)    ((gint64)(msec) * NSEC_PER_SEC / MSEC_PER_SEC)

◆ MSEC_TO_USEC

#define MSEC_TO_USEC (   msec)    ((gint64)(msec) * USEC_PER_SEC / MSEC_PER_SEC)

◆ NSEC_PER_SEC

#define NSEC_PER_SEC   1000000000L

◆ USEC_PER_SEC

#define USEC_PER_SEC   1000000L

◆ USEC_TO_NSEC

#define USEC_TO_NSEC (   usec)    ((gint64)(usec) * NSEC_PER_SEC / USEC_PER_SEC)

◆ USEC_TO_USEC

#define USEC_TO_USEC (   usec)    ((gint64)(usec) * USEC_PER_SEC / USEC_PER_SEC)

Function Documentation

◆ check_nanosleep()

gboolean check_nanosleep ( void  )

check_nanosleep:

Check if nanosleep() is accurate enough for sub-millisecond sleeping. If it is not good enough, we're skipping the minor sleeps in LogReader to balance the cost of returning to the main loop (e.g. we're always going to return to the main loop, instead of trying to wait for the writer).

◆ timespec_add_msec()

void timespec_add_msec ( struct timespec *  ts,
glong  msec 
)

◆ timespec_add_usec()

void timespec_add_usec ( struct timespec *  ts,
gint64  usec 
)

◆ timespec_diff_msec()

glong timespec_diff_msec ( const struct timespec *  t1,
const struct timespec *  t2 
)

◆ timespec_diff_nsec()

gint64 timespec_diff_nsec ( struct timespec *  t1,
struct timespec *  t2 
)

◆ timespec_diff_usec()

gint64 timespec_diff_usec ( const struct timespec *  t1,
const struct timespec *  t2 
)