version 1.2, 1995/12/14 03:23:31 |
version 1.3, 1996/02/22 22:24:47 |
|
|
/* $NetBSD: job.c,v 1.13 1995/11/22 17:40:09 christos Exp $ */ |
/* $NetBSD: job.c,v 1.14 1996/02/04 22:20:42 christos Exp $ */ |
|
|
/* |
/* |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California. |
|
|
#if 0 |
#if 0 |
static char sccsid[] = "@(#)job.c 5.15 (Berkeley) 3/1/91"; |
static char sccsid[] = "@(#)job.c 5.15 (Berkeley) 3/1/91"; |
#else |
#else |
static char rcsid[] = "$NetBSD: job.c,v 1.13 1995/11/22 17:40:09 christos Exp $"; |
static char rcsid[] = "$NetBSD: job.c,v 1.14 1996/02/04 22:20:42 christos Exp $"; |
#endif |
#endif |
#endif /* not lint */ |
#endif /* not lint */ |
|
|
|
|
#include <sys/wait.h> |
#include <sys/wait.h> |
#include <fcntl.h> |
#include <fcntl.h> |
#include <errno.h> |
#include <errno.h> |
|
#include <utime.h> |
#include <signal.h> |
#include <signal.h> |
#include <stdio.h> |
#include <stdio.h> |
#include <string.h> |
#include <string.h> |
|
|
int signo; /* The signal number we've received */ |
int signo; /* The signal number we've received */ |
{ |
{ |
sigset_t nmask, omask; |
sigset_t nmask, omask; |
|
struct sigaction act; |
|
|
if (DEBUG(JOB)) { |
if (DEBUG(JOB)) { |
(void) fprintf(stdout, "JobPassSig(%d) called.\n", signo); |
(void) fprintf(stdout, "JobPassSig(%d) called.\n", signo); |
|
|
* This ensures that all our jobs get continued when we wake up before |
* This ensures that all our jobs get continued when we wake up before |
* we take any other signal. |
* we take any other signal. |
*/ |
*/ |
sigfillset(&nmask); |
sigemptyset(&nmask); |
(void) sigprocmask(SIG_BLOCK, &nmask, &omask); |
sigaddset(&nmask, signo); |
|
sigprocmask(SIG_SETMASK, &nmask, &omask); |
|
act.sa_handler = SIG_DFL; |
|
sigemptyset(&act.sa_mask); |
|
act.sa_flags = 0; |
|
sigaction(signo, &act, NULL); |
|
|
if (DEBUG(JOB)) { |
if (DEBUG(JOB)) { |
(void) fprintf(stdout, |
(void) fprintf(stdout, |
|
|
Lst_ForEach(jobs, JobCondPassSig, (ClientData) &signo); |
Lst_ForEach(jobs, JobCondPassSig, (ClientData) &signo); |
|
|
(void) sigprocmask(SIG_SETMASK, &omask, NULL); |
(void) sigprocmask(SIG_SETMASK, &omask, NULL); |
(void) signal(signo, JobPassSig); |
sigprocmask(SIG_SETMASK, &omask, NULL); |
|
act.sa_handler = JobPassSig; |
|
sigaction(signo, &act, NULL); |
} |
} |
|
|
/*- |
/*- |
|
|
Boolean silent; /* TRUE if should not print messages */ |
Boolean silent; /* TRUE if should not print messages */ |
{ |
{ |
int streamID; /* ID of stream opened to do the touch */ |
int streamID; /* ID of stream opened to do the touch */ |
struct timeval times[2]; /* Times for utimes() call */ |
struct utimbuf times; /* Times for utime() call */ |
|
|
if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) { |
if (gn->type & (OP_JOIN|OP_USE|OP_EXEC|OP_OPTIONAL)) { |
/* |
/* |
|
|
} else { |
} else { |
char *file = gn->path ? gn->path : gn->name; |
char *file = gn->path ? gn->path : gn->name; |
|
|
times[0].tv_sec = times[1].tv_sec = now; |
times.actime = times.modtime = now; |
times[0].tv_usec = times[1].tv_usec = 0; |
if (utime(file, ×) < 0){ |
if (utimes(file, times) < 0){ |
|
streamID = open(file, O_RDWR | O_CREAT, 0666); |
streamID = open(file, O_RDWR | O_CREAT, 0666); |
|
|
if (streamID >= 0) { |
if (streamID >= 0) { |