Skip to content

Commit

Permalink
Enable omrthread_get_stack_range on AIX
Browse files Browse the repository at this point in the history
Signed-off-by: Tobi Ajila <atobia@ca.ibm.com>
  • Loading branch information
tajila committed Apr 27, 2021
1 parent 1749b88 commit 141c34e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions thread/common/omrthreadinspect.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 1991, 2019 IBM Corp. and others
* Copyright (c) 1991, 2021 IBM Corp. and others
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
Expand Down Expand Up @@ -300,7 +300,7 @@ uintptr_t
omrthread_get_stack_range(omrthread_t thread, void **stackStart, void **stackEnd)
{

#if defined(LINUX)
#if defined(LINUX) || defined(AIXPPC)
pthread_attr_t attr;
OSTHREAD osTid = thread->handle;
uintptr_t rc = 0;
Expand All @@ -322,7 +322,7 @@ omrthread_get_stack_range(omrthread_t thread, void **stackStart, void **stackEnd
thread->os_errno = rc;
return (J9THREAD_ERR_GETSTACK | J9THREAD_ERR_OS_ERRNO_SET);
}
#else
#else /* (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) */
if ((rc = pthread_attr_getstackaddr(&attr, stackStart)) != 0) {
thread->os_errno = rc;
return (J9THREAD_ERR_GETSTACK | J9THREAD_ERR_OS_ERRNO_SET);
Expand All @@ -332,13 +332,13 @@ omrthread_get_stack_range(omrthread_t thread, void **stackStart, void **stackEnd
thread->os_errno = rc;
return (J9THREAD_ERR_GETSTACK | J9THREAD_ERR_OS_ERRNO_SET);
}
#endif /* #if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) */
#endif /* (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) */
pthread_attr_destroy(&attr);

/* On Linux, native stack grows from high to low memory */
*stackEnd = (void *)((uintptr_t)*stackStart + stackSize);
return J9THREAD_SUCCESS;
#elif defined(OSX)
#elif defined(OSX) /* defined(LINUX) || defined(AIXPPC) */
OSTHREAD osTid = thread->handle;
size_t stackSize = 0;

Expand All @@ -348,7 +348,7 @@ omrthread_get_stack_range(omrthread_t thread, void **stackStart, void **stackEnd
return J9THREAD_SUCCESS;
#else /* defined(OSX) */
return J9THREAD_ERR_UNSUPPORTED_PLAT;
#endif /* defined(LINUX) */
#endif /* defined(LINUX) || defined(AIXPPC) */
}

#if (defined(OMR_THR_JLM))
Expand Down

0 comments on commit 141c34e

Please sign in to comment.