previous | start | next

Job List

The job list is implemented as an array, jobs, of entries.

Each entry is a C type: struct job_t give by

struct job_t {              /* The job struct */
    pid_t pid;              /* job PID */
    int jid;                /* job ID [1, 2, ...] */
    int state;              /* UNDEF, BG, FG, or ST */
    char cmdline[MAXLINE];  /* command line */
};
struct job_t jobs[MAXJOBS]; /* The job list */
     

(The UNDEF state means the entry in the array is free.)

The jobs array is global variable and so can be referenced from any function you write.



previous | start | next