On Wed, Oct 14, 2009 at 11:16:13AM +0100, Nicholas Marriott wrote:
> Hi
>
> This works fine on Solaris 10 so I have committed it.
Thanks.
>
> I think the tty arg being empty may be something funny with ttyname on Solaris
> which also affects eg list-clients but so far noone has complained or sent a
> fix so I haven't looked into it.
I don't have a problem with list-clients, so maybe that's something on an
earlier release.
I did track down why tty was empty in osdep_get_names(); forkpty-sunos wasn't
copying the slave pty's name into the caller-provided buffer.
The attached diff should fix that; it works for me. Also, list-panes was
displaying "unknown" because it was calling ttyname() on the master end of
the pty pair instead of ptsname(); I wrapped that in an ifdef because I
wasn't sure if there was a reason why it was calling ttyname() instead of
using wp->tty.
Thank you,
Todd Carson
Index: cmd-list-panes.c
===================================================================
RCS file: /cvsroot/tmux/tmux/cmd-list-panes.c,v
retrieving revision 1.1
diff -u -r1.1 cmd-list-panes.c
--- cmd-list-panes.c 12 Oct 2009 00:08:12 -0000 1.1
+++ cmd-list-panes.c 15 Oct 2009 00:36:41 -0000
@@ -67,7 +67,11 @@
name = NULL;
if (wp->fd != -1)
+#if defined(__sun)
+ name = ptsname(wp->fd);
+#else
name = ttyname(wp->fd);
+#endif
if (name == NULL)
name = "unknown";
ctx->print(ctx, "%s [%ux%u] [history %u/%u, %llu bytes]",
Index: osdep-sunos.c
===================================================================
RCS file: /cvsroot/tmux/tmux/osdep-sunos.c,v
retrieving revision 1.1
diff -u -r1.1 osdep-sunos.c
--- osdep-sunos.c 14 Oct 2009 10:14:21 -0000 1.1
+++ osdep-sunos.c 15 Oct 2009 00:36:41 -0000
@@ -28,7 +28,7 @@
#include "tmux.h"
char *
-osdep_get_name(int fd, unused char *tty)
+osdep_get_name(int fd, char *tty)
{
struct psinfo p;
struct stat st;
@@ -37,10 +37,7 @@
int f;
pid_t pgrp;
- if ((path = ptsname(fd)) == NULL)
- return (NULL);
-
- if ((f = open(path, O_RDONLY)) < 0)
+ if ((f = open(tty, O_RDONLY)) < 0)
return (NULL);
if ((fstat(f, &st) != 0) ||
Index: compat/forkpty-sunos.c
===================================================================
RCS file: /cvsroot/tmux/tmux/compat/forkpty-sunos.c,v
retrieving revision 1.8
diff -u -r1.8 forkpty-sunos.c
--- compat/forkpty-sunos.c 20 Sep 2009 18:31:16 -0000 1.8
+++ compat/forkpty-sunos.c 15 Oct 2009 00:36:41 -0000
@@ -27,7 +27,7 @@
#include "tmux.h"
pid_t
-forkpty(int *master, unused char *name, struct termios *tio, struct winsize *ws)
+forkpty(int *master, char *name, struct termios *tio, struct winsize *ws)
{
int slave;
char *path;
@@ -42,6 +42,8 @@
if ((path = ptsname(*master)) == NULL)
goto out;
+ if (name != NULL)
+ (void) strlcpy(name, path, TTY_NAME_MAX);
if ((slave = open(path, O_RDWR|O_NOCTTY)) == -1)
goto out;
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users