stdlib.c 730 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2021-02-15 Meco Man first version
  9. */
  10. #include <rtthread.h>
  11. #define DBG_TAG "stdlib"
  12. #define DBG_LVL DBG_INFO
  13. #include <rtdbg.h>
  14. void __rt_libc_exit(int status)
  15. {
  16. rt_thread_t self = rt_thread_self();
  17. if (self != RT_NULL)
  18. {
  19. LOG_E("thread:%s exit:%d!", self->name, status);
  20. rt_thread_control(self, RT_THREAD_CTRL_CLOSE, RT_NULL);
  21. }
  22. }
  23. int __rt_libc_system(const char *string)
  24. {
  25. #ifdef RT_USING_MSH
  26. extern int msh_exec(char *cmd, rt_size_t length);
  27. msh_exec((char*)string, rt_strlen(string));
  28. #endif
  29. return 0;
  30. }