// If the current RLIMIT_STACK is RLIM_INFINITY, only admit to an 8MiB stack // in case callers such as ART take infinity too literally. if (stack_limit.rlim_cur == RLIM_INFINITY) {
stack_limit.rlim_cur = 8 * 1024 * 1024;
}
uintptr_t lo, hi;
__find_main_stack_limits(&lo, &hi);
*stack_size = stack_limit.rlim_cur;
*stack_base = reinterpret_cast<void*>(hi - *stack_size); return0;
}
__BIONIC_WEAK_FOR_NATIVE_BRIDGE int pthread_getattr_np(pthread_t t, pthread_attr_t* attr) {
pthread_internal_t* thread = reinterpret_cast<pthread_internal_t*>(t);
*attr = thread->attr; // We prefer reading join_state here to setting thread->attr.flags in pthread_detach. // Because data race exists in the latter case. if (atomic_load(&thread->join_state) == THREAD_DETACHED) {
attr->flags |= PTHREAD_ATTR_FLAG_DETACHED;
} // The main thread's stack information is not stored in thread->attr, // and we need to query it at runtime because it can change: // the kernel will automatically expand the main thread's stack up to RLIMIT_STACK. if (thread->tid == getpid()) { return __pthread_attr_getstack_main_thread(&attr->stack_base, &attr->stack_size);
} return0;
}
__BIONIC_WEAK_FOR_NATIVE_BRIDGE int pthread_attr_setscope(pthread_attr_t*, int scope) { if (scope == PTHREAD_SCOPE_SYSTEM) { return0;
} if (scope == PTHREAD_SCOPE_PROCESS) { return ENOTSUP;
} return EINVAL;
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.