libc.c 498 B

12345678910111213141516171819202122
  1. #include <rtthread.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <fcntl.h>
  5. void libc_system_init(const char* tty_name)
  6. {
  7. int fd;
  8. /* init console device */
  9. rt_console_init(tty_name);
  10. /* open console as stdin/stdout/stderr */
  11. fd = open("/dev/console", O_RDONLY, 0); /* for stdin */
  12. fd = open("/dev/console", O_WRONLY, 0); /* for stdout */
  13. fd = open("/dev/console", O_WRONLY, 0); /* for stderr */
  14. /* set PATH and HOME */
  15. putenv("PATH=/");
  16. putenv("HOME=/");
  17. }