tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: refine of the GSOC project



On 12.05.2016 22:46, Christos Zoulas wrote:
> On May 12,  9:07pm, n54%gmx.com@localhost (Kamil Rytarowski) wrote:
> -- Subject: Re: refine of the GSOC project
>
> | On 12.05.2016 07:37, Charles Cui wrote:
> | >    PTHREAD_STACK_MIN  (freebsd)
> | 
> | I was told that this one is missing on purpose as there is no good
> | reason to limit it from this side and a sane minimum is PAGE_SIZE.
> | 
> | Perhaps this is the way to go, to define it as it?
>
> Yes and this is tech-userlevel, so what do people say?
>
> christos
>

An alternative is to go for 8192 (2*PAGE_SIZE) to mimic MINSIGSTKSZ:

/usr/include/sys/signal.h:#define    MINSIGSTKSZ    8192            /*
minimum allowable stack */

Is there a good reason for MINSIGSTKSZ to be 2*PAGE_SIZE for a signal
stack? Also it's hard-coding an arbitrary value for all ports.

PAGE_SIZE is used in the sysconf(3) interface with the
_SC_THREAD_STACK_MIN key:
$ cat test.c
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char **argv)
{
    printf("_SC_THREAD_STACK_MIN=%ld\n", sysconf(_SC_THREAD_STACK_MIN));
    return 0;
}
$ gcc test.c -o test
$ ./test
_SC_THREAD_STACK_MIN=4096

This

Unfortunately THREAD_STACK_MIN is missing in the getconf(3) call -- is
it a bug?
A list of acceptable keys is listed in: src/usr.bin/getconf/getconf.c

I cannot find (_SC_)THREAD_STACK_MIN in sysconf(3) either.

lib/libc/gen/sysconf.c
<https://github.com/IIJ-NetBSD/netbsd-src/blob/e906c85589abdd46570b12c47ec307159c9b8b6a/lib/libc/gen/sysconf.c>:
case /_SC_THREAD_STACK_MIN/:
lib/libc/gen/sysconf.c
<https://github.com/IIJ-NetBSD/netbsd-src/blob/e906c85589abdd46570b12c47ec307159c9b8b6a/lib/libc/gen/sysconf.c>: 
return _getpagesize();


Home | Main Index | Thread Index | Old Index