/platform/mcu/bk7231s/beken/func/hostapd-2.5/src/utils/os_none.c

https://github.com/alibaba/AliOS-Things · C · 130 lines · 78 code · 39 blank · 13 comment · 1 complexity · 8326d43b1542d6c074395890171c33f5 MD5 · raw file

  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. #include "include.h"
  14. #include "fake_clock_pub.h"
  15. #include "includes.h"
  16. #include "os.h"
  17. void os_sleep(os_time_t sec, os_time_t usec)
  18. {
  19. }
  20. int os_get_time(struct os_time *t)
  21. {
  22. t->sec = fclk_get_second();
  23. t->usec = (fclk_get_tick() * FCLK_DURATION_MS * 1000) % 1000000;
  24. return 0;
  25. }
  26. int os_get_reltime(struct os_reltime *t)
  27. {
  28. t->sec = fclk_get_second();
  29. t->usec = (fclk_get_tick() * FCLK_DURATION_MS * 1000) % 1000000;
  30. return 0;
  31. }
  32. int os_mktime(int year, int month, int day, int hour, int min, int sec,
  33. os_time_t *t)
  34. {
  35. return -1;
  36. }
  37. int os_gmtime(os_time_t t, struct os_tm *tm)
  38. {
  39. return -1;
  40. }
  41. int os_daemonize(const char *pid_file)
  42. {
  43. return -1;
  44. }
  45. void os_daemonize_terminate(const char *pid_file)
  46. {
  47. }
  48. int os_get_random(unsigned char *buf, size_t len)
  49. {
  50. srand(fclk_get_second());
  51. while(len--){
  52. *buf++ = rand()%255;
  53. }
  54. return 0;
  55. }
  56. unsigned long os_random(void)
  57. {
  58. return rand();
  59. }
  60. char * os_rel2abs_path(const char *rel_path)
  61. {
  62. return NULL; /* strdup(rel_path) can be used here */
  63. }
  64. int os_program_init(void)
  65. {
  66. return 0;
  67. }
  68. void os_program_deinit(void)
  69. {
  70. }
  71. int os_setenv(const char *name, const char *value, int overwrite)
  72. {
  73. return -1;
  74. }
  75. int os_unsetenv(const char *name)
  76. {
  77. return -1;
  78. }
  79. char * os_readfile(const char *name, size_t *len)
  80. {
  81. return NULL;
  82. }
  83. int os_fdatasync(FILE *stream)
  84. {
  85. return 0;
  86. }
  87. int os_exec(const char *program, const char *arg, int wait_completion)
  88. {
  89. return -1;
  90. }
  91. // eof