[ale] chroot and /proc?
Jim Kinney
jim.kinney at gmail.com
Tue Apr 1 22:53:17 EDT 2008
So only /proc/cpuinfo needs to be in the chroot for bind to find all the
cpu's. As the data in cpuinfo is static (unless you reboot and change the
cpu's physically) a copy can be placed in the /var/chroot/ and that should
suffice.
2008/4/1 Jeff Lightner <jlightner at water.com>:
> I guess I should have mentioned the OP on the BIND list specifically
> stated that using "-n 4" still only resulted in BIND finding 1 CPU.
>
>
>
> Later discussion on the BIND list (after I'd posted here) indicates:
>
> After quick look into bind and glibc code /proc has to be mounted.
>
> named calls sysconf(3) function and internal glibc implementation looks
> like this:
>
>
>
> __get_nprocs () {
>
> ..
>
> FILE *fp = fopen ("/proc/stat", "rc");
>
> if (fp != NULL) {
>
> ..
>
> } else {
>
> fp = fopen ("/proc/cpuinfo", "rc");
>
> if (fp != NULL) {
>
> ..
>
> }
>
> ..
>
> }
>
>
>
> return 1;
>
> }
>
>
>
> So if you don't have /proc mounted in chroot glibc is not able to get
> number of CPUs and returns 1. When you don't need detect correct number of
> CPUs (always use one CPU) then you don't have to mount /proc
>
>
>
> The poster was from RedHat and in a later post indicated he was going to
> work on a patch to determine number of CPUs BEFORE BIND starts the chroot
> environment as suggested in response to the above.
>
>
>
> That seems to sum it up nicely for me.
>
>
> ------------------------------
>
> *From:* ale-bounces at ale.org [mailto:ale-bounces at ale.org] *On Behalf Of *Jason
> Fritcher
> *Sent:* Tuesday, April 01, 2008 2:20 PM
> *To:* ale at ale.org
> *Subject:* Re: [ale] chroot and /proc?
>
>
>
>
>
> On Apr 1, 2008, at 12:09 PM, Jeff Lightner wrote:
>
> Alternatively I'm wondering if there isn't a better way to let the chroot
> environment BIND know that there are 4 CPUs?
>
>
>
> Sure, there is a command-line option to tell it how many CPUs there are...
>
>
>
> -n #cpus
>
> Create #cpus worker threads to take advantage of multiple CPUs.
> If
>
> not specified, named will try to determine the number of CPUs
>
> present and create one thread per CPU. If it is unable to
> determine
>
> the number of CPUs, a single worker thread will be created.
>
>
>
> --
>
> Jason Fritcher
>
> jkf at wolfnet.org
>
>
>
>
>
>
> ----------------------------------
> CONFIDENTIALITY NOTICE: This e-mail may contain privileged or confidential
> information and is for the sole use of the intended recipient(s). If you are
> not the intended recipient, any disclosure, copying, distribution, or use of
> the contents of this information is prohibited and may be unlawful. If you
> have received this electronic transmission in error, please reply
> immediately to the sender that you have received the message in error, and
> delete it. Thank you.
> ----------------------------------
>
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>
>
--
--
James P. Kinney III
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20080401/7cbe127c/attachment.html
More information about the Ale
mailing list