From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 18 18:14:58 2013 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 43358D05 for ; Sun, 18 Aug 2013 18:14:58 +0000 (UTC) (envelope-from fernando.apesteguia@gmail.com) Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [IPv6:2a00:1450:400c:c05::231]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CDBD8244E for ; Sun, 18 Aug 2013 18:14:57 +0000 (UTC) Received: by mail-wi0-f177.google.com with SMTP id hq12so2310521wib.4 for ; Sun, 18 Aug 2013 11:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=lSGNL9oVz5+jXCKLXBrrl87I+/H8JfhKaumVUy/HRhI=; b=Yj/T6G5C+nsY0tM5pOLy+FjzY56blpxSweFRU6h/B/mn/iCFY0Jj0yHOwAVedXXYOV daQ/YfprGwZZhNuetwFMCt9DvfqbKYB7IkhP5cjrJCd1ZZEPzDuvlfkrtyjZ0F8p3dkI GWYQLM433mEuZfSAZA8ybcJWysi8bAnXxakONADREgLCJ6yHwr6LZD7OIYGwebCzbvvW UkQF8dOtslMLVaE8cIZP3g9RDZRYZCZImIydfvin9wKUv6h1Ti6DLRzKr+91gAOl8Ru7 EBomdWw2/dj2xADybGdNmo71xzorC9rHuE1pF2KQWjpL+yyqgu//yWBIAFl2E1QK1PdC hOhQ== MIME-Version: 1.0 X-Received: by 10.180.185.97 with SMTP id fb1mr5378214wic.61.1376849696191; Sun, 18 Aug 2013 11:14:56 -0700 (PDT) Received: by 10.180.91.11 with HTTP; Sun, 18 Aug 2013 11:14:56 -0700 (PDT) In-Reply-To: References: Date: Sun, 18 Aug 2013 20:14:56 +0200 Message-ID: Subject: Re: ps_strings From: =?ISO-8859-1?Q?Fernando_Apestegu=EDa?= To: Carlos Jacobo Puga Medina Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: FreeBSD Hackers X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Aug 2013 18:14:58 -0000 On Sat, Aug 17, 2013 at 8:00 PM, Carlos Jacobo Puga Medina < cjpugmed@gmail.com> wrote: > Hi people, > > Despite I made a request not long ago[1], I'm looking for documentation to > create the ps_strings structure man page because isn't covered in other man > page such e.g. execve(2). So, I'm interested to know for what it's > currently used. > > Any input will be appreciated. > It is for storing the vectors for program arguments and environment. They are placed at the top of the process stack. This information is used for instance, by the ps(1) program via the kvm(3) interface. The same structure is accesed from the linuxolator (linprocfs.c) to implement the "environ" pseudo-file. In the first case (libkvm interface) a sysctl is used to retrieve that information. Anyway, both paths end up calling proc_getenvv/proc_getargv in kern_proc.c. Those are "selectors" for the function that does the actual work: get_ps_strings. This function first calls get_proc_vector to copy the relevant memory area (look for vptr in the "case" statement) from the process stack and then it iterates to extract all the strings. Have a look at the comment in sys/exec.h All this is probably not needed for the man page, but hey, just my two cents. > > --CJPM > > > [1] http://lists.freebsd.org/pipermail/freebsd-doc/2013-July/022422.html. > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >