1*e4e529b2SAndy Fiddaman /* 2*e4e529b2SAndy Fiddaman * This file and its contents are supplied under the terms of the 3*e4e529b2SAndy Fiddaman * Common Development and Distribution License ("CDDL"), version 1.0. 4*e4e529b2SAndy Fiddaman * You may only use this file in accordance with the terms of version 5*e4e529b2SAndy Fiddaman * 1.0 of the CDDL. 6*e4e529b2SAndy Fiddaman * 7*e4e529b2SAndy Fiddaman * A full copy of the text of the CDDL should have accompanied this 8*e4e529b2SAndy Fiddaman * source. A copy of the CDDL is also available via the Internet at 9*e4e529b2SAndy Fiddaman * http://www.illumos.org/license/CDDL. 10*e4e529b2SAndy Fiddaman */ 11*e4e529b2SAndy Fiddaman 12*e4e529b2SAndy Fiddaman /* 13*e4e529b2SAndy Fiddaman * Copyright 2025 Oxide Computer Company 14*e4e529b2SAndy Fiddaman */ 15*e4e529b2SAndy Fiddaman 16*e4e529b2SAndy Fiddaman #ifndef _SYSERR_H 17*e4e529b2SAndy Fiddaman #define _SYSERR_H 18*e4e529b2SAndy Fiddaman 19*e4e529b2SAndy Fiddaman /* 20*e4e529b2SAndy Fiddaman * Definitions for library-private variables relating to error names and 21*e4e529b2SAndy Fiddaman * descriptions. 22*e4e529b2SAndy Fiddaman */ 23*e4e529b2SAndy Fiddaman 24*e4e529b2SAndy Fiddaman /* 25*e4e529b2SAndy Fiddaman * The maximum system error number; the size of the _sys_nerrs and 26*e4e529b2SAndy Fiddaman * _sys_err_names arrays. 27*e4e529b2SAndy Fiddaman */ 28*e4e529b2SAndy Fiddaman extern int _sys_num_nerr; 29*e4e529b2SAndy Fiddaman 30*e4e529b2SAndy Fiddaman /* 31*e4e529b2SAndy Fiddaman * _sys_nerrs and _sys_nindex are used together. _sys_nerrs is one long string 32*e4e529b2SAndy Fiddaman * that is a concatenation of all of the error descriptions, separated by '\0', 33*e4e529b2SAndy Fiddaman * and _sys_index is an array of indices into that. A pointer to the 34*e4e529b2SAndy Fiddaman * description for a particular error can therefore be obtained (after bounds 35*e4e529b2SAndy Fiddaman * checks) via: 36*e4e529b2SAndy Fiddaman * &_sys_nerrs[_sys_nindex[<errnum>]] 37*e4e529b2SAndy Fiddaman */ 38*e4e529b2SAndy Fiddaman extern const char _sys_nerrs[]; 39*e4e529b2SAndy Fiddaman extern const int _sys_nindex[]; 40*e4e529b2SAndy Fiddaman /* 41*e4e529b2SAndy Fiddaman * An array mapping an errno to its constant, e.g. ENOENT -> "ENOENT" 42*e4e529b2SAndy Fiddaman */ 43*e4e529b2SAndy Fiddaman extern const char *_sys_err_names[]; 44*e4e529b2SAndy Fiddaman 45*e4e529b2SAndy Fiddaman #endif /* _SYSERR_H */ 46