Add a display server and graphical user interface #38
3
base/etc/user/00-gclient
Normal file
3
base/etc/user/00-gclient
Normal file
@ -0,0 +1,3 @@
|
||||
Name=gclient
|
||||
Description=Sample user application.
|
||||
Command=/usr/bin/gclient
|
@ -7,6 +7,7 @@
|
||||
#include <os/File.h>
|
||||
#include <os/LocalServer.h>
|
||||
#include <os/Process.h>
|
||||
#include <os/Security.h>
|
||||
#include <pwd.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -19,6 +20,8 @@ Result<int> luna_main(int argc, char** argv)
|
||||
{
|
||||
srand((unsigned)time(NULL));
|
||||
|
||||
TRY(os::Security::pledge("stdio rpath wpath cpath unix proc exec tty id", NULL));
|
||||
|
||||
StringView socket_path = "/tmp/wind.sock";
|
||||
StringView user;
|
||||
|
||||
@ -74,8 +77,8 @@ Result<int> luna_main(int argc, char** argv)
|
||||
auto server = TRY(os::LocalServer::create(socket_path, false));
|
||||
TRY(server->listen(20));
|
||||
|
||||
StringView args[] = { "/usr/bin/gclient"_sv };
|
||||
TRY(os::Process::spawn("/usr/bin/gclient"_sv, Slice<StringView> { args, 1 }, false));
|
||||
StringView args[] = { "/usr/bin/init"_sv, "--user"_sv };
|
||||
TRY(os::Process::spawn("/usr/bin/init"_sv, Slice<StringView> { args, 2 }, false));
|
||||
|
||||
ui::Color background = ui::BLACK;
|
||||
|
||||
@ -85,6 +88,8 @@ Result<int> luna_main(int argc, char** argv)
|
||||
|
||||
Vector<os::LocalServer::Client> clients;
|
||||
|
||||
TRY(os::Security::pledge("stdio rpath unix", NULL));
|
||||
|
||||
while (1)
|
||||
{
|
||||
screen.canvas().fill(background);
|
||||
|
Loading…
Reference in New Issue
Block a user