]> git.pld-linux.org Git - packages/prctl.git/blob - prctl-alpha-sysinfo.patch
- non-parallel install
[packages/prctl.git] / prctl-alpha-sysinfo.patch
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
3 @@ -25,8 +25,12 @@
4  #include <getopt.h>
5  #include <errno.h>
6  #include <pwd.h>
7 -#include <linux/prctl.h>
8 +#include <sys/prctl.h>
9  #include <string.h>
10 +#ifdef __alpha__
11 +#include <asm/sysinfo.h>
12 +#include <asm/unistd.h>
13 +#endif
14  
15  /* Version */
16  #define VERSION        "1.4"
17 @@ -37,6 +41,20 @@
18  #define PSR_UC         0x08
19  /* Command line options */
20  
21 +#ifdef __alpha__
22 +unsigned long getsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
23 +               int *start, void *arg)
24 +{
25 +       return syscall(__NR_osf_getsysinfo, op, buffer, nbytes, start, arg);
26 +}
27 +
28 +unsigned long setsysinfo(unsigned long op, void *buffer, unsigned long nbytes,
29 +               int *start, void *arg)
30 +{
31 +       return syscall(__NR_osf_setsysinfo, op, buffer, nbytes, start, arg);
32 +}
33 +#endif
34 +
35  struct option longopts[] = {
36         {"unaligned", 1, (int *)0, 'u'},
37         {"fpemu", 1, (int *)0, 'f'},
38 @@ -72,6 +90,57 @@
39         int alignval, retval;
40         int umask;
41  
42 +#ifdef __alpha__
43 +       if (prctl_val == -1) {
44 +               unsigned int val;
45 +
46 +               retval = 0;
47 +               if(getsysinfo(GSI_UACPROC, &val, sizeof(val), NULL, NULL) != 1) {
48 +                       retval = -1;
49 +                       goto out;
50 +               }
51 +               printf("%-13s= ", "unaligned");
52 +               if(!val)
53 +                       printf("default\n");
54 +               else
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" : "");
61 +       } else {
62 +               unsigned int buf[2];
63 +               buf[0] = SSIN_UACPROC;
64 +               buf[1] = 0;
65 +               if(prctl_val & PR_UNALIGN_NOPRINT)
66 +                       buf[1] |= UAC_NOPRINT;
67 +               if(prctl_val & PR_UNALIGN_SIGBUS)
68 +                       buf[1] |= UAC_SIGBUS;
69 +               retval = 0;
70 +               if(setsysinfo(SSI_NVPAIRS, buf, 1, NULL, NULL) != 0)
71 +                       retval = -1;
72 +               else {
73 +                       if (verbose) {
74 +                               printf("Set \"unaligned\" to ");
75 +                               switch (prctl_val) {
76 +                               case 0:
77 +                                       printf("\"default\"\n");
78 +                                       break;
79 +
80 +                               case PR_UNALIGN_NOPRINT:
81 +                                       printf("\"silent\"\n");
82 +                                       break;
83 +
84 +                               case PR_UNALIGN_SIGBUS:
85 +                                       printf("\"signal\"\n");
86 +                                       break;
87 +                               }
88 +                       }
89 +               }
90 +       }
91 +out:
92 +#else
93         /*
94          * Check if we need to display the value or set it.
95          */
96 @@ -118,6 +187,7 @@
97                         }
98                 }
99         }
100 +#endif
101         if (retval == -1) {
102                 fprintf(stderr, "Failed to %s \"unalign\" value: %s\n",
103                         ((prctl_val == -1)?"get":"set"), strerror(errno));
This page took 0.068589 seconds and 3 git commands to generate.