1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:17:34 +00:00

Implement errno in LibC.

This also meant I had to implement BSS (SHT_NOBITS) sections in ELFLoader.
I also added an strerror() so we can print out what the errors are.
This commit is contained in:
Andreas Kling 2018-10-25 12:06:00 +02:00
parent 434b6a8688
commit 260b14e505
14 changed files with 209 additions and 27 deletions

View file

@ -1,6 +1,8 @@
#include <LibC/stdio.h>
#include <LibC/unistd.h>
#include <LibC/process.h>
#include <LibC/errno.h>
#include <LibC/string.h>
static void prompt()
{
@ -12,12 +14,14 @@ static void prompt()
static int runcmd(char* cmd)
{
if (cmd[0] == 0)
return 0;
//printf("command: '%s'\n", cmd);
char buf[128];
sprintf(buf, "/bin/%s", cmd);
int ret = spawn(buf);
if (ret == -1) {
printf("spawn failed: %s\n", cmd);
printf("spawn failed: %s (%s)\n", cmd, strerror(errno));
return 1;
}
waitpid(ret);