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 :-/.
This commit is contained in:
Nicholas Marriott
2009-02-09 18:08:01 +00:00
parent 9d90d9ad70
commit c9cfc9a9f3
7 changed files with 83 additions and 54 deletions

View File

@ -1,4 +1,4 @@
/* $Id: osdep-darwin.c,v 1.4 2009-02-07 19:41:35 nicm Exp $ */
/* $Id: osdep-darwin.c,v 1.5 2009-02-09 18:08:01 nicm Exp $ */
/*
* Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
@ -25,7 +25,9 @@
#include <string.h>
#include <unistd.h>
char *get_argv0(int, char *);
int osdep_get_name(int, char *, pid_t *, char **);
#define unused __attribute__ ((unused))
/*
* XXX This actually returns the executable path, not the process's argv[0].
@ -33,8 +35,8 @@ char *get_argv0(int, char *);
* Apple's 'ps' source and start digging.
*/
char *
get_argv0(int fd, __attribute__ ((unused)) char *tty)
int
osdep_get_name(int fd, unused char *tty, unused pid_t *last_pid, char **name)
{
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 };
size_t size;