Changed some odd strings, added missing ones.
In case of an unknown error, it will now also take the error base definitions into account (ie. it could return "Unknown Application Kit Error (x)"). git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12237 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,529 +1,459 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2001, Dan Sinclair. All rights reserved.
|
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
** Distributed under the terms of the NewOS License.
|
* Distributed under the terms of the MIT license.
|
||||||
*/
|
*
|
||||||
|
* Copyright 2001, Dan Sinclair. All rights reserved.
|
||||||
|
* Distributed under the terms of the NewOS License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <Errors.h>
|
#include <SupportDefs.h>
|
||||||
|
#include <translation/TranslationErrors.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
static const struct error_base {
|
||||||
|
int base;
|
||||||
|
const char *name;
|
||||||
|
} kErrorBases[] = {
|
||||||
|
{B_GENERAL_ERROR_BASE, "General "},
|
||||||
|
{B_OS_ERROR_BASE, "OS "},
|
||||||
|
{B_APP_ERROR_BASE, "Application Kit "},
|
||||||
|
{B_INTERFACE_ERROR_BASE, "Interface Kit "},
|
||||||
|
{B_MEDIA_ERROR_BASE, "Media Kit "},
|
||||||
|
{B_MEDIA_ERROR_BASE + 0x200, ""},
|
||||||
|
{B_TRANSLATION_ERROR_BASE, "Translation Kit "},
|
||||||
|
{B_MEDIA_ERROR_BASE + 0x100, ""},
|
||||||
|
{B_MIDI_ERROR_BASE, "Midi Kit "},
|
||||||
|
{B_STORAGE_ERROR_BASE, "Storage Kit "},
|
||||||
|
{B_POSIX_ERROR_BASE, "POSIX "},
|
||||||
|
{B_MAIL_ERROR_BASE, "Mail Kit "},
|
||||||
|
{B_PRINT_ERROR_BASE, "Print "},
|
||||||
|
{B_DEVICE_ERROR_BASE, "Device "},
|
||||||
|
{B_ERRORS_END, "Application "},
|
||||||
|
};
|
||||||
|
static const uint32 kNumErrorBases = sizeof(kErrorBases) / sizeof(struct error_base);
|
||||||
|
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
error_description(int error)
|
error_description(int error)
|
||||||
{
|
{
|
||||||
switch (error) {
|
switch (error) {
|
||||||
/* General Errors */
|
// General Errors
|
||||||
|
|
||||||
case B_NO_ERROR:
|
case B_NO_ERROR:
|
||||||
return "No Error";
|
return "No error";
|
||||||
|
|
||||||
case B_ERROR:
|
case B_ERROR:
|
||||||
return "General Error";
|
return "General system error";
|
||||||
|
|
||||||
case B_INTERRUPTED:
|
|
||||||
// EINTR
|
|
||||||
return "Interrupted system call";
|
|
||||||
|
|
||||||
case B_NO_MEMORY:
|
case B_NO_MEMORY:
|
||||||
// ENOMEM
|
// ENOMEM
|
||||||
return "Out of memory";
|
return "Out of memory";
|
||||||
|
|
||||||
case B_IO_ERROR:
|
case B_IO_ERROR:
|
||||||
// EIO
|
// EIO
|
||||||
return "I/O error";
|
return "I/O error";
|
||||||
|
case B_PERMISSION_DENIED:
|
||||||
|
// EACCES
|
||||||
|
return "Permission denied";
|
||||||
|
case B_BAD_INDEX:
|
||||||
|
return "Index not in range for the data set";
|
||||||
|
case B_BAD_TYPE:
|
||||||
|
return "Bad argument type passed to function";
|
||||||
case B_BAD_VALUE:
|
case B_BAD_VALUE:
|
||||||
// EINVAL
|
// EINVAL
|
||||||
return "Invalid Argument";
|
return "Invalid Argument";
|
||||||
|
|
||||||
case B_TIMED_OUT:
|
|
||||||
// ETIMEDOUT
|
|
||||||
return "Timed out"; // "Operation timed out"
|
|
||||||
|
|
||||||
case B_NOT_ALLOWED:
|
|
||||||
// EPERM
|
|
||||||
return "Operation not permitted"; // "Operation not allowed"
|
|
||||||
|
|
||||||
case B_PERMISSION_DENIED:
|
|
||||||
// EACCES
|
|
||||||
return "Operation not permitted"; // "Permission denied"
|
|
||||||
|
|
||||||
case B_FILE_ERROR:
|
|
||||||
// EBADF
|
|
||||||
return "Bad file descriptor";
|
|
||||||
|
|
||||||
case B_ENTRY_NOT_FOUND:
|
|
||||||
// ENOENT
|
|
||||||
return "No such file or directory";
|
|
||||||
|
|
||||||
case ENFILE:
|
|
||||||
return "Too many open files in system"; // "File table overflow"
|
|
||||||
|
|
||||||
case B_NO_MORE_FDS:
|
|
||||||
// EMFILE
|
|
||||||
return "Too many open files";
|
|
||||||
|
|
||||||
case ENXIO:
|
|
||||||
return "Device not configured"; // "No such device"
|
|
||||||
|
|
||||||
case ESPIPE:
|
|
||||||
return "Illegal seek"; // "Seek not allowed on file descriptor"
|
|
||||||
|
|
||||||
case ENOSYS:
|
|
||||||
return "Unimplemented"; // "Function not implemented"
|
|
||||||
|
|
||||||
case EDOM:
|
|
||||||
return "Numerical argument out of range"; // "Domain Error"
|
|
||||||
|
|
||||||
/* Semaphore errors */
|
|
||||||
case B_BAD_SEM_ID:
|
|
||||||
return "Bad semaphore ID";
|
|
||||||
|
|
||||||
case B_NO_MORE_SEMS:
|
|
||||||
return "No more semaphores";
|
|
||||||
|
|
||||||
/* VFS errors */
|
|
||||||
case ENOBUFS:
|
|
||||||
return "No buffer space available";
|
|
||||||
|
|
||||||
case B_READ_ONLY_DEVICE:
|
|
||||||
// EROFS:
|
|
||||||
return "Read-only file system";
|
|
||||||
|
|
||||||
case B_FILE_EXISTS:
|
|
||||||
// EEXIST
|
|
||||||
return "File or Directory already exists";
|
|
||||||
|
|
||||||
case B_BUSY:
|
|
||||||
// EBUSY
|
|
||||||
return "Device/File/Resource busy";
|
|
||||||
|
|
||||||
case B_NOT_A_DIRECTORY:
|
|
||||||
// ENOTDIR
|
|
||||||
return "Not a directory";
|
|
||||||
|
|
||||||
/* Ports errors */
|
|
||||||
case B_BAD_PORT_ID:
|
|
||||||
return "Bad port ID";
|
|
||||||
|
|
||||||
case B_NO_MORE_PORTS:
|
|
||||||
return "No more ports available"; // "No more ports"
|
|
||||||
|
|
||||||
case B_BAD_INDEX:
|
|
||||||
return "Index not in range for the data set";
|
|
||||||
|
|
||||||
case B_BAD_TYPE:
|
|
||||||
return "Bad argument type passed to function";
|
|
||||||
|
|
||||||
case B_MISMATCHED_VALUES:
|
case B_MISMATCHED_VALUES:
|
||||||
return "Mismatched values passed to function";
|
return "Mismatched values passed to function";
|
||||||
|
|
||||||
case B_NAME_NOT_FOUND:
|
case B_NAME_NOT_FOUND:
|
||||||
return "Name not found";
|
return "Name not found";
|
||||||
|
|
||||||
case B_NAME_IN_USE:
|
case B_NAME_IN_USE:
|
||||||
return "Name in use";
|
return "Name in use";
|
||||||
|
case B_TIMED_OUT:
|
||||||
|
// ETIMEDOUT
|
||||||
|
return "Operation timed out";
|
||||||
|
case B_INTERRUPTED:
|
||||||
|
// EINTR
|
||||||
|
return "Interrupted system call";
|
||||||
case B_WOULD_BLOCK:
|
case B_WOULD_BLOCK:
|
||||||
// EAGAIN
|
// EAGAIN
|
||||||
// EWOULDBLOCK
|
// EWOULDBLOCK
|
||||||
return "Operation would block";
|
return "Operation would block";
|
||||||
|
|
||||||
case B_CANCELED:
|
case B_CANCELED:
|
||||||
return "Operation canceled";
|
return "Operation canceled";
|
||||||
|
|
||||||
case B_NO_INIT:
|
case B_NO_INIT:
|
||||||
return "Initialization failed";
|
return "Initialization failed";
|
||||||
|
case B_BUSY:
|
||||||
|
// EBUSY
|
||||||
|
return "Device/File/Resource busy";
|
||||||
|
case B_NOT_ALLOWED:
|
||||||
|
// EPERM
|
||||||
|
return "Operation not allowed";
|
||||||
|
case B_BAD_DATA:
|
||||||
|
return "Bad data";
|
||||||
|
|
||||||
|
// Kernel Kit Errors
|
||||||
|
|
||||||
|
case B_BAD_SEM_ID:
|
||||||
|
return "Bad semaphore ID";
|
||||||
|
case B_NO_MORE_SEMS:
|
||||||
|
return "No more semaphores";
|
||||||
|
|
||||||
case B_BAD_THREAD_ID:
|
case B_BAD_THREAD_ID:
|
||||||
return "Bad thread ID";
|
return "Bad thread ID";
|
||||||
|
|
||||||
case B_NO_MORE_THREADS:
|
case B_NO_MORE_THREADS:
|
||||||
return "No more threads";
|
return "No more threads";
|
||||||
|
|
||||||
case B_BAD_THREAD_STATE:
|
case B_BAD_THREAD_STATE:
|
||||||
return "Thread is inappropriate state";
|
return "Thread is inappropriate state";
|
||||||
|
|
||||||
case B_BAD_TEAM_ID:
|
case B_BAD_TEAM_ID:
|
||||||
return "Operation on invalid team";
|
return "Operation on invalid team";
|
||||||
|
|
||||||
case B_NO_MORE_TEAMS:
|
case B_NO_MORE_TEAMS:
|
||||||
return "No more teams";
|
return "No more teams";
|
||||||
|
|
||||||
|
case B_BAD_PORT_ID:
|
||||||
|
return "Bad port ID";
|
||||||
|
case B_NO_MORE_PORTS:
|
||||||
|
return "No more ports available"; // "No more ports"
|
||||||
|
|
||||||
case B_BAD_IMAGE_ID:
|
case B_BAD_IMAGE_ID:
|
||||||
return "Bad image ID";
|
return "Bad image ID";
|
||||||
|
|
||||||
case B_BAD_ADDRESS:
|
case B_BAD_ADDRESS:
|
||||||
// EFAULT
|
// EFAULT
|
||||||
return "Bad address";
|
return "Bad address";
|
||||||
|
|
||||||
case B_NOT_AN_EXECUTABLE:
|
case B_NOT_AN_EXECUTABLE:
|
||||||
// ENOEXEC
|
// ENOEXEC
|
||||||
return "Not an executable";
|
return "Not an executable";
|
||||||
|
|
||||||
case B_MISSING_LIBRARY:
|
case B_MISSING_LIBRARY:
|
||||||
return "Missing library";
|
return "Missing library";
|
||||||
|
|
||||||
case B_MISSING_SYMBOL:
|
case B_MISSING_SYMBOL:
|
||||||
return "Symbol not found";
|
return "Symbol not found";
|
||||||
|
|
||||||
case B_DEBUGGER_ALREADY_INSTALLED:
|
case B_DEBUGGER_ALREADY_INSTALLED:
|
||||||
return "Debugger already installed for this team";
|
return "Debugger already installed for this team";
|
||||||
|
|
||||||
case B_APP_ERROR_BASE:
|
// Application Kit Errors
|
||||||
// B_BAD_REPLY
|
|
||||||
return "Invalid or unwanted reply";
|
|
||||||
|
|
||||||
|
case B_BAD_REPLY:
|
||||||
|
return "Invalid or unwanted reply";
|
||||||
case B_DUPLICATE_REPLY:
|
case B_DUPLICATE_REPLY:
|
||||||
return "Duplicate reply";
|
return "Duplicate reply";
|
||||||
|
|
||||||
case B_MESSAGE_TO_SELF:
|
case B_MESSAGE_TO_SELF:
|
||||||
return "Can't send message to self";
|
return "Can't send message to self";
|
||||||
|
|
||||||
case B_BAD_HANDLER:
|
case B_BAD_HANDLER:
|
||||||
return "Bad handler";
|
return "Bad handler";
|
||||||
|
|
||||||
case B_ALREADY_RUNNING:
|
case B_ALREADY_RUNNING:
|
||||||
return "Already running";
|
return "Already running";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED:
|
case B_LAUNCH_FAILED:
|
||||||
return "Launch failed";
|
return "Launch failed";
|
||||||
|
|
||||||
case B_AMBIGUOUS_APP_LAUNCH:
|
case B_AMBIGUOUS_APP_LAUNCH:
|
||||||
return "Ambiguous app launch";
|
return "Ambiguous app launch";
|
||||||
|
|
||||||
case B_UNKNOWN_MIME_TYPE:
|
case B_UNKNOWN_MIME_TYPE:
|
||||||
return "Unknown MIME type";
|
return "Unknown MIME type";
|
||||||
|
|
||||||
case B_BAD_SCRIPT_SYNTAX:
|
case B_BAD_SCRIPT_SYNTAX:
|
||||||
return "Bad script syntax";
|
return "Bad script syntax";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED_NO_RESOLVE_LINK:
|
case B_LAUNCH_FAILED_NO_RESOLVE_LINK:
|
||||||
return "Could not resolve a link";
|
return "Could not resolve a link";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED_EXECUTABLE:
|
case B_LAUNCH_FAILED_EXECUTABLE:
|
||||||
return "File is mistakenly marked as executable";
|
return "File is mistakenly marked as executable";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED_APP_NOT_FOUND:
|
case B_LAUNCH_FAILED_APP_NOT_FOUND:
|
||||||
return "Application could not be found";
|
return "Application could not be found";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED_APP_IN_TRASH:
|
case B_LAUNCH_FAILED_APP_IN_TRASH:
|
||||||
return "Application is in the trash";
|
return "Application is in the trash";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED_NO_PREFERRED_APP:
|
case B_LAUNCH_FAILED_NO_PREFERRED_APP:
|
||||||
return "There is no preferred application for this type of file";
|
return "There is no preferred application for this type of file";
|
||||||
|
|
||||||
case B_LAUNCH_FAILED_FILES_APP_NOT_FOUND:
|
case B_LAUNCH_FAILED_FILES_APP_NOT_FOUND:
|
||||||
return "This file has a preferred app, but it could not be found";
|
return "This file has a preferred app, but it could not be found";
|
||||||
|
|
||||||
case B_BAD_MIME_SNIFFER_RULE:
|
case B_BAD_MIME_SNIFFER_RULE:
|
||||||
return "Bad sniffer rule";
|
return "Bad sniffer rule";
|
||||||
|
case B_NOT_A_MESSAGE:
|
||||||
|
return "Data is not a message";
|
||||||
|
|
||||||
case B_STREAM_NOT_FOUND:
|
// Storage Kit Errors
|
||||||
return "Stream not found";
|
|
||||||
|
|
||||||
case B_SERVER_NOT_FOUND:
|
|
||||||
return "Server not found";
|
|
||||||
|
|
||||||
case B_RESOURCE_NOT_FOUND:
|
|
||||||
return "Resource not found";
|
|
||||||
|
|
||||||
case B_RESOURCE_UNAVAILABLE:
|
|
||||||
return "Resource unavailable";
|
|
||||||
|
|
||||||
case B_BAD_SUBSCRIBER:
|
|
||||||
return "Bad subscriber";
|
|
||||||
|
|
||||||
case B_SUBSCRIBER_NOT_ENTERED:
|
|
||||||
return "Subscriber not entered";
|
|
||||||
|
|
||||||
case B_BUFFER_NOT_AVAILABLE:
|
|
||||||
return "Buffer not available";
|
|
||||||
|
|
||||||
case B_LAST_BUFFER_ERROR:
|
|
||||||
return "Last buffer";
|
|
||||||
|
|
||||||
|
case B_FILE_ERROR:
|
||||||
|
// EBADF
|
||||||
|
return "Bad file descriptor";
|
||||||
case B_FILE_NOT_FOUND:
|
case B_FILE_NOT_FOUND:
|
||||||
return "File not found";
|
case B_ENTRY_NOT_FOUND:
|
||||||
|
// ENOENT
|
||||||
|
return "No such file or directory";
|
||||||
|
case B_FILE_EXISTS:
|
||||||
|
// EEXIST
|
||||||
|
return "File or Directory already exists";
|
||||||
case B_NAME_TOO_LONG:
|
case B_NAME_TOO_LONG:
|
||||||
// ENAMETOOLONG
|
// ENAMETOOLONG
|
||||||
return "File name too long";
|
return "File name too long";
|
||||||
|
case B_NOT_A_DIRECTORY:
|
||||||
|
// ENOTDIR
|
||||||
|
return "Not a directory";
|
||||||
case B_DIRECTORY_NOT_EMPTY:
|
case B_DIRECTORY_NOT_EMPTY:
|
||||||
// ENOTEMPTY
|
// ENOTEMPTY
|
||||||
return "Directory not empty";
|
return "Directory not empty";
|
||||||
|
|
||||||
case B_DEVICE_FULL:
|
case B_DEVICE_FULL:
|
||||||
// ENOSPC
|
// ENOSPC
|
||||||
return "No space left on device";
|
return "No space left on device";
|
||||||
|
case B_READ_ONLY_DEVICE:
|
||||||
|
// EROFS:
|
||||||
|
return "Read-only file system";
|
||||||
case B_IS_A_DIRECTORY:
|
case B_IS_A_DIRECTORY:
|
||||||
// EISDIR
|
// EISDIR
|
||||||
return "Is a directory";
|
return "Is a directory";
|
||||||
|
case B_NO_MORE_FDS:
|
||||||
|
// EMFILE
|
||||||
|
return "Too many open files";
|
||||||
case B_CROSS_DEVICE_LINK:
|
case B_CROSS_DEVICE_LINK:
|
||||||
// EXDEV
|
// EXDEV
|
||||||
return "Cross-device link";
|
return "Cross-device link";
|
||||||
|
|
||||||
case B_LINK_LIMIT:
|
case B_LINK_LIMIT:
|
||||||
// ELOOP
|
// ELOOP
|
||||||
return "Too many symbolic links";
|
return "Too many symbolic links";
|
||||||
|
|
||||||
case B_BUSTED_PIPE:
|
case B_BUSTED_PIPE:
|
||||||
// EPIPE
|
// EPIPE
|
||||||
return "Broken pipe";
|
return "Broken pipe";
|
||||||
|
|
||||||
case B_UNSUPPORTED:
|
case B_UNSUPPORTED:
|
||||||
return "Operation not supported";
|
return "Operation not supported";
|
||||||
|
|
||||||
case B_PARTITION_TOO_SMALL:
|
case B_PARTITION_TOO_SMALL:
|
||||||
return "Partition too small to contain filesystem";
|
return "Partition too small to contain filesystem";
|
||||||
|
|
||||||
|
// Media Kit Errors
|
||||||
|
|
||||||
|
case B_STREAM_NOT_FOUND:
|
||||||
|
return "Stream not found";
|
||||||
|
case B_SERVER_NOT_FOUND:
|
||||||
|
return "Server not found";
|
||||||
|
case B_RESOURCE_NOT_FOUND:
|
||||||
|
return "Resource not found";
|
||||||
|
case B_RESOURCE_UNAVAILABLE:
|
||||||
|
return "Resource unavailable";
|
||||||
|
case B_BAD_SUBSCRIBER:
|
||||||
|
return "Bad subscriber";
|
||||||
|
case B_SUBSCRIBER_NOT_ENTERED:
|
||||||
|
return "Subscriber not entered";
|
||||||
|
case B_BUFFER_NOT_AVAILABLE:
|
||||||
|
return "Buffer not available";
|
||||||
|
case B_LAST_BUFFER_ERROR:
|
||||||
|
return "Last buffer";
|
||||||
|
|
||||||
|
// Mail Kit Errors
|
||||||
|
|
||||||
|
case B_MAIL_NO_DAEMON:
|
||||||
|
return "No mail daemon";
|
||||||
|
case B_MAIL_UNKNOWN_USER:
|
||||||
|
return "Unknown mail user";
|
||||||
|
case B_MAIL_WRONG_PASSWORD:
|
||||||
|
return "Wrong password (mail)";
|
||||||
|
case B_MAIL_UNKNOWN_HOST:
|
||||||
|
return "Mail unknown host";
|
||||||
|
case B_MAIL_ACCESS_ERROR:
|
||||||
|
return "Mail access error";
|
||||||
|
case B_MAIL_UNKNOWN_FIELD:
|
||||||
|
return "Unknown mail field";
|
||||||
|
case B_MAIL_NO_RECIPIENT:
|
||||||
|
return "No mail recipient";
|
||||||
|
case B_MAIL_INVALID_MAIL:
|
||||||
|
return "Invaild mail";
|
||||||
|
|
||||||
|
// Printing Errors
|
||||||
|
|
||||||
|
case B_NO_PRINT_SERVER:
|
||||||
|
return "No print server";
|
||||||
|
|
||||||
|
// Device Kit Errors
|
||||||
|
|
||||||
|
case B_DEV_INVALID_IOCTL:
|
||||||
|
return "Invalid device ioctl";
|
||||||
|
case B_DEV_NO_MEMORY:
|
||||||
|
return "No device memory";
|
||||||
|
case B_DEV_BAD_DRIVE_NUM:
|
||||||
|
return "Bad drive number";
|
||||||
|
case B_DEV_NO_MEDIA:
|
||||||
|
return "No media present";
|
||||||
|
case B_DEV_UNREADABLE:
|
||||||
|
return "Device unreadable";
|
||||||
|
case B_DEV_FORMAT_ERROR:
|
||||||
|
return "Device format error";
|
||||||
|
case B_DEV_TIMEOUT:
|
||||||
|
return "Device timeout";
|
||||||
|
case B_DEV_RECALIBRATE_ERROR:
|
||||||
|
return "Device recalibrate error";
|
||||||
|
case B_DEV_SEEK_ERROR:
|
||||||
|
return "Device seek error";
|
||||||
|
case B_DEV_ID_ERROR:
|
||||||
|
return "Device ID error";
|
||||||
|
case B_DEV_READ_ERROR:
|
||||||
|
return "Device read error";
|
||||||
|
case B_DEV_WRITE_ERROR:
|
||||||
|
return "Device write error";
|
||||||
|
case B_DEV_NOT_READY:
|
||||||
|
return "Device not ready";
|
||||||
|
case B_DEV_MEDIA_CHANGED:
|
||||||
|
return "Device media changed";
|
||||||
|
case B_DEV_MEDIA_CHANGE_REQUESTED:
|
||||||
|
return "Device media change requested";
|
||||||
|
case B_DEV_RESOURCE_CONFLICT:
|
||||||
|
return "Resource conflict";
|
||||||
|
case B_DEV_CONFIGURATION_ERROR:
|
||||||
|
return "Configuration error";
|
||||||
|
case B_DEV_DISABLED_BY_USER:
|
||||||
|
return "Disabled by user";
|
||||||
|
case B_DEV_DOOR_OPEN:
|
||||||
|
return "Drive door open";
|
||||||
|
|
||||||
|
// the commented out ones are really strange error codes...
|
||||||
|
//case B_DEV_INVALID_PIPE:
|
||||||
|
|
||||||
|
case B_DEV_CRC_ERROR:
|
||||||
|
return "Device check-sum error";
|
||||||
|
case B_DEV_STALLED:
|
||||||
|
return "Device stalled";
|
||||||
|
|
||||||
|
//case B_DEV_BAD_PID:
|
||||||
|
//case B_DEV_UNEXPECTED_PID:
|
||||||
|
|
||||||
|
case B_DEV_DATA_OVERRUN:
|
||||||
|
return "Device data overrun";
|
||||||
|
case B_DEV_DATA_UNDERRUN:
|
||||||
|
return "Device data underrun";
|
||||||
|
case B_DEV_FIFO_OVERRUN:
|
||||||
|
return "Device FIFO overrun";
|
||||||
|
case B_DEV_FIFO_UNDERRUN:
|
||||||
|
return "Device FIFO underrun";
|
||||||
|
case B_DEV_PENDING:
|
||||||
|
return "Device pending";
|
||||||
|
case B_DEV_MULTIPLE_ERRORS:
|
||||||
|
return "Multiple device errors";
|
||||||
|
case B_DEV_TOO_LATE:
|
||||||
|
return "Device too late";
|
||||||
|
|
||||||
|
// Translation Kit Errors
|
||||||
|
|
||||||
|
case B_NO_TRANSLATOR:
|
||||||
|
return "No translator found";
|
||||||
|
case B_ILLEGAL_DATA:
|
||||||
|
return "";
|
||||||
|
|
||||||
|
// Other POSIX Errors
|
||||||
|
|
||||||
|
case ENFILE:
|
||||||
|
return "File table overflow";
|
||||||
|
case ENXIO:
|
||||||
|
return "Device not accessible";
|
||||||
|
case ESPIPE:
|
||||||
|
return "Seek not allowed on file descriptor";
|
||||||
|
case ENOSYS:
|
||||||
|
return "Function not implemented";
|
||||||
|
case EDOM:
|
||||||
|
return "Numerical argument out of range"; // "Domain Error"
|
||||||
|
case ENOBUFS:
|
||||||
|
return "No buffer space available";
|
||||||
case E2BIG:
|
case E2BIG:
|
||||||
return "Argument too big";
|
return "Argument too big";
|
||||||
|
|
||||||
case ECHILD:
|
case ECHILD:
|
||||||
return "No child process";
|
return "No child process";
|
||||||
|
|
||||||
case EDEADLK:
|
case EDEADLK:
|
||||||
return "Resource deadlock";
|
return "Resource deadlock";
|
||||||
|
|
||||||
case EFBIG:
|
case EFBIG:
|
||||||
return "File too large";
|
return "File too large";
|
||||||
|
|
||||||
case EMLINK:
|
case EMLINK:
|
||||||
return "Too many links";
|
return "Too many links";
|
||||||
|
|
||||||
case ENODEV:
|
case ENODEV:
|
||||||
return "No such device";
|
return "No such device";
|
||||||
|
|
||||||
case ENOLCK:
|
case ENOLCK:
|
||||||
return "No record locks available";
|
return "No record locks available";
|
||||||
|
|
||||||
case ENOTTY:
|
case ENOTTY:
|
||||||
return "Not a tty";
|
return "Not a tty";
|
||||||
|
|
||||||
case ESRCH:
|
case ESRCH:
|
||||||
return "No such process";
|
return "No such process";
|
||||||
|
|
||||||
case EFPOS:
|
case EFPOS:
|
||||||
return "File Position Error";
|
return "File Position Error";
|
||||||
|
|
||||||
case ESIGPARM:
|
case ESIGPARM:
|
||||||
return "Signal Error";
|
return "Signal Error";
|
||||||
|
|
||||||
case ERANGE:
|
case ERANGE:
|
||||||
return "Range Error";
|
return "Range Error";
|
||||||
|
|
||||||
case EPROTOTYPE:
|
case EPROTOTYPE:
|
||||||
return "Protocol wrong type for socket";
|
return "Protocol wrong type for socket";
|
||||||
|
|
||||||
case EPROTONOSUPPORT:
|
case EPROTONOSUPPORT:
|
||||||
return "Protocol not supported";
|
return "Protocol not supported";
|
||||||
|
|
||||||
case EPFNOSUPPORT:
|
case EPFNOSUPPORT:
|
||||||
return "Protocol family not supported";
|
return "Protocol family not supported";
|
||||||
|
|
||||||
case EAFNOSUPPORT:
|
case EAFNOSUPPORT:
|
||||||
return "Address family not supported by protocol family";
|
return "Address family not supported by protocol family";
|
||||||
|
|
||||||
case EADDRINUSE:
|
case EADDRINUSE:
|
||||||
return "Address already in use";
|
return "Address already in use";
|
||||||
|
|
||||||
case EADDRNOTAVAIL:
|
case EADDRNOTAVAIL:
|
||||||
return "Can't assign requested address";
|
return "Can't assign requested address";
|
||||||
|
|
||||||
case ENETDOWN:
|
case ENETDOWN:
|
||||||
return "Network is down";
|
return "Network is down";
|
||||||
|
|
||||||
case ENETUNREACH:
|
case ENETUNREACH:
|
||||||
return "Network is unreachable";
|
return "Network is unreachable";
|
||||||
|
|
||||||
case ENETRESET:
|
case ENETRESET:
|
||||||
return "Network dropped connection on reset";
|
return "Network dropped connection on reset";
|
||||||
|
|
||||||
case ECONNABORTED:
|
case ECONNABORTED:
|
||||||
return "Software caused connection abort";
|
return "Software caused connection abort";
|
||||||
|
|
||||||
case ECONNRESET:
|
case ECONNRESET:
|
||||||
return "Connection reset by peer";
|
return "Connection reset by peer";
|
||||||
|
|
||||||
case EISCONN:
|
case EISCONN:
|
||||||
return "Socket is already connected";
|
return "Socket is already connected";
|
||||||
|
|
||||||
case ENOTCONN:
|
case ENOTCONN:
|
||||||
return "Socket is not connected";
|
return "Socket is not connected";
|
||||||
|
|
||||||
case ESHUTDOWN:
|
case ESHUTDOWN:
|
||||||
return "Can't send after socket shutdown";
|
return "Can't send after socket shutdown";
|
||||||
|
|
||||||
case ECONNREFUSED:
|
case ECONNREFUSED:
|
||||||
return "Connection refused";
|
return "Connection refused";
|
||||||
|
|
||||||
case EHOSTUNREACH:
|
case EHOSTUNREACH:
|
||||||
return "No route to host";
|
return "No route to host";
|
||||||
|
|
||||||
case ENOPROTOOPT:
|
case ENOPROTOOPT:
|
||||||
return "Protocol option not available";
|
return "Protocol option not available";
|
||||||
|
|
||||||
case EINPROGRESS:
|
case EINPROGRESS:
|
||||||
return "Operation now in progress";
|
return "Operation now in progress";
|
||||||
|
|
||||||
case EALREADY:
|
case EALREADY:
|
||||||
return "Operation already in progress";
|
return "Operation already in progress";
|
||||||
|
|
||||||
case EILSEQ:
|
case EILSEQ:
|
||||||
return "Illegal byte sequence";
|
return "Illegal byte sequence";
|
||||||
|
|
||||||
case ENOMSG:
|
case ENOMSG:
|
||||||
return "No message of desired type";
|
return "No message of desired type";
|
||||||
|
|
||||||
case ESTALE:
|
case ESTALE:
|
||||||
return "Stale NFS file handle";
|
return "Stale file handle";
|
||||||
|
|
||||||
case EOVERFLOW:
|
case EOVERFLOW:
|
||||||
return "Value too large for defined type";
|
return "Value too large for defined type";
|
||||||
|
|
||||||
case EMSGSIZE:
|
case EMSGSIZE:
|
||||||
return "Message too long";
|
return "Message too long";
|
||||||
|
|
||||||
case EOPNOTSUPP:
|
case EOPNOTSUPP:
|
||||||
return "Operation not supported";
|
return "Operation not supported";
|
||||||
|
|
||||||
case ENOTSOCK:
|
case ENOTSOCK:
|
||||||
return "Socket operation on non-socket";
|
return "Socket operation on non-socket";
|
||||||
|
|
||||||
case EBADMSG:
|
case EBADMSG:
|
||||||
return "Bad message";
|
return "Bad message";
|
||||||
|
|
||||||
case ECANCELED:
|
case ECANCELED:
|
||||||
return "Operation canceled";
|
return "Operation canceled";
|
||||||
|
|
||||||
case EDESTADDRREQ:
|
case EDESTADDRREQ:
|
||||||
return "Destination address required";
|
return "Destination address required";
|
||||||
|
|
||||||
case EDQUOT:
|
case EDQUOT:
|
||||||
return "Reserved";
|
return "Reserved";
|
||||||
|
|
||||||
case EIDRM:
|
case EIDRM:
|
||||||
return "Identifier removed";
|
return "Identifier removed";
|
||||||
|
|
||||||
case EMULTIHOP:
|
case EMULTIHOP:
|
||||||
return "Reserved";
|
return "Reserved";
|
||||||
|
|
||||||
case ENODATA:
|
case ENODATA:
|
||||||
return "No message available";
|
return "No message available";
|
||||||
|
|
||||||
case ENOLINK:
|
case ENOLINK:
|
||||||
return "Reserved";
|
return "Reserved";
|
||||||
|
|
||||||
case ENOSR:
|
case ENOSR:
|
||||||
return "No STREAM resources";
|
return "No STREAM resources";
|
||||||
|
|
||||||
case ENOSTR:
|
case ENOSTR:
|
||||||
return "Not a STREAM";
|
return "Not a STREAM";
|
||||||
|
|
||||||
case ENOTSUP:
|
case ENOTSUP:
|
||||||
return "Not supported";
|
return "Not supported";
|
||||||
|
|
||||||
case EPROTO:
|
case EPROTO:
|
||||||
return "Protocol error";
|
return "Protocol error";
|
||||||
|
|
||||||
case ETIME:
|
case ETIME:
|
||||||
return "STREAM ioctl() timeout";
|
return "STREAM ioctl() timeout";
|
||||||
|
|
||||||
case ETXTBSY:
|
case ETXTBSY:
|
||||||
return "Text file busy";
|
return "Text file busy";
|
||||||
|
|
||||||
case B_MAIL_NO_DAEMON:
|
|
||||||
return "No mail daemon";
|
|
||||||
|
|
||||||
case B_MAIL_UNKNOWN_USER:
|
|
||||||
return "Unknown mail user";
|
|
||||||
|
|
||||||
case B_MAIL_WRONG_PASSWORD:
|
|
||||||
return "Wrong password (mail)";
|
|
||||||
|
|
||||||
case B_MAIL_UNKNOWN_HOST:
|
|
||||||
return "Mail unknown host";
|
|
||||||
|
|
||||||
case B_MAIL_ACCESS_ERROR:
|
|
||||||
return "Mail access error";
|
|
||||||
|
|
||||||
case B_MAIL_UNKNOWN_FIELD:
|
|
||||||
return "Unknown mail field";
|
|
||||||
|
|
||||||
case B_MAIL_NO_RECIPIENT:
|
|
||||||
return "No mail recipient";
|
|
||||||
|
|
||||||
case B_MAIL_INVALID_MAIL:
|
|
||||||
return "Invaild mail";
|
|
||||||
|
|
||||||
case B_PRINT_ERROR_BASE:
|
|
||||||
// B_NO_PRINT_SERVER
|
|
||||||
return "No print server";
|
|
||||||
|
|
||||||
case B_DEV_INVALID_IOCTL:
|
|
||||||
return "Invalid device ioctl";
|
|
||||||
|
|
||||||
case B_DEV_NO_MEMORY:
|
|
||||||
return "No device memory";
|
|
||||||
|
|
||||||
case B_DEV_BAD_DRIVE_NUM:
|
|
||||||
return "Bad drive number";
|
|
||||||
|
|
||||||
case B_DEV_NO_MEDIA:
|
|
||||||
return "No media present";
|
|
||||||
|
|
||||||
case B_DEV_UNREADABLE:
|
|
||||||
return "Device unreadable";
|
|
||||||
|
|
||||||
case B_DEV_FORMAT_ERROR:
|
|
||||||
return "Device format error";
|
|
||||||
|
|
||||||
case B_DEV_TIMEOUT:
|
|
||||||
return "Device timeout";
|
|
||||||
|
|
||||||
case B_DEV_RECALIBRATE_ERROR:
|
|
||||||
return "Device recalibrate error";
|
|
||||||
|
|
||||||
case B_DEV_SEEK_ERROR:
|
|
||||||
return "Device seek error";
|
|
||||||
|
|
||||||
case B_DEV_ID_ERROR:
|
|
||||||
return "Device ID error";
|
|
||||||
|
|
||||||
case B_DEV_READ_ERROR:
|
|
||||||
return "Device read error";
|
|
||||||
|
|
||||||
case B_DEV_WRITE_ERROR:
|
|
||||||
return "Device write error";
|
|
||||||
|
|
||||||
case B_DEV_NOT_READY:
|
|
||||||
return "Device not ready";
|
|
||||||
|
|
||||||
case B_DEV_MEDIA_CHANGED:
|
|
||||||
return "Device media changed";
|
|
||||||
|
|
||||||
case B_DEV_MEDIA_CHANGE_REQUESTED:
|
|
||||||
return "Device media change requested";
|
|
||||||
|
|
||||||
case B_DEV_RESOURCE_CONFLICT:
|
|
||||||
return "Resource conflict";
|
|
||||||
|
|
||||||
case B_DEV_CONFIGURATION_ERROR:
|
|
||||||
return "Configuration error";
|
|
||||||
|
|
||||||
case B_DEV_DISABLED_BY_USER:
|
|
||||||
return "Disabled by user";
|
|
||||||
|
|
||||||
case B_DEV_DOOR_OPEN:
|
|
||||||
return "Drive door open";
|
|
||||||
|
|
||||||
case B_NOT_A_MESSAGE:
|
|
||||||
return "Data is not a message";
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -533,13 +463,24 @@ error_description(int error)
|
|||||||
char *
|
char *
|
||||||
strerror(int error)
|
strerror(int error)
|
||||||
{
|
{
|
||||||
static char unknown[28];
|
static char unknown[48];
|
||||||
|
const char *system;
|
||||||
|
uint32 i;
|
||||||
|
|
||||||
char *description = error_description(error);
|
char *description = error_description(error);
|
||||||
if (description != NULL)
|
if (description != NULL)
|
||||||
return description;
|
return description;
|
||||||
|
|
||||||
sprintf(unknown, "Unknown Error (%d)", error);
|
system = "";
|
||||||
|
for (i = 0; i < kNumErrorBases; i++) {
|
||||||
|
if (kErrorBases[i].base <= error
|
||||||
|
&& ((i + 1 < kNumErrorBases && kErrorBases[i + 1].base > error)
|
||||||
|
|| i + 1 == kNumErrorBases)) {
|
||||||
|
system = kErrorBases[i].name;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sprintf(unknown, "Unknown %sError (%d)", system, error);
|
||||||
return unknown;
|
return unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user