This little program allows a developer to trap null pointer dereferences on OpenServer 5 without changing the kernel configuration options. On OpenServer 5, there are kernel configuration option that controls the system behaviour when location zero is referenced (a null pointer dereference). By default, the system permits the reference. If "notice_null_refs" is set to 1 in kernel/space.c, a message is displayed on the console (allowing a developer to track down the offending program without terminating it). If "signal_null_refs" is set, a SIGSEGV can be sent to the process. Since these are kernel options, they affect all users on the system. A developer may wish to detect this error condition in programs under development, but not turn an option on and effect currently deployed programs. If the program is being compiled to COFF, the option -Wl,-z can be added to the link step. This directs the linker to arrange for page zero to be unmapped. References to page zero then cause a SIGSEGV. If the program is being compiled to ELF, the -z option is not available, and program behaviour is controlled by the kernel options. The "trapnull" program allows a program to be monitored for references to the first 16 locations of the address space. By default, the program is terminated with a SIGSEGV if it references any of these locations. However, the -r option instructs trapnull to simply report on the reference, including the EIP, but to allow the program to continue. Example: trapnull -r ./null foo bar -x Runs the command "./null foo bar -x", and reports on any references to the first 16 locations. Example: trapnull ./null foo bar -x Runs the command "./null foo bar -x", and sends SIGSEGV to the process if it references any of the first 16 locations. Tom Kelly tom@sco.com