2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 /* Get CM initialization parameters. */
11 #include <afsconfig.h>
14 #include <afs/param.h>
17 #include <netinet/in.h>
19 #include <afs/venus.h>
28 * if -file <path> is given, fetch initialization parameters via ioctl()
31 * otherwise, fetch initialization paramters via lpioctl()
37 GetInitParamsCmd(struct cmd_syndesc *as, void *arock)
39 struct cm_initparams cm_initParams;
40 struct ViceIoctl blob;
45 if (as->parms[0].items) {
46 file = as->parms[0].items->data;
50 printf("ioctl test\n");
51 fd = open(file, O_RDONLY, 0);
57 printf("lpioctl test\n");
62 blob.out = (char *)&cm_initParams;
63 blob.out_size = sizeof(struct cm_initparams);
66 code = ioctl(fd, VIOC_GETINITPARAMS, &blob);
68 perror("ioctl: Error getting CM initialization parameters");
73 code = lpioctl(NULL, VIOC_GETINITPARAMS, &blob, 0);
75 perror("lpioctl: Error getting CM initialization parameters");
80 printf("cm_initparams version: %d\n", cm_initParams.cmi_version);
81 printf("Chunk Files: %d\n", cm_initParams.cmi_nChunkFiles);
82 printf("Stat Caches: %d\n", cm_initParams.cmi_nStatCaches);
83 printf("Data Caches: %d\n", cm_initParams.cmi_nDataCaches);
84 printf("Volume Caches: %d\n", cm_initParams.cmi_nVolumeCaches);
85 printf("First Chunk Size: %d\n", cm_initParams.cmi_firstChunkSize);
86 printf("Other Chunk Size: %d\n", cm_initParams.cmi_otherChunkSize);
87 printf("Initial Cache Size: %dK\n", cm_initParams.cmi_cacheSize);
88 printf("CM Sets Time: %c\n", cm_initParams.cmi_setTime ? 'Y' : 'N');
89 printf("Disk Based Cache: %c\n", cm_initParams.cmi_memCache ? 'N' : 'Y');
95 main(int ac, char **av)
98 struct cmd_syndesc *ts;
102 * The following signal action for AIX is necessary so that in case of a
103 * crash (i.e. core is generated) we can include the user's data section
104 * in the core dump. Unfortunately, by default, only a partial core is
105 * generated which, in many cases, isn't too useful.
107 struct sigaction nsa;
109 sigemptyset(&nsa.sa_mask);
110 nsa.sa_handler = SIG_DFL;
111 nsa.sa_flags = SA_FULLDUMP;
112 sigaction(SIGSEGV, &nsa, NULL);
115 ts = cmd_CreateSyntax(NULL, GetInitParamsCmd, NULL,
116 "Get CM initialization parameters");
118 cmd_AddParm(ts, "-file", CMD_SINGLE, CMD_OPTIONAL, "filename in AFS");
119 code = cmd_Dispatch(ac, av);