System call returns

If an error occurs during service, the server (whatever process or kernel function that may be) will return a negative value in r0. You can use this table to deduce which error was returned.

Kernel codes

These codes are part of the syscall contract: the number and its meaning never change, and no code is ever removed or renumbered. New kernel codes may only be added in the reserved -13-99 band.

Value Name Meaning
0 ZUZU_OK Success
-1 ERR_NOPERM Caller lacks the right for this operation
-2 ERR_NOENT A name or id (not a handle) does not exist
-3 ERR_BUSY Object exists but is in the wrong state or in use
-4 ERR_NOMEM Kernel resource exhausted: PMM, kmalloc, table, VA
-5 ERR_BADTYPE Handle exists but is the wrong type here
-6 ERR_BADARG A passed value is invalid (flag, size, count)
-7 ERR_NOSYS No such syscall, or no such RPC operation
-8 ERR_BADPTR User pointer invalid, unmapped, or uncopyable
-9 ERR_DEAD Object was destroyed, or peer is gone
-10 ERR_TIMEOUT Deadline expired; also returned when a poll finds nothing
-11 ERR_OVERFLOW Caller size/payload exceeds a static limit
-12 ERR_BADHANDLE Handle index names no live entry in the table
-13 ... -99 - Reserved for future zuzu kernel codes

zuzuOS server/library codes

Codes -100 and up belong to zuzuOS servers and libraries. They may be added to or renumbered with the OS, but the same rule still holds: one code, one meaning.

Value Name Meaning
-100 ERR_BUFFULL Ring/channel is full (writer side)
-101 ERR_BUFEMPTY Ring/channel is empty (reader side)
-102 ERR_SYSDOWN A required service is not running
-103 ERR_NOTCONN Connection/session is not established
-104 ERR_DUPLICATE Duplicate registration/request rejected
-105 ERR_MALFORMED Received bytes fail to parse (wire/packet)
-106 ERR_IO Device or filesystem I/O error
-107 ERR_OUTDATED Feature is deprecated, or there is a version mismatch between binaries

Fatal error codes

Fatal codes come from critical processes and are delivered to the kernel. A fatal code is a 32-bit value: the high 16 bits carry the tag 0xFA7A (FATAL_TAG = 0xFA7A0000, matched with FATAL_TAG_MASK = 0xFFFF0000) and the low 16 bits carry the reason (FATAL_REASON_MASK = 0x0000FFFF). Do not use these codes as process exit codes.

Reason Name Meaning
1 FATAL_KERNEL_OUTDATED The running kernel is too old for this binary