1
0
mirror of https://github.com/tmux/tmux.git synced 2025-04-10 11:08:49 +00:00

More AIX tweaks.

This commit is contained in:
Nicholas Marriott 2009-03-31 22:08:45 +00:00
parent 92594c8029
commit d13add828a
3 changed files with 29 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.77 2009-03-31 21:24:33 nicm Exp $ # $Id: GNUmakefile,v 1.78 2009-03-31 22:08:45 nicm Exp $
.PHONY: clean .PHONY: clean
@ -76,7 +76,7 @@ SRCS+= compat/vis.c compat/strlcpy.c compat/strlcat.c compat/strtonum.c \
CFLAGS+= -DNO_TREE_H -DNO_ASPRINTF -DNO_QUEUE_H -DNO_VSYSLOG \ CFLAGS+= -DNO_TREE_H -DNO_ASPRINTF -DNO_QUEUE_H -DNO_VSYSLOG \
-DNO_PROGNAME -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM \ -DNO_PROGNAME -DNO_STRLCPY -DNO_STRLCAT -DNO_STRTONUM \
-DNO_SETPROCTITLE -DNO_QUEUE_H -DNO_TREE_H -DNO_FORKPTY -DNO_FGETLN \ -DNO_SETPROCTITLE -DNO_QUEUE_H -DNO_TREE_H -DNO_FORKPTY -DNO_FGETLN \
-DBROKEN_GETOPT -DBROKEN_POLL -DBROKEN_GETOPT -DBROKEN_POLL -DNO_PATHS_H
LDFLAGS+= -L/usr/local/lib LDFLAGS+= -L/usr/local/lib
endif endif

View File

@ -1,4 +1,4 @@
/* $Id: forkpty-aix.c,v 1.1 2009-03-31 21:23:18 nicm Exp $ */ /* $Id: forkpty-aix.c,v 1.2 2009-03-31 22:08:45 nicm Exp $ */
/* /*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@ -30,18 +30,14 @@ pid_t
forkpty(int *master, forkpty(int *master,
unused char *name, unused struct termios *tio, struct winsize *ws) unused char *name, unused struct termios *tio, struct winsize *ws)
{ {
int slave; int slave, fd;
char *path; char *path;
pid_t pid; pid_t pid;
if ((*master = open("/dev/ptc", O_RDWR|O_NOCTTY)) == -1) if ((*master = open("/dev/ptc", O_RDWR|O_NOCTTY)) == -1)
return (-1); return (-1);
if (grantpt(*master) != 0)
goto out;
if (unlockpt(*master) != 0)
goto out;
if ((path = ptsname(*master)) == NULL) if ((path = ttyname(*master)) == NULL)
goto out; goto out;
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1) if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
goto out; goto out;
@ -52,11 +48,28 @@ forkpty(int *master,
case 0: case 0:
close(*master); close(*master);
setsid(); fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
#ifdef TIOCSCTTY if (fd >= 0) {
if (ioctl(slave, TIOCSCTTY, NULL) == -1) ioctl(fd, TIOCNOTTY, NULL);
fatal("ioctl failed"); close(fd);
#endif }
if (setsid() < 0)
fatal("setsid");
fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
if (fd >= 0)
fatalx("open succeeded (failed to disconnect)");
fd = open(path, O_RDWR);
if (fd < 0)
fatal("open failed");
close(fd);
fd = open("/dev/tty", O_WRONLY);
if (fd < 0)
fatal("open failed");
close(fd);
if (ioctl(slave, TIOCSWINSZ, ws) == -1) if (ioctl(slave, TIOCSWINSZ, ws) == -1)
fatal("ioctl failed"); fatal("ioctl failed");

3
tmux.h
View File

@ -1,4 +1,4 @@
/* $Id: tmux.h,v 1.292 2009-03-29 11:18:28 nicm Exp $ */ /* $Id: tmux.h,v 1.293 2009-03-31 22:08:45 nicm Exp $ */
/* /*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -109,6 +109,7 @@ extern const char *__progname;
#define _PATH_BSHELL "/bin/sh" #define _PATH_BSHELL "/bin/sh"
#define _PATH_TMP "/tmp/" #define _PATH_TMP "/tmp/"
#define _PATH_DEVNULL "/dev/null" #define _PATH_DEVNULL "/dev/null"
#define _PATH_TTY "/dev/tty"
#endif #endif
/* Default configuration file. */ /* Default configuration file. */