+ if (pthread_attr_init_done) {
+ return &tattr;
+ }
+
+ WARN("Uninitialized pthread attributes, using libc defaults.");
+ return NULL;
+}
+
+static void __attribute__((constructor)) init_default_pthread_attr(void)
+{
+ int ret;
+ struct rlimit rlim;
+ size_t pthread_ss, system_ss, selected_ss;
+
+ ret = pthread_attr_init(&tattr);
+ if (ret) {
+ errno = ret;
+ PERROR("pthread_attr_init");
+ goto error;
+ }
+
+ /* Get system stack size limits. */
+ ret = getrlimit(RLIMIT_STACK, &rlim);
+ if (ret < 0) {
+ PERROR("getrlimit");
+ goto error_destroy;
+ }
+ DBG("Stack size limits: soft %lld, hard %lld bytes",
+ (long long) rlim.rlim_cur,
+ (long long) rlim.rlim_max);
+