24typedef enum { JOB_RUNNING, JOB_STOPPED, JOB_DONE }
JobStatus;
58int jobs_add(pid_t pgid,
const char* cmdline,
int is_background);
void jobs_set_background(pid_t pgid, int is_bg)
Set the background of a job.
Definition jobs.c:226
const char * jobs_get_cmdline(int job_id)
Get the cmdline of a job.
Definition jobs.c:217
void jobs_reap_done_and_print(void)
Reap done jobs and print them.
Definition jobs.c:155
int jobs_add(pid_t pgid, const char *cmdline, int is_background)
Add a job to the job table.
Definition jobs.c:43
JobStatus
Represents the status of a job.
Definition jobs.h:24
void jobs_mark(pid_t pgid, JobStatus status)
Mark a job as running or stopped.
Definition jobs.c:76
struct Job Job
Represents a job.
int jobs_pick_most_recent_stopped_for_bg(void)
Pick the most recent stopped job for background.
Definition jobs.c:133
int jobs_pick_most_recent_for_fg(void)
Pick the most recent job for foreground.
Definition jobs.c:120
void jobs_print_one(int job_id)
Print a single job.
Definition jobs.c:197
pid_t jobs_get_pgid(int job_id)
Get the pgid of a job.
Definition jobs.c:145
void jobs_init(void)
Initialize the job table.
Definition jobs.c:29
void jobs_print()
Print all jobs.
Definition jobs.c:85
Represents a job.
Definition jobs.h:33
pid_t pgid
Process group ID.
Definition jobs.h:35
int is_background
Background flag: 0 = fg/stopped-in-fg; 1 = running in bg or bg'ed.
Definition jobs.h:38
int id
Job ID number.
Definition jobs.h:34
JobStatus status
Current job status.
Definition jobs.h:37
char cmdline[MAX_CMDLINE]
Command line string.
Definition jobs.h:36
Core data structures and constants.
#define MAX_CMDLINE
Maximum command line length including null terminator.
Definition yash.h:25