]> git.cworth.org Git - tar/blob - gnu/openat-priv.h
upstream: Fix extraction of device nodes.
[tar] / gnu / openat-priv.h
1 /* -*- buffer-read-only: t -*- vi: set ro: */
2 /* DO NOT EDIT! GENERATED AUTOMATICALLY! */
3 /* Internals for openat-like functions.
4
5    Copyright (C) 2005-2006, 2009-2010 Free Software Foundation, Inc.
6
7    This program is free software: you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
19
20 /* written by Jim Meyering */
21
22 #ifndef _GL_HEADER_OPENAT_PRIV
23 #define _GL_HEADER_OPENAT_PRIV
24
25 #include <errno.h>
26 #include <stdlib.h>
27
28 #define OPENAT_BUFFER_SIZE 512
29 char *openat_proc_name (char buf[OPENAT_BUFFER_SIZE], int fd, char const *file);
30
31 /* Trying to access a BUILD_PROC_NAME file will fail on systems without
32    /proc support, and even on systems *with* ProcFS support.  Return
33    nonzero if the failure may be legitimate, e.g., because /proc is not
34    readable, or the particular .../fd/N directory is not present.  */
35 #define EXPECTED_ERRNO(Errno)                   \
36   ((Errno) == ENOTDIR || (Errno) == ENOENT      \
37    || (Errno) == EPERM || (Errno) == EACCES     \
38    || (Errno) == ENOSYS /* Solaris 8 */         \
39    || (Errno) == EOPNOTSUPP /* FreeBSD */)
40
41 /* Wrapper function shared among linkat and renameat.  */
42 int at_func2 (int fd1, char const *file1,
43               int fd2, char const *file2,
44               int (*func) (char const *file1, char const *file2));
45
46 #endif /* _GL_HEADER_OPENAT_PRIV */