summaryrefslogtreecommitdiffstats
path: root/osdep-linux.c
authornicm <nicm>2009-02-09 18:08:01 (GMT)
committer nicm <nicm>2009-02-09 18:08:01 (GMT)
commitfa951d1f513fedc56e8f059f20f558ac6bac82f5 (patch) (side-by-side diff)
treeab9e215489dc696c4024dedaa555f6a6c148584a /osdep-linux.c
parentda4644638bb54926c267c3e7a012a1fb5af1a629 (diff)
downloadtmux-old-fa951d1f513fedc56e8f059f20f558ac6bac82f5.zip
tmux-old-fa951d1f513fedc56e8f059f20f558ac6bac82f5.tar.gz
tmux-old-fa951d1f513fedc56e8f059f20f558ac6bac82f5.tar.bz2
Don't try to change the window name unless the pid of the process chosen has
changed. Reduces CPU use. osdep-* stuff is a bit horrible now but there we go :-/.
Diffstat (limited to 'osdep-linux.c') (more/less context) (ignore whitespace changes)
-rw-r--r--osdep-linux.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/osdep-linux.c b/osdep-linux.c
index 2d4e6c3..eef2885 100644
--- a/osdep-linux.c
+++ b/osdep-linux.c
@@ -26,8 +26,8 @@
#include "tmux.h"
-char *
-get_argv0(int fd, unused char *tty)
+int
+osdep_get_name(int fd, unused char *tty, unused pid_t *last_pid, char **name)
{
FILE *f;
char *path, *buf;
@@ -35,13 +35,15 @@ get_argv0(int fd, unused char *tty)
int ch;
pid_t pgrp;
+ *name = NULL;
+
if ((pgrp = tcgetpgrp(fd)) == -1)
- return (NULL);
+ return (-1);
xasprintf(&path, "/proc/%lld/cmdline", (long long) pgrp);
if ((f = fopen(path, "r")) == NULL) {
xfree(path);
- return (NULL);
+ return (-1);
}
xfree(path);
@@ -55,9 +57,10 @@ get_argv0(int fd, unused char *tty)
}
if (buf != NULL)
buf[len] = '\0';
+ *name = buf;
fclose(f);
- return (buf);
+ return (0);
}
#endif