Functions
os_internal.c File Reference
#include "includes.h"
#include "os.h"
Include dependency graph for os_internal.c:

Go to the source code of this file.

Functions

int os_daemonize (const char *pid_file)
void os_daemonize_terminate (const char *pid_file)
void os_free (void *ptr)
int os_get_random (unsigned char *buf, size_t len)
int os_get_time (struct os_time *t)
void * os_malloc (size_t size)
int os_memcmp (const void *s1, const void *s2, size_t n)
void * os_memcpy (void *dest, const void *src, size_t n)
void * os_memmove (void *dest, const void *src, size_t n)
void * os_memset (void *s, int c, size_t n)
int os_mktime (int year, int month, int day, int hour, int min, int sec, os_time_t *t)
void os_program_deinit (void)
int os_program_init (void)
unsigned long os_random (void)
char * os_readfile (const char *name, size_t *len)
void * os_realloc (void *ptr, size_t size)
char * os_rel2abs_path (const char *rel_path)
int os_setenv (const char *name, const char *value, int overwrite)
void os_sleep (os_time_t sec, os_time_t usec)
int os_snprintf (char *str, size_t size, const char *format,...)
int os_strcasecmp (const char *s1, const char *s2)
char * os_strchr (const char *s, int c)
int os_strcmp (const char *s1, const char *s2)
char * os_strdup (const char *s)
size_t os_strlcpy (char *dest, const char *src, size_t siz)
size_t os_strlen (const char *s)
int os_strncasecmp (const char *s1, const char *s2, size_t n)
int os_strncmp (const char *s1, const char *s2, size_t n)
char * os_strncpy (char *dest, const char *src, size_t n)
char * os_strrchr (const char *s, int c)
char * os_strstr (const char *haystack, const char *needle)
int os_unsetenv (const char *name)
void * os_zalloc (size_t size)

Function Documentation

int os_daemonize ( const char *  pid_file)

os_daemonize - Run in the background (detach from the controlling terminal) : File name to write the process ID to or NULL to skip this Returns: 0 on success, -1 on failure

Definition at line 73 of file os_internal.c.

void os_daemonize_terminate ( const char *  pid_file)

os_daemonize_terminate - Stop running in the background (remove pid file) : File name to write the process ID to or NULL to skip this

Definition at line 92 of file os_internal.c.

void os_free ( void *  ptr)

Definition at line 242 of file os_internal.c.

int os_get_random ( unsigned char *  buf,
size_t  len 
)

os_get_random - Get cryptographically strong pseudo random data : Buffer for pseudo random data : Length of the buffer Returns: 0 on success, -1 on failure

Definition at line 99 of file os_internal.c.

int os_get_time ( struct os_time t)

os_get_time - Get current time (sec, usec) : Pointer to buffer for the time Returns: 0 on success, -1 on failure

Definition at line 39 of file os_internal.c.

void* os_malloc ( size_t  size)

Definition at line 230 of file os_internal.c.

int os_memcmp ( const void *  s1,
const void *  s2,
size_t  n 
)

Definition at line 282 of file os_internal.c.

void* os_memcpy ( void *  dest,
const void *  src,
size_t  n 
)

Definition at line 248 of file os_internal.c.

void* os_memmove ( void *  dest,
const void *  src,
size_t  n 
)

Definition at line 258 of file os_internal.c.

void* os_memset ( void *  s,
int  c,
size_t  n 
)

Definition at line 273 of file os_internal.c.

int os_mktime ( int  year,
int  month,
int  day,
int  hour,
int  min,
int  sec,
os_time_t t 
)

os_mktime - Convert broken-down time into seconds since 1970-01-01 : Four digit year : Month (1 .. 12) : Day of month (1 .. 31) : Hour (0 .. 23) : Minute (0 .. 59) : Second (0 .. 60) : Buffer for returning calendar time representation (seconds since 1970-01-01 00:00:00) Returns: 0 on success, -1 on failure

