]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/execcmd.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / src / engine / execcmd.h
1 /*
2 * Copyright 1993, 1995 Christopher Seiwald.
3 *
4 * This file is part of Jam - see jam.c for Copyright information.
5 */
6
7 /*
8 * execcmd.h - execute a shell script.
9 *
10 * Defines the interface to be implemented in platform specific implementation
11 * modules as well as different shared utility functions prepared in the
12 * execcmd.c module.
13 */
14
15 #ifndef EXECCMD_H
16 #define EXECCMD_H
17
18 #include "lists.h"
19 #include "strings.h"
20 #include "timestamp.h"
21
22
23 typedef struct timing_info
24 {
25 double system;
26 double user;
27 timestamp start;
28 timestamp end;
29 } timing_info;
30
31 typedef void (* ExecCmdCallback)
32 (
33 void * const closure,
34 int const status,
35 timing_info const * const,
36 char const * const cmd_stdout,
37 char const * const cmd_stderr,
38 int const cmd_exit_reason
39 );
40
41 /* Global initialization. Must be called after setting
42 * globs.jobs. May be called multiple times. */
43 void exec_init( void );
44 /* Global cleanup */
45 void exec_done( void );
46
47 /* Status codes passed to ExecCmdCallback routines. */
48 #define EXEC_CMD_OK 0
49 #define EXEC_CMD_FAIL 1
50 #define EXEC_CMD_INTR 2
51
52 int exec_check
53 (
54 string const * command,
55 LIST * * pShell,
56 int * error_length,
57 int * error_max_length
58 );
59
60 /* exec_check() return codes. */
61 #define EXEC_CHECK_OK 101
62 #define EXEC_CHECK_NOOP 102
63 #define EXEC_CHECK_LINE_TOO_LONG 103
64 #define EXEC_CHECK_TOO_LONG 104
65
66 /* Prevents action output from being written
67 * immediately to stdout/stderr.
68 */
69 #define EXEC_CMD_QUIET 1
70
71 void exec_cmd
72 (
73 string const * command,
74 int flags,
75 ExecCmdCallback func,
76 void * closure,
77 LIST * shell
78 );
79
80 void exec_wait();
81
82
83 /******************************************************************************
84 * *
85 * Utility functions defined in the execcmd.c module. *
86 * *
87 ******************************************************************************/
88
89 /* Constructs a list of command-line elements using the format specified by the
90 * given shell list.
91 */
92 void argv_from_shell( char const * * argv, LIST * shell, char const * command,
93 int const slot );
94
95 /* Interrupt routine bumping the internal interrupt counter. Needs to be
96 * registered by platform specific exec*.c modules.
97 */
98 void onintr( int disp );
99
100 /* Returns whether an interrupt has been detected so far. */
101 int interrupted( void );
102
103 /* Checks whether the given shell list is actually a request to execute raw
104 * commands without an external shell.
105 */
106 int is_raw_command_request( LIST * shell );
107
108 /* Utility worker for exec_check() checking whether all the given command lines
109 * are under the specified length limit.
110 */
111 int check_cmd_for_too_long_lines( char const * command, int const max,
112 int * const error_length, int * const error_max_length );
113
114 #endif