[PATCH] Finish the task 'sysctl reporting current working directory'
Mateusz Guzik
mjguzik at gmail.com
Thu Nov 6 08:13:36 UTC 2014
On Mon, Nov 03, 2014 at 04:52:35PM +0800, Tiwei Bie wrote:
kernel changes got in in r274167
Please submit tmux patch to bugzilla.
>
> diff --git a/osdep-freebsd.c b/osdep-freebsd.c
> index d596eab..46f6f3f 100644
> --- a/osdep-freebsd.c
> +++ b/osdep-freebsd.c
> @@ -132,6 +132,21 @@ error:
> return (NULL);
> }
>
> +#ifdef KERN_PROC_CWD
> +char *
> +osdep_get_cwd(int fd)
> +{
> + static struct kinfo_file info;
> + int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_CWD, 0 };
> + size_t len = sizeof info;
> +
> + if ((name[3] = tcgetpgrp(fd)) == -1)
> + return (NULL);
> + if (sysctl(name, 4, &info, &len, NULL, 0) != 0)
> + return (NULL);
> + return (info.kf_path);
> +}
> +#else /* !KERN_PROC_CWD */
> char *
> osdep_get_cwd(int fd)
> {
> @@ -157,6 +172,7 @@ osdep_get_cwd(int fd)
> free(info);
> return (NULL);
> }
> +#endif /* KERN_PROC_CWD */
>
> struct event_base *
> osdep_event_init(void)
--
Mateusz Guzik <mjguzik gmail.com>
More information about the freebsd-hackers
mailing list