Stephen Smalley wrote: > On Mon, 2007-01-15 at 17:57 -0500, Karl MacMillan wrote: >> The attached patch adds a central errno.h to libsepol and converts >> several existing error numbers. This will unify the error numbers, >> remove duplication, and prevent overlapping error numbers (a source of >> potential bugs). Existing return values from functions exposed as part >> of the binary interface are not changed. > > I'm not enthusiastic about diverging the errno values from the system > values for e.g. ENOMEM and friends. I'd prefer to keep them the same, > and use some other part of the value space for any custom error values > defined by libsepol. I think that practically we are going to end up diverging from system errno values to some extent. For example, -EPERM is -1 and I think that trying to change every function that returns -1 for general error is going to be hard. The updated patch aligns them more closely, however. Also, I'm not sure about referring to this as > errno.h, as libsepol is _not_ setting errno to these values; it uses > these values as internal return values for conveying error information. Changed to errcodes.h. > The functions that do happen to explicitly set errno are using > traditional errno values. I explicitly did not change those return values. In addition to the changes noted above, I removed the license statements from the header files, which I took as the consensus from the other discussion in this thread. Updated patch attached. The attached patch adds a central header for error and return codes (errcodes.h) to libsepol and converts several existing error numbers. This will unify the error numbers, remove duplication, and prevent overlapping error numbers (a source of potential bugs). Existing return values from functions exposed as part of the binary interface are not changed. Signed-off-by: Karl MacMillan checkpolicy/policy_parse.y | 15 ++--- libsepol/include/sepol/errcodes.h | 25 ++++++++ libsepol/include/sepol/policydb/hashtab.h | 23 +++----- libsepol/include/sepol/policydb/link.h | 29 +--------- libsepol/src/avtab.c | 18 +++--- libsepol/src/expand.c | 7 +- libsepol/src/hashtab.c | 45 +++++++++++----- libsepol/src/link.c | 33 ++++++----- libsepol/src/policydb.c | 6 +- libsepol/src/private.h | 4 + policycoreutils/semodule_deps/semodule_deps.c | 9 +-- 11 files changed, 122 insertions(+), 92 deletions(-)