xref: /freebsd/contrib/wpa/src/utils/os_none.c (revision 7648bc9fee8dec6cb3c4941e0165a930fbe8dcb0)
13157ba21SRui Paulo /*
23157ba21SRui Paulo  * wpa_supplicant/hostapd / Empty OS specific functions
33157ba21SRui Paulo  * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
43157ba21SRui Paulo  *
5f05cddf9SRui Paulo  * This software may be distributed under the terms of the BSD license.
6f05cddf9SRui Paulo  * See README for more details.
73157ba21SRui Paulo  *
83157ba21SRui Paulo  * This file can be used as a starting point when adding a new OS target. The
93157ba21SRui Paulo  * functions here do not really work as-is since they are just empty or only
103157ba21SRui Paulo  * return an error value. os_internal.c can be used as another starting point
113157ba21SRui Paulo  * or reference since it has example implementation of many of these functions.
123157ba21SRui Paulo  */
133157ba21SRui Paulo 
143157ba21SRui Paulo #include "includes.h"
153157ba21SRui Paulo 
163157ba21SRui Paulo #include "os.h"
173157ba21SRui Paulo 
os_sleep(os_time_t sec,os_time_t usec)183157ba21SRui Paulo void os_sleep(os_time_t sec, os_time_t usec)
193157ba21SRui Paulo {
203157ba21SRui Paulo }
213157ba21SRui Paulo 
223157ba21SRui Paulo 
os_get_time(struct os_time * t)233157ba21SRui Paulo int os_get_time(struct os_time *t)
243157ba21SRui Paulo {
253157ba21SRui Paulo 	return -1;
263157ba21SRui Paulo }
273157ba21SRui Paulo 
283157ba21SRui Paulo 
os_get_reltime(struct os_reltime * t)295b9c547cSRui Paulo int os_get_reltime(struct os_reltime *t)
305b9c547cSRui Paulo {
315b9c547cSRui Paulo 	return -1;
325b9c547cSRui Paulo }
335b9c547cSRui Paulo 
345b9c547cSRui Paulo 
os_mktime(int year,int month,int day,int hour,int min,int sec,os_time_t * t)353157ba21SRui Paulo int os_mktime(int year, int month, int day, int hour, int min, int sec,
363157ba21SRui Paulo 	      os_time_t *t)
373157ba21SRui Paulo {
383157ba21SRui Paulo 	return -1;
393157ba21SRui Paulo }
403157ba21SRui Paulo 
os_gmtime(os_time_t t,struct os_tm * tm)41f05cddf9SRui Paulo int os_gmtime(os_time_t t, struct os_tm *tm)
42f05cddf9SRui Paulo {
43f05cddf9SRui Paulo 	return -1;
44f05cddf9SRui Paulo }
45f05cddf9SRui Paulo 
463157ba21SRui Paulo 
os_daemonize(const char * pid_file)473157ba21SRui Paulo int os_daemonize(const char *pid_file)
483157ba21SRui Paulo {
493157ba21SRui Paulo 	return -1;
503157ba21SRui Paulo }
513157ba21SRui Paulo 
523157ba21SRui Paulo 
os_daemonize_terminate(const char * pid_file)533157ba21SRui Paulo void os_daemonize_terminate(const char *pid_file)
543157ba21SRui Paulo {
553157ba21SRui Paulo }
563157ba21SRui Paulo 
573157ba21SRui Paulo 
os_get_random(unsigned char * buf,size_t len)583157ba21SRui Paulo int os_get_random(unsigned char *buf, size_t len)
593157ba21SRui Paulo {
603157ba21SRui Paulo 	return -1;
613157ba21SRui Paulo }
623157ba21SRui Paulo 
633157ba21SRui Paulo 
os_random(void)643157ba21SRui Paulo unsigned long os_random(void)
653157ba21SRui Paulo {
663157ba21SRui Paulo 	return 0;
673157ba21SRui Paulo }
683157ba21SRui Paulo 
693157ba21SRui Paulo 
os_rel2abs_path(const char * rel_path)703157ba21SRui Paulo char * os_rel2abs_path(const char *rel_path)
713157ba21SRui Paulo {
723157ba21SRui Paulo 	return NULL; /* strdup(rel_path) can be used here */
733157ba21SRui Paulo }
743157ba21SRui Paulo 
753157ba21SRui Paulo 
os_program_init(void)763157ba21SRui Paulo int os_program_init(void)
773157ba21SRui Paulo {
783157ba21SRui Paulo 	return 0;
793157ba21SRui Paulo }
803157ba21SRui Paulo 
813157ba21SRui Paulo 
os_program_deinit(void)823157ba21SRui Paulo void os_program_deinit(void)
833157ba21SRui Paulo {
843157ba21SRui Paulo }
853157ba21SRui Paulo 
863157ba21SRui Paulo 
os_setenv(const char * name,const char * value,int overwrite)873157ba21SRui Paulo int os_setenv(const char *name, const char *value, int overwrite)
883157ba21SRui Paulo {
893157ba21SRui Paulo 	return -1;
903157ba21SRui Paulo }
913157ba21SRui Paulo 
923157ba21SRui Paulo 
os_unsetenv(const char * name)933157ba21SRui Paulo int os_unsetenv(const char *name)
943157ba21SRui Paulo {
953157ba21SRui Paulo 	return -1;
963157ba21SRui Paulo }
973157ba21SRui Paulo 
983157ba21SRui Paulo 
os_readfile(const char * name,size_t * len)993157ba21SRui Paulo char * os_readfile(const char *name, size_t *len)
1003157ba21SRui Paulo {
1013157ba21SRui Paulo 	return NULL;
1023157ba21SRui Paulo }
1033157ba21SRui Paulo 
1043157ba21SRui Paulo 
os_fdatasync(FILE * stream)105325151a3SRui Paulo int os_fdatasync(FILE *stream)
106325151a3SRui Paulo {
107325151a3SRui Paulo 	return 0;
108325151a3SRui Paulo }
109325151a3SRui Paulo 
110325151a3SRui Paulo 
os_zalloc(size_t size)1113157ba21SRui Paulo void * os_zalloc(size_t size)
1123157ba21SRui Paulo {
1133157ba21SRui Paulo 	return NULL;
1143157ba21SRui Paulo }
1153157ba21SRui Paulo 
1163157ba21SRui Paulo 
os_memdup(const void * src,size_t n)117*85732ac8SCy Schubert void * os_memdup(const void *src, size_t n)
118*85732ac8SCy Schubert {
119*85732ac8SCy Schubert 	return NULL;
120*85732ac8SCy Schubert }
121*85732ac8SCy Schubert 
122*85732ac8SCy Schubert 
1233157ba21SRui Paulo #ifdef OS_NO_C_LIB_DEFINES
os_malloc(size_t size)1243157ba21SRui Paulo void * os_malloc(size_t size)
1253157ba21SRui Paulo {
1263157ba21SRui Paulo 	return NULL;
1273157ba21SRui Paulo }
1283157ba21SRui Paulo 
1293157ba21SRui Paulo 
os_realloc(void * ptr,size_t size)1303157ba21SRui Paulo void * os_realloc(void *ptr, size_t size)
1313157ba21SRui Paulo {
1323157ba21SRui Paulo 	return NULL;
1333157ba21SRui Paulo }
1343157ba21SRui Paulo 
1353157ba21SRui Paulo 
os_free(void * ptr)1363157ba21SRui Paulo void os_free(void *ptr)
1373157ba21SRui Paulo {
1383157ba21SRui Paulo }
1393157ba21SRui Paulo 
1403157ba21SRui Paulo 
os_memcpy(void * dest,const void * src,size_t n)1413157ba21SRui Paulo void * os_memcpy(void *dest, const void *src, size_t n)
1423157ba21SRui Paulo {
1433157ba21SRui Paulo 	return dest;
1443157ba21SRui Paulo }
1453157ba21SRui Paulo 
1463157ba21SRui Paulo 
os_memmove(void * dest,const void * src,size_t n)1473157ba21SRui Paulo void * os_memmove(void *dest, const void *src, size_t n)
1483157ba21SRui Paulo {
1493157ba21SRui Paulo 	return dest;
1503157ba21SRui Paulo }
1513157ba21SRui Paulo 
1523157ba21SRui Paulo 
os_memset(void * s,int c,size_t n)1533157ba21SRui Paulo void * os_memset(void *s, int c, size_t n)
1543157ba21SRui Paulo {
1553157ba21SRui Paulo 	return s;
1563157ba21SRui Paulo }
1573157ba21SRui Paulo 
1583157ba21SRui Paulo 
os_memcmp(const void * s1,const void * s2,size_t n)1593157ba21SRui Paulo int os_memcmp(const void *s1, const void *s2, size_t n)
1603157ba21SRui Paulo {
1613157ba21SRui Paulo 	return 0;
1623157ba21SRui Paulo }
1633157ba21SRui Paulo 
1643157ba21SRui Paulo 
os_strdup(const char * s)1653157ba21SRui Paulo char * os_strdup(const char *s)
1663157ba21SRui Paulo {
1673157ba21SRui Paulo 	return NULL;
1683157ba21SRui Paulo }
1693157ba21SRui Paulo 
1703157ba21SRui Paulo 
os_strlen(const char * s)1713157ba21SRui Paulo size_t os_strlen(const char *s)
1723157ba21SRui Paulo {
1733157ba21SRui Paulo 	return 0;
1743157ba21SRui Paulo }
1753157ba21SRui Paulo 
1763157ba21SRui Paulo 
os_strcasecmp(const char * s1,const char * s2)1773157ba21SRui Paulo int os_strcasecmp(const char *s1, const char *s2)
1783157ba21SRui Paulo {
1793157ba21SRui Paulo 	/*
1803157ba21SRui Paulo 	 * Ignoring case is not required for main functionality, so just use
1813157ba21SRui Paulo 	 * the case sensitive version of the function.
1823157ba21SRui Paulo 	 */
1833157ba21SRui Paulo 	return os_strcmp(s1, s2);
1843157ba21SRui Paulo }
1853157ba21SRui Paulo 
1863157ba21SRui Paulo 
os_strncasecmp(const char * s1,const char * s2,size_t n)1873157ba21SRui Paulo int os_strncasecmp(const char *s1, const char *s2, size_t n)
1883157ba21SRui Paulo {
1893157ba21SRui Paulo 	/*
1903157ba21SRui Paulo 	 * Ignoring case is not required for main functionality, so just use
1913157ba21SRui Paulo 	 * the case sensitive version of the function.
1923157ba21SRui Paulo 	 */
1933157ba21SRui Paulo 	return os_strncmp(s1, s2, n);
1943157ba21SRui Paulo }
1953157ba21SRui Paulo 
1963157ba21SRui Paulo 
os_strchr(const char * s,int c)1973157ba21SRui Paulo char * os_strchr(const char *s, int c)
1983157ba21SRui Paulo {
1993157ba21SRui Paulo 	return NULL;
2003157ba21SRui Paulo }
2013157ba21SRui Paulo 
2023157ba21SRui Paulo 
os_strrchr(const char * s,int c)2033157ba21SRui Paulo char * os_strrchr(const char *s, int c)
2043157ba21SRui Paulo {
2053157ba21SRui Paulo 	return NULL;
2063157ba21SRui Paulo }
2073157ba21SRui Paulo 
2083157ba21SRui Paulo 
os_strcmp(const char * s1,const char * s2)2093157ba21SRui Paulo int os_strcmp(const char *s1, const char *s2)
2103157ba21SRui Paulo {
2113157ba21SRui Paulo 	return 0;
2123157ba21SRui Paulo }
2133157ba21SRui Paulo 
2143157ba21SRui Paulo 
os_strncmp(const char * s1,const char * s2,size_t n)2153157ba21SRui Paulo int os_strncmp(const char *s1, const char *s2, size_t n)
2163157ba21SRui Paulo {
2173157ba21SRui Paulo 	return 0;
2183157ba21SRui Paulo }
2193157ba21SRui Paulo 
2203157ba21SRui Paulo 
os_strlcpy(char * dest,const char * src,size_t size)2213157ba21SRui Paulo size_t os_strlcpy(char *dest, const char *src, size_t size)
2223157ba21SRui Paulo {
2233157ba21SRui Paulo 	return 0;
2243157ba21SRui Paulo }
2253157ba21SRui Paulo 
2263157ba21SRui Paulo 
os_memcmp_const(const void * a,const void * b,size_t len)2275b9c547cSRui Paulo int os_memcmp_const(const void *a, const void *b, size_t len)
2285b9c547cSRui Paulo {
2295b9c547cSRui Paulo 	return 0;
2305b9c547cSRui Paulo }
2315b9c547cSRui Paulo 
os_strstr(const char * haystack,const char * needle)2323157ba21SRui Paulo char * os_strstr(const char *haystack, const char *needle)
2333157ba21SRui Paulo {
2343157ba21SRui Paulo 	return NULL;
2353157ba21SRui Paulo }
2363157ba21SRui Paulo 
2373157ba21SRui Paulo 
os_snprintf(char * str,size_t size,const char * format,...)2383157ba21SRui Paulo int os_snprintf(char *str, size_t size, const char *format, ...)
2393157ba21SRui Paulo {
2403157ba21SRui Paulo 	return 0;
2413157ba21SRui Paulo }
2423157ba21SRui Paulo #endif /* OS_NO_C_LIB_DEFINES */
2435b9c547cSRui Paulo 
2445b9c547cSRui Paulo 
os_exec(const char * program,const char * arg,int wait_completion)2455b9c547cSRui Paulo int os_exec(const char *program, const char *arg, int wait_completion)
2465b9c547cSRui Paulo {
2475b9c547cSRui Paulo 	return -1;
2485b9c547cSRui Paulo }
249