Update Gnulib to the latest git version
[deliverable/binutils-gdb.git] / gnulib / import / same-inode.h
1 /* Determine whether two stat buffers are known to refer to the same file.
2
3 Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program 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 General Public License for more details.
14
15 You should have received a copy of the GNU 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
This page took 0.029701 seconds and 4 git commands to generate.