1 /* @(#)checkerr.h	1.14 12/11/13 Copyright 2003-2012 J. Schilling */
2 /*
3  *	Generic error control for programs that do file i/o.
4  *	The error control is usually used by archiving programs.
5  *
6  *	The current version does not provide a stable interface.
7  *	It does not support multi-threaded programs and it may call
8  *	comerr() from the parser. If you use the code before there is
9  *	an official stable and "library-compliant" interface, be careful
10  *	and watch for changes.
11  *
12  *	Copyright (c) 2003-2012 J. Schilling
13  */
14 /*
15  * The contents of this file are subject to the terms of the
16  * Common Development and Distribution License, Version 1.0 only
17  * (the "License").  You may not use this file except in compliance
18  * with the License.
19  *
20  * See the file CDDL.Schily.txt in this distribution for details.
21  *
22  * When distributing Covered Code, include this CDDL HEADER in each
23  * file and include the License file CDDL.Schily.txt from this distribution.
24  */
25 
26 #ifndef _SCHILY_CHECKERR_H
27 #define	_SCHILY_CHECKERR_H
28 
29 #ifndef _SCHILY_MCONFIG_H
30 #include <schily/mconfig.h>
31 #endif
32 #ifndef _SCHILY_STANDARD_H
33 #include <schily/standard.h>
34 #endif
35 #ifndef	_SCHILY_UTYPES_H
36 #include <schily/utypes.h>
37 #endif
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * Error conditions handled by error control.
45  */
46 #define	E_STAT		0x0001		/* Could not stat(2) file	   */
47 #define	E_GETACL	0x0002		/* Could not retrieve ACL info	   */
48 #define	E_OPEN		0x0004		/* Could not open file		   */
49 #define	E_READ		0x0008		/* Could not read file		   */
50 #define	E_WRITE		0x0010		/* Could not write file		   */
51 #define	E_GROW		0x0020		/* File did grow during backup	   */
52 #define	E_SHRINK	0x0040		/* File did shrink during backup   */
53 #define	E_MISSLINK	0x0080		/* Missing hard link(s) for file   */
54 #define	E_NAMETOOLONG	0x0100		/* File name too long for archive  */
55 #define	E_FILETOOBIG	0x0200		/* File too big for archive	   */
56 #define	E_SPECIALFILE	0x0400		/* Improper file type for archive  */
57 #define	E_READLINK	0x0800		/* Could not read symbolic link	   */
58 #define	E_GETXATTR	0x1000		/* Could not get xattr		   */
59 #define	E_CHDIR		0x2000		/* Could not chdir()		   */
60 
61 /*
62  * Currently unused: 0x4000 .. 0x8000
63  */
64 
65 #define	E_SETTIME	0x10000		/* Could not set file times	   */
66 #define	E_SETMODE	0x20000		/* Could not set access modes	   */
67 #define	E_SECURITY	0x40000		/* Skipped for security reasons	   */
68 #define	E_LSECURITY	0x80000		/* Link skipped for security	   */
69 #define	E_SAMEFILE	0x100000	/* Skipped from/to identical	   */
70 #define	E_BADACL	0x200000	/* ACL string conversion error	   */
71 #define	E_SETACL	0x400000	/* Could not set ACL for file	   */
72 #define	E_SETXATTR	0x800000	/* Could not set xattr		   */
73 
74 /*
75  * Currently unused: 0x1000000 .. 0x8000000
76  */
77 
78 #define	E_DIFF		0x10000000	/* Diffs encountered		   */
79 #define	E_WARN		0x20000000	/* Print this error but do exit(0) */
80 #define	E_ABORT		0x40000000	/* Abort on this error		   */
81 #define	E_EXT		0x80000000	/* Extended (TBD later)		   */
82 
83 #define	E_ALL		(~(UInt32_t)(E_DIFF|E_ABORT))
84 
85 extern	int	errconfig	__PR((char *name));
86 extern	BOOL	errhidden	__PR((int etype, const char *fname));
87 extern	BOOL	errwarnonly	__PR((int etype, const char *fname));
88 extern	BOOL	errabort	__PR((int etype, const char *fname,
89 					BOOL doexit));
90 
91 #ifdef	__cplusplus
92 }
93 #endif
94 
95 #endif /* _SCHILY_CHECKERR_H */
96