os_none.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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. #include "includes.h"
  20. #include "os.h"
  21. void os_sleep(os_time_t sec, os_time_t usec)
  22. {
  23. }
  24. int os_get_time(struct os_time *t)
  25. {
  26. return -1;
  27. }
  28. int os_mktime(int year, int month, int day, int hour, int min, int sec,
  29. os_time_t *t)
  30. {
  31. return -1;
  32. }
  33. int os_daemonize(const char *pid_file)
  34. {
  35. return -1;
  36. }
  37. void os_daemonize_terminate(const char *pid_file)
  38. {
  39. }
  40. int os_get_random(unsigned char *buf, size_t len)
  41. {
  42. return -1;
  43. }
  44. unsigned long os_random(void)
  45. {
  46. return 0;
  47. }
  48. char * os_rel2abs_path(const char *rel_path)
  49. {
  50. return NULL; /* strdup(rel_path) can be used here */
  51. }
  52. int os_program_init(void)
  53. {
  54. return 0;
  55. }
  56. void os_program_deinit(void)
  57. {
  58. }
  59. int os_setenv(const char *name, const char *value, int overwrite)
  60. {
  61. return -1;
  62. }
  63. int os_unsetenv(const char *name)
  64. {
  65. return -1;
  66. }
  67. char * os_readfile(const char *name, size_t *len)
  68. {
  69. return NULL;
  70. }
  71. void * os_zalloc(size_t size)
  72. {
  73. return NULL;
  74. }
  75. #ifdef OS_NO_C_LIB_DEFINES
  76. void * os_malloc(size_t size)
  77. {
  78. return NULL;
  79. }
  80. void * os_realloc(void *ptr, size_t size)
  81. {
  82. return NULL;
  83. }
  84. void os_free(void *ptr)
  85. {
  86. }
  87. void * os_memcpy(void *dest, const void *src, size_t n)
  88. {
  89. return dest;
  90. }
  91. void * os_memmove(void *dest, const void *src, size_t n)
  92. {
  93. return dest;
  94. }
  95. void * os_memset(void *s, int c, size_t n)
  96. {
  97. return s;
  98. }
  99. int os_memcmp(const void *s1, const void *s2, size_t n)
  100. {
  101. return 0;
  102. }
  103. char * os_strdup(const char *s)
  104. {
  105. return NULL;
  106. }
  107. size_t os_strlen(const char *s)
  108. {
  109. return 0;
  110. }
  111. int os_strcasecmp(const char *s1, const char *s2)
  112. {
  113. /*
  114. * Ignoring case is not required for main functionality, so just use
  115. * the case sensitive version of the function.
  116. */
  117. return os_strcmp(s1, s2);
  118. }
  119. int os_strncasecmp(const char *s1, const char *s2, size_t n)
  120. {
  121. /*
  122. * Ignoring case is not required for main functionality, so just use
  123. * the case sensitive version of the function.
  124. */
  125. return os_strncmp(s1, s2, n);
  126. }
  127. char * os_strchr(const char *s, int c)
  128. {
  129. return NULL;
  130. }
  131. char * os_strrchr(const char *s, int c)
  132. {
  133. return NULL;
  134. }
  135. int os_strcmp(const char *s1, const char *s2)
  136. {
  137. return 0;
  138. }
  139. int os_strncmp(const char *s1, const char *s2, size_t n)
  140. {
  141. return 0;
  142. }
  143. char * os_strncpy(char *dest, const char *src, size_t n)
  144. {
  145. return dest;
  146. }
  147. size_t os_strlcpy(char *dest, const char *src, size_t size)
  148. {
  149. return 0;
  150. }
  151. char * os_strstr(const char *haystack, const char *needle)
  152. {
  153. return NULL;
  154. }
  155. int os_snprintf(char *str, size_t size, const char *format, ...)
  156. {
  157. return 0;
  158. }
  159. #endif /* OS_NO_C_LIB_DEFINES */