tech-userlevel archive

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

Re: PTHREAD_STACK_MIN vs _SC_THREAD_STACK_MIN



On 30.06.2019 17:42, Joerg Sonnenberger wrote:
> On Sat, Jun 29, 2019 at 06:12:49PM +0200, Kamil Rytarowski wrote:
>> NetBSD does not implement PTHREAD_STACK_MIN as this is an optional part
>> of POSIX, however it implements sysconf(_SC_THREAD_STACK_MIN).
>>
>> I think that this is inconsistent we we should pick one of the following
>> paths:
>>
>> 1. Define PTHREAD_STACK_MIN as sysconf(_SC_THREAD_STACK_MIN).
>>
>> 2. Drop _SC_THREAD_STACK_MIN from sysconf(3).
>>
>> Independently we could tune SC_THREAD_STACK_MIN to return something
>> larger than PAGE_SIZE if we find it needed. There were debates that a
>> single page might not be sufficient.
>>
>> There is also a similar constant MINSIGSTKSZ (8192 bytes).
> 
> Neither option makes sense. PTHREAD_STACK_MIN is supposed to be ICE and
> that can't work reasonable on platforms with dynamic page size.
> _SC_THREAD_STACK_MIN is a perfectly reasonable mechanism to get a
> reasonable limit at run time. In short: this is fine, nothing to change.
> 
> Joerg
> 

I'm aware that the value should be suitable for usage in preprocessor..
however it's already done exactly this way in Illumos (as an
extension/violation that in practice probably makes no issues anywhere).

#define	PTHREAD_STACK_MIN	((size_t)_sysconf(_SC_THREAD_STACK_MIN))

http://src.illumos.org/source/xref/illumos-gate/usr/src/head/limits.h#328

But OK, thanks!

Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index