myshell 2.0.0
Loading...
Searching...
No Matches
msh_jobs.h
1//
2// Created by andrew on 11/8/23.
3//
4
5#ifndef MYSHELL_MSH_JOBS_H
6#define MYSHELL_MSH_JOBS_H
7
16#include "types/msh_process.h"
17
18#include <map>
19#include <sstream>
20
21struct process;
22extern std::map<pid_t, process> processes;
23
24void init_job_control();
25
26void sigchld_handler(int);
27
28int wait_for_process(pid_t pid, int *status);
29
30int reap_children();
31
33
34void print_processes();
35
37
38void update_jobs();
39
40void add_process(pid_t pid, int flags, const std::vector<std::string> &args);
41
42void remove_process(pid_t pid);
43
44void set_process_status(pid_t pid, status_t status);
45
46
47#endif //MYSHELL_MSH_JOBS_H
std::map< pid_t, process > processes
The internal process table.
Definition msh_jobs.cpp:30
void remove_process(pid_t pid)
Remove a process from the internal process table.
Definition msh_jobs.cpp:208
void init_job_control()
Initialize job control.
Definition msh_jobs.cpp:40
void add_process(pid_t pid, int flags, const std::vector< std::string > &args)
Add a process to the internal process table.
Definition msh_jobs.cpp:199
int wait_for_process(pid_t pid, int *status)
Wait for the process to finish.
Definition msh_jobs.cpp:88
int no_background_processes()
Return the number of currently running background processes.
Definition msh_jobs.cpp:130
void update_jobs()
Update the internal process table.
Definition msh_jobs.cpp:185
void print_completed_processes()
Print all completed background processes.
Definition msh_jobs.cpp:165
int reap_children()
Wait for all background processes to finish.
Definition msh_jobs.cpp:114
void sigchld_handler(int)
SIGCHLD handler.
Definition msh_jobs.cpp:61
void print_processes()
Print all internal processes.
Definition msh_jobs.cpp:143
void set_process_status(pid_t pid, status_t status)
Change the status of a process in the internal process table.
Definition msh_jobs.cpp:218
Information about an internal process.
Definition msh_process.h:24