bug-make
[Top][All Lists]
Advanced

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

[PATCH] Use pid_t to store PIDs instead of int. (a better version)


From: Aron Barath
Subject: [PATCH] Use pid_t to store PIDs instead of int. (a better version)
Date: Mon, 9 Jul 2018 07:31:25 +0200

---
 src/commands.c     |  2 +-
 src/job.c          | 15 ++++++++-------
 src/job.h          |  2 +-
 src/main.c         |  2 +-
 src/makeint.h      |  2 +-
 src/remote-cstms.c |  4 ++--
 src/remote-stub.c  |  2 +-
 7 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/src/commands.c b/src/commands.c
index fbf5714..49cd5e0 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -32,7 +32,7 @@ this program.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #ifndef HAVE_UNISTD_H
-int getpid ();
+pid_t getpid ();
 #endif
 
 
diff --git a/src/job.c b/src/job.c
index 88539e8..47ce73d 100644
--- a/src/job.c
+++ b/src/job.c
@@ -1379,7 +1379,8 @@ start_job_command (struct child *child)
   /* start_waiting_job has set CHILD->remote if we can start a remote job.  */
   if (child->remote)
     {
-      int is_remote, id, used_stdin;
+      int is_remote, used_stdin;
+      pid_t id;
       if (start_remote_job (argv, child->environment,
                             child->good_stdin ? 0 : get_bad_stdin (),
                             &is_remote, &id, &used_stdin))
@@ -2133,10 +2134,10 @@ start_waiting_jobs (void)
 
 /* EMX: Start a child process. This function returns the new pid.  */
 # if defined __EMX__
-int
+pid_t
 child_execute_job (struct output *out, int good_stdin, char **argv, char 
**envp)
 {
-  int pid;
+  pid_t pid;
   int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
   int fdout = FD_STDOUT;
   int fderr = FD_STDERR;
@@ -2231,14 +2232,14 @@ child_execute_job (struct output *out, int good_stdin, 
char **argv, char **envp)
 /* POSIX:
    Create a child process executing the command in ARGV.
    ENVP is the environment of the new program.  Returns the PID or -1.  */
-int
+pid_t
 child_execute_job (struct output *out, int good_stdin, char **argv, char 
**envp)
 {
   const int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
   int fdout = FD_STDOUT;
   int fderr = FD_STDERR;
   int r;
-  int pid;
+  pid_t pid;
 
   /* Divert child output if we want to capture it.  */
   if (out && out->syncout)
@@ -2283,7 +2284,7 @@ child_execute_job (struct output *out, int good_stdin, 
char **argv, char **envp)
 
 /* EMX: This function returns the pid of the child process.  */
 # ifdef __EMX__
-int
+pid_t
 # else
 void
 # endif
@@ -2359,7 +2360,7 @@ exec_command (char **argv, char **envp)
 #else  /* !WINDOWS32 */
 
 # ifdef __EMX__
-  int pid;
+  pid_t pid;
 # endif
 
   /* Be the user, permanently.  */
diff --git a/src/job.h b/src/job.h
index 3bd2385..afd9d8d 100644
--- a/src/job.h
+++ b/src/job.h
@@ -62,7 +62,7 @@ char **construct_command_argv (char *line, char **restp, 
struct file *file,
 #ifdef VMS
 int child_execute_job (struct child *child, char *argv);
 #else
-int child_execute_job (struct output *out, int good_stdin, char **argv, char 
**envp);
+pid_t child_execute_job (struct output *out, int good_stdin, char **argv, char 
**envp);
 #endif
 
 #ifdef _AMIGA
diff --git a/src/main.c b/src/main.c
index 31b7eac..eed4e81 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2472,7 +2472,7 @@ main (int argc, char **argv, char **envp)
                Therefore it may be the best solution simply to spawn the
                child process including all file handles and to wait for its
                termination. */
-            int pid;
+            pid_t pid;
             int r;
             pid = child_execute_job (NULL, 1, nargv, environ);
 
diff --git a/src/makeint.h b/src/makeint.h
index fab20fa..79b286c 100644
--- a/src/makeint.h
+++ b/src/makeint.h
@@ -707,7 +707,7 @@ vms_restore_symbol (const char *string);
 void remote_setup (void);
 void remote_cleanup (void);
 int start_remote_job_p (int);
-int start_remote_job (char **, char **, int, int *, int *, int *);
+int start_remote_job (char **, char **, int, int *, pid_t *, int *);
 int remote_status (int *, int *, int *, int);
 void block_remote_children (void);
 void unblock_remote_children (void);
diff --git a/src/remote-cstms.c b/src/remote-cstms.c
index a123380..53535b5 100644
--- a/src/remote-cstms.c
+++ b/src/remote-cstms.c
@@ -136,7 +136,7 @@ start_remote_job_p (int first_p)
 
 int
 start_remote_job (char **argv, char **envp, int stdin_fd,
-                  int *is_remote, int *id_ptr, int *used_stdin)
+                  int *is_remote, pid_t *id_ptr, int *used_stdin)
 {
   char waybill[MAX_DATA_SIZE], msg[128];
   struct hostent *host;
@@ -145,7 +145,7 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
   int len;
   int retsock, retport, sock;
   Rpc_Stat status;
-  int pid;
+  pid_t pid;
 
   /* Create the return socket.  */
   retsock = Rpc_UdpCreate (True, 0);
diff --git a/src/remote-stub.c b/src/remote-stub.c
index d63b816..7a51730 100644
--- a/src/remote-stub.c
+++ b/src/remote-stub.c
@@ -53,7 +53,7 @@ start_remote_job_p (int first_p UNUSED)
 
 int
 start_remote_job (char **argv UNUSED, char **envp UNUSED, int stdin_fd UNUSED,
-                  int *is_remote UNUSED, int *id_ptr UNUSED,
+                  int *is_remote UNUSED, pid_t *id_ptr UNUSED,
                   int *used_stdin UNUSED)
 {
   return -1;
-- 
2.18.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]