Began migration of job_t away from halloc

This commit is contained in:
ridiculousfish 2012-01-29 18:25:54 -08:00
parent f243cd86c9
commit 966cd6a8ca
2 changed files with 20 additions and 13 deletions

View file

@ -213,8 +213,7 @@ job_t *job_create()
while( job_get( free_id ) != 0 ) while( job_get( free_id ) != 0 )
free_id++; free_id++;
res = (job_t *)halloc( 0, sizeof(job_t) ); res = new job_t(free_id);
res->job_id = free_id;
job_list().push_front(res); job_list().push_front(res);
job_set_flag( res, job_set_flag( res,

28
proc.h
View file

@ -124,8 +124,9 @@ enum
element, which is the block of commands to execute. element, which is the block of commands to execute.
*/ */
typedef struct process class process_t
{ {
public:
/** /**
Type of process. Can be one of \c EXTERNAL, \c Type of process. Can be one of \c EXTERNAL, \c
INTERNAL_BUILTIN, \c INTERNAL_FUNCTION, \c INTERNAL_BLOCK, INTERNAL_BUILTIN, \c INTERNAL_FUNCTION, \c INTERNAL_BLOCK,
@ -161,15 +162,14 @@ typedef struct process
int count_help_magic; int count_help_magic;
/** next process in pipeline */ /** next process in pipeline */
struct process *next; struct process_t *next;
#ifdef HAVE__PROC_SELF_STAT #ifdef HAVE__PROC_SELF_STAT
/** Last time of cpu time check */ /** Last time of cpu time check */
struct timeval last_time; struct timeval last_time;
/** Number of jiffies spent in process at last cpu time check */ /** Number of jiffies spent in process at last cpu time check */
unsigned long last_jiffies; unsigned long last_jiffies;
#endif #endif
} };
process_t;
/** /**
Constant for the flag variable in the job struct Constant for the flag variable in the job struct
@ -237,6 +237,19 @@ typedef struct process
class job_t class job_t
{ {
public: public:
job_t(int jobid) :
command(NULL),
first_process(NULL),
pgid(0),
tmodes(),
job_id(jobid),
io(NULL),
flags(0)
{
}
/** /**
The original command which led to the creation of this The original command which led to the creation of this
job. It is used for displaying messages about job status job. It is used for displaying messages about job status
@ -268,18 +281,13 @@ class job_t
unique identifier of the job within this shell, and is unique identifier of the job within this shell, and is
used e.g. in process expansion. used e.g. in process expansion.
*/ */
int job_id; const int job_id;
/** /**
List of all IO redirections for this job List of all IO redirections for this job
*/ */
io_data_t *io; io_data_t *io;
/**
A pointer to the next job in the job queue
*/
//struct job *next;
/** /**
Bitset containing information about the job. A combination of the JOB_* constants. Bitset containing information about the job. A combination of the JOB_* constants.
*/ */