os_none.c revision 8d520ff1dc2da35cdca849e982051b86468016d8
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
24void os_sleep(os_time_t sec, os_time_t usec)
25{
26}
27
28
29int os_get_time(struct os_time *t)
30{
31	return -1;
32}
33
34
35int 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
42int os_daemonize(const char *pid_file)
43{
44	return -1;
45}
46
47
48void os_daemonize_terminate(const char *pid_file)
49{
50}
51
52
53int os_get_random(unsigned char *buf, size_t len)
54{
55	return -1;
56}
57
58
59unsigned long os_random(void)
60{
61	return 0;
62}
63
64
65char * os_rel2abs_path(const char *rel_path)
66{
67	return NULL; /* strdup(rel_path) can be used here */
68}
69
70
71int os_program_init(void)
72{
73	return 0;
74}
75
76
77void os_program_deinit(void)
78{
79}
80
81
82int os_setenv(const char *name, const char *value, int overwrite)
83{
84	return -1;
85}
86
87
88int os_unsetenv(const char *name)
89{
90	return -1;
91}
92
93
94char * os_readfile(const char *name, size_t *len)
95{
96	return NULL;
97}
98
99
100void * os_zalloc(size_t size)
101{
102	return NULL;
103}
104
105
106#ifdef OS_NO_C_LIB_DEFINES
107void * os_malloc(size_t size)
108{
109	return NULL;
110}
111
112
113void * os_realloc(void *ptr, size_t size)
114{
115	return NULL;
116}
117
118
119void os_free(void *ptr)
120{
121}
122
123
124void * os_memcpy(void *dest, const void *src, size_t n)
125{
126	return dest;
127}
128
129
130void * os_memmove(void *dest, const void *src, size_t n)
131{
132	return dest;
133}
134
135
136void * os_memset(void *s, int c, size_t n)
137{
138	return s;
139}
140
141
142int os_memcmp(const void *s1, const void *s2, size_t n)
143{
144	return 0;
145}
146
147
148char * os_strdup(const char *s)
149{
150	return NULL;
151}
152
153
154size_t os_strlen(const char *s)
155{
156	return 0;
157}
158
159
160int 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
170int 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
180char * os_strchr(const char *s, int c)
181{
182	return NULL;
183}
184
185
186char * os_strrchr(const char *s, int c)
187{
188	return NULL;
189}
190
191
192int os_strcmp(const char *s1, const char *s2)
193{
194	return 0;
195}
196
197
198int os_strncmp(const char *s1, const char *s2, size_t n)
199{
200	return 0;
201}
202
203
204char * os_strncpy(char *dest, const char *src, size_t n)
205{
206	return dest;
207}
208
209
210size_t os_strlcpy(char *dest, const char *src, size_t size)
211{
212	return 0;
213}
214
215
216char * os_strstr(const char *haystack, const char *needle)
217{
218	return NULL;
219}
220
221
222int os_snprintf(char *str, size_t size, const char *format, ...)
223{
224	return 0;
225}
226#endif /* OS_NO_C_LIB_DEFINES */
227