Remove the KERN_PROC_CWD the proc_current_path format (which is the only

thing that uses it now).
This commit is contained in:
nicm 2013-10-10 12:39:24 +00:00
parent 99e3cbc526
commit d0566a474a
4 changed files with 1 additions and 21 deletions

View File

@ -518,7 +518,6 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
struct grid_line *gl; struct grid_line *gl;
unsigned long long size; unsigned long long size;
u_int i, idx; u_int i, idx;
const char *cwd;
char *cmd; char *cmd;
size = 0; size = 0;
@ -551,9 +550,7 @@ format_window_pane(struct format_tree *ft, struct window_pane *wp)
format_add(ft, "pane_pid", "%ld", (long) wp->pid); format_add(ft, "pane_pid", "%ld", (long) wp->pid);
if (wp->cmd != NULL) if (wp->cmd != NULL)
format_add(ft, "pane_start_command", "%s", wp->cmd); format_add(ft, "pane_start_command", "%s", wp->cmd);
if ((cwd = get_proc_cwd(wp->fd)) != NULL) if ((cmd = format_get_command(wp)) != NULL) {
format_add(ft, "pane_current_path", "%s", cwd);
if ((cmd = get_proc_name(wp->fd, wp->tty)) != NULL) {
format_add(ft, "pane_current_command", "%s", cmd); format_add(ft, "pane_current_command", "%s", cmd);
free(cmd); free(cmd);
} }

View File

@ -37,7 +37,6 @@
struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *); struct kinfo_proc *cmp_procs(struct kinfo_proc *, struct kinfo_proc *);
char *get_proc_name(int, char *); char *get_proc_name(int, char *);
char *get_proc_cwd(int);
struct kinfo_proc * struct kinfo_proc *
cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2) cmp_procs(struct kinfo_proc *p1, struct kinfo_proc *p2)
@ -132,17 +131,3 @@ error:
free(buf); free(buf);
return (NULL); return (NULL);
} }
char*
get_proc_cwd(int fd)
{
int name[] = { CTL_KERN, KERN_PROC_CWD, 0 };
static char path[MAXPATHLEN];
size_t pathlen = sizeof path;
if ((name[2] = tcgetpgrp(fd)) == -1)
return (NULL);
if (sysctl(name, 3, path, &pathlen, NULL, 0) != 0)
return (NULL);
return (path);
}

1
tmux.1
View File

@ -3068,7 +3068,6 @@ The following variables are available, where appropriate:
.It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag" .It Li "mouse_utf8_flag" Ta "" Ta "Pane mouse UTF-8 flag"
.It Li "pane_active" Ta "" Ta "1 if active pane" .It Li "pane_active" Ta "" Ta "1 if active pane"
.It Li "pane_current_command" Ta "" Ta "Current command if available" .It Li "pane_current_command" Ta "" Ta "Current command if available"
.It Li "pane_current_path" Ta "" Ta "Current path if available"
.It Li "pane_dead" Ta "" Ta "1 if pane is dead" .It Li "pane_dead" Ta "" Ta "1 if pane is dead"
.It Li "pane_height" Ta "" Ta "Height of pane" .It Li "pane_height" Ta "" Ta "Height of pane"
.It Li "pane_id" Ta "#D" Ta "Unique pane ID" .It Li "pane_id" Ta "#D" Ta "Unique pane ID"

1
tmux.h
View File

@ -2317,7 +2317,6 @@ u_int utf8_split2(u_int, u_char *);
/* procname.c */ /* procname.c */
char *get_proc_name(int, char *); char *get_proc_name(int, char *);
char *get_proc_cwd(int);
/* log.c */ /* log.c */
void log_open(int, const char *); void log_open(int, const char *);