1 /* File identity for the dynamic linker. Generic POSIX.1 version.
2 Copyright (C) 2015-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library 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 GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
22 /* For POSIX.1 systems, the pair of st_dev and st_ino constitute
23 a unique identifier for a file. */
30 /* Sample FD to fill in *ID. Returns true on success.
31 On error, returns false, with errno set. */
33 _dl_get_file_id (int fd
, struct r_file_id
*id
)
35 struct __stat64_t64 st
;
37 if (__glibc_unlikely (__fstat64_time64 (fd
, &st
) < 0))
45 /* Compare two results from _dl_get_file_id for equality. */
47 _dl_file_id_match_p (const struct r_file_id
*a
, const struct r_file_id
*b
)
49 return a
->dev
== b
->dev
&& a
->ino
== b
->ino
;