mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Natanael Copa <ncopa@alpinelinux.org>
To: musl@lists.openwall.com
Subject: bug with sysconf(_SC_CHILD_MAX) with user process ulimit set to unlimited
Date: Thu, 7 Dec 2017 16:26:09 +0100	[thread overview]
Message-ID: <20171207162609.45e02f83@ncopa-desktop.copa.dup.pw> (raw)

Hi,

While trying to debug why `bash -c 'sleep 1 &  wait $!'` hangs with
alpine in docker[1] I made an interesting discovery.

Set user process ulimit to "unlimited" and run the following program on
an x86_64 machine:

#include <stdio.h>
#include <unistd.h>

int main() {
	long maxchild = sysconf(_SC_CHILD_MAX);
	printf("maxchild: %ld\n", maxchild);
	return 0;
}


With musl libc it prints:

  maxchild: 9223372036854775807

With glibc it prints:

  maxchild: -1


Setting the process ulimit to something like 64k makes bash work again.

Shouldn't sysconf(_SC_CHILD_MAX) return -1 if ulimit is set to
"unlimited"?

Thanks!

-nc


[1]: https://github.com/tianon/docker-bash/issues/4


             reply	other threads:[~2017-12-07 15:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 15:26 Natanael Copa [this message]
2017-12-07 17:05 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207162609.45e02f83@ncopa-desktop.copa.dup.pw \
    --to=ncopa@alpinelinux.org \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).