syscall_close.c 573 B

1234567891011121314151617181920212223242526
  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. * 2015-01-28 Bernard first version
  9. */
  10. #include <rtthread.h>
  11. #include <yfuns.h>
  12. #include <unistd.h>
  13. #pragma module_name = "?__close"
  14. int __close(int handle)
  15. {
  16. if (handle == _LLIO_STDOUT ||
  17. handle == _LLIO_STDERR ||
  18. handle == _LLIO_STDIN)
  19. return _LLIO_ERROR;
  20. #ifdef RT_LIBC_USING_FILEIO
  21. return close(handle);
  22. #else
  23. return _LLIO_ERROR;
  24. #endif /* RT_LIBC_USING_FILEIO */
  25. }