1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:17:36 +00:00

Add SpinLock to IDE disk access.

This forces serialization of accesses. This driver needs to be redesigned.
This commit is contained in:
Andreas Kling 2018-10-31 21:31:56 +01:00
parent dec5683e9c
commit 8f6998c902
7 changed files with 57 additions and 13 deletions

View file

@ -5,10 +5,12 @@
#include <LibC/string.h>
#include <LibC/stdlib.h>
#include <LibC/utsname.h>
#include <LibC/pwd.h>
#include <AK/FileSystemPath.h>
struct GlobalState {
String cwd;
String username;
char ttyname[32];
char hostname[32];
};
@ -19,7 +21,7 @@ static void prompt()
if (getuid() == 0)
printf("# ");
else
printf("\033[31;1m%s\033[0m:\033[37;1m%s\033[0m:\033[32;1m%s\033[0m$> ", g->ttyname, g->hostname, g->cwd.characters());
printf("\033[31;1m%s\033[0m@\033[37;1m%s\033[0m:\033[32;1m%s\033[0m$> ", g->username.characters(), g->hostname, g->cwd.characters());
}
static int sh_pwd(int, const char**)
@ -170,6 +172,12 @@ int main(int, char**)
rc = ttyname_r(0, g->ttyname, sizeof(g->ttyname));
if (rc < 0)
perror("ttyname_r");
{
auto* pw = getpwuid(getuid());
if (pw)
g->username = pw->pw_name;
endpwent();
}
greeting();