1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

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
This commit is contained in:
Alexey Zelkin 2003-02-03 10:08:45 +00:00
parent 8dad14b11b
commit 618a8b4df0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=110276

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002 Alexey Zelkin <phantom@FreeBSD.org>
* Copyright (c) 2002,2003 Alexey Zelkin <phantom@FreeBSD.org>
* 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);
}