Add support for Unix lookup by name to user-uid and user-gid
[sxemacs] / src / process.h
1 /* Definitions for asynchronous process control in SXEmacs.
2    Copyright (C) 1985, 1992, 1993, 1994 Free Software Foundation, Inc.
3
4 This file is part of SXEmacs
5
6 SXEmacs is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 SXEmacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program.  If not, see <http://www.gnu.org/licenses/>. */
18
19
20 #ifndef INCLUDED_process_h_
21 #define INCLUDED_process_h_
22
23 #if defined (NO_SUBPROCESSES)
24 #undef XPROCESS
25 #undef CHECK_PROCESS
26 #undef XSETPROCESS
27 #define PROCESSP(x) 0
28 #define PROCESS_LIVE_P(x) 0
29 #define Fprocess_status(x) Qnil
30 #define Fget_process(x) Qnil
31 #define Fget_buffer_process(x) Qnil
32 #define kill_buffer_processes(x) 0
33 #define close_process_descs() 0
34 #define init_sxemacs_process() 0
35 void wait_without_blocking(void);
36
37 #else                           /* not NO_SUBPROCESSES */
38
39 /* struct Lisp_Process is defined in procimpl.h; only process-*.c need
40    to know about the guts of it. */
41
42 enum PROCESS_TYPES {
43         PROCESS_TYPE_PROC,
44         PROCESS_TYPE_NETWORK,
45         PROCESS_TYPE_MULTICAST,
46         PROCESS_TYPE_SSL,
47         PROCESS_TYPE_NETWORK_SERVER_LISTEN,
48         /* last entry holds the number of process types */
49         PROCESS_TYPES_COUNT
50 };
51
52 DECLARE_LRECORD(process, Lisp_Process);
53 #define XPROCESS(x) XRECORD (x, process, Lisp_Process)
54 #define XSETPROCESS(x, p) XSETRECORD (x, p, process)
55 #define PROCESSP(x) RECORDP (x, process)
56 #define CHECK_PROCESS(x) CHECK_RECORD (x, process)
57 #define PROCESS_LIVE_P(x) (EQ ((x)->status_symbol, Qrun))
58 #define PROCESS_READABLE_P(x) (!NILP ((x)->pipe_instream))
59
60 #define CHECK_LIVE_PROCESS(x) do {                      \
61   CHECK_PROCESS (x);                                    \
62   if (! PROCESS_LIVE_P (XPROCESS (x)))                  \
63     dead_wrong_type_argument (Qprocess_live_p, (x));    \
64 } while (0)
65
66 #define CHECK_READABLE_PROCESS(x) do {                  \
67   CHECK_PROCESS (x);                                    \
68   if (! PROCESS_READABLE_P (XPROCESS (x)))              \
69     dead_wrong_type_argument (Qprocess_readable_p, (x));        \
70 } while (0)
71
72 #ifdef emacs
73
74 EXFUN(Fprocess_kill_without_query, 2);
75 EXFUN(Fprocess_id, 1);
76
77 Lisp_Object connect_to_file_descriptor(Lisp_Object name,
78                                        Lisp_Object buffer,
79                                        Lisp_Object infd, Lisp_Object outfd);
80 int connected_via_filedesc_p(Lisp_Process * p);
81 void kill_buffer_processes(Lisp_Object buffer);
82 void close_process_descs(void);
83
84 void set_process_filter(Lisp_Object proc,
85                         Lisp_Object filter, int filter_does_read);
86
87 /* True iff we are about to fork off a synchronous process or if we
88    are waiting for it.  */
89 extern volatile int synch_process_alive;
90
91 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
92 extern const char *synch_process_death;
93
94 /* If synch_process_death is zero,
95    this is exit code of synchronous subprocess.  */
96 extern int synch_process_retcode;
97
98 void update_process_status(Lisp_Object p,
99                            Lisp_Object status_symbol,
100                            int exit_code, int core_dumped);
101
102 void get_process_streams(Lisp_Process * p,
103                          Lisp_Object * instr, Lisp_Object * outstr);
104 int get_process_selected_p(Lisp_Process * p);
105 void set_process_selected_p(Lisp_Process * p, int selected_p);
106
107 Lisp_Process *get_process_from_usid(USID usid);
108
109 #ifdef HAVE_SOCKETS
110 int network_connection_p(Lisp_Object process);
111 #else
112 #define network_connection_p(x) 0
113 #endif
114
115 extern Lisp_Object Qclosed, Qmulticast, Qopen, Qrun, Qstop, Qtcp, Qudp;
116 extern Lisp_Object Vprocess_connection_type, Vprocess_list;
117
118 /* Report all recent events of a change in process status
119    (either run the sentinel or output a message).
120    This is done while Emacs is waiting for keyboard input.  */
121 void status_notify(void);
122 void kick_status_notify(void);
123
124 void deactivate_process(Lisp_Object proc);
125
126 void
127  child_setup(int in, int out, int err,
128              char **new_argv, const char *current_dir);
129
130 Charcount read_process_output(Lisp_Object proc);
131
132 const char *signal_name(int signum);
133
134 Lisp_Object canonicalize_host_name(Lisp_Object host);
135
136 #endif                          /* not NO_SUBPROCESSES */
137
138 /* The name of the file open to get a null file, or a data sink.
139    MS-DOS, and OS/2 redefine this.  */
140 #ifndef NULL_DEVICE
141 #define NULL_DEVICE "/dev/null"
142 #endif
143
144 /* A string listing the possible suffixes used for executable files,
145    separated by colons.  MS-DOS, and OS/2 redefine this.  */
146 #ifndef EXEC_SUFFIXES
147 #define EXEC_SUFFIXES ""
148 #endif
149
150 #endif                          /* emacs */
151
152 #endif                          /* INCLUDED_process_h_ */