HardenedBSD/release/dumpnlist.c

45 lines
909 B
C
Raw Normal View History

#include <sys/types.h>
#include <sys/fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <nlist.h>
#include <stdio.h>
struct nlist nl[] = {
{"_isa_devtab_bio"},
{"_isa_devtab_tty"},
{"_isa_devtab_net"},
{"_isa_devtab_null"},
{"_isa_biotab_wdc"},
{"_isa_biotab_fdc"},
{"_eisadriver_set"},
{"_eisa_dev_list"},
{"_pcidevice_set"},
{"_device_list"},
{"_scbusses"},
{"_scsi_cinit"},
{"_scsi_dinit"},
{"_scsi_tinit"},
{""},
};
int
main(int ac, char **av)
{
int i;
i = nlist(av[1], nl);
if (i == -1) {
fprintf(stderr, "nlist returns error for %s\n", av[1]);
perror("nlist");
return 1;
}
Multiple changes stacked as one commit since they all depend on one another. First, change sysinstall and the Makefile rules to not build the kernel nlist directly into sysinstall now. Instead, spit it out as an ascii file in /stand and parse it from sysinstall later. This solves the chicken-n- egg problem of building sysinstall into the fsimage before BOOTMFS is built and can have its symbols extracted. Now we generate the symbol file in release.8. Second, add Poul-Henning's USERCONFIG_BOOT changes. These have two effects: 1. Userconfig is always entered, rather than only after a -c (don't scream yet, it's not as bad as it sounds). 2. Userconfig reads a message string which can optionally be written just past the boot blocks. This string "preloads" the userconfig input buffer and is parsed as user input. If the first command is not "USERCONFIG", userconfig will treat this as an implied "quit" (which is why you don't need to scream - you never even know you went through userconfig and back out again if you don't specifically ask for it), otherwise it will read and execute the following commands until a "quit" is seen or the end is reached, in which case the normal userconfig command prompt will then be presented. How to create your own startup sequences, using any boot.flp image from the next snap forward (not yet, but soon): % dd of=/dev/rfd0 seek=1 bs=512 count=1 conv=sync <<WAKKA_WAKKA_DOO USERCONFIG irq ed0 10 iomem ed0 0xcc000 disable ed1 quit WAKKA_WAKKA_DOO Third, add an intro screen to UserConfig so that users aren't just thrown into this strange screen if userconfig is auto-launched. The default boot.flp startup sequence is now, in fact, this: USERCONFIG intro visual (Since visual never returns, we don't need a following "quit"). Submitted-By: phk & jkh
1996-10-05 12:44:07 +02:00
printf("%d\n", sizeof(nl) / sizeof(struct nlist));
for (i = 0; nl[i].n_name; i++) {
Multiple changes stacked as one commit since they all depend on one another. First, change sysinstall and the Makefile rules to not build the kernel nlist directly into sysinstall now. Instead, spit it out as an ascii file in /stand and parse it from sysinstall later. This solves the chicken-n- egg problem of building sysinstall into the fsimage before BOOTMFS is built and can have its symbols extracted. Now we generate the symbol file in release.8. Second, add Poul-Henning's USERCONFIG_BOOT changes. These have two effects: 1. Userconfig is always entered, rather than only after a -c (don't scream yet, it's not as bad as it sounds). 2. Userconfig reads a message string which can optionally be written just past the boot blocks. This string "preloads" the userconfig input buffer and is parsed as user input. If the first command is not "USERCONFIG", userconfig will treat this as an implied "quit" (which is why you don't need to scream - you never even know you went through userconfig and back out again if you don't specifically ask for it), otherwise it will read and execute the following commands until a "quit" is seen or the end is reached, in which case the normal userconfig command prompt will then be presented. How to create your own startup sequences, using any boot.flp image from the next snap forward (not yet, but soon): % dd of=/dev/rfd0 seek=1 bs=512 count=1 conv=sync <<WAKKA_WAKKA_DOO USERCONFIG irq ed0 10 iomem ed0 0xcc000 disable ed1 quit WAKKA_WAKKA_DOO Third, add an intro screen to UserConfig so that users aren't just thrown into this strange screen if userconfig is auto-launched. The default boot.flp startup sequence is now, in fact, this: USERCONFIG intro visual (Since visual never returns, we don't need a following "quit"). Submitted-By: phk & jkh
1996-10-05 12:44:07 +02:00
printf("%s\n", nl[i].n_name);
printf("%d %d %d %ld\n",
nl[i].n_type, nl[i].n_other, nl[i].n_desc, nl[i].n_value);
}
return 0;
}