/* deletejob - Delete a job whose PID=pid from the job list */ int deletejob(struct job_t *jobs, pid_t pid) { int i; if (pid < 1) return 0; for (i = 0; i < MAXJOBS; i++) { if (jobs[i].pid == pid) { clearjob(&jobs[i]); nextjid = maxjid(jobs)+1; return 1; } } return 0; }
/* * Requires: * "jobs" points to an array of MAXJOBS job structures. * * Effects: * Deletes a job from the jobs list whose PID equals "pid". */ static int deletejob(JobP jobs, pid_t pid) { int i; if (pid < 1) return (0); for (i = 0; i < MAXJOBS; i++) { if (jobs[i].pid == pid) { clearjob(&jobs[i]); nextjid = maxjid(jobs) + 1; return (1); } } return (0); }
/* deletejob - Delete a job whose PID=pid from the job list */ int deletejob(struct job_t *job_list, pid_t pid) { int i; //fprintf(stderr, "try to delete job:%d\n", pid); if (pid < 1) return 0; for (i = 0; i < MAXJOBS; i++) { if (job_list[i].pid == pid) { clearjob(&job_list[i]); nextjid = maxjid(job_list)+1; return 1; } } return 0; }
/* deletejob - Delete a job whose PID=pid from the job list */ int deletejob(struct job_t *jobs, pid_t pid) { int i; //printf("here in delete job \n" ); if (pid < 1) return 0; for (i = 0; i < MAXJOBS; i++) { if (jobs[i].pid == pid) { clearjob(&jobs[i]); nextjid = maxjid(jobs)+1; // printf("job found\n"); return 1; } } return 0; }
/* initjobs - Initialize the job list */ void initjobs(struct job_t *jobs) { int i; for (i = 0; i < MAXJOBS; i++) clearjob(&jobs[i]); }
//function used to initialize the job list void initjobs(struct job_t *job_list){ int i; for(i=0;i<20;i++){ clearjob(&job_list[i]); } }