VirtualBox

Changeset 3140 in kBuild for trunk/src/kmk/job.h


Ignore:
Timestamp:
Mar 14, 2018 9:28:10 PM (7 years ago)
Author:
bird
Message:

kmk: Merged in changes from GNU make 4.2.1 (2e55f5e4abdc0e38c1d64be703b446695e70b3b6 / https://git.savannah.gnu.org/git/make.git).

Location:
trunk/src/kmk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk

  • trunk/src/kmk/job.h

    r2591 r3140  
    11/* Definitions for managing subprocesses in GNU Make.
    2 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
    3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
    4 Foundation, Inc.
     2Copyright (C) 1992-2016 Free Software Foundation, Inc.
    53This file is part of GNU Make.
    64
     
    1715this program.  If not, see <http://www.gnu.org/licenses/>.  */
    1816
    19 #ifndef SEEN_JOB_H
    20 #define SEEN_JOB_H
     17#include "output.h"
    2118
    2219#ifdef HAVE_FCNTL_H
     
    2825/* How to set close-on-exec for a file descriptor.  */
    2926
    30 #if !defined F_SETFD
    31 # define CLOSE_ON_EXEC(_d)
     27#if !defined(F_SETFD) || !defined(F_GETFD)
     28# ifdef WINDOWS32
     29#  define CLOSE_ON_EXEC(_d)  process_noinherit(_d)
     30# else
     31#  define CLOSE_ON_EXEC(_d)
     32# endif
    3233#else
    3334# ifndef FD_CLOEXEC
     
    3738#endif
    3839
     40#ifdef NO_OUTPUT_SYNC
     41# define RECORD_SYNC_MUTEX(m) \
     42    O (error, NILF,                                                    \
     43       _("-O[TYPE] (--output-sync[=TYPE]) is not configured for this build."));
     44#else
     45# ifdef WINDOWS32
     46/* For emulations in w32/compat/posixfcn.c.  */
     47#  define F_GETFD 1
     48#  define F_SETLKW 2
     49/* Implementation note: None of the values of l_type below can be zero
     50   -- they are compared with a static instance of the struct, so zero
     51   means unknown/invalid, see w32/compat/posixfcn.c. */
     52#  define F_WRLCK 1
     53#  define F_UNLCK 2
     54
     55struct flock
     56  {
     57    short l_type;
     58    short l_whence;
     59    off_t l_start;
     60    off_t l_len;
     61    pid_t l_pid;
     62  };
     63
     64/* This type is actually a HANDLE, but we want to avoid including
     65   windows.h as much as possible.  */
     66typedef intptr_t sync_handle_t;
     67
     68/* Public functions emulated/provided in posixfcn.c.  */
     69int fcntl (intptr_t fd, int cmd, ...);
     70intptr_t create_mutex (void);
     71int same_stream (FILE *f1, FILE *f2);
     72
     73#  define RECORD_SYNC_MUTEX(m) record_sync_mutex(m)
     74void record_sync_mutex (const char *str);
     75void prepare_mutex_handle_string (intptr_t hdl);
     76# else  /* !WINDOWS32 */
     77
     78typedef int sync_handle_t;      /* file descriptor */
     79
     80#  define RECORD_SYNC_MUTEX(m) (void)(m)
     81
     82# endif
     83#endif  /* !NO_OUTPUT_SYNC */
     84
    3985/* Structure describing a running or dead child process.  */
    4086
    4187struct child
    4288  {
    43     struct child *next;         /* Link in the chain.  */
     89    struct child *next;         /* Link in the chain.  */
    4490
    45     struct file *file;          /* File being remade.  */
     91    struct file *file;          /* File being remade.  */
    4692
    47     char **environment;         /* Environment for commands.  */
     93    char **environment;         /* Environment for commands.  */
     94    char *sh_batch_file;        /* Script file for shell commands */
     95    char **command_lines;       /* Array of variable-expanded cmd lines.  */
     96    char *command_ptr;          /* Ptr into command_lines[command_line].  */
    4897
    49     char **command_lines;       /* Array of variable-expanded cmd lines.  */
    50     unsigned int command_line;  /* Index into above.  */
    51     char *command_ptr;          /* Ptr into command_lines[command_line].  */
     98#ifdef VMS
     99    char *comname;              /* Temporary command file name */
     100    int efn;                    /* Completion event flag number */
     101    int cstatus;                /* Completion status */
     102    int vms_launch_status;      /* non-zero if lib$spawn, etc failed */
     103#endif
    52104
    53     pid_t pid;                  /* Child process's ID number.  */
    54 #ifdef VMS
    55     int efn;                    /* Completion event flag number */
    56     int cstatus;                /* Completion status */
    57     char *comname;              /* Temporary command file name */
     105    unsigned int  command_line; /* Index into command_lines.  */
     106    struct output output;       /* Output for this child.  */
     107    pid_t         pid;          /* Child process's ID number.  */
     108    unsigned int  remote:1;     /* Nonzero if executing remotely.  */
     109    unsigned int  noerror:1;    /* Nonzero if commands contained a '-'.  */
     110    unsigned int  good_stdin:1; /* Nonzero if this child has a good stdin.  */
     111    unsigned int  deleted:1;    /* Nonzero if targets have been deleted.  */
     112    unsigned int  recursive:1;  /* Nonzero for recursive command ('+' etc.)  */
     113    unsigned int  dontcare:1;   /* Saved dontcare flag.  */
     114
     115#ifdef CONFIG_WITH_KMK_BUILTIN
     116    unsigned int has_status:1;  /* Nonzero if status is available. */
     117    int status;                 /* Status of the job. */
    58118#endif
    59     char *sh_batch_file;        /* Script file for shell commands */
    60 #ifdef CONFIG_WITH_KMK_BUILTIN
    61     int status;                 /* Status of the job. */
    62     unsigned int has_status:1;  /* Nonzero if status is available. */
    63 #endif
    64     unsigned int remote:1;      /* Nonzero if executing remotely.  */
    65 
    66     unsigned int noerror:1;     /* Nonzero if commands contained a `-'.  */
    67 
    68     unsigned int good_stdin:1;  /* Nonzero if this child has a good stdin.  */
    69     unsigned int deleted:1;     /* Nonzero if targets have been deleted.  */
    70     unsigned int dontcare:1;    /* Saved dontcare flag.  */
    71119#ifdef CONFIG_WITH_PRINT_TIME_SWITCH
    72120    big_int start_ts;           /* nano_timestamp of the first command.  */
     
    76124extern struct child *children;
    77125
     126/* A signal handler for SIGCHLD, if needed.  */
     127RETSIGTYPE child_handler (int sig);
    78128int is_bourne_compatible_shell(const char *path);
    79129void new_job (struct file *file);
     
    83133char **construct_command_argv (char *line, char **restp, struct file *file,
    84134                               int cmd_flags, char** batch_file);
     135
    85136#ifdef VMS
    86 int child_execute_job (char *argv, struct child *child);
    87 #elif defined(__EMX__)
    88 int child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp);
     137int child_execute_job (struct child *child, char *argv);
    89138#else
    90 void child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp);
     139# define FD_STDIN       (fileno (stdin))
     140# define FD_STDOUT      (fileno (stdout))
     141# define FD_STDERR      (fileno (stderr))
     142int child_execute_job (struct output *out, int good_stdin, char **argv, char **envp);
    91143#endif
     144
    92145#ifdef _AMIGA
    93 void exec_command (char **argv);
     146void exec_command (char **argv) __attribute__ ((noreturn));
    94147#elif defined(__EMX__)
    95148int exec_command (char **argv, char **envp);
    96149#else
    97 void exec_command (char **argv, char **envp);
     150void exec_command (char **argv, char **envp) __attribute__ ((noreturn));
    98151#endif
    99152
     
    104157void unblock_sigs (void);
    105158#else
    106 #ifdef  HAVE_SIGSETMASK
     159#ifdef  HAVE_SIGSETMASK
    107160extern int fatal_signal_mask;
    108 #define unblock_sigs()  sigsetmask (0)
     161#define unblock_sigs()  sigsetmask (0)
    109162#else
    110 #define unblock_sigs()
     163#define unblock_sigs()
    111164#endif
    112165#endif
    113166
    114167extern unsigned int jobserver_tokens;
    115 
    116 #endif /* SEEN_JOB_H */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette