From owner-freebsd-hackers@FreeBSD.ORG Thu Nov 6 08:13:36 2014 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 71B3BEF0 for ; Thu, 6 Nov 2014 08:13:36 +0000 (UTC) Received: from mail-wi0-x22d.google.com (mail-wi0-x22d.google.com [IPv6:2a00:1450:400c:c05::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3A587A6 for ; Thu, 6 Nov 2014 08:13:35 +0000 (UTC) Received: by mail-wi0-f173.google.com with SMTP id n3so679350wiv.6 for ; Thu, 06 Nov 2014 00:13:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=w+339epwBdTpprOD1LXBS+dMjbqbbNcpdbxrcQSgJug=; b=l12KoWzxbIYLt8DanEJLjWn16W8gL09CNopHYFu9IVgX+AWb5Pp+eA62MS7wn4d2gi 2M0iYVCibt1DFIpdyFFUBiAHKBKBndoXAm2/5+dMgPuinqD91rMH3vm1mPFRFgCXXnql lhuep85xGqb5nCijdYqKtiNfzfZlm7ZfE9n1Qpb8vivdyusVLHBL5k0C1C7FKtfAwx/u 9jJQt4Kr84WyUZRKkKkDbPRvF+8ZKrHiyHWIKlV45Dw6Ciyv4A85orpPtdrj7EvCQ/Ya frAVbqYENxGNwRfJn1o0ZxBfl4KzIXwBD3qBjKYa9ntpJmrx8bmQVCr0sS77D+oizr/a afWQ== X-Received: by 10.180.108.13 with SMTP id hg13mr37887214wib.27.1415261614429; Thu, 06 Nov 2014 00:13:34 -0800 (PST) Received: from dft-labs.eu (n1x0n-1-pt.tunnel.tserv5.lon1.ipv6.he.net. [2001:470:1f08:1f7::2]) by mx.google.com with ESMTPSA id fv2sm7344395wib.2.2014.11.06.00.13.33 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 06 Nov 2014 00:13:33 -0800 (PST) Date: Thu, 6 Nov 2014 09:13:31 +0100 From: Mateusz Guzik To: Tiwei Bie Subject: Re: [PATCH] Finish the task 'sysctl reporting current working directory' Message-ID: <20141106081330.GA12284@dft-labs.eu> Mail-Followup-To: Mateusz Guzik , Tiwei Bie , freebsd-hackers@freebsd.org References: <1414987325-23280-1-git-send-email-btw@mail.ustc.edu.cn> <20141103051908.GC29497@dft-labs.eu> <20141103064052.GA1739@freebsd> <20141103080526.GE29497@dft-labs.eu> <20141103085235.GA85851@freebsd> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20141103085235.GA85851@freebsd> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Nov 2014 08:13:36 -0000 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