dfs_posix.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. * 2009-05-27 Yi.qiu The first version.
  9. * 2010-07-18 Bernard add stat and statfs structure definitions.
  10. * 2011-05-16 Yi.qiu Change parameter name of rename, "new" is C++ key word.
  11. * 2017-12-27 Bernard Add fcntl API.
  12. * 2018-02-07 Bernard Change the 3rd parameter of open/fcntl/ioctl to '...'
  13. */
  14. #ifndef __DFS_POSIX_H__
  15. #define __DFS_POSIX_H__
  16. #include <dfs_file.h>
  17. #include <sys/stat.h>
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. /* file api*/
  22. int close(int d);
  23. #if defined(RT_USING_NEWLIB) && defined(_EXFUN)
  24. _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte));
  25. _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte));
  26. #else
  27. int read(int fd, void *buf, size_t len);
  28. int write(int fd, const void *buf, size_t len);
  29. #endif
  30. off_t lseek(int fd, off_t offset, int whence);
  31. int rename(const char *from, const char *to);
  32. int unlink(const char *pathname);
  33. int fsync(int fildes);
  34. int ftruncate(int fd, off_t length);
  35. /* directory api*/
  36. int rmdir(const char *path);
  37. int chdir(const char *path);
  38. char *getcwd(char *buf, size_t size);
  39. /* file system api */
  40. int statfs(const char *path, struct statfs *buf);
  41. int access(const char *path, int amode);
  42. int pipe(int fildes[2]);
  43. #ifdef __cplusplus
  44. }
  45. #endif
  46. #endif