Module Name:    src
Committed By:   rillig
Date:           Sat Nov 14 12:38:06 UTC 2020

Modified Files:
        src/usr.bin/make: job.c job.h

Log Message:
make(1): rename JobState to JobStatus

The status is only part of the whole state of a job.


To generate a diff of this commit:
cvs rdiff -u -r1.316 -r1.317 src/usr.bin/make/job.c
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/make/job.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.316 src/usr.bin/make/job.c:1.317
--- src/usr.bin/make/job.c:1.316	Sun Nov  8 15:07:37 2020
+++ src/usr.bin/make/job.c	Sat Nov 14 12:38:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.316 2020/11/08 15:07:37 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.317 2020/11/14 12:38:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.316 2020/11/08 15:07:37 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.317 2020/11/14 12:38:06 rillig Exp $");
 
 /* A shell defines how the commands are run.  All commands for a target are
  * written into a single file, which is then given to the shell to execute
@@ -430,7 +430,7 @@ job_table_dump(const char *where)
     debug_printf("job table @ %s\n", where);
     for (job = job_table; job < job_table_end; job++) {
 	debug_printf("job %d, status %d, flags %d, pid %d\n",
-	    (int)(job - job_table), job->job_state, job->flags, job->pid);
+		     (int)(job - job_table), job->status, job->flags, job->pid);
     }
 }
 
@@ -526,7 +526,7 @@ JobCondPassSig(int signo)
     DEBUG1(JOB, "JobCondPassSig(%d) called.\n", signo);
 
     for (job = job_table; job < job_table_end; job++) {
-	if (job->job_state != JOB_ST_RUNNING)
+	if (job->status != JOB_ST_RUNNING)
 	    continue;
 	DEBUG2(JOB, "JobCondPassSig passing signal %d to child %d.\n",
 	       signo, job->pid);
@@ -633,12 +633,12 @@ JobPassSig_suspend(int signo)
 }
 
 static Job *
-JobFindPid(int pid, JobState status, Boolean isJobs)
+JobFindPid(int pid, JobStatus status, Boolean isJobs)
 {
     Job *job;
 
     for (job = job_table; job < job_table_end; job++) {
-	if ((job->job_state == status) && job->pid == pid)
+	if (job->status == status && job->pid == pid)
 	    return job;
     }
     if (DEBUG(JOB) && isJobs)
@@ -1092,10 +1092,10 @@ JobFinish(Job *job, int status)
 	if (!(job->flags & JOB_SPECIAL))
 	    return_job_token = TRUE;
 	Make_Update(job->node);
-	job->job_state = JOB_ST_FREE;
+	job->status = JOB_ST_FREE;
     } else if (status != 0) {
 	errors++;
-	job->job_state = JOB_ST_FREE;
+	job->status = JOB_ST_FREE;
     }
 
     /*
@@ -1302,7 +1302,7 @@ JobExec(Job *job, char **argv)
     JobSigLock(&mask);
 
     /* Pre-emptively mark job running, pid still zero though */
-    job->job_state = JOB_ST_RUNNING;
+    job->status = JOB_ST_RUNNING;
 
     cpid = vFork();
     if (cpid == -1)
@@ -1497,7 +1497,7 @@ JobStart(GNode *gn, JobFlags flags)
     int tfd;			/* File descriptor to the temp file */
 
     for (job = job_table; job < job_table_end; job++) {
-	if (job->job_state == JOB_ST_FREE)
+	if (job->status == JOB_ST_FREE)
 	    break;
     }
     if (job >= job_table_end)
@@ -1506,7 +1506,7 @@ JobStart(GNode *gn, JobFlags flags)
     memset(job, 0, sizeof *job);
     job->node = gn;
     job->tailCmds = NULL;
-    job->job_state = JOB_ST_SETUP;
+    job->status = JOB_ST_SETUP;
 
     if (gn->type & OP_SPECIAL)
 	flags |= JOB_SPECIAL;
@@ -1646,7 +1646,7 @@ JobStart(GNode *gn, JobFlags flags)
 	    job->node->made = MADE;
 	    Make_Update(job->node);
 	}
