comparison src/s/darwin.h @ 107932:9b8dfcd5e0b0

Use openpty for allocating pty on Darwin. Fix Bug#726 and Bug#5819. * s/darwin.h (PTY_ITERATION, PTY_NAME_SPRINTF, PTY_TTY_NAME_SPRINTF) (PTY_OPEN): New defines. Use openpty (Bug#726, Bug#5819).
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Sat, 10 Apr 2010 19:31:01 +0900
parents 1d1d5d9bd884
children c168d4537385 376148b31b5e
comparison
equal deleted inserted replaced
107931:db7a670d5832 107932:9b8dfcd5e0b0
88 * Define HAVE_PTYS if the system supports pty devices. 88 * Define HAVE_PTYS if the system supports pty devices.
89 * Note: PTYs are broken on darwin <6. Use at your own risk. 89 * Note: PTYs are broken on darwin <6. Use at your own risk.
90 */ 90 */
91 91
92 #define HAVE_PTYS 92 #define HAVE_PTYS
93 /* Run only once. We need a `for'-loop because the code uses
94 `continue'. */
95 #define PTY_ITERATION for (i = 0; i < 1; i++)
96 #define PTY_NAME_SPRINTF /* none */
97 #define PTY_TTY_NAME_SPRINTF /* none */
98 /* Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
99 But we don't have to block SIGCHLD because it is blocked in the
100 implementation of grantpt. */
101 #define PTY_OPEN \
102 do \
103 { \
104 int slave; \
105 if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) \
106 fd = -1; \
107 else \
108 emacs_close (slave); \
109 } \
110 while (0)
93 111
94 /** 112 /**
95 * PTYs only work correctly on Darwin 7 or higher. So make the 113 * PTYs only work correctly on Darwin 7 or higher. So make the
96 * default for process-connection-type dependent on the kernel 114 * default for process-connection-type dependent on the kernel
97 * version. 115 * version.