stat-w32.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Core of implementation of fstat and stat for native Windows.
  2. Copyright (C) 2017-2021 Free Software Foundation, Inc.
  3. This program is free software: you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <https://www.gnu.org/licenses/>. */
  13. #ifndef _STAT_W32_H
  14. #define _STAT_W32_H 1
  15. /* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */
  16. #if _GL_WINDOWS_STAT_TIMESPEC
  17. extern struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft);
  18. #else
  19. extern time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft);
  20. #endif
  21. /* Fill *BUF with information about the file designated by H.
  22. PATH is the file name, if known, otherwise NULL.
  23. Return 0 if successful, or -1 with errno set upon failure. */
  24. extern int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf);
  25. /* Bitmasks for st_mode. */
  26. #define S_IREAD_UGO (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6))
  27. #define S_IWRITE_UGO (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6))
  28. #define S_IEXEC_UGO (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6))
  29. #endif /* _STAT_W32_H */