From owner-freebsd-arch Fri Aug 24 9:13: 3 2001 Delivered-To: freebsd-arch@freebsd.org Received: from kabel203050.kabel.utwente.nl (kabel203050.kabel.utwente.nl [130.89.203.50]) by hub.freebsd.org (Postfix) with ESMTP id DB42737B40A for ; Fri, 24 Aug 2001 09:12:34 -0700 (PDT) (envelope-from mauddib@kabel203050.kabel.utwente.nl) Received: by mauddib.thuis (Postfix, from userid 1000) id 341C1B882; Fri, 24 Aug 2001 14:14:08 +0200 (CEST) Date: Fri, 24 Aug 2001 14:14:08 +0200 From: Edwin de Jong To: freebsd-arch@freebsd.org Subject: slight change to kldload(8)/kldunload(8) Message-ID: <20010824141407.A3733@gmx.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, The attached diffs are slight changes to kldload and kldload to support multiple arguments (so it is possible now to say kldload module1.ko module2.ko). Edwin de Jong (private mail if I did anything wrong, first commit) -- "I wish there was a knob on the TV to turn up the intelligence. There's a knob called `brightness', but it doesn't work." -- Gallagher --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kldload.diff" Index: kldload/kldload.8 =================================================================== RCS file: /home/ncvs/src/sbin/kldload/kldload.8,v retrieving revision 1.15 diff -r1.15 kldload.8 37a38 > \&... 41c42 < loads the file --- > loads the files Index: kldload/kldload.c =================================================================== RCS file: /home/ncvs/src/sbin/kldload/kldload.c,v retrieving revision 1.7 diff -r1.7 kldload.c 42c42 < fprintf(stderr, "usage: kldload [-v] filename\n"); --- > fprintf(stderr, "usage: kldload [-v] filename...\n"); 64,72c64,71 < if (argc != 1) < usage(); < < fileid = kldload(argv[0]); < if (fileid < 0) < err(1, "can't load %s", argv[0]); < else < if (verbose) < printf("Loaded %s, id=%d\n", argv[0], fileid); --- > for(argc-- ; argc >= 0 ; argc--) { > fileid = kldload(argv[argc]); > if (fileid < 0) > err(1, "can't load %s", argv[argc]); > else > if (verbose) > printf("Loaded %s, id=%d\n", argv[argc], fileid); > } --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="kldunload.diff" Index: kldunload/kldunload.8 =================================================================== RCS file: /home/ncvs/src/sbin/kldunload/kldunload.8,v retrieving revision 1.11 diff -r1.11 kldunload.8 37a38 > \&... 40d40 < .Op Fl n 41a42 > \&... 45c46 < utility unloads a file which was previously loaded with --- > utility unloads files which were previously loaded with 52,57c53,54 < .It Fl i Ar id < Unload the file with this ID. < .It Fl n Ar name < Unload the file with this name. < .It Ar name < Unload the file with this name. --- > .It Fl i > Use ID's instead of names. Index: kldunload/kldunload.c =================================================================== RCS file: /home/ncvs/src/sbin/kldunload/kldunload.c,v retrieving revision 1.10 diff -r1.10 kldunload.c 42,43c42,43 < fprintf(stderr, "usage: kldunload [-v] -i id\n"); < fprintf(stderr, " kldunload [-v] [-n] name\n"); --- > fprintf(stderr, "usage: kldunload [-v] -i id...\n"); > fprintf(stderr, " kldunload [-v] name...\n"); 51,53c51,52 < int verbose = 0; < int fileid = 0; < char* filename = 0; --- > unsigned short int verbose = 0, optfileid = 0; > int fileid; 55c54 < while ((c = getopt(argc, argv, "i:n:v")) != -1) --- > while ((c = getopt(argc, argv, "inv")) != -1) 58,61c57 < fileid = atoi(optarg); < if (!fileid) < errx(1, "Invalid ID %s", optarg); < break; --- > optfileid = 1; 63d58 < filename = optarg; 74,80c69,70 < if (!fileid && !filename && (argc == 1)) { < filename = *argv; < argc--; < } < < if (argc != 0 || fileid && filename) < usage(); --- > if (argc == 0) > usage(); 82,83c72,88 < if (fileid == 0 && filename == 0) < usage(); --- > for(argc--; argc >= 0; argc--) { > if (optfileid == 0) { > if((fileid = kldfind(argv[argc])) < 0) > err(1, "can't find file %s", argv[argc]); > } > else { > if(!(fileid = atoi(argv[argc]))) > err(1, "invalid file id: %s", argv[argc]); > } > > if (verbose) { > struct kld_file_stat stat; > stat.version = sizeof stat; > if (kldstat(fileid, &stat) < 0) > err(1, "can't stat file id: %n", fileid); > printf("Unloading %s, id=%d\n", stat.name, fileid); > } 85,87c90,91 < if (filename) { < if ((fileid = kldfind(filename)) < 0) < err(1, "can't find file %s", filename); --- > if (kldunload(fileid) < 0) > err(1, "can't unload file id: %n", fileid); 89,99d92 < < if (verbose) { < struct kld_file_stat stat; < stat.version = sizeof stat; < if (kldstat(fileid, &stat) < 0) < err(1, "can't stat file"); < printf("Unloading %s, id=%d\n", stat.name, fileid); < } < < if (kldunload(fileid) < 0) < err(1, "can't unload file"); --IJpNTDwzlM2Ie8A6-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message