root/maint/gnulib/lib/same-inode.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /* Determine whether two stat buffers are known to refer to the same file.
   2 
   3    Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc.
   4 
   5    This file is free software: you can redistribute it and/or modify
   6    it under the terms of the GNU Lesser General Public License as
   7    published by the Free Software Foundation; either version 2.1 of the
   8    License, or (at your option) any later version.
   9 
  10    This file is distributed in the hope that it will be useful,
  11    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13    GNU Lesser General Public License for more details.
  14 
  15    You should have received a copy of the GNU Lesser General Public License
  16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
  17 
  18 #ifndef SAME_INODE_H
  19 # define SAME_INODE_H 1
  20 
  21 # include <sys/types.h>
  22 
  23 # if defined __VMS && __CRTL_VER < 80200000
  24 #  define SAME_INODE(a, b)             \
  25     ((a).st_ino[0] == (b).st_ino[0]    \
  26      && (a).st_ino[1] == (b).st_ino[1] \
  27      && (a).st_ino[2] == (b).st_ino[2] \
  28      && (a).st_dev == (b).st_dev)
  29 # elif defined _WIN32 && ! defined __CYGWIN__
  30    /* Native Windows.  */
  31 #  if _GL_WINDOWS_STAT_INODES
  32     /* stat() and fstat() set st_dev and st_ino to 0 if information about
  33        the inode is not available.  */
  34 #   define SAME_INODE(a, b) \
  35      (!((a).st_ino == 0 && (a).st_dev == 0) \
  36       && (a).st_ino == (b).st_ino && (a).st_dev == (b).st_dev)
  37 #  else
  38     /* stat() and fstat() set st_ino to 0 always.  */
  39 #   define SAME_INODE(a, b) 0
  40 #  endif
  41 # else
  42 #  define SAME_INODE(a, b)    \
  43     ((a).st_ino == (b).st_ino \
  44      && (a).st_dev == (b).st_dev)
  45 # endif
  46 
  47 #endif

/* [previous][next][first][last][top][bottom][index][help] */