equal
deleted
inserted
replaced
326 if (res != 0) { |
326 if (res != 0) { |
327 if (res == ENOMEM) { |
327 if (res == ENOMEM) { |
328 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); |
328 vm_exit_out_of_memory(0, OOM_MMAP_ERROR, "pthread_getattr_np"); |
329 } |
329 } |
330 else { |
330 else { |
331 fatal(err_msg("pthread_getattr_np failed with errno = %d", res)); |
331 fatal("pthread_getattr_np failed with errno = %d", res); |
332 } |
332 } |
333 } |
333 } |
334 |
334 |
335 address stack_bottom; |
335 address stack_bottom; |
336 size_t stack_bytes; |
336 size_t stack_bytes; |
337 res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes); |
337 res = pthread_attr_getstack(&attr, (void **) &stack_bottom, &stack_bytes); |
338 if (res != 0) { |
338 if (res != 0) { |
339 fatal(err_msg("pthread_attr_getstack failed with errno = %d", res)); |
339 fatal("pthread_attr_getstack failed with errno = %d", res); |
340 } |
340 } |
341 address stack_top = stack_bottom + stack_bytes; |
341 address stack_top = stack_bottom + stack_bytes; |
342 |
342 |
343 // The block of memory returned by pthread_attr_getstack() includes |
343 // The block of memory returned by pthread_attr_getstack() includes |
344 // guard pages where present. We need to trim these off. |
344 // guard pages where present. We need to trim these off. |
346 assert(((intptr_t) stack_bottom & (page_bytes - 1)) == 0, "unaligned stack"); |
346 assert(((intptr_t) stack_bottom & (page_bytes - 1)) == 0, "unaligned stack"); |
347 |
347 |
348 size_t guard_bytes; |
348 size_t guard_bytes; |
349 res = pthread_attr_getguardsize(&attr, &guard_bytes); |
349 res = pthread_attr_getguardsize(&attr, &guard_bytes); |
350 if (res != 0) { |
350 if (res != 0) { |
351 fatal(err_msg("pthread_attr_getguardsize failed with errno = %d", res)); |
351 fatal("pthread_attr_getguardsize failed with errno = %d", res); |
352 } |
352 } |
353 int guard_pages = align_size_up(guard_bytes, page_bytes) / page_bytes; |
353 int guard_pages = align_size_up(guard_bytes, page_bytes) / page_bytes; |
354 assert(guard_bytes == guard_pages * page_bytes, "unaligned guard"); |
354 assert(guard_bytes == guard_pages * page_bytes, "unaligned guard"); |
355 |
355 |
356 #ifdef IA64 |
356 #ifdef IA64 |