libc.c 529 B

1234567891011121314151617181920
  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. rt_kprintf("stdin: %d\n", fd);
  13. fd = open("/dev/console", O_WRONLY, 0); /* for stdout */
  14. rt_kprintf("stdout: %d\n", fd);
  15. fd = open("/dev/console", O_WRONLY, 0); /* for stderr */
  16. rt_kprintf("stderr: %d\n", fd);
  17. }