libk  magic.h at [8b84a67d85]

File kcore/magic.h artifact a7232aabca part of check-in 8b84a67d85


/* <k/magic.h>
 * ~ lexi hale <lexi@hale.su>
 * one of libk's biggest goals is standardization across
 * software. for this reason, we define here a variety
 * of "magical numbers" used to signal or describe
 * various states, messages, and errors. suggestions are
 * welcome.
 */
#ifndef KImagic
#define KImagic

#include <k/type.h>

typedef enum kbad {
	// values to be returned by an entry function
	kbad_ok = 0,
		/* the requested operation completed
		 * successfully */

	kbad_mem = 1,
		/* the system does not have enough free
		 * memory to complete the requested operation */

	/* these are synchronized with freebsd's existing
	 * sysexit.h conventions. */
	kbad_usage = 64,
		/* # fbsd EX_USAGE
		 * a usage screen was displayed to the user
		 * on request or due to improperly formed call */
	kbad_data = 65,
		/* # fbsd EX_DATAERR
		 * data supplied by the user was incorrect in
		 * some way */
	kbad_no_input = 66,
		/* # fbsd EX_NOINPUT
		 * input to the program is absent */
	kbad_user = 67,
		/* # fbsd EX_NOUSER
		 * these aren't the droids you're looking for */
	kbad_host = 68,
		/* # fbsd EX_NOHOST
		 * that host doesn't exist */
	kbad_avail = 69,
		/* # fbsd EX_UNAVAILABLE
		 * a necessary resource or support system isn't
		 * available, or something else went wrong */
	kbad_internal = 70,
		/* # fbsd EX_SOFTWARE
		 * "my bad" */
	kbad_os = 71,
		/* # fbsd EX_OSERR
		 * the OS did a fucksy-wucksy */
	kbad_osfile = 72,
		/* # fbsd EX_OSFILE
		 * a system file is fucked up or gone */
	kbad_creat = 73,
		/* # fbsd EX_CANTCREAT */
	kbad_io = 74,
		/* # fbsd EX_IOERR */
	kbad_try = 75,
		/* # fbsd EX_TEMPFAIL
		 * something went wrong this time. try again
		 * some other time */
	kbad_proto = 76,
		/* # fbsd EX_PROTOCOL
		 * failure to speak a protocol correctly */
	kbad_perm = 77,
		/* # fbsd EX_NOPERM
		 * you or the program do not have permissions
		 * to do the thing requested */
	kbad_conf = 78,
		/* # fbsd EX_CONFIG
		 * your configuration is fucked */
} kbad;

#endif