| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: swapctl.c,v 1.33 2008/05/29 14:51:25 mrg Exp $ */ | | 1 | /* $NetBSD: swapctl.c,v 1.34 2008/12/28 20:18:53 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1996, 1997, 1999 Matthew R. Green | | 4 | * Copyright (c) 1996, 1997, 1999 Matthew R. Green |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -54,27 +54,27 @@ | | | @@ -54,27 +54,27 @@ |
54 | * -p <pri> use this priority | | 54 | * -p <pri> use this priority |
55 | * -c change priority | | 55 | * -c change priority |
56 | * | | 56 | * |
57 | * or, if invoked as "swapon" (compatibility mode): | | 57 | * or, if invoked as "swapon" (compatibility mode): |
58 | * | | 58 | * |
59 | * -a all devices listed as `sw' in /etc/fstab | | 59 | * -a all devices listed as `sw' in /etc/fstab |
60 | * -t same as -t above (feature not present in old | | 60 | * -t same as -t above (feature not present in old |
61 | * swapon(8) command) | | 61 | * swapon(8) command) |
62 | * <dev> add this device | | 62 | * <dev> add this device |
63 | */ | | 63 | */ |
64 | #include <sys/cdefs.h> | | 64 | #include <sys/cdefs.h> |
65 | | | 65 | |
66 | #ifndef lint | | 66 | #ifndef lint |
67 | __RCSID("$NetBSD: swapctl.c,v 1.33 2008/05/29 14:51:25 mrg Exp $"); | | 67 | __RCSID("$NetBSD: swapctl.c,v 1.34 2008/12/28 20:18:53 christos Exp $"); |
68 | #endif | | 68 | #endif |
69 | | | 69 | |
70 | | | 70 | |
71 | #include <sys/param.h> | | 71 | #include <sys/param.h> |
72 | #include <sys/stat.h> | | 72 | #include <sys/stat.h> |
73 | #include <sys/swap.h> | | 73 | #include <sys/swap.h> |
74 | #include <sys/sysctl.h> | | 74 | #include <sys/sysctl.h> |
75 | #include <sys/disk.h> | | 75 | #include <sys/disk.h> |
76 | #include <sys/disklabel.h> | | 76 | #include <sys/disklabel.h> |
77 | | | 77 | |
78 | #include <unistd.h> | | 78 | #include <unistd.h> |
79 | #include <err.h> | | 79 | #include <err.h> |
80 | #include <errno.h> | | 80 | #include <errno.h> |
| @@ -513,27 +513,29 @@ get_dumpdev(void) | | | @@ -513,27 +513,29 @@ get_dumpdev(void) |
513 | | | 513 | |
514 | if (swapctl(SWAP_GETDUMPDEV, &dev, 0) == -1) { | | 514 | if (swapctl(SWAP_GETDUMPDEV, &dev, 0) == -1) { |
515 | warn("could not get dump device"); | | 515 | warn("could not get dump device"); |
516 | return 0; | | 516 | return 0; |
517 | } else if (dev == NODEV) { | | 517 | } else if (dev == NODEV) { |
518 | printf("no dump device set\n"); | | 518 | printf("no dump device set\n"); |
519 | return 0; | | 519 | return 0; |
520 | } else { | | 520 | } else { |
521 | name = devname(dev, S_IFBLK); | | 521 | name = devname(dev, S_IFBLK); |
522 | printf("dump device is "); | | 522 | printf("dump device is "); |
523 | if (name) | | 523 | if (name) |
524 | printf("%s\n", name); | | 524 | printf("%s\n", name); |
525 | else | | 525 | else |
526 | printf("major %d minor %d\n", major(dev), minor(dev)); | | 526 | printf("major %llu minor %llu\n", |
| | | 527 | (unsigned long long)major(dev), |
| | | 528 | (unsigned long long)minor(dev)); |
527 | } | | 529 | } |
528 | return 1; | | 530 | return 1; |
529 | } | | 531 | } |
530 | | | 532 | |
531 | static void | | 533 | static void |
532 | do_localdevs(int add) | | 534 | do_localdevs(int add) |
533 | { | | 535 | { |
534 | size_t ressize; | | 536 | size_t ressize; |
535 | char *disknames, *disk; | | 537 | char *disknames, *disk; |
536 | static const char mibname[] = "hw.disknames"; | | 538 | static const char mibname[] = "hw.disknames"; |
537 | | | 539 | |
538 | ressize = 0; | | 540 | ressize = 0; |
539 | if (sysctlbyname(mibname, NULL, &ressize, NULL, 0)) | | 541 | if (sysctlbyname(mibname, NULL, &ressize, NULL, 0)) |