Florian Weimer <fwei...@redhat.com> writes:

> * Omair Majid:
>
>> Florian Weimer <fwei...@redhat.com> writes:
>>
>>> * Jan Kratochvil:
>>>
>>>> gold is also limited by 'ulimit -S -n', I had to raise it while building 
>>>> LLDB
>>>> (using -DLLVM_USE_LINKER=gold).
>>>
>>> gold should either do this upon start (like OpenJDK does),
>>
>> Do you have any pointers to source or docs that explain the OpenJDK
>> technique for this?
>
> Uhm, now I have to look.  I hope it really does that, I noticed it only
> because it was possible to open more than 1024 files, contrary to what I
> expected based on the system configuration.
>
> The responsible code is os::init_2(), in
> src/hotspot/os/linux/os_linux.cpp:
>
>   if (MaxFDLimit) {
>     // set the number of file descriptors to max. print out error
>     // if getrlimit/setrlimit fails but continue regardless.
>     struct rlimit nbr_files;
>     int status = getrlimit(RLIMIT_NOFILE, &nbr_files);
>     if (status != 0) {
>       log_info(os)("os::init_2 getrlimit failed: %s", os::strerror(errno));
>     } else {
>       nbr_files.rlim_cur = nbr_files.rlim_max;
>       status = setrlimit(RLIMIT_NOFILE, &nbr_files);
>       if (status != 0) {
>         log_info(os)("os::init_2 setrlimit failed: %s", os::strerror(errno));
>       }
>     }
>   }
>
> rlim_max is what is sometimes called the hard limit, rlim_cur the soft
> limit.  It is the difference between “ulimit -S -n” and “ulimit -H -n”.
> The quoted code fragment raises the soft limit up to the hard limit,
> which is as far as you can go without additional privileges.
>
> Does this answer your question?

Yes, it does. Thanks.

(I was secretly hoping there was a way to bump rlim_cur past
the current value of rlim_max...)

Omair

--
PGP Key: B157A9F0 (http://pgp.mit.edu/)
Fingerprint = 9DB5 2F0B FD3E C239 E108  E7BD DF99 7AF8 B157 A9F0
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to