kern/58497: sysctl knob to return current process' jid

C. Stephen Gunn csg at
Fri Oct 24 15:00:41 PDT 2003

The following reply was made to PR kern/58497; it has been noted by GNATS.

From: "C. Stephen Gunn" <csg at>
To: "Poul-Henning Kamp" <phk at>
Cc: FreeBSD-gnats-submit at
Subject: Re: kern/58497: sysctl knob to return current process' jid 
Date: Fri, 24 Oct 2003 16:50:35 -0500

 On Fri, 24 Oct 2003 22:57:39 +0200, "Poul-Henning Kamp" wrote:
 > >There is no easy way to tell if a process is operating in a Jail
 > >environment.
 > Yes, in fact there is:
 Good point, my problem statemen was unnecessairly broad.  As we
 discussed on IRC, perhaps letting jail'd processes learn their
 jid servese no useful purpose, which might weaken security.
 For posterity, one way to detect if we're operating in a jail from
 the command line would be something like:
 INJAIL=`ps -p $$ | awk '$3 ~ /.*J/ { print "yes" };'`
 Unless someone sees other value in a sysctl to get the JID,
 someone can go ahead and resolve this request.  Thanks.
  - Steve

More information about the freebsd-bugs mailing list