1189251Ssam/*
2214734Srpaulo * OS specific functions
3214734Srpaulo * Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
4189251Ssam *
5252726Srpaulo * This software may be distributed under the terms of the BSD license.
6252726Srpaulo * See README for more details.
7189251Ssam */
8189251Ssam
9189251Ssam#ifndef OS_H
10189251Ssam#define OS_H
11189251Ssam
12189251Ssamtypedef long os_time_t;
13189251Ssam
14189251Ssam/**
15189251Ssam * os_sleep - Sleep (sec, usec)
16189251Ssam * @sec: Number of seconds to sleep
17189251Ssam * @usec: Number of microseconds to sleep
18189251Ssam */
19189251Ssamvoid os_sleep(os_time_t sec, os_time_t usec);
20189251Ssam
21189251Ssamstruct os_time {
22189251Ssam	os_time_t sec;
23189251Ssam	os_time_t usec;
24189251Ssam};
25189251Ssam
26189251Ssam/**
27189251Ssam * os_get_time - Get current time (sec, usec)
28189251Ssam * @t: Pointer to buffer for the time
29189251Ssam * Returns: 0 on success, -1 on failure
30189251Ssam */
31189251Ssamint os_get_time(struct os_time *t);
32189251Ssam
33189251Ssam
34189251Ssam/* Helper macros for handling struct os_time */
35189251Ssam
36189251Ssam#define os_time_before(a, b) \
37189251Ssam	((a)->sec < (b)->sec || \
38189251Ssam	 ((a)->sec == (b)->sec && (a)->usec < (b)->usec))
39189251Ssam
40189251Ssam#define os_time_sub(a, b, res) do { \
41189251Ssam	(res)->sec = (a)->sec - (b)->sec; \
42189251Ssam	(res)->usec = (a)->usec - (b)->usec; \
43189251Ssam	if ((res)->usec < 0) { \
44189251Ssam		(res)->sec--; \
45189251Ssam		(res)->usec += 1000000; \
46189251Ssam	} \
47189251Ssam} while (0)
48189251Ssam
49189251Ssam/**
50189251Ssam * os_mktime - Convert broken-down time into seconds since 1970-01-01
51189251Ssam * @year: Four digit year
52189251Ssam * @month: Month (1 .. 12)
53189251Ssam * @day: Day of month (1 .. 31)
54189251Ssam * @hour: Hour (0 .. 23)
55189251Ssam * @min: Minute (0 .. 59)
56189251Ssam * @sec: Second (0 .. 60)
57189251Ssam * @t: Buffer for returning calendar time representation (seconds since
58189251Ssam * 1970-01-01 00:00:00)
59189251Ssam * Returns: 0 on success, -1 on failure
60189251Ssam *
61189251Ssam * Note: The result is in seconds from Epoch, i.e., in UTC, not in local time
62189251Ssam * which is used by POSIX mktime().
63189251Ssam */
64189251Ssamint os_mktime(int year, int month, int day, int hour, int min, int sec,
65189251Ssam	      os_time_t *t);
66189251Ssam
67252726Srpaulostruct os_tm {
68252726Srpaulo	int sec; /* 0..59 or 60 for leap seconds */
69252726Srpaulo	int min; /* 0..59 */
70252726Srpaulo	int hour; /* 0..23 */
71252726Srpaulo	int day; /* 1..31 */
72252726Srpaulo	int month; /* 1..12 */
73252726Srpaulo	int year; /* Four digit year */
74252726Srpaulo};
75189251Ssam
76252726Srpauloint os_gmtime(os_time_t t, struct os_tm *tm);
77252726Srpaulo
78189251Ssam/**
79189251Ssam * os_daemonize - Run in the background (detach from the controlling terminal)
80189251Ssam * @pid_file: File name to write the process ID to or %NULL to skip this
81189251Ssam * Returns: 0 on success, -1 on failure
82189251Ssam */
83189251Ssamint os_daemonize(const char *pid_file);
84189251Ssam
85189251Ssam/**
86189251Ssam * os_daemonize_terminate - Stop running in the background (remove pid file)
87189251Ssam * @pid_file: File name to write the process ID to or %NULL to skip this
88189251Ssam */
89189251Ssamvoid os_daemonize_terminate(const char *pid_file);
90189251Ssam
91189251Ssam/**
92189251Ssam * os_get_random - Get cryptographically strong pseudo random data
93189251Ssam * @buf: Buffer for pseudo random data
94189251Ssam * @len: Length of the buffer
95189251Ssam * Returns: 0 on success, -1 on failure
96189251Ssam */
97189251Ssamint os_get_random(unsigned char *buf, size_t len);
98189251Ssam
99189251Ssam/**
100189251Ssam * os_random - Get pseudo random value (not necessarily very strong)
101189251Ssam * Returns: Pseudo random value
102189251Ssam */
103189251Ssamunsigned long os_random(void);
104189251Ssam
105189251Ssam/**
106189251Ssam * os_rel2abs_path - Get an absolute path for a file
107189251Ssam * @rel_path: Relative path to a file
108189251Ssam * Returns: Absolute path for the file or %NULL on failure
109189251Ssam *
110189251Ssam * This function tries to convert a relative path of a file to an absolute path
111189251Ssam * in order for the file to be found even if current working directory has
112189251Ssam * changed. The returned value is allocated and caller is responsible for
113189251Ssam * freeing it. It is acceptable to just return the same path in an allocated
114189251Ssam * buffer, e.g., return strdup(rel_path). This function is only used to find
115189251Ssam * configuration files when os_daemonize() may have changed the current working
116189251Ssam * directory and relative path would be pointing to a different location.
117189251Ssam */
118189251Ssamchar * os_rel2abs_path(const char *rel_path);
119189251Ssam
120189251Ssam/**
121189251Ssam * os_program_init - Program initialization (called at start)
122189251Ssam * Returns: 0 on success, -1 on failure
123189251Ssam *
124189251Ssam * This function is called when a programs starts. If there are any OS specific
125189251Ssam * processing that is needed, it can be placed here. It is also acceptable to
126189251Ssam * just return 0 if not special processing is needed.
127189251Ssam */
128189251Ssamint os_program_init(void);
129189251Ssam
130189251Ssam/**
131189251Ssam * os_program_deinit - Program deinitialization (called just before exit)
132189251Ssam *
133189251Ssam * This function is called just before a program exists. If there are any OS
134189251Ssam * specific processing, e.g., freeing resourced allocated in os_program_init(),
135189251Ssam * it should be done here. It is also acceptable for this function to do
136189251Ssam * nothing.
137189251Ssam */
138189251Ssamvoid os_program_deinit(void);
139189251Ssam
140189251Ssam/**
141189251Ssam * os_setenv - Set environment variable
142189251Ssam * @name: Name of the variable
143189251Ssam * @value: Value to set to the variable
144189251Ssam * @overwrite: Whether existing variable should be overwritten
145189251Ssam * Returns: 0 on success, -1 on error
146189251Ssam *
147189251Ssam * This function is only used for wpa_cli action scripts. OS wrapper does not
148189251Ssam * need to implement this if such functionality is not needed.
149189251Ssam */
150189251Ssamint os_setenv(const char *name, const char *value, int overwrite);
151189251Ssam
152189251Ssam/**
153189251Ssam * os_unsetenv - Delete environent variable
154189251Ssam * @name: Name of the variable
155189251Ssam * Returns: 0 on success, -1 on error
156189251Ssam *
157189251Ssam * This function is only used for wpa_cli action scripts. OS wrapper does not
158189251Ssam * need to implement this if such functionality is not needed.
159189251Ssam */
160189251Ssamint os_unsetenv(const char *name);
161189251Ssam
162189251Ssam/**
163189251Ssam * os_readfile - Read a file to an allocated memory buffer
164189251Ssam * @name: Name of the file to read
165189251Ssam * @len: For returning the length of the allocated buffer
166189251Ssam * Returns: Pointer to the allocated buffer or %NULL on failure
167189251Ssam *
168189251Ssam * This function allocates memory and reads the given file to this buffer. Both
169189251Ssam * binary and text files can be read with this function. The caller is
170189251Ssam * responsible for freeing the returned buffer with os_free().
171189251Ssam */
172189251Ssamchar * os_readfile(const char *name, size_t *len);
173189251Ssam
174189251Ssam/**
175189251Ssam * os_zalloc - Allocate and zero memory
176189251Ssam * @size: Number of bytes to allocate
177189251Ssam * Returns: Pointer to allocated and zeroed memory or %NULL on failure
178189251Ssam *
179189251Ssam * Caller is responsible for freeing the returned buffer with os_free().
180189251Ssam */
181189251Ssamvoid * os_zalloc(size_t size);
182189251Ssam
183252726Srpaulo/**
184252726Srpaulo * os_calloc - Allocate and zero memory for an array
185252726Srpaulo * @nmemb: Number of members in the array
186252726Srpaulo * @size: Number of bytes in each member
187252726Srpaulo * Returns: Pointer to allocated and zeroed memory or %NULL on failure
188252726Srpaulo *
189252726Srpaulo * This function can be used as a wrapper for os_zalloc(nmemb * size) when an
190252726Srpaulo * allocation is used for an array. The main benefit over os_zalloc() is in
191252726Srpaulo * having an extra check to catch integer overflows in multiplication.
192252726Srpaulo *
193252726Srpaulo * Caller is responsible for freeing the returned buffer with os_free().
194252726Srpaulo */
195252726Srpaulostatic inline void * os_calloc(size_t nmemb, size_t size)
196252726Srpaulo{
197252726Srpaulo	if (size && nmemb > (~(size_t) 0) / size)
198252726Srpaulo		return NULL;
199252726Srpaulo	return os_zalloc(nmemb * size);
200252726Srpaulo}
201189251Ssam
202252726Srpaulo
203189251Ssam/*
204189251Ssam * The following functions are wrapper for standard ANSI C or POSIX functions.
205189251Ssam * By default, they are just defined to use the standard function name and no
206189251Ssam * os_*.c implementation is needed for them. This avoids extra function calls
207189251Ssam * by allowing the C pre-processor take care of the function name mapping.
208189251Ssam *
209189251Ssam * If the target system uses a C library that does not provide these functions,
210189251Ssam * build_config.h can be used to define the wrappers to use a different
211189251Ssam * function name. This can be done on function-by-function basis since the
212189251Ssam * defines here are only used if build_config.h does not define the os_* name.
213189251Ssam * If needed, os_*.c file can be used to implement the functions that are not
214189251Ssam * included in the C library on the target system. Alternatively,
215189251Ssam * OS_NO_C_LIB_DEFINES can be defined to skip all defines here in which case
216189251Ssam * these functions need to be implemented in os_*.c file for the target system.
217189251Ssam */
218189251Ssam
219189251Ssam#ifdef OS_NO_C_LIB_DEFINES
220189251Ssam
221189251Ssam/**
222189251Ssam * os_malloc - Allocate dynamic memory
223189251Ssam * @size: Size of the buffer to allocate
224189251Ssam * Returns: Allocated buffer or %NULL on failure
225189251Ssam *
226189251Ssam * Caller is responsible for freeing the returned buffer with os_free().
227189251Ssam */
228189251Ssamvoid * os_malloc(size_t size);
229189251Ssam
230189251Ssam/**
231189251Ssam * os_realloc - Re-allocate dynamic memory
232189251Ssam * @ptr: Old buffer from os_malloc() or os_realloc()
233189251Ssam * @size: Size of the new buffer
234189251Ssam * Returns: Allocated buffer or %NULL on failure
235189251Ssam *
236189251Ssam * Caller is responsible for freeing the returned buffer with os_free().
237189251Ssam * If re-allocation fails, %NULL is returned and the original buffer (ptr) is
238189251Ssam * not freed and caller is still responsible for freeing it.
239189251Ssam */
240189251Ssamvoid * os_realloc(void *ptr, size_t size);
241189251Ssam
242189251Ssam/**
243189251Ssam * os_free - Free dynamic memory
244189251Ssam * @ptr: Old buffer from os_malloc() or os_realloc(); can be %NULL
245189251Ssam */
246189251Ssamvoid os_free(void *ptr);
247189251Ssam
248189251Ssam/**
249189251Ssam * os_memcpy - Copy memory area
250189251Ssam * @dest: Destination
251189251Ssam * @src: Source
252189251Ssam * @n: Number of bytes to copy
253189251Ssam * Returns: dest
254189251Ssam *
255189251Ssam * The memory areas src and dst must not overlap. os_memmove() can be used with
256189251Ssam * overlapping memory.
257189251Ssam */
258189251Ssamvoid * os_memcpy(void *dest, const void *src, size_t n);
259189251Ssam
260189251Ssam/**
261189251Ssam * os_memmove - Copy memory area
262189251Ssam * @dest: Destination
263189251Ssam * @src: Source
264189251Ssam * @n: Number of bytes to copy
265189251Ssam * Returns: dest
266189251Ssam *
267189251Ssam * The memory areas src and dst may overlap.
268189251Ssam */
269189251Ssamvoid * os_memmove(void *dest, const void *src, size_t n);
270189251Ssam
271189251Ssam/**
272189251Ssam * os_memset - Fill memory with a constant byte
273189251Ssam * @s: Memory area to be filled
274189251Ssam * @c: Constant byte
275189251Ssam * @n: Number of bytes started from s to fill with c
276189251Ssam * Returns: s
277189251Ssam */
278189251Ssamvoid * os_memset(void *s, int c, size_t n);
279189251Ssam
280189251Ssam/**
281189251Ssam * os_memcmp - Compare memory areas
282189251Ssam * @s1: First buffer
283189251Ssam * @s2: Second buffer
284189251Ssam * @n: Maximum numbers of octets to compare
285189251Ssam * Returns: An integer less than, equal to, or greater than zero if s1 is
286189251Ssam * found to be less than, to match, or be greater than s2. Only first n
287189251Ssam * characters will be compared.
288189251Ssam */
289189251Ssamint os_memcmp(const void *s1, const void *s2, size_t n);
290189251Ssam
291189251Ssam/**
292189251Ssam * os_strdup - Duplicate a string
293189251Ssam * @s: Source string
294189251Ssam * Returns: Allocated buffer with the string copied into it or %NULL on failure
295189251Ssam *
296189251Ssam * Caller is responsible for freeing the returned buffer with os_free().
297189251Ssam */
298189251Ssamchar * os_strdup(const char *s);
299189251Ssam
300189251Ssam/**
301189251Ssam * os_strlen - Calculate the length of a string
302189251Ssam * @s: '\0' terminated string
303189251Ssam * Returns: Number of characters in s (not counting the '\0' terminator)
304189251Ssam */
305189251Ssamsize_t os_strlen(const char *s);
306189251Ssam
307189251Ssam/**
308189251Ssam * os_strcasecmp - Compare two strings ignoring case
309189251Ssam * @s1: First string
310189251Ssam * @s2: Second string
311189251Ssam * Returns: An integer less than, equal to, or greater than zero if s1 is
312189251Ssam * found to be less than, to match, or be greatred than s2
313189251Ssam */
314189251Ssamint os_strcasecmp(const char *s1, const char *s2);
315189251Ssam
316189251Ssam/**
317189251Ssam * os_strncasecmp - Compare two strings ignoring case
318189251Ssam * @s1: First string
319189251Ssam * @s2: Second string
320189251Ssam * @n: Maximum numbers of characters to compare
321189251Ssam * Returns: An integer less than, equal to, or greater than zero if s1 is
322189251Ssam * found to be less than, to match, or be greater than s2. Only first n
323189251Ssam * characters will be compared.
324189251Ssam */
325189251Ssamint os_strncasecmp(const char *s1, const char *s2, size_t n);
326189251Ssam
327189251Ssam/**
328189251Ssam * os_strchr - Locate the first occurrence of a character in string
329189251Ssam * @s: String
330189251Ssam * @c: Character to search for
331189251Ssam * Returns: Pointer to the matched character or %NULL if not found
332189251Ssam */
333189251Ssamchar * os_strchr(const char *s, int c);
334189251Ssam
335189251Ssam/**
336189251Ssam * os_strrchr - Locate the last occurrence of a character in string
337189251Ssam * @s: String
338189251Ssam * @c: Character to search for
339189251Ssam * Returns: Pointer to the matched character or %NULL if not found
340189251Ssam */
341189251Ssamchar * os_strrchr(const char *s, int c);
342189251Ssam
343189251Ssam/**
344189251Ssam * os_strcmp - Compare two strings
345189251Ssam * @s1: First string
346189251Ssam * @s2: Second string
347189251Ssam * Returns: An integer less than, equal to, or greater than zero if s1 is
348189251Ssam * found to be less than, to match, or be greatred than s2
349189251Ssam */
350189251Ssamint os_strcmp(const char *s1, const char *s2);
351189251Ssam
352189251Ssam/**
353189251Ssam * os_strncmp - Compare two strings
354189251Ssam * @s1: First string
355189251Ssam * @s2: Second string
356189251Ssam * @n: Maximum numbers of characters to compare
357189251Ssam * Returns: An integer less than, equal to, or greater than zero if s1 is
358189251Ssam * found to be less than, to match, or be greater than s2. Only first n
359189251Ssam * characters will be compared.
360189251Ssam */
361189251Ssamint os_strncmp(const char *s1, const char *s2, size_t n);
362189251Ssam
363189251Ssam/**
364189251Ssam * os_strncpy - Copy a string
365189251Ssam * @dest: Destination
366189251Ssam * @src: Source
367189251Ssam * @n: Maximum number of characters to copy
368189251Ssam * Returns: dest
369189251Ssam */
370189251Ssamchar * os_strncpy(char *dest, const char *src, size_t n);
371189251Ssam
372189251Ssam/**
373189251Ssam * os_strstr - Locate a substring
374189251Ssam * @haystack: String (haystack) to search from
375189251Ssam * @needle: Needle to search from haystack
376189251Ssam * Returns: Pointer to the beginning of the substring or %NULL if not found
377189251Ssam */
378189251Ssamchar * os_strstr(const char *haystack, const char *needle);
379189251Ssam
380189251Ssam/**
381189251Ssam * os_snprintf - Print to a memory buffer
382189251Ssam * @str: Memory buffer to print into
383189251Ssam * @size: Maximum length of the str buffer
384189251Ssam * @format: printf format
385189251Ssam * Returns: Number of characters printed (not including trailing '\0').
386189251Ssam *
387189251Ssam * If the output buffer is truncated, number of characters which would have
388189251Ssam * been written is returned. Since some C libraries return -1 in such a case,
389189251Ssam * the caller must be prepared on that value, too, to indicate truncation.
390189251Ssam *
391189251Ssam * Note: Some C library implementations of snprintf() may not guarantee null
392189251Ssam * termination in case the output is truncated. The OS wrapper function of
393189251Ssam * os_snprintf() should provide this guarantee, i.e., to null terminate the
394189251Ssam * output buffer if a C library version of the function is used and if that
395189251Ssam * function does not guarantee null termination.
396189251Ssam *
397189251Ssam * If the target system does not include snprintf(), see, e.g.,
398189251Ssam * http://www.ijs.si/software/snprintf/ for an example of a portable
399189251Ssam * implementation of snprintf.
400189251Ssam */
401189251Ssamint os_snprintf(char *str, size_t size, const char *format, ...);
402189251Ssam
403189251Ssam#else /* OS_NO_C_LIB_DEFINES */
404189251Ssam
405214734Srpaulo#ifdef WPA_TRACE
406214734Srpaulovoid * os_malloc(size_t size);
407214734Srpaulovoid * os_realloc(void *ptr, size_t size);
408214734Srpaulovoid os_free(void *ptr);
409214734Srpaulochar * os_strdup(const char *s);
410214734Srpaulo#else /* WPA_TRACE */
411189251Ssam#ifndef os_malloc
412189251Ssam#define os_malloc(s) malloc((s))
413189251Ssam#endif
414189251Ssam#ifndef os_realloc
415189251Ssam#define os_realloc(p, s) realloc((p), (s))
416189251Ssam#endif
417189251Ssam#ifndef os_free
418189251Ssam#define os_free(p) free((p))
419189251Ssam#endif
420214734Srpaulo#ifndef os_strdup
421214734Srpaulo#ifdef _MSC_VER
422214734Srpaulo#define os_strdup(s) _strdup(s)
423214734Srpaulo#else
424214734Srpaulo#define os_strdup(s) strdup(s)
425214734Srpaulo#endif
426214734Srpaulo#endif
427214734Srpaulo#endif /* WPA_TRACE */
428189251Ssam
429189251Ssam#ifndef os_memcpy
430189251Ssam#define os_memcpy(d, s, n) memcpy((d), (s), (n))
431189251Ssam#endif
432189251Ssam#ifndef os_memmove
433189251Ssam#define os_memmove(d, s, n) memmove((d), (s), (n))
434189251Ssam#endif
435189251Ssam#ifndef os_memset
436189251Ssam#define os_memset(s, c, n) memset(s, c, n)
437189251Ssam#endif
438189251Ssam#ifndef os_memcmp
439189251Ssam#define os_memcmp(s1, s2, n) memcmp((s1), (s2), (n))
440189251Ssam#endif
441189251Ssam
442189251Ssam#ifndef os_strlen
443189251Ssam#define os_strlen(s) strlen(s)
444189251Ssam#endif
445189251Ssam#ifndef os_strcasecmp
446189251Ssam#ifdef _MSC_VER
447189251Ssam#define os_strcasecmp(s1, s2) _stricmp((s1), (s2))
448189251Ssam#else
449189251Ssam#define os_strcasecmp(s1, s2) strcasecmp((s1), (s2))
450189251Ssam#endif
451189251Ssam#endif
452189251Ssam#ifndef os_strncasecmp
453189251Ssam#ifdef _MSC_VER
454189251Ssam#define os_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
455189251Ssam#else
456189251Ssam#define os_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
457189251Ssam#endif
458189251Ssam#endif
459189251Ssam#ifndef os_strchr
460189251Ssam#define os_strchr(s, c) strchr((s), (c))
461189251Ssam#endif
462189251Ssam#ifndef os_strcmp
463189251Ssam#define os_strcmp(s1, s2) strcmp((s1), (s2))
464189251Ssam#endif
465189251Ssam#ifndef os_strncmp
466189251Ssam#define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
467189251Ssam#endif
468189251Ssam#ifndef os_strncpy
469189251Ssam#define os_strncpy(d, s, n) strncpy((d), (s), (n))
470189251Ssam#endif
471189251Ssam#ifndef os_strrchr
472189251Ssam#define os_strrchr(s, c) strrchr((s), (c))
473189251Ssam#endif
474189251Ssam#ifndef os_strstr
475189251Ssam#define os_strstr(h, n) strstr((h), (n))
476189251Ssam#endif
477189251Ssam
478189251Ssam#ifndef os_snprintf
479189251Ssam#ifdef _MSC_VER
480189251Ssam#define os_snprintf _snprintf
481189251Ssam#else
482189251Ssam#define os_snprintf snprintf
483189251Ssam#endif
484189251Ssam#endif
485189251Ssam
486189251Ssam#endif /* OS_NO_C_LIB_DEFINES */
487189251Ssam
488189251Ssam
489252726Srpaulostatic inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
490252726Srpaulo{
491252726Srpaulo	if (size && nmemb > (~(size_t) 0) / size)
492252726Srpaulo		return NULL;
493252726Srpaulo	return os_realloc(ptr, nmemb * size);
494252726Srpaulo}
495252726Srpaulo
496252726Srpaulo
497189251Ssam/**
498189251Ssam * os_strlcpy - Copy a string with size bound and NUL-termination
499189251Ssam * @dest: Destination
500189251Ssam * @src: Source
501189251Ssam * @siz: Size of the target buffer
502189251Ssam * Returns: Total length of the target string (length of src) (not including
503189251Ssam * NUL-termination)
504189251Ssam *
505189251Ssam * This function matches in behavior with the strlcpy(3) function in OpenBSD.
506189251Ssam */
507189251Ssamsize_t os_strlcpy(char *dest, const char *src, size_t siz);
508189251Ssam
509189251Ssam
510189251Ssam#ifdef OS_REJECT_C_LIB_FUNCTIONS
511189251Ssam#define malloc OS_DO_NOT_USE_malloc
512189251Ssam#define realloc OS_DO_NOT_USE_realloc
513189251Ssam#define free OS_DO_NOT_USE_free
514189251Ssam#define memcpy OS_DO_NOT_USE_memcpy
515189251Ssam#define memmove OS_DO_NOT_USE_memmove
516189251Ssam#define memset OS_DO_NOT_USE_memset
517189251Ssam#define memcmp OS_DO_NOT_USE_memcmp
518189251Ssam#undef strdup
519189251Ssam#define strdup OS_DO_NOT_USE_strdup
520189251Ssam#define strlen OS_DO_NOT_USE_strlen
521189251Ssam#define strcasecmp OS_DO_NOT_USE_strcasecmp
522189251Ssam#define strncasecmp OS_DO_NOT_USE_strncasecmp
523189251Ssam#undef strchr
524189251Ssam#define strchr OS_DO_NOT_USE_strchr
525189251Ssam#undef strcmp
526189251Ssam#define strcmp OS_DO_NOT_USE_strcmp
527189251Ssam#undef strncmp
528189251Ssam#define strncmp OS_DO_NOT_USE_strncmp
529189251Ssam#undef strncpy
530189251Ssam#define strncpy OS_DO_NOT_USE_strncpy
531189251Ssam#define strrchr OS_DO_NOT_USE_strrchr
532189251Ssam#define strstr OS_DO_NOT_USE_strstr
533189251Ssam#undef snprintf
534189251Ssam#define snprintf OS_DO_NOT_USE_snprintf
535189251Ssam
536189251Ssam#define strcpy OS_DO_NOT_USE_strcpy
537189251Ssam#endif /* OS_REJECT_C_LIB_FUNCTIONS */
538189251Ssam
539189251Ssam#endif /* OS_H */
540