From 263e2476e49a1922267fc32e3a903c3825035049 Mon Sep 17 00:00:00 2001 From: phantom Date: Mon, 3 Feb 2003 10:08:45 +0000 Subject: Improve pthread_attr_get_np() by enabling it to return thread's real stack address instead of specified by pthread_attr_t passed to pthread_create(). Suggested by: deischen --- lib/libc_r/uthread/uthread_attr_get_np.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib/libc_r') diff --git a/lib/libc_r/uthread/uthread_attr_get_np.c b/lib/libc_r/uthread/uthread_attr_get_np.c index a427f79..ba6fd19 100644 --- a/lib/libc_r/uthread/uthread_attr_get_np.c +++ b/lib/libc_r/uthread/uthread_attr_get_np.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002 Alexey Zelkin + * Copyright (c) 2002,2003 Alexey Zelkin * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -45,5 +45,13 @@ _pthread_attr_get_np(pthread_t pid, pthread_attr_t *dst) return (ret); memcpy(*dst, &pid->attr, sizeof(struct pthread_attr)); + + /* + * Special case, if stack address was not provided by caller + * of pthread_create(), then return address allocated internally + */ + if ((*dst)->stackaddr_attr == NULL) + (*dst)->stackaddr_attr = pid->stack; + return (0); } -- cgit v1.1