1 /* @(#)checkerr.h 1.17 19/02/28 Copyright 2003-2019 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-2019 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 * A copy of the CDDL is also available via the Internet at 22 * http://www.opensource.org/licenses/cddl1.txt 23 * 24 * When distributing Covered Code, include this CDDL HEADER in each 25 * file and include the License file CDDL.Schily.txt from this distribution. 26 */ 27 28 #ifndef _SCHILY_CHECKERR_H 29 #define _SCHILY_CHECKERR_H 30 31 #ifndef _SCHILY_MCONFIG_H 32 #include <schily/mconfig.h> 33 #endif 34 #ifndef _SCHILY_STANDARD_H 35 #include <schily/standard.h> 36 #endif 37 #ifndef _SCHILY_UTYPES_H 38 #include <schily/utypes.h> 39 #endif 40 41 #ifdef __cplusplus 42 extern "C" { 43 #endif 44 45 /* 46 * Error conditions handled by error control. 47 */ 48 #define E_STAT 0x0001 /* Could not stat(2) file */ 49 #define E_GETACL 0x0002 /* Could not retrieve ACL info */ 50 #define E_OPEN 0x0004 /* Could not open file */ 51 #define E_READ 0x0008 /* Could not read file */ 52 #define E_WRITE 0x0010 /* Could not write file */ 53 #define E_GROW 0x0020 /* File did grow during backup */ 54 #define E_SHRINK 0x0040 /* File did shrink during backup */ 55 #define E_MISSLINK 0x0080 /* Missing hard link(s) for file */ 56 #define E_NAMETOOLONG 0x0100 /* File name too long for archive */ 57 #define E_FILETOOBIG 0x0200 /* File too big for archive */ 58 #define E_SPECIALFILE 0x0400 /* Improper file type for archive */ 59 #define E_READLINK 0x0800 /* Could not read symbolic link */ 60 #define E_GETXATTR 0x1000 /* Could not get xattr */ 61 #define E_CHDIR 0x2000 /* Could not chdir() */ 62 #define E_ICONV 0x4000 /* Could not convert via iconv() */ 63 #define E_ID 0x8000 /* Could not write numeric uid/gid */ 64 #define E_TIME (0x0001|E_FL1) /* Could not convert time_t */ 65 66 /* 67 * Currently unused: none 68 */ 69 70 #define E_SETTIME 0x10000 /* Could not set file times */ 71 #define E_SETMODE 0x20000 /* Could not set access modes */ 72 #define E_SECURITY 0x40000 /* Skipped for security reasons */ 73 #define E_LSECURITY 0x80000 /* Link skipped for security */ 74 #define E_SAMEFILE 0x100000 /* Skipped from/to identical */ 75 #define E_BADACL 0x200000 /* ACL string conversion error */ 76 #define E_SETACL 0x400000 /* Could not set ACL for file */ 77 #define E_SETXATTR 0x800000 /* Could not set xattr */ 78 79 /* 80 * Unused for flag array index: 0x1000000 .. 0x8000000 81 */ 82 #define E_FL1 0x1000000 /* 1st enhancement bit */ 83 #define E_FL2 0x2000000 /* 2nd enhancement bit */ 84 #define E_FL3 0x3000000 /* 3rd enhancement index */ 85 #define E_FL4 0x4000000 /* 3rd enhancement bit */ 86 #define E_FL5 0x5000000 /* 5th enhancement index */ 87 #define E_FL6 0x6000000 /* 6th enhancement index */ 88 #define E_FL7 0x7000000 /* 7th enhancement index */ 89 #define E_FL8 0x8000000 /* 4th enhancement bit */ 90 #define E_FL9 0x9000000 /* 9th enhancement index */ 91 #define E_FL10 0xA000000 /* 10th enhancement index */ 92 #define E_FL11 0xB000000 /* 11th enhancement index */ 93 #define E_FL12 0xC000000 /* 12th enhancement index */ 94 #define E_FL13 0xD000000 /* 13th enhancement index */ 95 #define E_FL14 0xE000000 /* 14th enhancement index */ 96 #define E_FL15 0xF000000 /* 15th enhancement index */ 97 #define E_EMASK 0xF000000 /* Enhancement mask */ 98 #define E_NFL 16 /* Number of flag array elements */ 99 #define E_SHIFT 24 /* Sift to get index */ 100 101 #define E_DIFF 0x10000000 /* Diffs encountered */ 102 #define E_WARN 0x20000000 /* Print this error but do exit(0) */ 103 #define E_ABORT 0x40000000 /* Abort on this error */ 104 #define E_EXT 0x80000000 /* Extended (TBD later) */ 105 106 #define E_ALL (~(UInt32_t)(E_DIFF|E_ABORT)) 107 108 extern int errconfig __PR((char *name)); 109 extern BOOL errhidden __PR((int etype, const char *fname)); 110 extern BOOL errwarnonly __PR((int etype, const char *fname)); 111 extern BOOL errabort __PR((int etype, const char *fname, 112 BOOL doexit)); 113 114 #ifdef __cplusplus 115 } 116 #endif 117 118 #endif /* _SCHILY_CHECKERR_H */ 119