luasandbox  1.4.0
Generic Lua sandbox for dynamic data analysis
Macros | Functions | Variables
util.h File Reference

Shared types and structures. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "../error.h"
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LSB_UTIL_EXPORT
 

Functions

LSB_UTIL_EXPORT size_t lsb_lp2 (unsigned long long x)
 Hacker's Delight - Henry S. More...
 
LSB_UTIL_EXPORT char * lsb_read_file (const char *fn)
 Read a file into a string. More...
 
LSB_UTIL_EXPORT unsigned long long lsb_get_time ()
 Retrieves the highest resolution timer available converted to nanoseconds. More...
 
LSB_UTIL_EXPORT long long lsb_get_timestamp ()
 Retrieves the highest resolution time since Jan 1, 1970 converted to nanoseconds. More...
 
LSB_UTIL_EXPORT bool lsb_set_tz (const char *tz)
 Sets the timezone environment variable for the time conversion functions. More...
 

Variables

LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_NULL
 
LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_OOM
 
LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_FULL
 
LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_PRANGE
 

Detailed Description

Shared types and structures.

Definition in file util.h.

Macro Definition Documentation

#define LSB_UTIL_EXPORT

Definition at line 28 of file util.h.

Function Documentation

LSB_UTIL_EXPORT unsigned long long lsb_get_time ( )

Retrieves the highest resolution timer available converted to nanoseconds.

Returns
unsigned long long
LSB_UTIL_EXPORT long long lsb_get_timestamp ( )

Retrieves the highest resolution time since Jan 1, 1970 converted to nanoseconds.

Returns
unsigned long long (time_ns)
LSB_UTIL_EXPORT size_t lsb_lp2 ( unsigned long long  x)

Hacker's Delight - Henry S.

Warren, Jr. page 48

Parameters
x
Returns
size_t Least power of 2 greater than or equal to x
LSB_UTIL_EXPORT char* lsb_read_file ( const char *  fn)

Read a file into a string.

Parameters
fnFilename to read
Returns
char* NULL on failure otherwise a pointer to the file contents (must be freed by the caller).
LSB_UTIL_EXPORT bool lsb_set_tz ( const char *  tz)

Sets the timezone environment variable for the time conversion functions.

Parameters
tzTimezone string (if NULL uses UTC)
Returns
bool True if the environment variable is successfully set

Variable Documentation

LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_FULL
LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_NULL
LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_OOM
LSB_UTIL_EXPORT lsb_err_id LSB_ERR_UTIL_PRANGE