Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 24 Aug 2001 17:55:54 +0200
From:      Edwin de Jong <mauddib@gmx.net>
To:        freebsd-arch@freebsd.org
Subject:   Re: slight change to kldload(8)/kldunload(8)
Message-ID:  <20010824175554.A1282@gmx.net>
In-Reply-To: <20010824141407.A3733@gmx.net>; from mauddib@gmx.net on Fri, Aug 24, 2001 at 02:14:08PM %2B0200
References:  <20010824141407.A3733@gmx.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

Uhm, wrong patch, here is the real one:

-- 
"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

--1yeeQ81UyVL57Vl7
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);
>     }

--1yeeQ81UyVL57Vl7
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="kldunload.diff"

? kldunload/a.out
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,58
< 	    fileid = atoi(optarg);
< 	    if (!fileid)
< 		errx(1, "Invalid ID %s", optarg);
< 	    break;
---
> 	    optfileid = 1;
>             break;
63d59
< 	    filename = optarg;
74,83c70,71
<     if (!fileid && !filename && (argc == 1)) {
< 	filename = *argv;
< 	argc--;
<     }
<     
<     if (argc != 0 || fileid && filename)
< 	usage();
< 
<     if (fileid == 0 && filename == 0)
< 	usage();
---
>     if (argc == 0)
>         usage();  
85,87c73,93
<     if (filename) {
< 	if ((fileid = kldfind(filename)) < 0)
< 	    err(1, "can't find file %s", filename);
---
>     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]);
>         }
> 	else {
>            
>             if (verbose) {
>                  struct kld_file_stat stat;
>                  stat.version = sizeof stat;
>                  if (kldstat(fileid, &stat) < 0)
>                      err(1, "can't stat file id: %d", fileid);
>                  printf("Unloading %s, id=%d\n", stat.name, fileid);
>             }
> 
>             if (kldunload(fileid) < 0)
>                  err(1, "can't unload file id: %d", fileid);
>         }
89,99d94
< 
<     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");

--1yeeQ81UyVL57Vl7--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010824175554.A1282>