-	job->job_state = JOB_ST_FREE;
+	job->status = JOB_ST_FREE;
 	return cmdsOK ? JOB_FINISHED : JOB_ERROR;
     }
 
@@ -1961,7 +1961,7 @@ JobReapChild(pid_t pid, int status, Bool
 	return;
     }
 
-    job->job_state = JOB_ST_FINISHED;
+    job->status = JOB_ST_FINISHED;
     job->exit_status = status;
 
     JobFinish(job, status);
@@ -2016,7 +2016,7 @@ Job_CatchOutput(void)
 	if (!fds[i].revents)
 	    continue;
 	job = jobfds[i];
-	if (job->job_state == JOB_ST_RUNNING)
+	if (job->status == JOB_ST_RUNNING)
 	    JobDoOutput(job, FALSE);
 #if defined(USE_FILEMON) && !defined(USE_FILEMON_DEV)
 	/*
@@ -2458,7 +2458,7 @@ JobInterrupt(int runINTERRUPT, int signo
     JobSigLock(&mask);
 
     for (job = job_table; job < job_table_end; job++) {
-	if (job->job_state != JOB_ST_RUNNING)
+	if (job->status != JOB_ST_RUNNING)
 	    continue;
 
 	gn = job->node;
@@ -2537,7 +2537,7 @@ Job_AbortAll(void)
 
     if (jobTokensRunning) {
 	for (job = job_table; job < job_table_end; job++) {
-	    if (job->job_state != JOB_ST_RUNNING)
+	    if (job->status != JOB_ST_RUNNING)
 		continue;
 	    /*
 	     * kill the child process with increasingly drastic signals to make
@@ -2563,8 +2563,8 @@ JobRestartJobs(void)
     Job *job;
 
     for (job = job_table; job < job_table_end; job++) {
-	if (job->job_state == JOB_ST_RUNNING &&
-		(make_suspended || job->suspended)) {
+	if (job->status == JOB_ST_RUNNING &&
+	    (make_suspended || job->suspended)) {
 	    DEBUG1(JOB, "Restarting stopped job pid %d.\n", job->pid);
 	    if (job->suspended) {
 		    (void)printf("*** [%s] Continued\n", job->node->name);
@@ -2575,7 +2575,7 @@ JobRestartJobs(void)
 		debug_printf("Failed to send SIGCONT to %d\n", job->pid);
 	    }
 	}
-	if (job->job_state == JOB_ST_FINISHED)
+	if (job->status == JOB_ST_FINISHED)
 	    /* Job exit deferred after calling waitpid() in a signal handler */
 	    JobFinish(job, job->exit_status);
     }

Index: src/usr.bin/make/job.h
diff -u src/usr.bin/make/job.h:1.61 src/usr.bin/make/job.h:1.62
--- src/usr.bin/make/job.h:1.61	Sun Nov  8 01:16:04 2020
+++ src/usr.bin/make/job.h	Sat Nov 14 12:38:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.h,v 1.61 2020/11/08 01:16:04 rillig Exp $	*/
+/*	$NetBSD: job.h,v 1.62 2020/11/14 12:38:06 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -117,13 +117,13 @@ struct pollfd;
 # include "meta.h"
 #endif
 
-typedef enum JobState {
+typedef enum JobStatus {
     JOB_ST_FREE =	0,	/* Job is available */
     JOB_ST_SETUP =	1,	/* Job is allocated but otherwise invalid */
     /* XXX: What about the 2? */
     JOB_ST_RUNNING =	3,	/* Job is running, pid valid */
     JOB_ST_FINISHED =	4	/* Job is done (ie after SIGCHILD) */
-} JobState;
+} JobStatus;
 
 typedef enum JobFlags {
     JOB_NONE	= 0,
@@ -167,7 +167,7 @@ typedef struct Job {
 
     int exit_status;		/* from wait4() in signal handler */
 
-    JobState job_state;		/* status of the job entry */
+    JobStatus status;
 
     Boolean suspended;
 

Reply via email to