From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 24 21:13:19 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CC7510656B4; Mon, 24 Oct 2011 21:13:19 +0000 (UTC) (envelope-from to.my.trociny@gmail.com) Received: from mail-bw0-f54.google.com (mail-bw0-f54.google.com [209.85.214.54]) by mx1.freebsd.org (Postfix) with ESMTP id 8FC6E8FC13; Mon, 24 Oct 2011 21:13:18 +0000 (UTC) Received: by bkbzu17 with SMTP id zu17so11207461bkb.13 for ; Mon, 24 Oct 2011 14:13:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:x-comment-to:sender:date:in-reply-to :message-id:user-agent:mime-version:content-type; bh=i5V8f6ZXrymankJ2JlCQbGLREwRgHJ0rXXFBz5p6W9E=; b=XtSzzSaHp4vjaWsMgpB+llqgB2WI8lx0SKkzAgqcqyGkoapERs4a/HqgmqqFLy14oV IMutWt2XO72dXfb90bcosCqufDy/VPonYdyuLRgV0EJYtMEgy4hAa8GKPnqLi+YsZi2J /DpfxWhRx7HujqwjnD9ITDEs1t04yMosB624c= Received: by 10.204.145.15 with SMTP id b15mr19028348bkv.52.1319490797063; Mon, 24 Oct 2011 14:13:17 -0700 (PDT) Received: from localhost ([95.69.173.122]) by mx.google.com with ESMTPS id j9sm25208969bkd.2.2011.10.24.14.13.13 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 24 Oct 2011 14:13:13 -0700 (PDT) From: Mikolaj Golub To: Kostik Belousov References: <86y5wkeuw9.fsf@kopusha.home.net> <20111016171005.GB50300@deviant.kiev.zoral.com.ua> X-Comment-To: Kostik Belousov Sender: Mikolaj Golub Date: Tue, 25 Oct 2011 00:13:10 +0300 In-Reply-To: <20111016171005.GB50300@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Sun, 16 Oct 2011 20:10:05 +0300") Message-ID: <86aa8qozyx.fsf@kopusha.home.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-hackers@freebsd.org, Robert Watson Subject: Re: "ps -e" without procfs(5) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Oct 2011 21:13:19 -0000 On Sun, 16 Oct 2011 20:10:05 +0300 Kostik Belousov wrote: KB> In my opinion, the way to implement the feature is to (re)use KB> linprocfs_doargv() and provide another kern.proc sysctl to retrieve the KB> argv and env vectors. Then, ps(1) and procstat(1) can use it, as well as KB> procfs and linprocfs inside the kernel. Thanks! I am testing a patch (without auxv vector so far) and have some questions. Original ps -e returns environment only for user owned processes (the access is restricted by the permissions of /proc/pid/mem file). My kern.proc.env sysctl does not have such a restriction. I suppose I should add it? What function I could use for this? BTW, linprocfs allows to read other user's environment. KB> While you are at the code, it would be useful to also export the auxv vector, KB> which is immediately before env. It looks I can find the location of auxv but what about the size? Or do you propose to extend struct ps_strings to store location and size of auxv? I could do this way... -- Mikolaj Golub