Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern For consistency with other code, put the module ini...



details:   https://anonhg.NetBSD.org/src/rev/f01a9ebe85e3
branches:  trunk
changeset: 942056:f01a9ebe85e3
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Nov 04 19:03:17 2020 +0000

description:
For consistency with other code, put the module init/fini code into
separate routines called from module's modcmd() code, rather than
in-lining in the modcmd.

diffstat:

 sys/kern/sys_ptrace.c |  27 +++++++++++++++++++++++----
 1 files changed, 23 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r 3ab2e728c71c -r f01a9ebe85e3 sys/kern/sys_ptrace.c
--- a/sys/kern/sys_ptrace.c     Wed Nov 04 18:32:12 2020 +0000
+++ b/sys/kern/sys_ptrace.c     Wed Nov 04 19:03:17 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_ptrace.c,v 1.9 2020/10/19 15:07:47 kamil Exp $     */
+/*     $NetBSD: sys_ptrace.c,v 1.10 2020/11/04 19:03:17 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.9 2020/10/19 15:07:47 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace.c,v 1.10 2020/11/04 19:03:17 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -180,6 +180,25 @@
 #define        DEPS    "ptrace_common"  
 
 MODULE(MODULE_CLASS_EXEC, ptrace, DEPS);
+
+static int
+ptrace_init(void)
+{ 
+       int error;
+
+       error = syscall_establish(&emul_netbsd, ptrace_syscalls);
+       return error;
+}       
+ 
+static int     
+ptrace_fini(void)
+{
+       int error;
+
+       error = syscall_disestablish(&emul_netbsd, ptrace_syscalls);
+       return error;
+}
+
  
 static int
 ptrace_modcmd(modcmd_t cmd, void *arg)
@@ -188,10 +207,10 @@
  
        switch (cmd) {
        case MODULE_CMD_INIT: 
-               error = syscall_establish(&emul_netbsd, ptrace_syscalls);
+               error == ptrace_init();
                break;
        case MODULE_CMD_FINI:
-               error = syscall_disestablish(&emul_netbsd, ptrace_syscalls);
+               error = ptrace_fini();
                break;
        default:
                error = ENOTTY;



Home | Main Index | Thread Index | Old Index