Example #1
0
static void spawn_job(struct kvvec *kvv)
{
	int result;
	child_process *cp;

	if (!kvv) {
		wlog("Received NULL command key/value vector. Bug in iocache.c or kvvec.c?");
		return;
	}

	cp = parse_command_kvvec(kvv);
	if (!cp) {
		job_error(NULL, kvv, "Failed to parse worker-command");
		return;
	}
	if (!cp->cmd) {
		job_error(cp, kvv, "Failed to parse commandline. Ignoring job %u", cp->id);
		return;
	}

	result = fd_start_cmd(cp);
	if (result < 0) {
		job_error(cp, kvv, "Failed to start child");
		return;
	}

	started++;
	running_jobs++;
	cp->request = kvv;
	cp->sq_event = squeue_add(sq, cp->timeout + time(NULL), cp);
}
Example #2
0
File: jobs.c Project: Fusiow/msh
void		fg_bg(t_jobs *jobs, char **tab, int k)
{
	int		pid;
	int		ret;

	ret = 0;
	pid = 0;
	if (jobs == NULL)
	{
		job_error(k);
		return ;
	}
	if (tab[1])
	{
		if (is_digit(tab[1]) == 0)
		{
			pid_error(tab[1]);
			return ;
		}
	}
	else
		pid = find_pid(g_jobs);
	job_continued(jobs->job, jobs->name);
	kill(pid, SIGCONT);
	waitpid(pid, &ret, WUNTRACED);
	check_return(ret, pid);
}
Example #3
0
void Xmpp_client::file_received (QXmppTransferJob *job)
{
    qDebug() << "Xmpp_client::file_received";
    qDebug() << "Got transfer request from:" << job->jid();


    bool check = connect(job, SIGNAL(error(QXmppTransferJob::Error)), this, SLOT(job_error(QXmppTransferJob::Error)));
    Q_ASSERT(check);

    check = connect(job, SIGNAL(finished()), this, SLOT(job_finished()));
    Q_ASSERT(check);

    check = connect(job, SIGNAL(progress(qint64,qint64)), this, SLOT(job_progress(qint64,qint64)));
    Q_ASSERT(check);



    // allocate a buffer to receive the file
    m_buffer = new QBuffer(this);
    m_buffer->open(QIODevice::WriteOnly);
    job->accept(m_buffer);
}