+#define CLIENT_ERRORS \
+ PARA_ERROR(TASK_STARTED, "task started"), \
+
+
+#define AFH_ERRORS \
+ PARA_ERROR(AFH_SYNTAX, "afh syntax error"), \
+ PARA_ERROR(AFH_SHORT_WRITE, "afh short write"), \
+
+
+#define AFH_COMMON_ERRORS \
+ PARA_ERROR(AUDIO_FORMAT, "audio format not recognized"), \
+
+
+#define ACL_ERRORS \
+ PARA_ERROR(ACL_PERM, "access denied by acl"), \
+
+
#define FSCK_ERRORS \
PARA_ERROR(FSCK_SYNTAX, "fsck syntax error"), \
PARA_ERROR(RANGE_VIOLATION, "range violation detected, very bad"), \
#define FSCK_ERRORS \
PARA_ERROR(FSCK_SYNTAX, "fsck syntax error"), \
PARA_ERROR(RANGE_VIOLATION, "range violation detected, very bad"), \
PARA_ERROR(ALREADY_MAPPED, "file already mapped"), \
PARA_ERROR(BAD_SIZE, "invalid size specified"), \
PARA_ERROR(TRUNC, "failed to truncate file"), \
PARA_ERROR(ALREADY_MAPPED, "file already mapped"), \
PARA_ERROR(BAD_SIZE, "invalid size specified"), \
PARA_ERROR(TRUNC, "failed to truncate file"), \
PARA_ERROR(BAD_TABLE, "table not open"), \
PARA_ERROR(BAD_TABLE_DESC, "invalid table description"), \
PARA_ERROR(RB_KEY_EXISTS, "key already exists in rbtree"), \
PARA_ERROR(BAD_TABLE, "table not open"), \
PARA_ERROR(BAD_TABLE_DESC, "invalid table description"), \
PARA_ERROR(RB_KEY_EXISTS, "key already exists in rbtree"), \
PARA_ERROR(INDEX_CORRUPTION, "index corruption detected"), \
PARA_ERROR(INVALID_OBJECT, "reference to invalid object"), \
PARA_ERROR(STAT, "can not stat file"), \
PARA_ERROR(INDEX_CORRUPTION, "index corruption detected"), \
PARA_ERROR(INVALID_OBJECT, "reference to invalid object"), \
PARA_ERROR(STAT, "can not stat file"), \
PARA_ERROR(WRITE, "write error"), \
PARA_ERROR(LSEEK, "lseek error"), \
PARA_ERROR(BUSY, "table is busy"), \
PARA_ERROR(WRITE, "write error"), \
PARA_ERROR(LSEEK, "lseek error"), \
PARA_ERROR(BUSY, "table is busy"), \
#define MOOD_ERRORS \
PARA_ERROR(MOOD_SYNTAX, "mood syntax error"), \
PARA_ERROR(NO_MOOD, "no mood available"), \
#define MOOD_ERRORS \
PARA_ERROR(MOOD_SYNTAX, "mood syntax error"), \
PARA_ERROR(NO_MOOD, "no mood available"), \
PARA_ERROR(NO_ATTRIBUTES, "no attributes defined yet"), \
PARA_ERROR(ATT_TABLE_FULL, "no more space left in attribute table"), \
PARA_ERROR(NO_ATTRIBUTES, "no attributes defined yet"), \
PARA_ERROR(ATT_TABLE_FULL, "no more space left in attribute table"), \
#define BLOB_ERRORS \
PARA_ERROR(BLOB_SYNTAX, "blob syntax error"), \
PARA_ERROR(DUMMY_ROW, "attempted to access blob dummy object"), \
#define PLAYLIST_ERRORS \
#define BLOB_ERRORS \
PARA_ERROR(BLOB_SYNTAX, "blob syntax error"), \
PARA_ERROR(DUMMY_ROW, "attempted to access blob dummy object"), \
#define PLAYLIST_ERRORS \
PARA_ERROR(PLAYLIST_LOADED, ""), /* not really an error */ \
PARA_ERROR(PATH_FOUND, ""), /* not really an error */ \
PARA_ERROR(PLAYLIST_EMPTY, "attempted to load empty playlist"), \
PARA_ERROR(PLAYLIST_LOADED, ""), /* not really an error */ \
PARA_ERROR(PATH_FOUND, ""), /* not really an error */ \
PARA_ERROR(PLAYLIST_EMPTY, "attempted to load empty playlist"), \
#define CLIENT_COMMON_ERRORS \
PARA_ERROR(CLIENT_SYNTAX, "syntax error"), \
PARA_ERROR(INVALID_CHALLENGE, "did not receive valid challenge"), \
PARA_ERROR(NO_CONFIG, "config file not found"), \
PARA_ERROR(CLIENT_AUTH, "authentication failed"), \
PARA_ERROR(SERVER_EOF, "connection closed by para_server"), \
#define CLIENT_COMMON_ERRORS \
PARA_ERROR(CLIENT_SYNTAX, "syntax error"), \
PARA_ERROR(INVALID_CHALLENGE, "did not receive valid challenge"), \
PARA_ERROR(NO_CONFIG, "config file not found"), \
PARA_ERROR(CLIENT_AUTH, "authentication failed"), \
PARA_ERROR(SERVER_EOF, "connection closed by para_server"), \
PARA_ERROR(NO_SUCH_TASK, "task not found"), \
PARA_ERROR(NOT_INITIALIZED, "scheduler not yet initialized"), \
#define STDIN_ERRORS \
PARA_ERROR(NO_SUCH_TASK, "task not found"), \
PARA_ERROR(NOT_INITIALIZED, "scheduler not yet initialized"), \
#define STDIN_ERRORS \
PARA_ERROR(CHMOD, "failed to set socket mode"), \
PARA_ERROR(SENDMSG, "sendmsg() failed"), \
PARA_ERROR(RECVMSG, "recvmsg() failed"), \
PARA_ERROR(CHMOD, "failed to set socket mode"), \
PARA_ERROR(SENDMSG, "sendmsg() failed"), \
PARA_ERROR(RECVMSG, "recvmsg() failed"), \
#define RECV_COMMON_ERRORS \
PARA_ERROR(RECV_SYNTAX, "recv syntax error"), \
#define RECV_COMMON_ERRORS \
PARA_ERROR(RECV_SYNTAX, "recv syntax error"), \
#define AUDIOD_ERRORS \
PARA_ERROR(NO_MORE_SLOTS, "no more empty slots"), \
PARA_ERROR(MISSING_COLON, "syntax error: missing colon"), \
PARA_ERROR(UNSUPPORTED_AUDIO_FORMAT, "given audio format not supported"), \
#define AUDIOD_ERRORS \
PARA_ERROR(NO_MORE_SLOTS, "no more empty slots"), \
PARA_ERROR(MISSING_COLON, "syntax error: missing colon"), \
PARA_ERROR(UNSUPPORTED_AUDIO_FORMAT, "given audio format not supported"), \
- PARA_ERROR(SIGNAL_CAUGHT, "caught signal"), \
+ PARA_ERROR(NOT_PLAYING, "not playing"), \
+ PARA_ERROR(AUDIOD_OFF, "audiod switched off"), \
+ PARA_ERROR(STATUS_TIMEOUT, "timeout reading server status"), \
PARA_ERROR(ATOI_OVERFLOW, "value too large"), \
PARA_ERROR(STRTOLL, "unknown strtoll error"), \
PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
PARA_ERROR(ATOI_OVERFLOW, "value too large"), \
PARA_ERROR(STRTOLL, "unknown strtoll error"), \
PARA_ERROR(ATOI_NO_DIGITS, "no digits found in string"), \
- PARA_ERROR(WRITE_OK, "can not check whether fd is writable"), \
- PARA_ERROR(SEND_QUEUED_CHUNK, "failed to send queued chunk"), \
+ PARA_ERROR(MAX_CLIENTS, "maximal number of clients exceeded"), \
#define COMMAND_ERRORS \
PARA_ERROR(COMMAND_SYNTAX, "syntax error in command"), \
PARA_ERROR(AUTH, "did not receive auth request"), \
#define COMMAND_ERRORS \
PARA_ERROR(COMMAND_SYNTAX, "syntax error in command"), \
PARA_ERROR(AUTH, "did not receive auth request"), \
PARA_ERROR(NO_AUDIO_FILE, "no audio file"), \
PARA_ERROR(BAD_CMD, "invalid command"), \
PARA_ERROR(PERM, "permission denied"), \
PARA_ERROR(NO_AUDIO_FILE, "no audio file"), \
PARA_ERROR(BAD_CMD, "invalid command"), \
PARA_ERROR(PERM, "permission denied"), \
- PARA_ERROR(DCCP_BIND, "dccp bind error"), \
- PARA_ERROR(DCCP_LISTEN, "dccp listen error"), \
- PARA_ERROR(DCCP_WRITE, "dccp write error"), \
- PARA_ERROR(CHDIR, "failed to change directory"), \
- PARA_ERROR(OPEN, "failed to open file"), \
- PARA_ERROR(CHDIR_PERM, "insufficient permissions to chdir"), \
PARA_ERROR(EMPTY, "file empty"), \
PARA_ERROR(MMAP, "mmap error"), \
PARA_ERROR(MUNMAP, "munmap failed"), \
PARA_ERROR(EMPTY, "file empty"), \
PARA_ERROR(MMAP, "mmap error"), \
PARA_ERROR(MUNMAP, "munmap failed"), \
PARA_ERROR(NO_WAV_HEADER, "wave header not found"), \
PARA_ERROR(WAV_HEADER_SUCCESS, "successfully read wave header"), \
PARA_ERROR(NO_DELAY, "no initial delay"), \
PARA_ERROR(NO_WAV_HEADER, "wave header not found"), \
PARA_ERROR(WAV_HEADER_SUCCESS, "successfully read wave header"), \
PARA_ERROR(NO_DELAY, "no initial delay"), \
PARA_ERROR(HW_PARAMS, "unable to install hw params"), \
PARA_ERROR(SW_PARAMS, "unable to install sw params"), \
PARA_ERROR(BAD_PERIOD, "can not use period equal to buffer size"), \
PARA_ERROR(HW_PARAMS, "unable to install hw params"), \
PARA_ERROR(SW_PARAMS, "unable to install sw params"), \
PARA_ERROR(BAD_PERIOD, "can not use period equal to buffer size"), \
PARA_ERROR(ALSA_WRITE, "alsa write error"), \
PARA_ERROR(PCM_OPEN, "unable to open pcm"), \
PARA_ERROR(SND_PCM_INFO, "pcm info error"), \
PARA_ERROR(ALSA_WRITE, "alsa write error"), \
PARA_ERROR(PCM_OPEN, "unable to open pcm"), \
PARA_ERROR(SND_PCM_INFO, "pcm info error"), \
#define WRITE_COMMON_ERRORS \
PARA_ERROR(WRITE_COMMON_SYNTAX, "syntax error in write option"), \
#define WRITE_COMMON_ERRORS \
PARA_ERROR(WRITE_COMMON_SYNTAX, "syntax error in write option"), \
#define CHUNK_QUEUE_ERRORS \
PARA_ERROR(QUEUE, "packet queue overrun"), \
#define CHUNK_QUEUE_ERRORS \
PARA_ERROR(QUEUE, "packet queue overrun"), \
*
* As zero should not be an error, we define a dummy enum entry with value
* 2**ss. That lets the real errors start at 2**ss + 1.
*
* As zero should not be an error, we define a dummy enum entry with value
* 2**ss. That lets the real errors start at 2**ss + 1.
*
* Easy, it's just \a num / 2**8.
*/
#define ERRNUM_TO_SS(num) ((num) >> SS_SHIFT)
/**
*
* Easy, it's just \a num / 2**8.
*/
#define ERRNUM_TO_SS(num) ((num) >> SS_SHIFT)
/**
*
* Also easy: It's the lower 8 bits of num.
*/
#define ERRNUM_TO_INDEX(num) (((1 << SS_SHIFT) - 1) & (num))
*
* Also easy: It's the lower 8 bits of num.
*/
#define ERRNUM_TO_INDEX(num) (((1 << SS_SHIFT) - 1) & (num))
-static inline int is_errno(int val, int _errno)
+/** Check whether a given number is a system error number.
+ *
+ * \param num The value to be checked.
+ * \param _errno The system error number.
+ *
+ * \return True if \a num is paraslash's representation of the system
+ * error identified by \a _errno.
+ */
+_static_inline_ int is_errno(int num, int _errno)
-#define PARA_STRERROR(num) IS_SYSTEM_ERROR(num)? \
- strerror((num) & ((1 << SYSTEM_ERROR_BIT) - 1)) : \
- para_errlist[ERRNUM_TO_SS(num)] [ERRNUM_TO_INDEX(num)]
-
+_static_inline_ const char *para_strerror(int num)
+{
+ assert(num > 0);
+ if (IS_SYSTEM_ERROR(num))
+ return strerror((num) & ((1 << SYSTEM_ERROR_BIT) - 1));
+ else
+ return para_errlist[ERRNUM_TO_SS(num)][ERRNUM_TO_INDEX(num)];
+}
*
* Each executable needs only the error lists of those subsystems it is
* actually linked with. We always reserve space for NUM_SS char pointers,
*
* Each executable needs only the error lists of those subsystems it is
* actually linked with. We always reserve space for NUM_SS char pointers,