~ubuntu-branches/ubuntu/saucy/strace/saucy

« back to all changes in this revision

Viewing changes to system.c

  • Committer: Bazaar Package Importer
  • Author(s): Jeff Bailey
  • Date: 2005-07-12 03:41:49 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050712034149-wewli8z223w7lhjv
Tags: 4.5.12-1ubuntu1
Do not include linux/socket.h in configure.  There are 
no parts in here that we use.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28
28
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
29
 *
30
 
 *      $Id: system.c,v 1.30 2004/03/01 22:10:54 roland Exp $
 
30
 *      $Id: system.c,v 1.37 2005/06/01 19:22:06 roland Exp $
31
31
 */
32
32
 
33
33
#include "defs.h"
36
36
#define _LINUX_SOCKET_H
37
37
#define _LINUX_FS_H
38
38
 
39
 
#define MS_RDONLY   1  /* Mount read-only */
40
 
#define MS_NOSUID   2  /* Ignore suid and sgid bits */
41
 
#define MS_NODEV    4  /* Disallow access to device special files */
42
 
#define MS_NOEXEC   8  /* Disallow program execution */
43
 
#define MS_SYNCHRONOUS 16  /* Writes are synced at once */
44
 
#define MS_REMOUNT 32  /* Alter flags of a mounted FS */
 
39
#define MS_RDONLY        1      /* Mount read-only */
 
40
#define MS_NOSUID        2      /* Ignore suid and sgid bits */
 
41
#define MS_NODEV         4      /* Disallow access to device special files */
 
42
#define MS_NOEXEC        8      /* Disallow program execution */
 
43
#define MS_SYNCHRONOUS  16      /* Writes are synced at once */
 
44
#define MS_REMOUNT      32      /* Alter flags of a mounted FS */
 
45
#define MS_MANDLOCK     64      /* Allow mandatory locks on an FS */
 
46
#define MS_DIRSYNC      128     /* Directory modifications are synchronous */
 
47
#define MS_NOATIME      1024    /* Do not update access times. */
 
48
#define MS_NODIRATIME   2048    /* Do not update directory access times */
 
49
#define MS_BIND         4096
 
50
#define MS_MOVE         8192
 
51
#define MS_REC          16384
 
52
#define MS_VERBOSE      32768
 
53
#define MS_POSIXACL     (1<<16) /* VFS does not apply the umask */
 
54
#define MS_ACTIVE       (1<<30)
 
55
#define MS_NOUSER       (1<<31)
45
56
 
46
57
#include <sys/socket.h>
47
58
#include <netinet/in.h>
49
60
 
50
61
#include <sys/syscall.h>
51
62
 
52
 
#ifdef SYS_personality
53
 
/* Workaround for kernel namespace pollution. */
54
 
#define _LINUX_PTRACE_H
55
 
/* Yuck yuck yuck.  We can't include linux/ptrace.h, but personality.h
56
 
   makes a declaration with struct pt_regs, which is defined there. */
57
 
struct pt_regs;
58
 
#define sys_personality kernel_sys_personality
59
 
#include <linux/personality.h>
60
 
#undef sys_personality
61
 
#endif /* SYS_personality */
62
 
 
63
63
#ifdef SYS_capget
64
64
#include <linux/capability.h>
65
65
#endif
78
78
 
79
79
#include <linux/sysctl.h>
80
80
 
81
 
static struct xlat mount_flags[] = {
 
81
static const struct xlat mount_flags[] = {
82
82
        { MS_RDONLY,    "MS_RDONLY"     },
83
83
        { MS_NOSUID,    "MS_NOSUID"     },
84
84
        { MS_NODEV,     "MS_NODEV"      },
85
85
        { MS_NOEXEC,    "MS_NOEXEC"     },
86
 
#ifdef MS_SYNCHRONOUS
87
86
        { MS_SYNCHRONOUS,"MS_SYNCHRONOUS"},
88
 
#else
89
 
        { MS_SYNC,      "MS_SYNC"       },
90
 
#endif
91
87
        { MS_REMOUNT,   "MS_REMOUNT"    },
 
88
        { MS_MANDLOCK,  "MS_MANDLOCK"   },
 
89
        { MS_NOATIME,   "MS_NOATIME"    },
 
90
        { MS_NODIRATIME,"MS_NODIRATIME" },
 
91
        { MS_BIND,      "MS_BIND"       },
 
92
        { MS_MOVE,      "MS_MOVE"       },
 
93
        { MS_REC,       "MS_REC"        },
 
94
        { MS_VERBOSE,   "MS_VERBOSE"    },
 
95
        { MS_POSIXACL,  "MS_POSIXACL"   },
 
96
        { MS_ACTIVE,    "MS_ACTIVE"     },
 
97
        { MS_NOUSER,    "MS_NOUSER"     },
92
98
        { 0,            NULL            },
93
99
};
94
100
 
101
107
                tprintf(", ");
102
108
                printpath(tcp, tcp->u_arg[1]);
103
109
                tprintf(", ");
104
 
                printpath(tcp, tcp->u_arg[2]);
 
110
                if ((tcp->u_arg[3] & (MS_BIND|MS_MOVE|MS_REMOUNT)) == 0)
 
111
                        printpath(tcp, tcp->u_arg[2]);
 
112
                else
 
113
                        tprintf("%#lx", tcp->u_arg[2]);
105
114
                tprintf(", ");
106
 
                printflags(mount_flags, tcp->u_arg[3]);
 
115
                printflags(mount_flags, tcp->u_arg[3], "MS_???");
107
116
                tprintf(", %#lx", tcp->u_arg[4]);
108
117
        }
109
118
        return 0;
124
133
        return 0;
125
134
}
126
135
 
127
 
static struct xlat personality_options[] = {
128
 
#ifdef PER_LINUX
129
 
        { PER_LINUX,    "PER_LINUX"     },
130
 
#endif
131
 
#ifdef PER_LINUX_32BIT
132
 
        { PER_LINUX_32BIT,      "PER_LINUX"     },
133
 
#endif
134
 
#ifdef PER_SVR4
135
 
        { PER_SVR4,     "PER_SVR4"      },
136
 
#endif
137
 
#ifdef PER_SVR3
138
 
        { PER_SVR3,     "PER_SVR3"      },
139
 
#endif
140
 
#ifdef PER_SCOSVR3
141
 
        { PER_SCOSVR3,  "PER_SCOSVR3"   },
142
 
#endif
143
 
#ifdef PER_WYSEV386
144
 
        { PER_WYSEV386, "PER_WYSEV386"  },
145
 
#endif
146
 
#ifdef PER_ISCR4
147
 
        { PER_ISCR4,    "PER_ISCR4"     },
148
 
#endif
149
 
#ifdef PER_BSD
150
 
        { PER_BSD,      "PER_BSD"       },
151
 
#endif
152
 
#ifdef PER_XENIX
153
 
