The patch below fixes some trivial comment typos and warnings from the lack
of an ioctl prototype. Do others routinely ignore these warnings or is my
compiler setup just pickier than normal?
--- lkcdutils/lkcd_config/lkcd_config.c Wed Sep 12 23:30:28 2001
+++ lkcdutils.fix/lkcd_config/lkcd_config.c Mon Sep 17 12:26:15 2001
@@ -20,8 +20,10 @@
#define DUMP_DEVICE "/dev/dump"
#define DUMP_TRUE 1
#define DUMP_FALSE 0
+int ioctl(int dev, unsigned int cmd, caddr_t arg);
+
/*
* Name: main()
* Func: A quick-and-dirty dump configuration tool. Should suffice
* for the time being.
@@ -116,37 +118,37 @@
perror("open of dump device");
return (dfd);
}
- /* set dump compression */
- if ((err = ioctl(dfd, DIOGDUMPCOMPRESS, &compress)) < 0) {
+ /* get dump compression */
+ if ((err = ioctl(dfd, DIOGDUMPCOMPRESS, (caddr_t)&compress)) <
0) {
perror("ioctl() query for dump compression failed");
close(dfd);
return (err);
}
- /* set dump flags */
- if ((err = ioctl(dfd, DIOGDUMPFLAGS, &flags)) < 0) {
+ /* get dump flags */
+ if ((err = ioctl(dfd, DIOGDUMPFLAGS, (caddr_t)&flags)) < 0) {
perror("ioctl() query for dump flags failed");
close(dfd);
return (err);
}
- /* set dump level */
- if ((err = ioctl(dfd, DIOGDUMPLEVEL, &level)) < 0) {
+ /* get dump level */
+ if ((err = ioctl(dfd, DIOGDUMPLEVEL, (caddr_t)&level)) < 0) {
perror("ioctl() query for dump level failed");
close(dfd);
return (err);
}
- /* set device to dump to (if specified) */
- if ((err = ioctl(dfd, DIOGDUMPDEV, &dnum)) < 0) {
+ /* get device to dump to (if specified) */
+ if ((err = ioctl(dfd, DIOGDUMPDEV, (caddr_t)&dnum)) < 0) {
perror("ioctl() for dump device failed");
close(dfd);
return (err);
}
- printf(" Configured dump device: 0x%x\n", dnum);
+ printf(" Configured dump device: 0x%x\n", (int)dnum);
memset(tbuf, 0, 1024);
if (flags == DUMP_FLAGS_NONE) {
strcat(tbuf, "DUMP_FLAGS_NONE|");
@@ -239,36 +241,36 @@
}
/* set dump compression */
if (compress_set == DUMP_TRUE) {
- if ((err = ioctl(dfd, DIOSDUMPCOMPRESS, compress)) < 0) {
+ if ((err = ioctl(dfd, DIOSDUMPCOMPRESS, (caddr_t)compress)) <
0) {
perror("ioctl() for dump compression failed");
close(dfd);
return (err);
}
}
/* set dump flags */
if (flags_set == DUMP_TRUE) {
- if ((err = ioctl(dfd, DIOSDUMPFLAGS, flags)) < 0) {
+ if ((err = ioctl(dfd, DIOSDUMPFLAGS, (caddr_t)flags)) < 0) {
perror("ioctl() for dump flags failed");
close(dfd);
return (err);
}
}
/* set dump level */
if (level_set == DUMP_TRUE) {
- if ((err = ioctl(dfd, DIOSDUMPLEVEL, level)) < 0) {
+ if ((err = ioctl(dfd, DIOSDUMPLEVEL, (caddr_t)level)) < 0) {
perror("ioctl() for dump level failed");
close(dfd);
return (err);
}
}
/* set device to dump to (if specified) */
if (dnum != (dev_t)0) {
- if ((err = ioctl(dfd, DIOSDUMPDEV, dnum)) < 0) {
+ if ((err = ioctl(dfd, DIOSDUMPDEV, (caddr_t)dnum)) < 0) {
perror("ioctl() for dump device failed");
close(dfd);
return (err);
}
|