- DBG("Default pthread stack size is %zu bytes", ptstacksize);
-
- /* Check if the default pthread stack size honors ulimits. */
- if (ptstacksize < rlim.rlim_cur) {
- DBG("Your libc doesn't honor stack size limits, setting thread stack size to soft limit (%lld bytes)",
- (long long) rlim.rlim_cur);
-
- /* Create pthread_attr_t struct with ulimit stack size. */
- ret = pthread_attr_setstacksize(&tattr, rlim.rlim_cur);
- if (ret < 0) {
- PERROR("pthread_attr_setstacksize");
- goto error;
- }
+ DBG("Default pthread stack size is %zu bytes", pthread_ss);
+
+ selected_ss = max_t(size_t, pthread_ss, system_ss);
+ if (selected_ss < DEFAULT_LTTNG_THREAD_STACK_SIZE) {
+ DBG("Default stack size is too small, setting it to %zu bytes",
+ (size_t) DEFAULT_LTTNG_THREAD_STACK_SIZE);
+ selected_ss = DEFAULT_LTTNG_THREAD_STACK_SIZE;