Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): rename JobState to JobStatus



details:   https://anonhg.NetBSD.org/src/rev/ab9f7cebd910
branches:  trunk
changeset: 957006:ab9f7cebd910
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 14 12:38:06 2020 +0000

description:
make(1): rename JobState to JobStatus

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

diffstat:

 usr.bin/make/job.c |  38 +++++++++++++++++++-------------------
 usr.bin/make/job.h |   8 ++++----
 2 files changed, 23 insertions(+), 23 deletions(-)

diffs (190 lines):

diff -r def823bfe97f -r ab9f7cebd910 usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sat Nov 14 12:36:49 2020 +0000
+++ b/usr.bin/make/job.c        Sat Nov 14 12:38:06 2020 +0000
@@ -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 @@
     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 @@
     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 @@
 }
 
 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 @@
        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 @@
     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 @@
     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 @@
     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 @@
            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 @@
        return;
     }
 
-    job->job_state = JOB_ST_FINISHED;
+    job->status = JOB_ST_FINISHED;
     job->exit_status = status;
 
     JobFinish(job, status);
@@ -2016,7 +2016,7 @@
        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 @@
     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 @@
 
     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 @@
     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 @@
                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);
     }
diff -r def823bfe97f -r ab9f7cebd910 usr.bin/make/job.h
--- a/usr.bin/make/job.h        Sat Nov 14 12:36:49 2020 +0000
+++ b/usr.bin/make/job.h        Sat Nov 14 12:38:06 2020 +0000
@@ -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 @@
 # 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 @@
 
     int exit_status;           /* from wait4() in signal handler */
 
-    JobState job_state;                /* status of the job entry */
+    JobStatus status;
 
     Boolean suspended;
 



Home | Main Index | Thread Index | Old Index