xref: /freebsd/contrib/wpa/src/utils/os_none.c (revision 61af1d13936ec56808f62d13dd8698f73b440dc1)
1 /*
2  * wpa_supplicant/hostapd / Empty OS specific functions
3  * Copyright (c) 2005-2006, Jouni Malinen <j@w1.fi>
4  *
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.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  *
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.
18  */
19 
20 #include "includes.h"
21 
22 #include "os.h"
23 
24 void os_sleep(os_time_t sec, os_time_t usec)
25 {
26 }
27 
28 
29 int os_get_time(struct os_time *t)
30 {
31 	return -1;
32 }
33 
34 
35 int os_mktime(int year, int month, int day, int hour, int min, int sec,
36 	      os_time_t *t)
37 {
38 	return -1;
39 }
40 
41 
42 int os_daemonize(const char *pid_file)
43 {
44 	return -1;
45 }
46 
47 
48 void os_daemonize_terminate(const char *pid_file)
49 {
50 }
51 
52 
53 int os_get_random(unsigned char *buf, size_t len)
54 {
55 	return -1;
56 }
57 
58 
59 unsigned long os_random(void)
60 {
61 	return 0;
62 }
63 
64 
65 char * os_rel2abs_path(const char *rel_path)
66 {
67 	return NULL; /* strdup(rel_path) can be used here */
68 }
69 
70 
71 int os_program_init(void)
72 {
73 	return 0;
74 }
75 
76 
77 void os_program_deinit(void)
78 {
79 }
80 
81 
82 int os_setenv(const char *name, const char *value, int overwrite)
83 {
84 	return -1;
85 }
86 
87 
88 int os_unsetenv(const char *name)
89 {
90 	return -1;
91 }
92 
93 
94 char * os_readfile(const char *name, size_t *len)
95 {
96 	return NULL;
97 }
98 
99 
100 void * os_zalloc(size_t size)
101 {
102 	return NULL;
103 }
104 
105 
106 #ifdef OS_NO_C_LIB_DEFINES
107 void * os_malloc(size_t size)
108 {
109 	return NULL;
110 }
111 
112 
113 void * os_realloc(void *ptr, size_t size)
114 {
115 	return NULL;
116 }
117 
118 
119 void os_free(void *ptr)
120 {
121 }
122 
123 
124 void * os_memcpy(void *dest, const void *src, size_t n)
125 {
126 	return dest;
127 }
128 
129 
130 void * os_memmove(void *dest, const void *src, size_t n)
131 {
132 	return dest;
133 }
134 
135 
136 void * os_memset(void *s, int c, size_t n)
137 {
138 	return s;
139 }
140 
141 
142 int os_memcmp(const void *s1, const void *s2, size_t n)
143 {
144 	return 0;
145 }
146 
147 
148 char * os_strdup(const char *s)
149 {
150 	return NULL;
151 }
152 
153 
154 size_t os_strlen(const char *s)
155 {
156 	return 0;
157 }
158 
159 
160 int os_strcasecmp(const char *s1, const char *s2)
161 {
162 	/*
163 	 * Ignoring case is not required for main functionality, so just use
164 	 * the case sensitive version of the function.
165 	 */
166 	return os_strcmp(s1, s2);
167 }
168 
169 
170 int os_strncasecmp(const char *s1, const char *s2, size_t n)
171 {
172 	/*
173 	 * Ignoring case is not required for main functionality, so just use
174 	 * the case sensitive version of the function.
175 	 */
176 	return os_strncmp(s1, s2, n);
177 }
178 
179 
180 char * os_strchr(const char *s, int c)
181 {
182 	return NULL;
183 }
184 
185 
186 char * os_strrchr(const char *s, int c)
187 {
188 	return NULL;
189 }
190 
191 
192 int os_strcmp(const char *s1, const char *s2)
193 {
194 	return 0;
195 }
196 
197 
198 int os_strncmp(const char *s1, const char *s2, size_t n)
199 {
200 	return 0;
201 }
202 
203 
204 char * os_strncpy(char *dest, const char *src, size_t n)
205 {
206 	return dest;
207 }
208 
209 
210 size_t os_strlcpy(char *dest, const char *src, size_t size)
211 {
212 	return 0;
213 }
214 
215 
216 char * os_strstr(const char *haystack, const char *needle)
217 {
218 	return NULL;
219 }
220 
221 
222 int os_snprintf(char *str, size_t size, const char *format, ...)
223 {
224 	return 0;
225 }
226 #endif /* OS_NO_C_LIB_DEFINES */
227