FileHandle.h 956 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #pragma once
  2. #include "il2cpp-config.h"
  3. #if IL2CPP_TARGET_POSIX
  4. #include <string>
  5. #include <sys/stat.h>
  6. #include <sys/types.h>
  7. #include "os/File.h"
  8. #include "os/c-api/OSGlobalEnums.h"
  9. namespace il2cpp
  10. {
  11. namespace os
  12. {
  13. struct FileHandle
  14. {
  15. int fd;
  16. FileType type;
  17. std::string path;
  18. int options;
  19. int shareMode;
  20. int accessMode;
  21. // The defaukt value of this field should be false,
  22. // meaning we _do_ own the file descriptor, and therefore
  23. // can close it. Zero-allocating this struct is something
  24. // we want to support, so make sure the default is 0.
  25. bool doesNotOwnFd;
  26. // device and inode are used as key for finding file handles
  27. dev_t device;
  28. ino_t inode;
  29. // Linked list of file handles
  30. FileHandle *prev;
  31. FileHandle *next;
  32. FileHandle() : prev(NULL), next(NULL)
  33. {
  34. }
  35. };
  36. }
  37. }
  38. #endif