2 * wpa_supplicant/hostapd / Empty OS specific functions
3 * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
14 * This file can be used as a starting point when adding a new OS target. The
15 * functions here do not really work as-is since they are just empty or only
16 * return an error value. os_internal.c can be used as another starting point
17 * or reference since it has example implementation of many of these functions.
24 void os_sleep(os_time_t sec
, os_time_t usec
)
29 int os_get_time(struct os_time
*t
)
35 int os_mktime(int year
, int month
, int day
, int hour
, int min
, int sec
,
42 int os_daemonize(const char *pid_file
)
48 void os_daemonize_terminate(const char *pid_file
)
53 int os_get_random(unsigned char *buf
, size_t len
)
59 unsigned long os_random(void)
65 char * os_rel2abs_path(const char *rel_path
)
67 return NULL
; /* strdup(rel_path) can be used here */
71 int os_program_init(void)
77 void os_program_deinit(void)
82 int os_setenv(const char *name
, const char *value
, int overwrite
)
88 int os_unsetenv(const char *name
)
94 char * os_readfile(const char *name
, size_t *len
)
100 void * os_zalloc(size_t size
)
106 #ifdef OS_NO_C_LIB_DEFINES
107 void * os_malloc(size_t size
)
113 void * os_realloc(void *ptr
, size_t size
)
119 void os_free(void *ptr
)
124 void * os_memcpy(void *dest
, const void *src
, size_t n
)
130 void * os_memmove(void *dest
, const void *src
, size_t n
)
136 void * os_memset(void *s
, int c
, size_t n
)
142 int os_memcmp(const void *s1
, const void *s2
, size_t n
)
148 char * os_strdup(const char *s
)
154 size_t os_strlen(const char *s
)
160 int os_strcasecmp(const char *s1
, const char *s2
)
163 * Ignoring case is not required for main functionality, so just use
164 * the case sensitive version of the function.
166 return os_strcmp(s1
, s2
);
170 int os_strncasecmp(const char *s1
, const char *s2
, size_t n
)
173 * Ignoring case is not required for main functionality, so just use
174 * the case sensitive version of the function.
176 return os_strncmp(s1
, s2
, n
);
180 char * os_strchr(const char *s
, int c
)
186 char * os_strrchr(const char *s
, int c
)
192 int os_strcmp(const char *s1
, const char *s2
)
198 int os_strncmp(const char *s1
, const char *s2
, size_t n
)
204 char * os_strncpy(char *dest
, const char *src
, size_t n
)
210 char * os_strstr(const char *haystack
, const char *needle
)
216 int os_snprintf(char *str
, size_t size
, const char *format
, ...)
220 #endif /* OS_NO_C_LIB_DEFINES */