Blame include/file_change_detection.h

Packit Service 0b5847
/* Detecting file changes using modification times.
Packit Service 0b5847
   Copyright (C) 2017-2020 Free Software Foundation, Inc.
Packit Service 0b5847
   This file is part of the GNU C Library.
Packit Service 0b5847
Packit Service 0b5847
   The GNU C Library is free software; you can redistribute it and/or
Packit Service 0b5847
   modify it under the terms of the GNU Lesser General Public
Packit Service 0b5847
   License as published by the Free Software Foundation; either
Packit Service 0b5847
   version 2.1 of the License, or (at your option) any later version.
Packit Service 0b5847
Packit Service 0b5847
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service 0b5847
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 0b5847
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 0b5847
   Lesser General Public License for more details.
Packit Service 0b5847
Packit Service 0b5847
   You should have received a copy of the GNU Lesser General Public
Packit Service 0b5847
   License along with the GNU C Library; if not, see
Packit Service 0b5847
   <https://www.gnu.org/licenses/>.  */
Packit Service 0b5847
Packit Service 9f560c
#ifndef _FILE_CHANGE_DETECTION_H
Packit Service 9f560c
#define _FILE_CHANGE_DETECTION_H
Packit Service 9f560c
Packit Service 0b5847
#include <stdbool.h>
Packit Service 0b5847
#include <stdio.h>
Packit Service 0b5847
#include <sys/stat.h>
Packit Service 0b5847
#include <sys/types.h>
Packit Service 0b5847
Packit Service 0b5847
/* Items for identifying a particular file version.  Excerpt from
Packit Service 0b5847
   struct stat64.  */
Packit Service 0b5847
struct file_change_detection
Packit Service 0b5847
{
Packit Service 0b5847
  /* Special values: 0 if file does not exist.  -1 to force mismatch
Packit Service 0b5847
     with the next comparison.  */
Packit Service 0b5847
  off64_t size;
Packit Service 0b5847
Packit Service 0b5847
  ino64_t ino;
Packit Service 0b5847
  struct timespec mtime;
Packit Service 0b5847
  struct timespec ctime;
Packit Service 0b5847
};
Packit Service 0b5847
Packit Service 0b5847
/* Returns true if *LEFT and *RIGHT describe the same version of the
Packit Service 0b5847
   same file.  */
Packit Service 9f560c
bool __file_is_unchanged (const struct file_change_detection *left,
Packit Service 9f560c
                          const struct file_change_detection *right);
Packit Service 0b5847
Packit Service 0b5847
/* Extract file change information to *FILE from the stat buffer
Packit Service 0b5847
   *ST.  */
Packit Service 9f560c
void __file_change_detection_for_stat (struct file_change_detection *file,
Packit Service 9f560c
                                       const struct stat64 *st);
Packit Service 0b5847
Packit Service 0b5847
/* Writes file change information for PATH to *FILE.  Returns true on
Packit Service 0b5847
   success.  For benign errors, *FILE is cleared, and true is
Packit Service 0b5847
   returned.  For errors indicating resource outages and the like,
Packit Service 0b5847
   false is returned.  */
Packit Service 9f560c
bool __file_change_detection_for_path (struct file_change_detection *file,
Packit Service 9f560c
                                       const char *path);
Packit Service 0b5847
Packit Service 0b5847
/* Writes file change information for the stream FP to *FILE.  Returns
Packit Service 0b5847
   ture on success, false on failure.  If FP is NULL, treat the file
Packit Service 0b5847
   as non-existing.  */
Packit Service 9f560c
bool __file_change_detection_for_fp (struct file_change_detection *file,
Packit Service 9f560c
                                     FILE *fp);
Packit Service 9f560c
Packit Service 9f560c
#ifndef _ISOMAC
Packit Service 9f560c
libc_hidden_proto (__file_is_unchanged)
Packit Service 9f560c
libc_hidden_proto (__file_change_detection_for_stat)
Packit Service 9f560c
libc_hidden_proto (__file_change_detection_for_path)
Packit Service 9f560c
libc_hidden_proto (__file_change_detection_for_fp)
Packit Service 9f560c
#endif
Packit Service 9f560c
Packit Service 9f560c
#endif /* _FILE_CHANGE_DETECTION_H */