rlimitCurrOpenFilesLimit

Get the rlimit current number of open files the process is allowed.

This routine returns the current soft limit on the number of open files the process is allowed. This is the number returned by the command: '$ ulimit -n'.

This routine translates this value to a 'uint', as tsv-split uses 'uint' for tracking output files. The rlimit 'rlim_t' type is usually 'ulong' or 'long'. RLIM_INFINITY and any value larger than 'uint.max' is translated to 'uint.max'.

An exception is thrown if call to 'getrlimit' fails.

Note about Windows: rlimit is a Posix construct, not available on Windows. Currently, tsv-split is written for Posix. To allow it compile on Windows, this routine returns 512 on Windows, which is the default for Windows stream I/O. This is a stop-gap solution. A more generalized 'systemCurrOpenFilesLimit' would make sense if Windows becomes primary platform. That would also require changing error messages, help, etc., to be platform specfic. At present, testing is done only on Posix platforms. For info on Windows stream I/O limits see: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio

uint
rlimitCurrOpenFilesLimit
()

Meta