nfsiod.c (399479328143e215807bf0009e216e21fb8dda80) | nfsiod.c (48660452c1bbbc5d7a41a3625df502b71557ca3a) |
---|---|
1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 75 unchanged lines hidden (view full) --- 84 errx(1, "NFS support is not available in the running kernel"); 85 86 num_servers = 0; 87 while ((ch = getopt(argc, argv, "n:")) != -1) 88 switch (ch) { 89 case 'n': 90 num_servers = atoi(optarg); 91 if (num_servers < 1) { | 1/* 2 * Copyright (c) 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Rick Macklem at The University of Guelph. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 75 unchanged lines hidden (view full) --- 84 errx(1, "NFS support is not available in the running kernel"); 85 86 num_servers = 0; 87 while ((ch = getopt(argc, argv, "n:")) != -1) 88 switch (ch) { 89 case 'n': 90 num_servers = atoi(optarg); 91 if (num_servers < 1) { |
92 warnx("nfsiod count %d; reset to %d", | 92 warnx("nfsiod count %u; reset to %d", |
93 num_servers, 1); 94 num_servers = 1; 95 } 96 if (num_servers > MAXNFSDCNT) { | 93 num_servers, 1); 94 num_servers = 1; 95 } 96 if (num_servers > MAXNFSDCNT) { |
97 warnx("nfsiod count %d; reset to %d", | 97 warnx("nfsiod count %u; reset to %d", |
98 num_servers, MAXNFSDCNT); 99 num_servers = MAXNFSDCNT; 100 } 101 break; 102 case '?': 103 default: 104 usage(); 105 } 106 argc -= optind; 107 argv += optind; 108 109 if (argc > 0) 110 usage(); 111 | 98 num_servers, MAXNFSDCNT); 99 num_servers = MAXNFSDCNT; 100 } 101 break; 102 case '?': 103 default: 104 usage(); 105 } 106 argc -= optind; 107 argv += optind; 108 109 if (argc > 0) 110 usage(); 111 |
112 if (num_servers == 0) 113 exit(0); /* no change */ 114 | |
115 len = sizeof iodmin; 116 error = sysctlbyname("vfs.nfs.iodmin", &iodmin, &len, NULL, 0); 117 if (error < 0) 118 err(1, "sysctlbyname(\"vfs.nfs.iodmin\")"); 119 len = sizeof iodmax; 120 error = sysctlbyname("vfs.nfs.iodmax", &iodmax, &len, NULL, 0); 121 if (error < 0) 122 err(1, "sysctlbyname(\"vfs.nfs.iodmax\")"); | 112 len = sizeof iodmin; 113 error = sysctlbyname("vfs.nfs.iodmin", &iodmin, &len, NULL, 0); 114 if (error < 0) 115 err(1, "sysctlbyname(\"vfs.nfs.iodmin\")"); 116 len = sizeof iodmax; 117 error = sysctlbyname("vfs.nfs.iodmax", &iodmax, &len, NULL, 0); 118 if (error < 0) 119 err(1, "sysctlbyname(\"vfs.nfs.iodmax\")"); |
120 if (num_servers == 0) { /* no change */ 121 printf("vfs.nfs.iodmin=%u\nvfs.nfs.iodmax=%u\n", 122 iodmin, iodmax); 123 exit(0); 124 } |
|
123 /* Catch the case where we're lowering num_servers below iodmin */ 124 if (iodmin > num_servers) { 125 iodmin = num_servers; 126 error = sysctlbyname("vfs.nfs.iodmin", NULL, 0, &iodmin, 127 sizeof iodmin); 128 if (error < 0) 129 err(1, "sysctlbyname(\"vfs.nfs.iodmin\")"); 130 } 131 iodmax = num_servers; 132 error = sysctlbyname("vfs.nfs.iodmax", NULL, 0, &iodmax, sizeof iodmax); 133 if (error < 0) 134 err(1, "sysctlbyname(\"vfs.nfs.iodmax\")"); 135 exit (0); 136} 137 | 125 /* Catch the case where we're lowering num_servers below iodmin */ 126 if (iodmin > num_servers) { 127 iodmin = num_servers; 128 error = sysctlbyname("vfs.nfs.iodmin", NULL, 0, &iodmin, 129 sizeof iodmin); 130 if (error < 0) 131 err(1, "sysctlbyname(\"vfs.nfs.iodmin\")"); 132 } 133 iodmax = num_servers; 134 error = sysctlbyname("vfs.nfs.iodmax", NULL, 0, &iodmax, sizeof iodmax); 135 if (error < 0) 136 err(1, "sysctlbyname(\"vfs.nfs.iodmax\")"); 137 exit (0); 138} 139 |