Kernel, libc: Add ENOEXEC (Exec format error)

This commit is contained in:
apio 2022-10-12 19:15:44 +02:00
parent ea886f58a0
commit 4091799701
5 changed files with 5 additions and 2 deletions

View File

@ -123,7 +123,7 @@ int main()
sleep(2);
if (execv("/bin/sym", NULL) < 0)
if (execv("/sys/config", NULL) < 0)
{
perror("execv");
return 1;

View File

@ -2,6 +2,7 @@
#define EPERM 1
#define ENOENT 2
#define ENOEXEC 8
#define EBADF 9
#define ENOMEM 12
#define EISDIR 21

View File

@ -34,7 +34,7 @@ void sys_exec(Context* context, const char* pathname)
if (ELFLoader::check_elf_image(program) < 0)
{
context->rax = -EINVAL; // FIXME: Should be ENOEXEC.
context->rax = -ENOEXEC;
return;
}

View File

@ -6,6 +6,7 @@ extern int errno;
#define EPERM 1 // Operation not permitted
#define ENOENT 2 // No such file or directory
#define ENOEXEC 8 // Exec format error
#define EBADF 9 // Bad file descriptor
#define ENOMEM 12 // Cannot allocate memory
#define EISDIR 21 // Is a directory

View File

@ -127,6 +127,7 @@ extern "C"
case EBADF: return "Bad file descriptor";
case EMFILE: return "Too many open files";
case EISDIR: return "Is a directory";
case ENOEXEC: return "Exec format error";
case 0: return "Success";
default: return (char*)(unsigned long int)err;
}