FileHandle.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 default 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()
  33. : fd(-1), type(kFileTypeUnknown), options(0), shareMode(0), accessMode(0),
  34. doesNotOwnFd(false), device(0), inode(0), prev(NULL), next(NULL)
  35. {
  36. }
  37. };
  38. }
  39. }
  40. #endif