toaruos/apps/session.c

40 lines
880 B
C
Raw Normal View History

2018-08-14 11:13:38 +03:00
/* vim: tabstop=4 shiftwidth=4 noexpandtab
* This file is part of ToaruOS and is released under the terms
* of the NCSA / University of Illinois License - see LICENSE.md
* Copyright (C) 2018 K. Lange
*
* session - UI session manager
*
* Runs a background and panel for a single user and waits
* for them to exit.
*/
2018-02-25 11:14:43 +03:00
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <errno.h>
#include <sys/wait.h>
int main(int argc, char * argv[]) {
int _background_pid = fork();
if (!_background_pid) {
char * args[] = {"/bin/background", "--really", NULL};
2018-02-25 11:14:43 +03:00
execvp(args[0], args);
}
2018-04-17 14:03:19 +03:00
int _panel_pid = fork();
if (!_panel_pid) {
char * args[] = {"/bin/panel", "--really", NULL};
2018-04-17 14:03:19 +03:00
execvp(args[0], args);
}
2018-02-25 11:14:43 +03:00
wait(NULL);
int pid;
do {
pid = waitpid(-1, NULL, 0);
} while ((pid > 0) || (pid == -1 && errno == EINTR));
return 0;
}