mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 19:00:07 +00:00
Update.
2001-03-20 Jakub Jelinek <jakub@redhat.com> * sysdeps/sparc/stackinfo.h: New file.
This commit is contained in:
parent
1fb7dc3c42
commit
df4cada7cf
@ -1,3 +1,7 @@
|
||||
2001-03-20 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
* sysdeps/sparc/stackinfo.h: New file.
|
||||
|
||||
2001-03-21 Andreas Jaeger <aj@suse.de>
|
||||
|
||||
* elf/global.c (main): Use proper prototype.
|
||||
|
95
linuxthreads/Examples/ex17.c
Normal file
95
linuxthreads/Examples/ex17.c
Normal file
@ -0,0 +1,95 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include <limits.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
static void *
|
||||
test_thread (void *v_param)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define STACKSIZE 0x100000
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
pthread_t thread;
|
||||
pthread_attr_t attr;
|
||||
int status;
|
||||
void *stack, *stack2;
|
||||
size_t stacksize;
|
||||
|
||||
pthread_attr_init (&attr);
|
||||
stack = mmap (NULL, STACKSIZE,
|
||||
PROT_READ | PROT_WRITE | PROT_EXEC,
|
||||
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
|
||||
|
||||
if (stack == (void *)-1)
|
||||
{
|
||||
perror ("mmap failed");
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = pthread_attr_setstack (&attr, stack, STACKSIZE);
|
||||
if (status != 0)
|
||||
{
|
||||
printf ("pthread_attr_setstack failed: %s\n", strerror (status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = pthread_attr_getstack (&attr, &stack2, &stacksize);
|
||||
if (status != 0)
|
||||
{
|
||||
printf ("pthread_attr_getstack failed: %s\n", strerror (status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (stack2 != stack || stacksize != STACKSIZE)
|
||||
{
|
||||
printf ("first pthread_attr_getstack returned different stack (%p,%x)\n"
|
||||
"than was set by setstack (%p,%x)\n",
|
||||
stack2, stacksize, stack, STACKSIZE);
|
||||
return 2;
|
||||
}
|
||||
|
||||
status = pthread_create (&thread, &attr, test_thread, NULL);
|
||||
if (status != 0)
|
||||
{
|
||||
printf ("pthread_create failed: %s\n", strerror (status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = pthread_getattr_np (thread, &attr);
|
||||
if (status != 0)
|
||||
{
|
||||
printf ("pthread_getattr_np failed: %s\n", strerror (status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
status = pthread_attr_getstack (&attr, &stack2, &stacksize);
|
||||
if (status != 0)
|
||||
{
|
||||
printf ("pthread_attr_getstack failed: %s\n", strerror (status));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (stack2 != stack || stacksize != STACKSIZE)
|
||||
{
|
||||
printf ("second pthread_attr_getstack returned different stack (%p,%x)\n"
|
||||
"than was set by setstack (%p,%x)\n",
|
||||
stack2, stacksize, stack, STACKSIZE);
|
||||
return 3;
|
||||
}
|
||||
|
||||
/* pthread_detach (thread); */
|
||||
if (pthread_join (thread, NULL) != 0)
|
||||
{
|
||||
printf ("join failed\n");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -55,7 +55,8 @@ endif
|
||||
|
||||
librt-tests = ex10 ex11
|
||||
tests = ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 $(librt-tests) ex12 ex13 joinrace \
|
||||
tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16
|
||||
tststack $(tests-nodelete-$(have-z-nodelete)) ecmutex ex14 ex15 ex16 \
|
||||
ex17
|
||||
|
||||
ifeq (yes,$(build-shared))
|
||||
tests-nodelete-yes = unload
|
||||
|
28
sysdeps/sparc/stackinfo.h
Normal file
28
sysdeps/sparc/stackinfo.h
Normal file
@ -0,0 +1,28 @@
|
||||
/* Copyright (C) 2001 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* This file contains a bit of information about the stack allocation
|
||||
of the processor. */
|
||||
|
||||
#ifndef _STACKINFO_H
|
||||
#define _STACKINFO_H 1
|
||||
|
||||
/* On sparc the stack grows down. */
|
||||
#define _STACK_GROWS_DOWN 1
|
||||
|
||||
#endif /* stackinfo.h */
|
Loading…
Reference in New Issue
Block a user