Where if not in examples we should follow style(9)?
This commit is contained in:
parent
bf64a6b6b4
commit
195ebc7e9e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=193374
@ -124,12 +124,12 @@ load (module_t mod, int cmd, void *arg)
|
||||
break;
|
||||
case MOD_UNLOAD :
|
||||
printf("1. Try to free ctx1 (%p): ", &clist);
|
||||
if(sysctl_ctx_free(&clist))
|
||||
if (sysctl_ctx_free(&clist) != 0)
|
||||
printf("failed: expected. Need to remove ctx3 first.\n");
|
||||
else
|
||||
printf("HELP! sysctl_ctx_free(%p) succeeded. EXPECT PANIC!!!\n", &clist);
|
||||
printf("2. Try to free ctx3 (%p): ", &clist2);
|
||||
if(sysctl_ctx_free(&clist2)) {
|
||||
if (sysctl_ctx_free(&clist2) != 0) {
|
||||
printf("sysctl_ctx_free(%p) failed!\n", &clist2);
|
||||
/* Remove subtree forcefully... */
|
||||
sysctl_remove_oid(b_root, 1, 1);
|
||||
@ -137,7 +137,7 @@ load (module_t mod, int cmd, void *arg)
|
||||
} else
|
||||
printf("Ok\n");
|
||||
printf("3. Try to free ctx1 (%p) again: ", &clist);
|
||||
if(sysctl_ctx_free(&clist)) {
|
||||
if (sysctl_ctx_free(&clist) != 0) {
|
||||
printf("sysctl_ctx_free(%p) failed!\n", &clist);
|
||||
/* Remove subtree forcefully... */
|
||||
sysctl_remove_oid(a_root1, 1, 1);
|
||||
@ -145,7 +145,7 @@ load (module_t mod, int cmd, void *arg)
|
||||
} else
|
||||
printf("Ok\n");
|
||||
printf("4. Try to free ctx2 (%p): ", &clist1);
|
||||
if(sysctl_ctx_free(&clist1)) {
|
||||
if (sysctl_ctx_free(&clist1) != 0) {
|
||||
printf("sysctl_ctx_free(%p) failed!\n", &clist1);
|
||||
/* Remove subtree forcefully... */
|
||||
sysctl_remove_oid(a_root, 1, 1);
|
||||
@ -156,7 +156,7 @@ load (module_t mod, int cmd, void *arg)
|
||||
error = EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
return (error);
|
||||
}
|
||||
|
||||
static moduledata_t mod_data = {
|
||||
|
@ -26,7 +26,6 @@
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/module.h>
|
||||
@ -38,18 +37,17 @@
|
||||
/*
|
||||
* The function for implementing the syscall.
|
||||
*/
|
||||
|
||||
static int
|
||||
hello(struct thread *td, void *arg)
|
||||
{
|
||||
|
||||
printf("hello kernel\n");
|
||||
return 0;
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* The `sysent' for the new syscall
|
||||
*/
|
||||
|
||||
static struct sysent hello_sysent = {
|
||||
0, /* sy_narg */
|
||||
hello /* sy_call */
|
||||
@ -58,13 +56,11 @@ static struct sysent hello_sysent = {
|
||||
/*
|
||||
* The offset in sysent where the syscall is allocated.
|
||||
*/
|
||||
|
||||
static int offset = NO_SYSCALL;
|
||||
|
||||
/*
|
||||
* The function called at load/unload.
|
||||
*/
|
||||
|
||||
static int
|
||||
load(struct module *module, int cmd, void *arg)
|
||||
{
|
||||
@ -81,7 +77,7 @@ load (struct module *module, int cmd, void *arg)
|
||||
error = EOPNOTSUPP;
|
||||
break;
|
||||
}
|
||||
return error;
|
||||
return (error);
|
||||
}
|
||||
|
||||
SYSCALL_MODULE(syscall, &offset, &hello_sysent, load, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user