View of xos/usr/xsh/jobs.h


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
#ifndef JOB_H
#define JOB_H
 
#include <sys/types.h>
 
enum {RF_NORMAL, RF_LONG, RF_ONLY_LEADER};
 
struct running_pipeline_struct {
  int foreground;
  struct proc_struct *first_proc;
  struct proc_struct *last_proc;
  pid_t pgid;
};
 
struct job_struct;
 
void init_job_control();
void end_job_control();
 
void init_running_pipeline(struct running_pipeline_struct *running_pipeline, int foreground);
pid_t make_child(struct running_pipeline_struct *running_pipeline, char *command);
int start_job(struct running_pipeline_struct *running_pipeline);
void kill_running_pipeline(struct running_pipeline_struct *running_pipeline);
int exit_pseudo_job(int exit_status);
 
struct job_struct *get_job(int n);
struct job_struct *get_current_job();
struct job_struct *get_previous_job();
struct job_struct *get_job_by_pid(pid_t pid);
 
void display_job(struct job_struct *job, int format);
void display_jobs(int format);
void display_unreported_jobs();
 
int run_job_in_foreground(struct job_struct *job, int *status);
int run_job_in_background(struct job_struct *job);
int kill_job(struct job_struct *job, int sig);
void wait_job(struct job_struct *job, int *status);
void wait_jobs();
 
#endif