Date: Sun, 18 Aug 2013 20:14:56 +0200 From: =?ISO-8859-1?Q?Fernando_Apestegu=EDa?= <fernando.apesteguia@gmail.com> To: Carlos Jacobo Puga Medina <cjpugmed@gmail.com> Cc: FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: ps_strings Message-ID: <CAGwOe2bXEn_Le_ey4rbS_=UrDcX=uYDW1aFFBUkuSYJ8XywuFg@mail.gmail.com> In-Reply-To: <CAHHLbRNz5TMdz67fXfFk9pLD8UFiRg%2B0G_oD1GXP23Fo4B72Bw@mail.gmail.com> References: <CAHHLbRNz5TMdz67fXfFk9pLD8UFiRg%2B0G_oD1GXP23Fo4B72Bw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGwOe2bXEn_Le_ey4rbS_=UrDcX=uYDW1aFFBUkuSYJ8XywuFg>