• LRN's avatar
    W32: Add a stat() implementation for private use · 53bd6a35
    LRN authored
    This commit adds new W32-only functions to gstdio.c,
    and a new header file, gstdioprivate.h.
    These functions are:
    and they fill a private structure, GWin32PrivateStat,
    which has all the fields that normal stat has, as well as some
    These functions are then used throughout glib and gio to get better
    data about the system. Specifically:
    * Full, 64-bit size, guaranteed (g_stat() is forced to use 32-bit st_size)
    * Full, 64-bit file identifier (st_ino is 0 when normal stat() is used, and still is)
    * W32 File attributes (which stat() doesn't report); in particular, this allows
      symlinks to be correctly identified
    * Full, 64-bit time, guaranteed (g_stat() uses 32-bit st_*time on 32-bit Windows)
    * Allocated file size (as a W32 replacement for the missing st_blocks)
    st_mode remains unchanged (thus, no S_ISLNK), so when these are given back to
    glib users (via g_stat(), for example, which is now implemented by calling g_win32_stat_utf8),
    this field does not contain anything unexpected.
    g_lstat() now calls g_win32_lstat_utf8(), which works on symlinks the way it's supposed to.
    Also adds the g_win32_readlink_utf8() function, which behaves like readlink()
    (including its inability to return 0-terminated strings and inability to say how large
    the output buffer should be; these limitations are purely for compatibility with
    existing glib code).
    Thus, symlink support should now be much better, although far from being complete.
    A new W32-only test in gio/tests/file.c highlights the following features:
    * allocated size
    * 64-bit time
    * unique file IDs
glocalfileoutputstream.c 30.3 KB