Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 387420 Details for
Bug 512922
=dev-libs/pth-2.0.7-r3 - configure: checking for stack setup via sigaltstack... loops endlessly
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
sigaltstack.c
sigaltstack.c (text/plain), 2.43 KB, created by
Alon Bar-Lev (RETIRED)
on 2014-10-26 08:29:52 UTC
(
hide
)
Description:
sigaltstack.c
Filename:
MIME Type:
Creator:
Alon Bar-Lev (RETIRED)
Created:
2014-10-26 08:29:52 UTC
Size:
2.43 KB
patch
obsolete
>#include <stdio.h> >#include <stdlib.h> >#include <string.h> >#include <sys/types.h> >#include <signal.h> >#include <unistd.h> >#define HAVE_STACK_T 1 >union alltypes { > long l; > double d; > void *vp; > void (*fp)(void); > char *cp; >}; >static volatile char *handler_addr = (char *)0xDEAD; >static volatile int handler_done = 0; >void handler(int sig) >{ > char garbage[1024]; > int i; > auto int dummy; >printf("B001\n"); > for (i = 0; i < 1024; i++) > garbage[i] = 'X'; >printf("B002\n"); > handler_addr = (char *)&dummy; >printf("B003\n"); > handler_done = 1; >printf("B004\n"); >fflush(stdout); > return; >} >int main(int argc, char *argv[]) >{ > FILE *f; > char *skaddr; > char *skbuf; > int sksize; > char result[1024]; > int i; > sksize = 32768; > skbuf = (char *)malloc(sksize*2+2*sizeof(union alltypes)); > if (skbuf == NULL) > exit(1); > for (i = 0; i < sksize*2+2*sizeof(union alltypes); i++) > skbuf[i] = 'A'; > skaddr = skbuf+sizeof(union alltypes); > { > struct sigaction sa; >#if defined(HAVE_STACK_T) > stack_t ss; >#else > struct sigaltstack ss; >#endif > ss.ss_sp = (void *)(skaddr + sksize); > ss.ss_size = sksize; > ss.ss_flags = 0; > if (sigaltstack(&ss, NULL) < 0) > exit(1); > memset((void *)&sa, 0, sizeof(struct sigaction)); > sa.sa_handler = handler; > sa.sa_flags = SA_ONSTACK; > sigemptyset(&sa.sa_mask); >printf("A001\n"); > sigaction(SIGUSR1, &sa, NULL); >printf("A002\n"); > kill(getpid(), SIGUSR1); >printf("A003\n"); >fflush(stdout); > while (!handler_done) > /*nop*/; >printf("A004\n"); >fflush(stdout); > } > if (handler_addr == (char *)0xDEAD) > exit(1); > if (handler_addr < skaddr+sksize) { > /* stack was placed into lower area */ > if (*(skaddr+sksize) != 'A') > sprintf(result, "(skaddr)+(sksize)-%d,(sksize)-%d", > sizeof(union alltypes), sizeof(union alltypes)); > else > strcpy(result, "(skaddr)+(sksize),(sksize)"); > } > else { > /* stack was placed into higher area */ > if (*(skaddr+sksize*2) != 'A') > sprintf(result, "(skaddr),(sksize)-%d", sizeof(union alltypes)); > else > strcpy(result, "(skaddr),(sksize)"); > } >/* > if ((f = fopen("conftestval", "w")) == NULL) > exit(1); >*/ >f = stdout; > fprintf(f, "%s\n", result); >/* fclose(f); */ > exit(0); >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 512922
:
387418
| 387420