zneo-zdsii-5_0_1-variadic-func-fix.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. diff --git a/apps/nshlib/nsh_console.c b/apps/nshlib/nsh_console.c
  2. index ba7dbe7..45e4ab1 100644
  3. --- a/apps/nshlib/nsh_console.c
  4. +++ b/apps/nshlib/nsh_console.c
  5. @@ -46,6 +46,7 @@
  6. #include <unistd.h>
  7. #include <fcntl.h>
  8. #include <string.h>
  9. +#include <stdarg.h>
  10. #include <assert.h>
  11. #include <errno.h>
  12. #include <debug.h>
  13. @@ -79,7 +80,12 @@ static FAR struct nsh_vtbl_s *nsh_consoleclone(FAR struct nsh_vtbl_s *vtbl);
  14. static void nsh_consolerelease(FAR struct nsh_vtbl_s *vtbl);
  15. static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
  16. FAR const void *buffer, size_t nbytes);
  17. +#if 0
  18. static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
  19. FAR const char *fmt, ...);
  20. +#else
  21. +static int nsh_consolevoutput(FAR struct nsh_vtbl_s *vtbl,
  22. + FAR const char *fmt, va_list ap);
  23. +#endif
  24. static FAR char *nsh_consolelinebuffer(FAR struct nsh_vtbl_s *vtbl);
  25. @@ -213,6 +219,7 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl, FAR const void *buf
  26. *
  27. ****************************************************************************/
  28. +#if 0
  29. static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
  30. FAR const char *fmt, ...)
  31. {
  32. @@ -263,6 +270,29 @@ static int nsh_consoleoutput(FAR struct nsh_vtbl_s *vtbl,
  33. #endif
  34. }
  35. +#else
  36. +static int nsh_consolevoutput(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, va_list ap)
  37. +{
  38. + FAR struct console_stdio_s *pstate = (FAR struct console_stdio_s *)vtbl;
  39. + int ret;
  40. +
  41. + /* The stream is open in a lazy fashion. This is done because the file
  42. + * descriptor may be opened on a different task than the stream. The
  43. + * actual open will then occur with the first output from the new task.
  44. + */
  45. +
  46. + if (nsh_openifnotopen(pstate) != 0)
  47. + {
  48. + return ERROR;
  49. + }
  50. +
  51. + ret = vfprintf(pstate->cn_outstream, fmt, ap);
  52. +
  53. + return ret;
  54. +#endif
  55. +}
  56. +#endif
  57. +
  58. /****************************************************************************
  59. * Name: nsh_consolelinebuffer
  60. *
  61. @@ -452,7 +504,11 @@ FAR struct console_stdio_s *nsh_newconsole(void)
  62. pstate->cn_vtbl.release = nsh_consolerelease;
  63. #endif
  64. pstate->cn_vtbl.write = nsh_consolewrite;
  65. +#if 0
  66. pstate->cn_vtbl.output = nsh_consoleoutput;
  67. +#else
  68. + pstate->cn_vtbl.voutput = nsh_consolevoutput;
  69. +#endif
  70. pstate->cn_vtbl.linebuffer = nsh_consolelinebuffer;
  71. pstate->cn_vtbl.exit = nsh_consoleexit;
  72. @@ -489,3 +545,15 @@ FAR struct console_stdio_s *nsh_newconsole(void)
  73. }
  74. return pstate;
  75. }
  76. +
  77. +int nsh_output(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...)
  78. +{
  79. + va_list ap;
  80. + int ret;
  81. +
  82. + va_start(ap, fmt);
  83. + ret = vtbl->voutput(vtbl, fmt, ap);
  84. + va_end(ap);
  85. +
  86. + return ret;
  87. +}
  88. diff --git a/apps/nshlib/nsh_console.h b/apps/nshlib/nsh_console.h
  89. index c78362f..207f9b9 100644
  90. --- a/apps/nshlib/nsh_console.h
  91. +++ b/apps/nshlib/nsh_console.h
  92. @@ -47,6 +47,7 @@
  93. #include <stdio.h>
  94. #include <stdint.h>
  95. #include <stdbool.h>
  96. +#include <stdarg.h>
  97. #include <errno.h>
  98. /****************************************************************************
  99. @@ -62,11 +63,13 @@
  100. #define nsh_undirect(v,s) (v)->undirect(v,s)
  101. #define nsh_exit(v,s) (v)->exit(v,s)
  102. +#if 0
  103. #ifdef CONFIG_CPP_HAVE_VARARGS
  104. # define nsh_output(v, ...) (v)->output(v, ##__VA_ARGS__)
  105. #else
  106. # define nsh_output vtbl->output
  107. #endif
  108. +#endif
  109. /* Size of info to be saved in call to nsh_redirect */
  110. @@ -107,6 +110,10 @@ struct nsh_vtbl_s
  111. void (*release)(FAR struct nsh_vtbl_s *vtbl);
  112. #endif
  113. ssize_t (*write)(FAR struct nsh_vtbl_s *vtbl, FAR const void *buffer, size_t nbytes);
  114. +#if 0
  115. int (*output)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
  116. +#else
  117. + int (*voutput)(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, va_list ap);
  118. +#endif
  119. FAR char *(*linebuffer)(FAR struct nsh_vtbl_s *vtbl);
  120. void (*redirect)(FAR struct nsh_vtbl_s *vtbl, int fd, FAR uint8_t *save);
  121. @@ -159,5 +166,6 @@ struct console_stdio_s
  122. /* Defined in nsh_console.c *************************************************/
  123. FAR struct console_stdio_s *nsh_newconsole(void);
  124. +int nsh_output(FAR struct nsh_vtbl_s *vtbl, FAR const char *fmt, ...);
  125. #endif /* __APPS_NSHLIB_NSH_CONSOLE_H */
  126. diff --git a/nuttx/include/wdog.h b/nuttx/include/nuttx/wdog.h
  127. index 0aa3584..ac4a36a 100644
  128. --- a/nuttx/include/nuttx/wdog.h
  129. +++ b/nuttx/include/nuttx/wdog.h
  130. @@ -74,7 +74,23 @@ typedef union wdparm_u wdparm_t;
  131. * watchdog function expires. Up to four parameters may be passed.
  132. */
  133. +#if 0
  134. typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, ...);
  135. +#elif CONFIG_MAX_WDOGPARMS < 1
  136. +typedef CODE void (*wdentry_t)(int argc);
  137. +#elif CONFIG_MAX_WDOGPARMS < 2
  138. +typedef CODE void (*wdentry_t)(int argc, uint32_t arg1);
  139. +#elif CONFIG_MAX_WDOGPARMS < 3
  140. +typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, uint32_t arg2);
  141. +#elif CONFIG_MAX_WDOGPARMS < 4
  142. +typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, uint32_t arg2,
  143. + uint32_t arg3);
  144. +#elif CONFIG_MAX_WDOGPARMS < 5
  145. +typedef CODE void (*wdentry_t)(int argc, uint32_t arg1, uint32_t arg2,
  146. + uint32_t arg3, uint32_t arg4);
  147. +#else
  148. +# error Ooops. CONFIG_MAX_WDOGPARMS > 4
  149. +#endif
  150. /* Watchdog 'handle' */