dfs_posix.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /* directory api*/
  21. int mkdir(const char *path, mode_t mode);
  22. DIR *opendir(const char *name);
  23. struct dirent *readdir(DIR *d);
  24. long telldir(DIR *d);
  25. void seekdir(DIR *d, off_t offset);
  26. void rewinddir(DIR *d);
  27. int closedir(DIR *d);
  28. /* file api*/
  29. int open(const char *file, int flags, ...);
  30. int close(int d);
  31. #if defined(RT_USING_NEWLIB) && defined(_EXFUN)
  32. _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte));
  33. _READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte));
  34. #else
  35. int read(int fd, void *buf, size_t len);
  36. int write(int fd, const void *buf, size_t len);
  37. #endif
  38. off_t lseek(int fd, off_t offset, int whence);
  39. int rename(const char *from, const char *to);
  40. int unlink(const char *pathname);
  41. int stat(const char *file, struct stat *buf);
  42. int fstat(int fildes, struct stat *buf);
  43. int fsync(int fildes);
  44. int fcntl(int fildes, int cmd, ...);
  45. int ioctl(int fildes, int cmd, ...);
  46. int ftruncate(int fd, off_t length);
  47. /* directory api*/
  48. int rmdir(const char *path);
  49. int chdir(const char *path);
  50. char *getcwd(char *buf, size_t size);
  51. /* file system api */
  52. int statfs(const char *path, struct statfs *buf);
  53. int access(const char *path, int amode);
  54. int pipe(int fildes[2]);
  55. int mkfifo(const char *path, mode_t mode);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif