Mercurial > hg > xemacs-beta
comparison src/s/linux.h @ 365:30d2cfa1092a r21-1-12
Import from CVS: tag r21-1-12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:00:12 +0200 |
parents | 6330739388db |
children | a4f53d9b3154 |
comparison
equal
deleted
inserted
replaced
364:63c3368d1275 | 365:30d2cfa1092a |
---|---|
192 /* Use BSD process groups, but use setpgid() instead of setpgrp() to | 192 /* Use BSD process groups, but use setpgid() instead of setpgrp() to |
193 actually set a process group. */ | 193 actually set a process group. */ |
194 | 194 |
195 /* XEmacs: removed setpgrp() definition because we use setpgid() when | 195 /* XEmacs: removed setpgrp() definition because we use setpgid() when |
196 it's available, and autodetect it. */ | 196 it's available, and autodetect it. */ |
197 | |
198 #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) && defined(HAVE_PTSNAME) | |
199 /* UNIX98 PTYs are available. | |
200 Added by Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>, | |
201 RUS-CERT, University of Stuttgart. Based on Emacs code for DGUX. */ | |
202 | |
203 #define PTY_ITERATION for (i = 0; i < 1; i++) | |
204 /* no iteration at all */ | |
205 | |
206 /* Use getpt() if it's available, because it provides Unix98 PTY | |
207 emulation for kernels which doesn't support it natively. */ | |
208 | |
209 #ifdef HAVE_GETPT | |
210 #define PTY_OPEN \ | |
211 do { \ | |
212 fd = getpt(); \ | |
213 if (fcntl (fd, F_SETFL, O_NDELAY) == -1) \ | |
214 fatal ("could not set master PTY to non-block mode"); \ | |
215 } while (0) | |
216 | |
217 #else | |
218 /* the master PTY device */ | |
219 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx"); | |
220 #endif | |
221 | |
222 /* This sets the name of the slave side of the PTY. grantpt(3) and | |
223 unlockpt(3) may fork a subprocess, so keep sigchld_handler() from | |
224 intercepting that death. */ | |
225 | |
226 #define PTY_TTY_NAME_SPRINTF \ | |
227 { \ | |
228 char *ptsname(), *ptyname; \ | |
229 \ | |
230 sigblock(sigmask(SIGCHLD)); \ | |
231 if (grantpt(fd) == -1) \ | |
232 fatal("could not grant slave pty"); \ | |
233 if (unlockpt(fd) == -1) \ | |
234 fatal("could not unlock slave pty"); \ | |
235 if (!(ptyname = ptsname(fd))) \ | |
236 fatal ("could not enable slave pty"); \ | |
237 strncpy(pty_name, ptyname, sizeof(pty_name)); \ | |
238 pty_name[sizeof(pty_name) - 1] = 0; \ | |
239 sigsetmask(siggetmask() & ~sigmask(SIGCHLD)); \ | |
240 } | |
241 | |
242 #endif |