mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Improve example, so that it doesn't dump core when example module
isn't loaded.
This commit is contained in:
parent
b13ce70710
commit
9fd7a1b3dd
1 changed files with 6 additions and 2 deletions
|
|
@ -30,6 +30,7 @@
|
|||
#include <sys/module.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
|
@ -37,11 +38,14 @@
|
|||
int
|
||||
main(int argc __unused, char **argv __unused)
|
||||
{
|
||||
int syscall_num;
|
||||
int modid, syscall_num;
|
||||
struct module_stat stat;
|
||||
|
||||
stat.version = sizeof(stat);
|
||||
modstat(modfind("sys/syscall"), &stat);
|
||||
if ((modid = modfind("sys/syscall")) == -1)
|
||||
err(1, "modfind");
|
||||
if (modstat(modid, &stat) != 0)
|
||||
err(1, "mostat");
|
||||
syscall_num = stat.data.intval;
|
||||
return syscall (syscall_num);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue