+ pthread_once(&__sdidinit, __sinit);
+
+ if (count) {
+ int64_t new = OSAtomicIncrement64(&__scounted);
+ if (new > __stream_max) {
+ /* Greater than the saved limit, check again with getrlimit. */
+ if (new > (__stream_max = sysconf(_SC_STREAM_MAX))){
+ OSAtomicDecrement64(&__scounted);
+ errno = EMFILE;
+ return NULL;
+ }
+ }
+ /* Overflowing #streams beyond RLIMIT_INFINITY */
+ if (new < 0) {
+ errno = EOVERFLOW;
+ return NULL;
+ }
+ }