mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-12-02 04:13:39 +00:00
Add two new flags:
-q just shut up, will you?! -u unlink output file after successful load
This commit is contained in:
parent
d599144d24
commit
9d1275ccf4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=3000
@ -23,9 +23,9 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: modload.8,v 1.3 1994/08/19 13:39:20 davidg Exp $
|
||||
.\" $Id: modload.8,v 1.4 1994/09/18 04:12:12 davidg Exp $
|
||||
.\"
|
||||
.Dd June 7, 1993
|
||||
.Dd September 22, 1994
|
||||
.Dt MODLOAD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -33,7 +33,7 @@
|
||||
.Nd load a kernel module
|
||||
.Sh SYNOPSIS
|
||||
.Nm modload
|
||||
.Op Fl dv
|
||||
.Op Fl dquv
|
||||
.Op Fl A Ar kernel
|
||||
.Op Fl e Ar entry
|
||||
.Op Fl p Ar postinstall
|
||||
@ -53,6 +53,12 @@ are as follows:
|
||||
Debug. Used to debug
|
||||
.Nm
|
||||
itself.
|
||||
.It Fl q
|
||||
Be very quiet.
|
||||
.It Fl u
|
||||
Delete the loaded module
|
||||
.Pq Ar output_file
|
||||
after loading.
|
||||
.It Fl v
|
||||
Print comments about the loading process.
|
||||
.It Fl A Ar kernel
|
||||
@ -111,6 +117,5 @@ to the corresponding command in
|
||||
Terrence R. Lambert, terry@cs.weber.edu
|
||||
.El
|
||||
.Sh BUGS
|
||||
Loadable streams modules and loadable execution interpreters
|
||||
are not currently supported. The loadable device driver framework can
|
||||
The loadable device driver framework can
|
||||
only reserve either a character or block device entry, not both.
|
||||
|
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: modload.c,v 1.2 1994/08/19 13:28:21 davidg Exp $
|
||||
* $Id: modload.c,v 1.3 1994/09/18 04:12:13 davidg Exp $
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -65,6 +65,8 @@
|
||||
|
||||
int debug = 0;
|
||||
int verbose = 0;
|
||||
int quiet = 0;
|
||||
int dounlink = 0;
|
||||
|
||||
int
|
||||
linkcmd(kernel, entry, outfile, address, object)
|
||||
@ -108,7 +110,7 @@ usage()
|
||||
{
|
||||
|
||||
fprintf(stderr, "usage:\n");
|
||||
fprintf(stderr, "modload [-d] [-v] [-A <kernel>] [-e <entry]\n");
|
||||
fprintf(stderr, "modload [-d] [-v] [-q] [-u] [-A <kernel>] [-e <entry]\n");
|
||||
fprintf(stderr,
|
||||
"[-p <postinstall>] [-o <output file>] <input file>\n");
|
||||
exit(1);
|
||||
@ -159,7 +161,7 @@ main(argc, argv)
|
||||
int sz, bytesleft;
|
||||
char buf[MODIOBUF];
|
||||
|
||||
while ((c = getopt(argc, argv, "dvA:e:p:o:")) != EOF) {
|
||||
while ((c = getopt(argc, argv, "dvquA:e:p:o:")) != EOF) {
|
||||
switch (c) {
|
||||
case 'd':
|
||||
debug = 1;
|
||||
@ -167,6 +169,12 @@ main(argc, argv)
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
break; /* verbose */
|
||||
case 'u':
|
||||
dounlink = 1;
|
||||
break;
|
||||
case 'q':
|
||||
quiet = 1;
|
||||
break;
|
||||
case 'A':
|
||||
kname = optarg;
|
||||
break; /* kernel */
|
||||
@ -329,7 +337,7 @@ main(argc, argv)
|
||||
* Success!
|
||||
*/
|
||||
fileopen &= ~PART_RESRV; /* loaded */
|
||||
printf("Module loaded as ID %d\n", resrv.slot);
|
||||
if(!quiet) printf("Module loaded as ID %d\n", resrv.slot);
|
||||
|
||||
if (post) {
|
||||
struct lmc_stat sbuf;
|
||||
@ -346,5 +354,12 @@ main(argc, argv)
|
||||
execl(post, post, id, type, offset, 0);
|
||||
err(16, "can't exec '%s'", post);
|
||||
}
|
||||
|
||||
if(dounlink) {
|
||||
if(unlink(out)) {
|
||||
err(17, "unlink(%s)", out);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user