        { PER_XENIX,    "PER_XENIX"     },
154
 
#endif
 
136
/* These are not macros, but enums.  We just copy the values by hand
 
137
   from Linux 2.6.9 here.  */
 
138
static const struct xlat personality_options[] = {
 
139
        { 0,            "PER_LINUX"     },
 
140
        { 0x00800000,   "PER_LINUX_32BIT"},
 
141
        { 0x04100001,   "PER_SVR4"      },
 
142
        { 0x05000002,   "PER_SVR3"      },
 
143
        { 0x07000003,   "PER_SCOSVR3"   },
 
144
        { 0x06000003,   "PER_OSR5"      },
 
145
        { 0x05000004,   "PER_WYSEV386"  },
 
146
        { 0x04000005,   "PER_ISCR4"     },
 
147
        { 0x00000006,   "PER_BSD"       },
 
148
        { 0x04000006,   "PER_SUNOS"     },
 
149
        { 0x05000007,   "PER_XENIX"     },
 
150
        { 0x00000008,   "PER_LINUX32"   },
 
151
        { 0x08000008,   "PER_LINUX32_3GB"},
 
152
        { 0x04000009,   "PER_IRIX32"    },
 
153
        { 0x0400000a,   "PER_IRIXN32"   },
 
154
        { 0x0400000b,   "PER_IRIX64"    },
 
155
        { 0x0000000c,   "PER_RISCOS"    },
 
156
        { 0x0400000d,   "PER_SOLARIS"   },
 
157
        { 0x0410000e,   "PER_UW7"       },
 
158
        { 0x0000000f,   "PER_OSF4"      },
 
159
        { 0x00000010,   "PER_HPUX"      },
155
160
        { 0,            NULL            },
156
161
};
157
162
 
165
170
}
166
171
 
167
172
#include <linux/reboot.h>
168
 
