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>
21 #include <afs/sys_prototypes.h>
22 #include <afs/afssyscalls.h>
30 * if -file <path> is given, fetch initialization parameters via ioctl()
33 * otherwise, fetch initialization paramters via lpioctl()
39 GetInitParamsCmd(struct cmd_syndesc
*as
, void *arock
)
41 struct cm_initparams cm_initParams
;
42 struct ViceIoctl blob
;
47 if (as
->parms
[0].items
) {
48 file
= as
->parms
[0].items
->data
;
52 printf("ioctl test\n");
53 fd
= open(file
, O_RDONLY
, 0);
59 printf("lpioctl test\n");
64 blob
.out
= (char *)&cm_initParams
;
65 blob
.out_size
= sizeof(struct cm_initparams
);
68 code
= ioctl(fd
, VIOC_GETINITPARAMS
, &blob
);
70 perror("ioctl: Error getting CM initialization parameters");
75 code
= lpioctl(NULL
, VIOC_GETINITPARAMS
, &blob
, 0);
77 perror("lpioctl: Error getting CM initialization parameters");
82 printf("cm_initparams version: %d\n", cm_initParams
.cmi_version
);
83 printf("Chunk Files: %d\n", cm_initParams
.cmi_nChunkFiles
);
84 printf("Stat Caches: %d\n", cm_initParams
.cmi_nStatCaches
);
85 printf("Data Caches: %d\n", cm_initParams
.cmi_nDataCaches
);
86 printf("Volume Caches: %d\n", cm_initParams
.cmi_nVolumeCaches
);
87 printf("First Chunk Size: %d\n", cm_initParams
.cmi_firstChunkSize
);
88 printf("Other Chunk Size: %d\n", cm_initParams
.cmi_otherChunkSize
);
89 printf("Initial Cache Size: %dK\n", cm_initParams
.cmi_cacheSize
);
90 printf("CM Sets Time: %c\n", cm_initParams
.cmi_setTime
? 'Y' : 'N');
91 printf("Disk Based Cache: %c\n", cm_initParams
.cmi_memCache
? 'N' : 'Y');
97 main(int ac
, char **av
)
100 struct cmd_syndesc
*ts
;
104 * The following signal action for AIX is necessary so that in case of a
105 * crash (i.e. core is generated) we can include the user's data section
106 * in the core dump. Unfortunately, by default, only a partial core is
107 * generated which, in many cases, isn't too useful.
109 struct sigaction nsa
;
111 sigemptyset(&nsa
.sa_mask
);
112 nsa
.sa_handler
= SIG_DFL
;
113 nsa
.sa_flags
= SA_FULLDUMP
;
114 sigaction(SIGSEGV
, &nsa
, NULL
);
117 ts
= cmd_CreateSyntax(NULL
, GetInitParamsCmd
, NULL
, 0,
118 "Get CM initialization parameters");
120 cmd_AddParm(ts
, "-file", CMD_SINGLE
, CMD_OPTIONAL
, "filename in AFS");
121 code
= cmd_Dispatch(ac
, av
);