mailing list of musl libc
 help / color / mirror / code / Atom feed
* bug with sysconf(_SC_CHILD_MAX) with user process ulimit set to unlimited
@ 2017-12-07 15:26 Natanael Copa
  2017-12-07 17:05 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Natanael Copa @ 2017-12-07 15:26 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-07 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 15:26 bug with sysconf(_SC_CHILD_MAX) with user process ulimit set to unlimited Natanael Copa
2017-12-07 17:05 ` Rich Felker

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).