static struct xlat bootflags1[] = {
 
173
static const struct xlat bootflags1[] = {
169
174
        { LINUX_REBOOT_MAGIC1,  "LINUX_REBOOT_MAGIC1"   },
170
175
        { 0,                    NULL                    },
171
176
};
172
177
 
173
 
static struct xlat bootflags2[] = {
 
178
static const struct xlat bootflags2[] = {
174
179
        { LINUX_REBOOT_MAGIC2,  "LINUX_REBOOT_MAGIC2"   },
175
180
        { LINUX_REBOOT_MAGIC2A, "LINUX_REBOOT_MAGIC2A"  },
176
181
        { LINUX_REBOOT_MAGIC2B, "LINUX_REBOOT_MAGIC2B"  },
177
182
        { 0,                    NULL                    },
178
183
};
179
184
 
180
 
static struct xlat bootflags3[] = {
 
185
static const struct xlat bootflags3[] = {
181
186
        { LINUX_REBOOT_CMD_CAD_OFF,     "LINUX_REBOOT_CMD_CAD_OFF"      },
182
187
        { LINUX_REBOOT_CMD_RESTART,     "LINUX_REBOOT_CMD_RESTART"      },
183
188
        { LINUX_REBOOT_CMD_HALT,        "LINUX_REBOOT_CMD_HALT"         },
192
197
struct tcb *tcp;
193
198
{
194
199
        if (entering(tcp)) {
195
 
                if (!printflags(bootflags1, tcp->u_arg[0]))
196
 
                        tprintf("LINUX_REBOOT_MAGIC???");
197
 
                tprintf(", ");
198
 
                if (!printflags(bootflags2, tcp->u_arg[1]))
199
 
                        tprintf("LINUX_REBOOT_MAGIC???");
200
 
                tprintf(", ");
201
 
                if (!printflags(bootflags3, tcp->u_arg[2]))
202
 
                        tprintf("LINUX_REBOOT_CMD_???");
 
200
                printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
 
201
                tprintf(", ");
 
202
                printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
 
203
                tprintf(", ");
 
204
                printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
203
205
                if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) {
204
206
                        tprintf(", ");
205
207
                        printstr(tcp, tcp->u_arg[3], -1);
209
211
}
210
212
 
211
213
#ifdef M68K
212
 
static struct xlat cacheflush_scope[] = {
 
214
static const struct xlat cacheflush_scope[] = {
213
215
#ifdef FLUSH_SCOPE_LINE
214
216
        { FLUSH_SCOPE_LINE,     "FLUSH_SCOPE_LINE" },
215
217
#endif
222
224
        { 0,                    NULL },
223
225
};
224
226
 
225
 
static struct xlat cacheflush_flags[] = {
 
227
static const struct xlat cacheflush_flags[] = {
226
228
#ifdef FLUSH_CACHE_BOTH
227
229
        { FLUSH_CACHE_BOTH,     "FLUSH_CACHE_BOTH" },
228
230
#endif
246
248
                printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
247
249
                tprintf(", ");
248
250
                /* flags */
249
 
                printflags(cacheflush_flags, tcp->u_arg[2]);
 
251
                printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
250
252
                /* len */
251
253
                tprintf(", %lu", tcp->u_arg[3]);
252
254
        }
277
279
        return 0;
278
280
}
279
281
 
280
 
static struct xlat bootflags[] = {
 
282
static const struct xlat bootflags[] = {
281
283
        { RB_AUTOBOOT,  "RB_AUTOBOOT"   },      /* for system auto-booting itself */
282
284
        { RB_ASKNAME,   "RB_ASKNAME"    },      /* ask for file name to reboot from */
283
285
        { RB_SINGLE,    "RB_SINGLE"     },      /* reboot to single user only */
297
299
struct tcb *tcp;
298
300
{
299
301
        if (entering(tcp)) {
300
 
                if (!printflags(bootflags, tcp->u_arg[0]))
301
 
                        tprintf("RB_???");
 
302
                printflags(bootflags, tcp->u_arg[0], "RB_???");
302
303
                if (tcp->u_arg[0] & RB_STRING) {
303
304
                        printstr(tcp, tcp->u_arg[1], -1);
304
305
                }
336
337
        return 0;
337
338
}
338
339
 
339
 
static struct xlat mountflags[] = {
 
340
static const struct xlat mountflags[] = {
340
341
        { M_RDONLY,     "M_RDONLY"      },
341
342
        { M_NOSUID,     "M_NOSUID"      },
342
343
        { M_NEWTYPE,    "M_NEWTYPE"     },
356
357
        { 0,            NULL            },
357
358
};
358
359
 
359
 
static struct xlat nfsflags[] = {
 
360
static const struct xlat nfsflags[] = {
360
361
        { NFSMNT_SOFT,          "NFSMNT_SOFT"           },
361
362
        { NFSMNT_WSIZE,         "NFSMNT_WSIZE"          },
362
363
        { NFSMNT_RSIZE,         "NFSMNT_RSIZE"          },
396
397
                }
397
398
                printstr(tcp, tcp->u_arg[1], -1);
398
399
                tprintf(", ");
399
 
                if (!printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE))
400
 
                        tprintf("0");
 
400
                printflags(mountflags, tcp->u_arg[2] & ~M_NEWTYPE, "M_???");
401
401
                tprintf(", ");
402
402
 
403
403
                if (strcmp(type, "4.2") == 0) {
417
417
                        tprintf("[");
418
418
                        printsock(tcp, (int) a.addr);
419
419
                        tprintf(", ");
420
 
                        if (!printflags(nfsflags, a.flags))
421
 
                                tprintf("NFSMNT_???");
 
420
                        printflags(nfsflags, a.flags, "NFSMNT_???");
422
421
                        tprintf(", ws:%u,rs:%u,to:%u,re:%u,",
423
422
                                a.wsize, a.rsize, a.timeo, a.retrans);
424
423
                        if (a.flags & NFSMNT_HOSTNAME && a.hostname)
477
476
        return printargs(tcp);
478
477
}
479
478
 
480
 
static struct xlat ex_auth_flags[] = {
 
479
static const struct xlat ex_auth_flags[] = {
481
480
        { AUTH_UNIX,    "AUTH_UNIX"     },
482
481
        { AUTH_DES,     "AUTH_DES"      },
483
482
        { 0,            NULL            },
523
522
        return 0;
524
523
}
525
524
 
526
 
static struct xlat sysconflimits[] = {
 
525
static const struct xlat sysconflimits[] = {
527
526
#ifdef  _SC_ARG_MAX
528
527
        { _SC_ARG_MAX,  "_SC_ARG_MAX"   },      /* space for argv & envp */
529
528
#endif
564
563
#endif /* SUNOS4 */
565
564
 
566
565
#if defined(SUNOS4) || defined(FREEBSD)
567
 
static struct xlat pathconflimits[] = {
 
566
static const struct xlat pathconflimits[] = {
568
567
#ifdef  _PC_LINK_MAX
569
568
        { _PC_LINK_MAX, "_PC_LINK_MAX"  },      /* max links to file/dir */
570
569
#endif
631
630
#include <sys/systeminfo.h>
632
631
#include <sys/utsname.h>
633
632
 
634
 
static struct xlat sysconfig_options[] = {
 
633
static const struct xlat sysconfig_options[] = {
635
634
#ifdef _CONFIG_NGROUPS
636
635
        { _CONFIG_NGROUPS,              "_CONFIG_NGROUPS"               },
637
636
#endif
719
718
        return 0;
720
719
}
721
720
 
722
 
static struct xlat sysinfo_options[] = {
 
721
static const struct xlat sysinfo_options[] = {
723
722
        { SI_SYSNAME,           "SI_SYSNAME"            },
724
723
        { SI_HOSTNAME,          "SI_HOSTNAME"           },
725
724
        { SI_RELEASE,           "SI_RELEASE"            },
767
766
 
768
767
#include <sys/syssgi.h>
769
768
 
770
 
static struct xlat syssgi_options[] = {
 
769
static const struct xlat syssgi_options[] = {
771
770
        { SGI_SYSID,            "SGI_SYSID"             },
772
771
#ifdef SGI_RDUBLK
773
772
        { SGI_RDUBLK,           "SGI_RDUBLK"            },
883
882
#ifdef SGI_GET_FP_PRECISE
884
883
        { SGI_GET_FP_PRECISE,   "SGI_GET_FP_PRECISE"    },
885
884
#endif
886
 
#ifdef SGI_GET_CONFIG_SMM       
 
885
#ifdef SGI_GET_CONFIG_SMM
887
886
        { SGI_GET_CONFIG_SMM,   "SGI_GET_CONFIG_SMM"    },
888
887
#endif
889
 
#ifdef SGI_FP_IMPRECISE_SUPP    
 
888
#ifdef SGI_FP_IMPRECISE_SUPP
890
889
        { SGI_FP_IMPRECISE_SUPP,"SGI_FP_IMPRECISE_SUPP" },
891
890
#endif
892
 
#ifdef SGI_CONFIG_NSMM_SUPP     
 
891
#ifdef SGI_CONFIG_NSMM_SUPP
893
892
        { SGI_CONFIG_NSMM_SUPP, "SGI_CONFIG_NSMM_SUPP"  },
894
893
#endif
895
 
#ifdef SGI_RT_TSTAMP_CREATE    
 
894
#ifdef SGI_RT_TSTAMP_CREATE
896
895
        { SGI_RT_TSTAMP_CREATE, "SGI_RT_TSTAMP_CREATE"  },
897
896
#endif
898
 
#ifdef SGI_RT_TSTAMP_DELETE    
 
897
#ifdef SGI_RT_TSTAMP_DELETE
899
898
        { SGI_RT_TSTAMP_DELETE, "SGI_RT_TSTAMP_DELETE"  },
900
899
#endif
901
 
#ifdef SGI_RT_TSTAMP_START     
 
900
#ifdef SGI_RT_TSTAMP_START
902
901
        { SGI_RT_TSTAMP_START,  "SGI_RT_TSTAMP_START"   },
903
902
#endif
904
 
#ifdef SGI_RT_TSTAMP_STOP      
 
903
#ifdef SGI_RT_TSTAMP_STOP
905
904
        { SGI_RT_TSTAMP_STOP,   "SGI_RT_TSTAMP_STOP"    },
906
905
#endif
907
 
#ifdef SGI_RT_TSTAMP_ADDR      
 
906
#ifdef SGI_RT_TSTAMP_ADDR
908
907
        { SGI_RT_TSTAMP_ADDR,   "SGI_RT_TSTAMP_ADDR"    },
909
908
#endif
910
 
#ifdef SGI_RT_TSTAMP_MASK      
 
909
#ifdef SGI_RT_TSTAMP_MASK
911
910
        { SGI_RT_TSTAMP_MASK,   "SGI_RT_TSTAMP_MASK"    },
912
911
#endif
913
 
#ifdef SGI_RT_TSTAMP_EOB_MODE  
 
912
#ifdef SGI_RT_TSTAMP_EOB_MODE
914
913
        { SGI_RT_TSTAMP_EOB_MODE,"SGI_RT_TSTAMP_EOB_MODE"},
915
914
#endif
916
 
#ifdef SGI_USE_FP_BCOPY 
 
915
#ifdef SGI_USE_FP_BCOPY
917
916
        { SGI_USE_FP_BCOPY,     "SGI_USE_FP_BCOPY"      },
918
917
#endif
919
 
#ifdef SGI_GET_UST              
 
918
#ifdef SGI_GET_UST
920
919
        { SGI_GET_UST,          "SGI_GET_UST"           },
921
920
#endif
922
 
#ifdef SGI_SPECULATIVE_EXEC     
 
921
#ifdef SGI_SPECULATIVE_EXEC
923
922
        { SGI_SPECULATIVE_EXEC, "SGI_SPECULATIVE_EXEC"  },
924
923
#endif
925
 
#ifdef SGI_XLV_NEXT_RQST        
 
924
#ifdef SGI_XLV_NEXT_RQST
926
925
        { SGI_XLV_NEXT_RQST,    "SGI_XLV_NEXT_RQST"     },
927
926
#endif
928
 
#ifdef SGI_XLV_ATTR_CURSOR      
 
927
#ifdef SGI_XLV_ATTR_CURSOR
929
928
        { SGI_XLV_ATTR_CURSOR,  "SGI_XLV_ATTR_CURSOR"   },
930
929
#endif
931
 
#ifdef SGI_XLV_ATTR_GET 
 
930
#ifdef SGI_XLV_ATTR_GET
932
931
        { SGI_XLV_ATTR_GET,     "SGI_XLV_ATTR_GET"      },
933
932
#endif
934
 
#ifdef SGI_XLV_ATTR_SET 
 
933
#ifdef SGI_XLV_ATTR_SET
935
934
        { SGI_XLV_ATTR_SET,     "SGI_XLV_ATTR_SET"      },
936
935
#endif
937
936
#ifdef SGI_BTOOLSIZE
938
937
        { SGI_BTOOLSIZE,        "SGI_BTOOLSIZE"         },
939
938
#endif
940
 
#ifdef SGI_BTOOLGET             
 
939
#ifdef SGI_BTOOLGET
941
940
        { SGI_BTOOLGET,         "SGI_BTOOLGET"          },
942
941
#endif
943
 
#ifdef SGI_BTOOLREINIT          
 
942
#ifdef SGI_BTOOLREINIT
944
943
        { SGI_BTOOLREINIT,      "SGI_BTOOLREINIT"       },
945
944
#endif
946
 
#ifdef SGI_CREATE_UUID          
 
945
#ifdef SGI_CREATE_UUID
947
946
        { SGI_CREATE_UUID,      "SGI_CREATE_UUID"       },
948
947
#endif
949
 
#ifdef SGI_NOFPE                
 
948
#ifdef SGI_NOFPE
950
949
        { SGI_NOFPE,            "SGI_NOFPE"             },
951
950
#endif
952
 
#ifdef SGI_OLD_SOFTFP           
 
951
#ifdef SGI_OLD_SOFTFP
953
952
        { SGI_OLD_SOFTFP,       "SGI_OLD_SOFTFP"        },
954
953
#endif
955
 
#ifdef SGI_FS_INUMBERS          
 
954
#ifdef SGI_FS_INUMBERS
956
955
        { SGI_FS_INUMBERS,      "SGI_FS_INUMBERS"       },
957
956
#endif
958
 
#ifdef SGI_FS_BULKSTAT          
 
957
#ifdef SGI_FS_BULKSTAT
959
958
        { SGI_FS_BULKSTAT,      "SGI_FS_BULKSTAT"       },
960
959
#endif
961
 
#ifdef SGI_RT_TSTAMP_WAIT       
 
960
#ifdef SGI_RT_TSTAMP_WAIT
962
961
        { SGI_RT_TSTAMP_WAIT,   "SGI_RT_TSTAMP_WAIT"    },
963
962
#endif
964
 
#ifdef SGI_RT_TSTAMP_UPDATE    
 
963
#ifdef SGI_RT_TSTAMP_UPDATE
965
964
        { SGI_RT_TSTAMP_UPDATE, "SGI_RT_TSTAMP_UPDATE"  },
966
965
#endif
967
 
#ifdef SGI_PATH_TO_HANDLE       
 
966
#ifdef SGI_PATH_TO_HANDLE
968
967
        { SGI_PATH_TO_HANDLE,   "SGI_PATH_TO_HANDLE"    },
969
968
#endif
970
 
#ifdef SGI_PATH_TO_FSHANDLE     
 
969
#ifdef SGI_PATH_TO_FSHANDLE
971
970
        { SGI_PATH_TO_FSHANDLE, "SGI_PATH_TO_FSHANDLE"  },
972
971
#endif
973
 
#ifdef SGI_FD_TO_HANDLE 
 
972
#ifdef SGI_FD_TO_HANDLE
974
973
        { SGI_FD_TO_HANDLE,     "SGI_FD_TO_HANDLE"      },
975
974
#endif
976
 
#ifdef SGI_OPEN_BY_HANDLE       
 
975
#ifdef SGI_OPEN_BY_HANDLE
977
976
        { SGI_OPEN_BY_HANDLE,   "SGI_OPEN_BY_HANDLE"    },
978
977
#endif
979
 
#ifdef SGI_READLINK_BY_HANDLE   
 
978
#ifdef SGI_READLINK_BY_HANDLE
980
979
        { SGI_READLINK_BY_HANDLE,"SGI_READLINK_BY_HANDLE"},
981
980
#endif
982
 
#ifdef SGI_READ_DANGID          
 
981
#ifdef SGI_READ_DANGID
983
982
        { SGI_READ_DANGID,      "SGI_READ_DANGID"       },
984
983
#endif
985
 
#ifdef SGI_CONST                
 
984
#ifdef SGI_CONST
986
985
        { SGI_CONST,            "SGI_CONST"             },
987
986
#endif
988
 
#ifdef SGI_XFS_FSOPERATIONS     
 
987
#ifdef SGI_XFS_FSOPERATIONS
989
988
        { SGI_XFS_FSOPERATIONS, "SGI_XFS_FSOPERATIONS"  },
990
989
#endif
991
 
#ifdef SGI_SETASH               
 
990
#ifdef SGI_SETASH
992
991
        { SGI_SETASH,           "SGI_SETASH"            },
993
992
#endif
994
 
#ifdef SGI_GETASH               
 
993
#ifdef SGI_GETASH
995
994
        { SGI_GETASH,           "SGI_GETASH"            },
996
995
#endif
997
 
#ifdef SGI_SETPRID              
 
996
#ifdef SGI_SETPRID
998
997
        { SGI_SETPRID,          "SGI_SETPRID"           },
999
998
#endif
1000
 
#ifdef SGI_GETPRID              
 
999
#ifdef SGI_GETPRID
1001
1000
        { SGI_GETPRID,          "SGI_GETPRID"           },
1002
1001
#endif
1003
 
#ifdef SGI_SETSPINFO            
 
1002
#ifdef SGI_SETSPINFO
1004
1003
        { SGI_SETSPINFO,        "SGI_SETSPINFO"         },
1005
1004
#endif
1006
 
#ifdef SGI_GETSPINFO            
 
1005
#ifdef SGI_GETSPINFO
1007
1006
        { SGI_GETSPINFO,        "SGI_GETSPINFO"         },
1008
1007
#endif
1009
 
#ifdef SGI_SHAREII              
 
1008
#ifdef SGI_SHAREII
1010
1009
        { SGI_SHAREII,          "SGI_SHAREII"           },
1011
1010
#endif
1012
 
#ifdef SGI_NEWARRAYSESS 
 
1011
#ifdef SGI_NEWARRAYSESS
1013
1012
        { SGI_NEWARRAYSESS,     "SGI_NEWARRAYSESS"      },
1014
1013
#endif
1015
 
#ifdef SGI_GETDFLTPRID          
 
1014
#ifdef SGI_GETDFLTPRID
1016
1015
        { SGI_GETDFLTPRID,      "SGI_GETDFLTPRID"       },
1017
1016
#endif
1018
 
#ifdef SGI_SET_DISMISSED_EXC_CNT 
 
1017
#ifdef SGI_SET_DISMISSED_EXC_CNT
1019
1018
        { SGI_SET_DISMISSED_EXC_CNT,"SGI_SET_DISMISSED_EXC_CNT" },
1020
1019
#endif
1021
 
#ifdef SGI_GET_DISMISSED_EXC_CNT 
 
1020
#ifdef SGI_GET_DISMISSED_EXC_CNT
1022
1021
        { SGI_GET_DISMISSED_EXC_CNT,"SGI_GET_DISMISSED_EXC_CNT" },
1023
1022
#endif
1024
 
#ifdef SGI_CYCLECNTR_SIZE       
 
1023
#ifdef SGI_CYCLECNTR_SIZE
1025
1024
        { SGI_CYCLECNTR_SIZE,   "SGI_CYCLECNTR_SIZE"    },
1026
1025
#endif
1027
 
#ifdef SGI_QUERY_FASTTIMER      
 
1026
#ifdef SGI_QUERY_FASTTIMER
1028
1027
        { SGI_QUERY_FASTTIMER,  "SGI_QUERY_FASTTIMER"   },
1029
1028
#endif
1030
 
#ifdef SGI_PIDSINASH            
 
1029
#ifdef SGI_PIDSINASH
1031
1030
        { SGI_PIDSINASH,        "SGI_PIDSINASH"         },
1032
1031
#endif
1033
 
#ifdef SGI_ULI                  
 
1032
#ifdef SGI_ULI
1034
1033
        { SGI_ULI,              "SGI_ULI"               },
1035
1034
#endif
1036
 
#ifdef SGI_LPG_SHMGET          
 
1035
#ifdef SGI_LPG_SHMGET
1037
1036
        { SGI_LPG_SHMGET,       "SGI_LPG_SHMGET"        },
1038
1037
#endif
1039
 
#ifdef SGI_LPG_MAP             
 
1038
#ifdef SGI_LPG_MAP
1040
1039
        { SGI_LPG_MAP,          "SGI_LPG_MAP"           },
1041
1040
#endif
1042
 
#ifdef SGI_CACHEFS_SYS          
 
1041
#ifdef SGI_CACHEFS_SYS
1043
1042
        { SGI_CACHEFS_SYS,      "SGI_CACHEFS_SYS"       },
1044
1043
#endif
1045
 
#ifdef SGI_NFSNOTIFY            
 
1044
#ifdef SGI_NFSNOTIFY
1046
1045
        { SGI_NFSNOTIFY,        "SGI_NFSNOTIFY"         },
1047
1046
#endif
1048
 
#ifdef SGI_LOCKDSYS             
 
1047
#ifdef SGI_LOCKDSYS
1049
1048
        { SGI_LOCKDSYS,         "SGI_LOCKDSYS"          },
1050
1049
#endif
1051
 
#ifdef SGI_EVENTCTR            
 
1050
#ifdef SGI_EVENTCTR
1052
1051
        { SGI_EVENTCTR,         "SGI_EVENTCTR"          },
1053
1052
#endif
1054
 
#ifdef SGI_GETPRUSAGE          
 
1053
#ifdef SGI_GETPRUSAGE
1055
1054
        { SGI_GETPRUSAGE,       "SGI_GETPRUSAGE"        },
1056
1055
#endif
1057
 
#ifdef SGI_PROCMASK_LOCATION    
 
1056
#ifdef SGI_PROCMASK_LOCATION
1058
1057
        { SGI_PROCMASK_LOCATION,"SGI_PROCMASK_LOCATION" },
1059
1058
#endif
1060
 
#ifdef SGI_UNUSED               
 
1059
#ifdef SGI_UNUSED
1061
1060
        { SGI_UNUSED,           "SGI_UNUSED"            },
1062
1061
#endif
1063
 
#ifdef SGI_CKPT_SYS             
1064
 
        { SGI_CKPT_SYS,         "SGI_CKPT_SYS"          },
1065
 
#endif
1066
 
#ifdef SGI_CKPT_SYS             
1067
 
        { SGI_CKPT_SYS,         "SGI_CKPT_SYS"          },
1068
 
#endif
1069
 
#ifdef SGI_GETGRPPID            
 
1062
#ifdef SGI_CKPT_SYS
 
1063
        { SGI_CKPT_SYS,         "SGI_CKPT_SYS"          },
 
1064
#endif
 
1065
#ifdef SGI_CKPT_SYS
 
1066
        { SGI_CKPT_SYS,         "SGI_CKPT_SYS"          },
 
1067
#endif
 
1068
#ifdef SGI_GETGRPPID
1070
1069
        { SGI_GETGRPPID,        "SGI_GETGRPPID"         },
1071
1070
#endif
1072
 
#ifdef SGI_GETSESPID            
 
1071
#ifdef SGI_GETSESPID
1073
1072
        { SGI_GETSESPID,        "SGI_GETSESPID"         },
1074
1073
#endif
1075
 
#ifdef SGI_ENUMASHS             
 
1074
#ifdef SGI_ENUMASHS
1076
1075
        { SGI_ENUMASHS,         "SGI_ENUMASHS"          },
1077
1076
#endif
1078
 
#ifdef SGI_SETASMACHID          
 
1077
#ifdef SGI_SETASMACHID
1079
1078
        { SGI_SETASMACHID,      "SGI_SETASMACHID"       },
1080
1079
#endif
1081
 
#ifdef SGI_GETASMACHID          
 
1080
#ifdef SGI_GETASMACHID
1082
1081
        { SGI_GETASMACHID,      "SGI_GETASMACHID"       },
1083
1082
#endif
1084
 
#ifdef SGI_GETARSESS            
 
1083
#ifdef SGI_GETARSESS
1085
1084
        { SGI_GETARSESS,        "SGI_GETARSESS"         },
1086
1085
#endif
1087
 
#ifdef SGI_JOINARRAYSESS        
 
1086
#ifdef SGI_JOINARRAYSESS
1088
1087
        { SGI_JOINARRAYSESS,    "SGI_JOINARRAYSESS"     },
1089
1088
#endif
1090
 
#ifdef SGI_SPROC_KILL           
 
1089
#ifdef SGI_SPROC_KILL
1091
1090
        { SGI_SPROC_KILL,       "SGI_SPROC_KILL"        },
1092
1091
#endif
1093
 
#ifdef SGI_DBA_CONFIG           
 
1092
#ifdef SGI_DBA_CONFIG
1094
1093
        { SGI_DBA_CONFIG,       "SGI_DBA_CONFIG"        },
1095
1094
#endif
1096
 
#ifdef SGI_RELEASE_NAME 
 
1095
#ifdef SGI_RELEASE_NAME
1097
1096
        { SGI_RELEASE_NAME,     "SGI_RELEASE_NAME"      },
1098
1097
#endif
1099
 
#ifdef SGI_SYNCH_CACHE_HANDLER 
 
1098
#ifdef SGI_SYNCH_CACHE_HANDLER
1100
1099
        { SGI_SYNCH_CACHE_HANDLER,"SGI_SYNCH_CACHE_HANDLER"},
1101
1100
#endif
1102
 
#ifdef SGI_SWASH_INIT           
 
1101
#ifdef SGI_SWASH_INIT
1103
1102
        { SGI_SWASH_INIT,       "SGI_SWASH_INIT"        },
1104
1103
#endif
1105
 
#ifdef SGI_NUMA_MIGR_PAGE       
 
1104
#ifdef SGI_NUMA_MIGR_PAGE
1106
1105
        { SGI_NUMA_MIGR_PAGE,   "SGI_NUMA_MIGR_PAGE"    },
1107
1106
#endif
1108
 
#ifdef SGI_NUMA_MIGR_PAGE_ALT   
 
1107
#ifdef SGI_NUMA_MIGR_PAGE_ALT
1109
1108
        { SGI_NUMA_MIGR_PAGE_ALT,"SGI_NUMA_MIGR_PAGE_ALT"},
1110
1109
#endif
1111
 
#ifdef SGI_KAIO_USERINIT        
 
1110
#ifdef SGI_KAIO_USERINIT
1112
1111
        { SGI_KAIO_USERINIT,    "SGI_KAIO_USERINIT"     },
1113
1112
#endif
1114
 
#ifdef SGI_KAIO_READ            
 
1113
#ifdef SGI_KAIO_READ
1115
1114
        { SGI_KAIO_READ,        "SGI_KAIO_READ"         },
1116
1115
#endif
1117
 
#ifdef SGI_KAIO_WRITE           
 
1116
#ifdef SGI_KAIO_WRITE
1118
1117
        { SGI_KAIO_WRITE,       "SGI_KAIO_WRITE"        },
1119
1118
#endif
1120
 
#ifdef SGI_KAIO_SUSPEND 
 
1119
#ifdef SGI_KAIO_SUSPEND
1121
1120
        { SGI_KAIO_SUSPEND,     "SGI_KAIO_SUSPEND"      },
1122
1121
#endif
1123
 
#ifdef SGI_KAIO_STATS           
 
1122
#ifdef SGI_KAIO_STATS
1124
1123
        { SGI_KAIO_STATS,       "SGI_KAIO_STATS"        },
1125
1124
#endif
1126
 
#ifdef SGI_INITIAL_PT_SPROC     
 
1125
#ifdef SGI_INITIAL_PT_SPROC
1127
1126
        { SGI_INITIAL_PT_SPROC, "SGI_INITIAL_PT_SPROC"  },
1128
1127
#endif
1129
1128
        { 0,                    NULL                    },
1156
1155
#include <sys/fs/nfs.h>
1157
1156
#include <sys/fs/nfs_clnt.h>
1158
1157
 
1159
 
static struct xlat mount_flags[] = {
 
1158
static const struct xlat mount_flags[] = {
1160
1159
        { MS_RDONLY,    "MS_RDONLY"     },
1161
1160
        { MS_FSS,       "MS_FSS"        },
1162
1161
        { MS_DATA,      "MS_DATA"       },
1170
1169
        { 0,            NULL            },
1171
1170
};
1172
1171
 
1173
 
static struct xlat nfs_flags[] = {
 
1172
static const struct xlat nfs_flags[] = {
1174
1173
        { NFSMNT_SOFT,          "NFSMNT_SOFT"           },
1175
1174
        { NFSMNT_WSIZE,         "NFSMNT_WSIZE"          },
1176
1175
        { NFSMNT_RSIZE,         "NFSMNT_RSIZE"          },
1211
1210
                tprintf(", ");
1212
1211
                printpath(tcp, tcp->u_arg[1]);
1213
1212
                tprintf(", ");
1214
 
                printflags(mount_flags, tcp->u_arg[2]);
 
1213
                printflags(mount_flags, tcp->u_arg[2], "MS_???");
1215
1214
                if (tcp->u_arg[2] & (MS_FSS | MS_DATA)) {
1216
1215
                        tprintf(", ");
1217
1216
                        tprintf("%ld", tcp->u_arg[3]);
1228
1227
                                        tprintf("addr=");
1229
1228
                                        printsock(tcp, (int) args.addr);
1230
1229
                                        tprintf(", flags=");
1231
 
                                        if (!printflags(nfs_flags, args.flags))
1232
 
                                                tprintf("NFSMNT_???");
 
1230
                                        printflags(nfs_flags, args.flags, "NFSMNT_???");
1233
1231
                                        tprintf(", hostname=");
1234
1232
                                        printstr(tcp, (int) args.hostname, -1);
1235
1233
                                        tprintf(", ...}");
1257
1255
 
1258
1256
#include <sys/fs/vx_ioctl.h>
1259
1257
 
1260
 
static struct xlat mount_flags[] = {
 
1258
static const struct xlat mount_flags[] = {
1261
1259
        { MS_RDONLY,    "MS_RDONLY"     },
1262
1260
        { MS_FSS,       "MS_FSS"        },
1263
1261
        { MS_DATA,      "MS_DATA"       },
1271
1269
};
1272
1270
 
1273
1271
#ifdef VX_MS_MASK
1274
 
static struct xlat vxfs_flags[] = {
 
1272
static const struct xlat vxfs_flags[] = {
1275
1273
        { VX_MS_NOLOG,          "VX_MS_NOLOG"           },
1276
1274
        { VX_MS_BLKCLEAR,       "VX_MS_BLKCLEAR"        },
1277
1275
        { VX_MS_SNAPSHOT,       "VX_MS_SNAPSHOT"        },
1293
1291
};
1294
1292
#endif
1295
1293
 
1296
 
static struct xlat nfs_flags[] = {
 
1294
static const struct xlat nfs_flags[] = {
1297
1295
        { NFSMNT_SOFT,          "NFSMNT_SOFT"           },
1298
1296
        { NFSMNT_WSIZE,         "NFSMNT_WSIZE"          },
1299
1297
        { NFSMNT_RSIZE,         "NFSMNT_RSIZE"          },
1324
1322
                tprintf(", ");
1325
1323
                printpath(tcp, tcp->u_arg[1]);
1326
1324
                tprintf(", ");
1327
 
                printflags(mount_flags, tcp->u_arg[2]);
 
1325
                printflags(mount_flags, tcp->u_arg[2], "MS_???");
1328
1326
                /* The doc sez that the file system type is given as a
1329
1327
                   fsindex, and we should use sysfs to work out the name.
1330
1328
                   This appears to be untrue for UW.  Maybe it's untrue
1348
1346
                                        tprintf("%#lx", tcp->u_arg[4]);
1349
1347
                                else {
1350
1348
                                        tprintf("{ flags=");
1351
 
                                        if (!printflags(vxfs_flags, args.mflags))
1352
 
                                                tprintf("0x%08x", args.mflags);
 
1349
                                        printflags(vxfs_flags, args.mflags, "VX_MS_???");
1353
1350
                                        if (args.mflags & VX_MS_SNAPSHOT) {
1354
1351
                                                tprintf (", snapof=");
1355
1352
                                                printstr (tcp,
1356
 
                                                          (long) args.primaryspec, 
 
1353
                                                          (long) args.primaryspec,
1357
1354
                                                          -1);
1358
1355
                                                if (args.snapsize > 0)
1359
1356
                                                        tprintf (", snapsize=%ld", args.snapsize);
1382
1379
                                                printsock(tcp, (int) addr.buf, addr.len);
1383
1380
                                        }
1384
1381
                                        tprintf(", flags=");
1385
 
                                        if (!printflags(nfs_flags, args.flags))
1386
 
                                                tprintf("NFSMNT_???");
 
1382
                                        printflags(nfs_flags, args.flags, "NFSMNT_???");
1387
1383
                                        tprintf(", hostname=");
1388
1384
                                        printstr(tcp, (int) args.hostname, -1);
1389
1385
                                        tprintf(", ...}");
1419
1415
 
1420
1416
#ifdef SYS_capget
1421
1417
 
1422
 
static struct xlat capabilities[] = {
 
1418
static const struct xlat capabilities[] = {
1423
1419
        { 1<<CAP_CHOWN,         "CAP_CHOWN"     },
1424
1420
        { 1<<CAP_DAC_OVERRIDE,  "CAP_DAC_OVERRIDE"},
1425
1421
        { 1<<CAP_DAC_READ_SEARCH,"CAP_DAC_READ_SEARCH"},
1461
1457
        if(!entering(tcp)) {
1462
1458
                if (!arg0) {
1463
1459
                        if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1464
 
                                fprintf(stderr, "sys_capget: no memory\n");
 
1460
                                fprintf(stderr, "out of memory\n");
1465
1461
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1466
1462
                                return -1;
1467
1463
                        }
1468
1464
                }
1469
1465
                if (!arg1) {
1470
1466
                        if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1471
 
                                fprintf(stderr, "sys_capget: no memory\n");
 
1467
                                fprintf(stderr, "out of memory\n");
1472
1468
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1473
1469
                                return -1;
1474
1470
                        }
1492
1488
                        tprintf("???");
1493
1489
                else {
1494
1490
                        tprintf("{");
1495
 
                        printflags(capabilities, arg1->effective);
1496
 
                        tprintf(", ");
1497
 
                        printflags(capabilities, arg1->permitted);
1498
 
                        tprintf(", ");
1499
 
                        printflags(capabilities, arg1->inheritable);
 
1491
                        printflags(capabilities, arg1->effective, "CAP_???");
 
1492
                        tprintf(", ");
 
1493
                        printflags(capabilities, arg1->permitted, "CAP_???");
 
1494
                        tprintf(", ");
 
1495
                        printflags(capabilities, arg1->inheritable, "CAP_???");
1500
1496
                        tprintf("}");
1501
 
                } 
 
1497
                }
1502
1498
        }
1503
1499
        return 0;
1504
1500
}
1513
1509
        if(entering(tcp)) {
1514
1510
                if (!arg0) {
1515
1511
                        if ((arg0 = malloc(sizeof(*arg0))) == NULL) {
1516
 
                                fprintf(stderr, "sys_capset: no memory\n");
 
1512
                                fprintf(stderr, "out of memory\n");
1517
1513
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1518
1514
                                return -1;
1519
1515
                        }
1520
1516
                }
1521
1517
                if (!arg1) {
1522
1518
                        if ((arg1 = malloc(sizeof(*arg1))) == NULL) {
1523
 
                                fprintf(stderr, "sys_capset: no memory\n");
 
1519
                                fprintf(stderr, "out of memory\n");
1524
1520
                                tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
1525
1521
                                return -1;
1526
1522
                        }
1544
1540
                        tprintf("???");
1545
1541
                else {
1546
1542
                        tprintf("{");
1547
 
                        printflags(capabilities, arg1->effective);
1548
 
                        tprintf(", ");
1549
 
                        printflags(capabilities, arg1->permitted);
1550
 
                        tprintf(", ");
1551
 
                        printflags(capabilities, arg1->inheritable);
 
1543
                        printflags(capabilities, arg1->effective, "CAP_???");
 
1544
                        tprintf(", ");
 
1545
                        printflags(capabilities, arg1->permitted, "CAP_???");
 
1546
                        tprintf(", ");
 
1547
                        printflags(capabilities, arg1->inheritable, "CAP_???");
1552
1548
                        tprintf("}");
1553
 
                } 
 
1549
                }
1554
1550
        }
1555
1551
        return 0;
1556
1552
}
1572
1568
#endif
1573
1569
 
1574
1570
#ifdef LINUX
1575
 
static struct xlat sysctl_root[] = {
 
1571
static const struct xlat sysctl_root[] = {
1576
1572
        { CTL_KERN, "CTL_KERN" },
1577
1573
        { CTL_VM, "CTL_VM" },
1578
1574
        { CTL_NET, "CTL_NET" },
1583
1579
        { 0, NULL }
1584
1580
};
1585
1581
 
1586
 
static struct xlat sysctl_kern[] = {
 
1582
static const struct xlat sysctl_kern[] = {
1587
1583
        { KERN_OSTYPE, "KERN_OSTYPE" },
1588
1584
        { KERN_OSRELEASE, "KERN_OSRELEASE" },
1589
1585
        { KERN_OSREV, "KERN_OSREV" },
1625
1621
        { 0, NULL }
1626
1622
};
1627
1623
 
1628
 
static struct xlat sysctl_vm[] = {
 
1624
static const struct xlat sysctl_vm[] = {
1629
1625
#ifdef VM_SWAPCTL
1630
1626
        { VM_SWAPCTL, "VM_SWAPCTL" },
1631
1627
#endif
1679
1675
        { 0, NULL },
1680
1676
};
1681
1677
 
1682
 
static struct xlat sysctl_net[] = {
 
1678
static const struct xlat sysctl_net[] = {
1683
1679
        { NET_CORE, "NET_CORE" },
1684
1680
        { NET_ETHER, "NET_ETHER" },
1685
1681
        { NET_802, "NET_802" },
1698
1694
        { 0, NULL }
1699
1695
};
1700
1696
 
1701
 
static struct xlat sysctl_net_core[] = {
 
1697
static const struct xlat sysctl_net_core[] = {
1702
1698
        { NET_CORE_WMEM_MAX, "NET_CORE_WMEM_MAX" },
1703
1699
        { NET_CORE_RMEM_MAX, "NET_CORE_RMEM_MAX" },
1704
1700
        { NET_CORE_WMEM_DEFAULT, "NET_CORE_WMEM_DEFAULT" },
1711
1707
        { 0, NULL }
1712
1708
};
1713
1709
 
1714
 
static struct xlat sysctl_net_unix[] = {
 
1710
static const struct xlat sysctl_net_unix[] = {
1715
1711
        { NET_UNIX_DESTROY_DELAY, "NET_UNIX_DESTROY_DELAY" },
1716
1712
        { NET_UNIX_DELETE_DELAY, "NET_UNIX_DELETE_DELAY" },
1717
1713
        { 0, NULL }
1718
1714
};
1719
1715
 
1720
 
static struct xlat sysctl_net_ipv4[] = {
 
1716
static const struct xlat sysctl_net_ipv4[] = {
1721
1717
        { NET_IPV4_FORWARD, "NET_IPV4_FORWARD" },
1722
1718
        { NET_IPV4_DYNADDR, "NET_IPV4_DYNADDR" },
1723
1719
        { NET_IPV4_CONF, "NET_IPV4_CONF" },
1760
1756
        {  0, NULL }
1761
1757
};
1762
1758
 
1763
 
static struct xlat sysctl_net_ipv4_route[] = {
 
1759
static const struct xlat sysctl_net_ipv4_route[] = {
1764
1760
        { NET_IPV4_ROUTE_FLUSH, "NET_IPV4_ROUTE_FLUSH" },
1765
1761
        { NET_IPV4_ROUTE_MIN_DELAY, "NET_IPV4_ROUTE_MIN_DELAY" },
1766
1762
        { NET_IPV4_ROUTE_MAX_DELAY, "NET_IPV4_ROUTE_MAX_DELAY" },
1778
1774
        { 0, NULL }
1779
1775
};
1780
1776
 
1781
 
static struct xlat sysctl_net_ipv4_conf[] = {
 
1777
static const struct xlat sysctl_net_ipv4_conf[] = {
1782
1778
        { NET_IPV4_CONF_FORWARDING, "NET_IPV4_CONF_FORWARDING" },
1783
1779
        { NET_IPV4_CONF_MC_FORWARDING, "NET_IPV4_CONF_MC_FORWARDING" },
1784
1780
        { NET_IPV4_CONF_PROXY_ARP, "NET_IPV4_CONF_PROXY_ARP" },
1793
1789
        { 0, NULL }
1794
1790
};
1795
1791
 
1796
 
static struct xlat sysctl_net_ipv6[] = {
 
1792
static const struct xlat sysctl_net_ipv6[] = {
1797
1793
        { NET_IPV6_CONF, "NET_IPV6_CONF" },
1798
1794
        { NET_IPV6_NEIGH, "NET_IPV6_NEIGH" },
1799
1795
        { NET_IPV6_ROUTE, "NET_IPV6_ROUTE" },
1800
1796
        { 0, NULL }
1801
1797
};
1802
1798
 
1803
 
static struct xlat sysctl_net_ipv6_route[] = {
 
1799
static const struct xlat sysctl_net_ipv6_route[] = {
1804
1800
        { NET_IPV6_ROUTE_FLUSH, "NET_IPV6_ROUTE_FLUSH" },
1805
1801
        { NET_IPV6_ROUTE_GC_THRESH, "NET_IPV6_ROUTE_GC_THRESH" },
1806
1802
        { NET_IPV6_ROUTE_MAX_SIZE, "NET_IPV6_ROUTE_MAX_SIZE" },
1817
1813
{
1818
1814
        struct __sysctl_args info;
1819
1815
        int *name;
1820
 
        umove (tcp, tcp->u_arg[0], &info);
1821
 
 
1822
 
        name = alloca (sizeof (int) * info.nlen);
1823
 
        umoven(tcp, (size_t) info.name, sizeof (int) * info.nlen, (char *) name);
 
1816
        unsigned long size;
 
1817
 
 
1818
        if (umove (tcp, tcp->u_arg[0], &info) < 0)
 
1819
                return printargs(tcp);
 
1820
 
 
1821
        size = sizeof (int) * (unsigned long) info.nlen;
 
1822
        name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size);
 
1823
        if (name == NULL ||
 
1824
            umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) {
 
1825
                free(name);
 
1826
                if (entering(tcp))
 
1827
                        tprintf("{%p, %d, %p, %p, %p, %Zu}",
 
1828
                                info.name, info.nlen, info.oldval,
 
1829
                                info.oldlenp, info.newval, info.newlen);
 
1830
                return 0;
 
1831
        }
1824
1832
 
1825
1833
        if (entering(tcp)) {
1826
 
                int cnt = 0;
 
1834
                int cnt = 0, max_cnt;
1827
1835
 
1828
1836
                tprintf("{{");
1829
1837
 
1913
1921
                        goto out;
1914
1922
                }
1915
1923
        out:
1916
 
                while (cnt < info.nlen)
 
1924
                max_cnt = abbrev(tcp) ? max_strlen : info.nlen;
 
1925
                while (cnt < max_cnt)
1917
1926
                        tprintf(", %x", name[cnt++]);
 
1927
                if (cnt < info.nlen)
 
1928
                        tprintf(", ...");
1918
1929
                tprintf("}, %d, ", info.nlen);
1919
1930
        } else {
1920
1931
                size_t oldlen;
1921
 
                umove(tcp, (size_t)info.oldlenp, &oldlen);
1922
 
                if (info.nlen >= 2
 
1932
                if (umove(tcp, (size_t)info.oldlenp, &oldlen) >= 0
 
1933
                    && info.nlen >= 2
1923
1934
                    && ((name[0] == CTL_KERN
1924
1935
                         && (name[1] == KERN_OSRELEASE
1925
1936
                             || name[1] == KERN_OSTYPE
1945
1956
                }
1946
1957
                tprintf("}");
1947
1958
        }
 
1959
 
 
1960
        free(name);
1948
1961
        return 0;
1949
1962
}
1950
1963
#else
1965
1978
        char ctl[1024];
1966
1979
        size_t len;
1967
1980
        int i, numeric;
1968
 
        
 
1981
 
1969
1982
        if (entering(tcp)) {
1970
1983
                if (tcp->u_arg[1] < 0 || tcp->u_arg[1] > CTL_MAXNAME ||
1971
1984
                    (umoven(tcp, tcp->u_arg[0], tcp->u_arg[1] * sizeof(int),
1996
2009
                if (!syserror(tcp) && (umove(tcp, tcp->u_arg[3], &len) >= 0)) {
1997
2010
                        printstr(tcp, tcp->u_arg[2], len);
1998
2011
                        tprintf(", [%u], ", len);
1999
 
                } else 
 
2012
                } else
2000
2013
                        tprintf("%#lx, %#lx, ", tcp->u_arg[2], tcp->u_arg[3]);
2001
2014
                printstr(tcp, tcp->u_arg[4], tcp->u_arg[5]);
2002
2015
                tprintf(", %lu", tcp->u_arg[5]);
2010
2023
#include <sys/ksym.h>
2011
2024
#include <sys/elf.h>
2012
2025
 
2013
 
static struct xlat ksym_flags[] = {
2014
 
        { STT_NOTYPE,   "STT_NOTYPE"    },      
2015
 
        { STT_FUNC,     "STT_FUNC"      },      
2016
 
        { STT_OBJECT,   "STT_OBJECT"    },      
 
2026
static const struct xlat ksym_flags[] = {
 
2027
        { STT_NOTYPE,   "STT_NOTYPE"    },
 
2028
        { STT_FUNC,     "STT_FUNC"      },
 
2029
        { STT_OBJECT,   "STT_OBJECT"    },
2017
2030
        { 0,            NULL            },
2018
2031
};
2019
2032
 
2053
2066
struct cred;
2054
2067
#include <sys/nscsys.h>
2055
2068
 
2056
 
static struct xlat ssi_cmd [] = {
 
2069
static const struct xlat ssi_cmd [] = {
2057
2070
        { SSISYS_BADOP, "SSISYS_BADOP"  },
2058
2071
        { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"},
2059
2072
        { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"},
2150
2163
                        if (iov.tio_udatainlen != sizeof cni ||
2151
2164
                            umove (tcp, (long) iov.tio_udatain, &cni) < 0)
2152
2165
                                goto bad_out;
2153
 
                        if (cni.info_len != sizeof info || 
 
2166
                        if (cni.info_len != sizeof info ||
2154
2167
                            iov.tio_udataoutlen != sizeof &info ||
2155
2168
                            umove (tcp, (long) iov.tio_udataout, &info) < 0)
2156
2169
                                goto bad_out;
2158
2171
                                 info.node_num, info.node_totalcpus,
2159
2172
                                 info.node_onlinecpus);
2160
2173
                        break;
2161
 
                        
 
2174
 
2162
2175
                    default:
2163
2176
                    bad_out:
2164
2177
                        if (iov.tio_udataoutlen) {
2182
2195
#define __NEW_UTS_LEN 64
2183
2196
#endif
2184
2197
 
2185
 
static struct xlat sysmips_operations[] = {
 
2198
static const struct xlat sysmips_operations[] = {
2186
2199
        { SETNAME,              "SETNAME"       },
2187
2200
        { FLUSH_CACHE,          "FLUSH_CACHE"   },
2188
2201
        { MIPS_FIXADE,          "MIPS_FIXADE"   },