Note: The result is in seconds from Epoch, i.e., in UTC, not in local time which is used by POSIX mktime().

Definition at line 50 of file os_internal.c.

void os_program_deinit ( void  )

os_program_deinit - Program deinitialization (called just before exit)

This function is called just before a program exists. If there are any OS specific processing, e.g., freeing resourced allocated in os_program_init(), it should be done here. It is also acceptable for this function to do nothing.

Definition at line 168 of file os_internal.c.

int os_program_init ( void  )

os_program_init - Program initialization (called at start) Returns: 0 on success, -1 on failure

This function is called when a programs starts. If there are any OS specific processing that is needed, it can be placed here. It is also acceptable to just return 0 if not special processing is needed.

Definition at line 162 of file os_internal.c.

unsigned long os_random ( void  )

os_random - Get pseudo random value (not necessarily very strong) Returns: Pseudo random value

Definition at line 117 of file os_internal.c.

char* os_readfile ( const char *  name,
size_t *  len 
)

Definition at line 190 of file os_internal.c.

void* os_realloc ( void *  ptr,
size_t  size 
)

Definition at line 236 of file os_internal.c.

char* os_rel2abs_path ( const char *  rel_path)

os_rel2abs_path - Get an absolute path for a file : Relative path to a file Returns: Absolute path for the file or NULL on failure

This function tries to convert a relative path of a file to an absolute path in order for the file to be found even if current working directory has changed. The returned value is allocated and caller is responsible for freeing it. It is acceptable to just return the same path in an allocated buffer, e.g., return strdup(rel_path). This function is only used to find configuration files when os_daemonize() may have changed the current working directory and relative path would be pointing to a different location.

Definition at line 123 of file os_internal.c.

int os_setenv ( const char *  name,
const char *  value,
int  overwrite 
)

Definition at line 173 of file os_internal.c.

void os_sleep ( os_time_t  sec,
os_time_t  usec 
)

os_sleep - Sleep (sec, usec) : Number of seconds to sleep : Number of microseconds to sleep

Definition at line 30 of file os_internal.c.

int os_snprintf ( char *  str,
size_t  size,
const char *  format,
  ... 
)

Definition at line 456 of file os_internal.c.

int os_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 324 of file os_internal.c.

char* os_strchr ( const char *  s,
int  c 
)

Definition at line 344 of file os_internal.c.

int os_strcmp ( const char *  s1,
const char *  s2 
)

Definition at line 370 of file os_internal.c.

char* os_strdup ( const char *  s)

Definition at line 301 of file os_internal.c.

size_t os_strlcpy ( char *  dest,
const char *  src,
size_t  siz 
)

os_strlcpy - Copy a string with size bound and NUL-termination : Destination : Source : Size of the target buffer Returns: Total length of the target string (length of src) (not including NUL-termination)

This function matches in behavior with the strlcpy(3) function in OpenBSD.

Definition at line 418 of file os_internal.c.

size_t os_strlen ( const char *  s)

Definition at line 315 of file os_internal.c.

int os_strncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Definition at line 334 of file os_internal.c.

int os_strncmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Definition at line 383 of file os_internal.c.

char* os_strncpy ( char *  dest,
const char *  src,
size_t  n 
)

Definition at line 402 of file os_internal.c.

char* os_strrchr ( const char *  s,
int  c 
)

Definition at line 355 of file os_internal.c.

char* os_strstr ( const char *  haystack,
const char *  needle 
)

Definition at line 443 of file os_internal.c.

int os_unsetenv ( const char *  name)

Definition at line 179 of file os_internal.c.

void* os_zalloc ( size_t  size)

os_zalloc - Allocate and zero memory : Number of bytes to allocate Returns: Pointer to allocated and zeroed memory or NULL on failure

Caller is responsible for freeing the returned buffer with os_free().

Definition at line 221 of file os_internal.c.



wpa_supplicant
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:26:42