2023-07-10 19:39:22 +00:00
|
|
|
#include <bits/signal.h>
|
2023-01-06 16:35:07 +00:00
|
|
|
#include <luna/SystemError.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2023-03-12 09:45:21 +00:00
|
|
|
// All other string functions are defined in luna/CString.cpp, so the same definitions can be used by both kernel
|
|
|
|
// and userspace.
|
2023-01-06 16:35:07 +00:00
|
|
|
|
2023-05-02 08:46:18 +00:00
|
|
|
extern "C++" const char* error_string(int);
|
|
|
|
|
2023-08-08 12:40:14 +00:00
|
|
|
int strcoll(const char* a, const char* b)
|
|
|
|
{
|
|
|
|
// In the POSIX or C locales strcoll() is equivalent to strcmp().
|
|
|
|
return strcmp(a, b);
|
|
|
|
}
|
|
|
|
|
2023-01-06 16:35:07 +00:00
|
|
|
char* strerror(int errnum)
|
|
|
|
{
|
|
|
|
return const_cast<char*>(error_string(errnum));
|
|
|
|
}
|
2023-07-10 19:39:22 +00:00
|
|
|
|
|
|
|
static const char* __internal_strsignal(int signo)
|
|
|
|
{
|
|
|
|
switch (signo)
|
|
|
|
{
|
|
|
|
case SIGHUP: return "Hangup";
|
|
|
|
case SIGINT: return "Terminal interrupt";
|
|
|
|
case SIGQUIT: return "Terminal quit";
|
|
|
|
case SIGILL: return "Invalid opcode";
|
|
|
|
case SIGTRAP: return "Breakpoint trap";
|
|
|
|
case SIGABRT: return "Aborted";
|
|
|
|
case SIGCHLD: return "Child stopped or exited";
|
|
|
|
case SIGFPE: return "Floating point exception";
|
|
|
|
case SIGKILL: return "Killed";
|
|
|
|
case SIGSTOP: return "Stopped";
|
|
|
|
case SIGSEGV: return "Segmentation fault";
|
|
|
|
case SIGCONT: return "Continued";
|
|
|
|
case SIGPIPE: return "Broken pipe";
|
|
|
|
case SIGALRM: return "Alarm signal";
|
|
|
|
case SIGTERM: return "Terminated";
|
2023-07-12 11:45:36 +00:00
|
|
|
case SIGTTIN: return "Background process stopped (terminal input)";
|
|
|
|
case SIGTTOU: return "Background process stopped (terminal output)";
|
2023-07-10 19:39:22 +00:00
|
|
|
default: return "Unknown signal";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char* strsignal(int signo)
|
|
|
|
{
|
|
|
|
return const_cast<char*>(__internal_strsignal(signo));
|
|
|
|
}
|
2023-01-06 16:35:07 +00:00
|
|
|
}
|