This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
return the stack base == 0 in my MIPS platform
- From: Bin Chen <binary dot chen at gmail dot com>
- To: libc-alpha at sourceware dot org
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 18 Feb 2008 04:48:23 -0800 (PST)
- Subject: return the stack base == 0 in my MIPS platform
- Complaints-to: groups-abuse@google.com
- Injection-info: s13g2000prd.googlegroups.com; posting-host=58.25.108.233; posting-account=tmGhqgoAAADDZAa5vbvtsXCG82fRhveB
- Newsgroups: comp.unix.programmer
Hi,
The following code returns stack base = 0, this eventually cause my
program segment fault, can anyone tell me whats wrong and how to fix
it?
Thanks.
Bin
#include <pthread.h>
int stackbase = 0, stacksize = 0;
main()
{
pthread_attr_t sattr;
pthread_attr_init(&sattr);
pthread_t thread;
thread = pthread_self();
pthread_getattr_np(thread, &sattr);
int rc = pthread_attr_getstack(&sattr, &stackbase,
&stacksize);
if (rc != 0) {
printf("error.\n");
exit(1);
}
printf("base %x, size %x\n", stackbase, stacksize);
return;
}
# ./p
base 0, size 2ab56e40