1 --- prctl-1.4/prctl.c.orig 2004-11-28 00:57:17.000000000 +0100
2 +++ prctl-1.4/prctl.c 2004-11-28 00:55:27.000000000 +0100
7 -#include <linux/prctl.h>
8 +#include <sys/prctl.h>
11 +#include <asm/sysinfo.h>
12 +#include <asm/unistd.h>
19 /* Command line options */
22 +unsigned long getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
23 + int *start, void *arg)
25 + return syscall(__NR_osf_getsysinfo, op, buffer, nbytes, start, arg);
28 +unsigned long setsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
29 + int *start, void *arg)
31 + return syscall(__NR_osf_setsysinfo, op, buffer, nbytes, start, arg);
35 struct option longopts[] = {
36 {"unaligned", 1, (int *)0, 'u'},
37 {"fpemu", 1, (int *)0, 'f'},
43 + if (prctl_val == -1) {
47 + if(getsysinfo(GSI_UACPROC, &val, sizeof(val), NULL, NULL) != 1) {
51 + printf("%-13s= ", "unaligned");
53 + printf("default\n");
55 + printf("%s%s%s%s%s\n",
56 + (val & UAC_NOPRINT) ? "silent" : "",
57 + (val & UAC_NOPRINT) && (val & (UAC_NOFIX | UAC_SIGBUS)) ? "," : "",
58 + (val & UAC_NOFIX) ? "nofix" : "",
59 + (val & UAC_NOFIX) && (val & UAC_SIGBUS) ? "," : "",
60 + (val & UAC_SIGBUS) ? "signal" : "");
62 + unsigned int buf[2];
63 + buf[0] = SSIN_UACPROC;
65 + if(prctl_val & PR_UNALIGN_NOPRINT)
66 + buf[1] |= UAC_NOPRINT;
67 + if(prctl_val & PR_UNALIGN_SIGBUS)
68 + buf[1] |= UAC_SIGBUS;
70 + if(setsysinfo(SSI_NVPAIRS, buf, 1, NULL, NULL) != 0)
74 + printf("Set \"unaligned\" to ");
75 + switch (prctl_val) {
77 + printf("\"default\"\n");
80 + case PR_UNALIGN_NOPRINT:
81 + printf("\"silent\"\n");
84 + case PR_UNALIGN_SIGBUS:
85 + printf("\"signal\"\n");
94 * Check if we need to display the value or set it.
102 fprintf(stderr, "Failed to %s \"unalign\" value: %s\n",
103 ((prctl_val == -1)?"get":"set"), strerror(errno));