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