toaruos/userspace/gui/core/gsession.c

45 lines
1000 B
C
Raw Normal View History

2014-06-09 00:33:59 +04: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) 2013-2014 Kevin Lange
2014-06-09 00:33:59 +04:00
*
* Graphical Session Manager
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <syscall.h>
2013-05-06 02:00:24 +04:00
#include <signal.h>
2014-04-29 11:28:41 +04:00
#include <errno.h>
#include <sys/wait.h>
int main(int argc, char * argv[]) {
/* Starts a graphical session and then spins waiting for a kill (logout) signal */
int _wallpaper_pid = fork();
if (!_wallpaper_pid) {
char * args[] = {"/bin/wallpaper", NULL};
execvp(args[0], args);
}
int _panel_pid = fork();
if (!_panel_pid) {
char * args[] = {"/bin/panel", NULL};
execvp(args[0], args);
}
2014-04-22 06:46:38 +04:00
int _toastd_pid = fork();
if (!_toastd_pid) {
char * args[] = {"/bin/toastd", NULL};
execvp(args[0], args);
}
wait(NULL);
2014-04-29 11:28:41 +04:00
int pid;
do {
pid = waitpid(-1, NULL, 0);
} while ((pid > 0) || (pid == -1 && errno == EINTR));
return 0;
}