diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-02-09 18:08:01 +0000 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2009-02-09 18:08:01 +0000 |
commit | c9cfc9a9f356386e07e6273f91dd3d46ca076c12 (patch) | |
tree | fd4f75d10b6b32715b6626e0af2c175d3b603401 /osdep-linux.c | |
parent | 9d90d9ad705b9059e9bfa61b86cca7744cbca53d (diff) | |
download | rtmux-c9cfc9a9f356386e07e6273f91dd3d46ca076c12.tar.gz rtmux-c9cfc9a9f356386e07e6273f91dd3d46ca076c12.tar.bz2 rtmux-c9cfc9a9f356386e07e6273f91dd3d46ca076c12.zip |
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')
-rw-r--r-- | osdep-linux.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/osdep-linux.c b/osdep-linux.c index 71085aa5..079b562d 100644 --- a/osdep-linux.c +++ b/osdep-linux.c @@ -1,4 +1,4 @@ -/* $Id: osdep-linux.c,v 1.3 2009-02-02 15:46:36 nicm Exp $ */ +/* $Id: osdep-linux.c,v 1.4 2009-02-09 18:08:01 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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 |