Blame sysdeps/posix/dl-fileid.h

Packit Service 82fcde
/* File identity for the dynamic linker.  Generic POSIX.1 version.
Packit Service 82fcde
   Copyright (C) 2015-2018 Free Software Foundation, Inc.
Packit Service 82fcde
   This file is part of the GNU C Library.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 82fcde
   modify it under the terms of the GNU Lesser General Public
Packit Service 82fcde
   License as published by the Free Software Foundation; either
Packit Service 82fcde
   version 2.1 of the License, or (at your option) any later version.
Packit Service 82fcde
Packit Service 82fcde
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 82fcde
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 82fcde
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 82fcde
   Lesser General Public License for more details.
Packit Service 82fcde
Packit Service 82fcde
   You should have received a copy of the GNU Lesser General Public
Packit Service 82fcde
   License along with the GNU C Library; if not, see
Packit Service 82fcde
   <http://www.gnu.org/licenses/>.  */
Packit Service 82fcde
Packit Service 82fcde
#include <stdbool.h>
Packit Service 82fcde
#include <sys/stat.h>
Packit Service 82fcde
Packit Service 82fcde
/* For POSIX.1 systems, the pair of st_dev and st_ino constitute
Packit Service 82fcde
   a unique identifier for a file.  */
Packit Service 82fcde
struct r_file_id
Packit Service 82fcde
  {
Packit Service 82fcde
    dev_t dev;
Packit Service 82fcde
    ino64_t ino;
Packit Service 82fcde
  };
Packit Service 82fcde
Packit Service 87a10b
/* Sample FD to fill in *ID and *ST.  Returns true on success.
Packit Service 82fcde
   On error, returns false, with errno set.  */
Packit Service 82fcde
static inline bool
Packit Service 87a10b
_dl_get_file_id (int fd, struct r_file_id *id, struct stat64 *st)
Packit Service 82fcde
{
Packit Service 87a10b
  if (__glibc_unlikely (__fxstat64 (_STAT_VER, fd, st) < 0))
Packit Service 82fcde
    return false;
Packit Service 82fcde
Packit Service 87a10b
  id->dev = st->st_dev;
Packit Service 87a10b
  id->ino = st->st_ino;
Packit Service 82fcde
  return true;
Packit Service 82fcde
}
Packit Service 82fcde
Packit Service 82fcde
/* Compare two results from _dl_get_file_id for equality.  */
Packit Service 82fcde
static inline bool
Packit Service 82fcde
_dl_file_id_match_p (const struct r_file_id *a, const struct r_file_id *b)
Packit Service 82fcde
{
Packit Service 82fcde
  return a->dev == b->dev && a->ino == b->ino;
Packit Service 82fcde
}