comparison src/s/hpux.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 8eaf7971accc
children a4f53d9b3154
comparison
equal deleted inserted replaced
364:63c3368d1275 365:30d2cfa1092a
155 1800, 2400, 3600, 4800, 7200, 9600, 19200, 38400 } 155 1800, 2400, 3600, 4800, 7200, 9600, 19200, 38400 }
156 156
157 /* This is needed for HPUX version 6.2; it may not be needed for 6.2.1. */ 157 /* This is needed for HPUX version 6.2; it may not be needed for 6.2.1. */
158 #define SHORT_CAST_BUG 158 #define SHORT_CAST_BUG
159 159
160 #if defined(HAVE_GRANTPT) && defined(HAVE_UNLOCKPT) && defined(HAVE_PTSNAME)
161 /* UNIX98 PTYs are available.
162 Added by Florian Weimer <Florian.Weimer@RUS.Uni-Stuttgart.DE>,
163 RUS-CERT, University of Stuttgart. Based on Emacs code for DGUX. */
164
165 #ifdef emacs
166 #include <grp.h>
167 #include <sys/stropts.h>
168 #endif
169
170 #define PTY_ITERATION for (i = 0; i < 1; i++)
171 /* no iteration at all */
172
173 /* the master PTY device */
174 #define PTY_NAME_SPRINTF strcpy (pty_name, "/dev/ptmx");
175
176 /* This sets the name of the slave side of the PTY. grantpt(3) and
177 unlockpt(3) may fork a subprocess, so keep sigchld_handler() from
178 intercepting that death. grantpt() behavior on HP-UX differs from
179 what's specified in the man page: the group of the slave PTY is set
180 to the user's primary group, and we fix that. */
181
182 #define PTY_TTY_NAME_SPRINTF \
183 { \
184 char *ptsname(), *ptyname; \
185 struct group *getgrnam (), *tty_group = getgrnam ("tty"); \
186 if (tty_group == NULL) \
187 fatal ("group tty not found"); \
188 \
189 sigblock(sigmask(SIGCHLD)); \
190 if (grantpt(fd) == -1) \
191 fatal("could not grant slave pty"); \
192 if (!(ptyname = ptsname(fd))) \
193 fatal ("could not enable slave pty"); \
194 strncpy(pty_name, ptyname, sizeof(pty_name)); \
195 pty_name[sizeof(pty_name) - 1] = 0; \
196 if (chown (pty_name, (uid_t) -1, tty_group->gr_gid) == -1) \
197 fatal ("could not chown slave pty"); \
198 if (unlockpt(fd) == -1) \
199 fatal("could not unlock slave pty"); \
200 sigunblock(sigmask(SIGCHLD)); \
201 }
202
203 /* Push various streams modules onto a PTY channel. */
204
205 #define SETUP_SLAVE_PTY \
206 if (ioctl (xforkin, I_PUSH, "ptem") == -1) \
207 fatal ("ioctl I_PUSH ptem", errno); \
208 if (ioctl (xforkin, I_PUSH, "ldterm") == -1) \
209 fatal ("ioctl I_PUSH ldterm", errno);
210
211 #else /* no UNIX98 PTYs */
212
160 /* This is how to get the device name of the tty end of a pty. */ 213 /* This is how to get the device name of the tty end of a pty. */
161 #define PTY_TTY_NAME_SPRINTF \ 214 #define PTY_TTY_NAME_SPRINTF \
162 sprintf (pty_name, "/dev/pty/tty%c%x", c, i); 215 sprintf (pty_name, "/dev/pty/tty%c%x", c, i);
163 216
164 /* This is how to get the device name of the control end of a pty. */ 217 /* This is how to get the device name of the control end of a pty. */
165 #define PTY_NAME_SPRINTF \ 218 #define PTY_NAME_SPRINTF \
166 sprintf (pty_name, "/dev/ptym/pty%c%x", c, i); 219 sprintf (pty_name, "/dev/ptym/pty%c%x", c, i);
167 220
221 #endif /* UNIX 98 PTYs */
222
168 /* This triggers a conditional in xfaces.c. */ 223 /* This triggers a conditional in xfaces.c. */
169 #define XOS_NEEDS_TIME_H 224 #define XOS_NEEDS_TIME_H