aboutsummaryrefslogtreecommitdiffhomepage
path: root/proc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'proc.cpp')
-rw-r--r--proc.cpp55
1 files changed, 50 insertions, 5 deletions
diff --git a/proc.cpp b/proc.cpp
index 7de06af5..fe4b9dda 100644
--- a/proc.cpp
+++ b/proc.cpp
@@ -491,6 +491,51 @@ static void handle_child_status( pid_t pid, int status )
return;
}
+process_t::process_t() :
+ argv_array(),
+ argv0_narrow(),
+ type(0),
+ actual_cmd(),
+ pid(0),
+ pipe_write_fd(0),
+ pipe_read_fd(0),
+ completed(0),
+ stopped(0),
+ status(0),
+ count_help_magic(0),
+ next(NULL)
+#ifdef HAVE__PROC_SELF_STAT
+ ,last_time(),
+ last_jiffies(0)
+#endif
+{
+}
+
+process_t::~process_t()
+{
+ if (this->next != NULL)
+ delete this->next;
+}
+
+job_t::job_t(job_id_t jobid) :
+ command_str(),
+ command_narrow(),
+ first_process(NULL),
+ pgid(0),
+ tmodes(),
+ job_id(jobid),
+ io(),
+ flags(0)
+{
+}
+
+job_t::~job_t()
+{
+ if (first_process != NULL)
+ delete first_process;
+ io_chain_destroy(this->io);
+ release_job_id(job_id);
+}
/* This is called from a signal handler */
void job_handle_signal ( int signal, siginfo_t *info, void *con )
@@ -808,12 +853,12 @@ static int select_try( job_t *j )
{
fd_set fds;
int maxfd=-1;
- io_data_t *d;
FD_ZERO(&fds);
- for( d = j->io; d; d=d->next )
+ for (size_t idx = 0; idx < j->io.size(); idx++)
{
+ const io_data_t *d = j->io.at(idx);
if( d->io_mode == IO_BUFFER )
{
int fd = d->param1.pipe_fd[0];
@@ -846,14 +891,14 @@ static int select_try( job_t *j )
*/
static void read_try( job_t *j )
{
- io_data_t *d, *buff=0;
+ io_data_t *buff=NULL;
/*
Find the last buffer, which is the one we want to read from
*/
- for( d = j->io; d; d=d->next )
+ for (size_t idx = 0; idx < j->io.size(); idx++)
{
-
+ io_data_t *d = j->io.at(idx);
if( d->io_mode == IO_BUFFER )
{
buff=d;