Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- byte lart_init_runtime(){
- int host_pipes[2];
- int remote_pipes[2];
- pipe(host_pipes);
- pipe(remote_pipes);
- lart()->mpid = getpid();
- pid_t pid = fork();
- if (pid==0){
- /* system ui */
- lart()->spid = getpid();
- lart()->rfd = remote_pipes[0];
- lart()->wfd = host_pipes[1];
- close(remote_pipes[1]);
- close(host_pipes[0]);
- return 2; /* sysui process */
- }
- else if (pid){
- lart()->spid = pid;
- lart()->rfd = host_pipes[0];
- lart()->wfd = remote_pipes[1];
- close(host_pipes[1]);
- close(remote_pipes[0]);
- return 1; /* manager process */
- }
- return 0; /* failed */
- }
Advertisement
Add Comment
Please, Sign In to add comment