compat_sysv_14_mod.c revision 1.2
11.2Spgoyette/* $NetBSD: compat_sysv_14_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $ */ 21.2Spgoyette 31.2Spgoyette/*- 41.2Spgoyette * Copyright (c) 2018 The NetBSD Foundation, Inc. 51.2Spgoyette * All rights reserved. 61.2Spgoyette * 71.2Spgoyette * This code is derived from software developed for The NetBSD Foundation 81.2Spgoyette * by Paul Goyette 91.2Spgoyette * 101.2Spgoyette * Redistribution and use in source and binary forms, with or without 111.2Spgoyette * modification, are permitted provided that the following conditions 121.2Spgoyette * are met: 131.2Spgoyette * 1. Redistributions of source code must retain the above copyright 141.2Spgoyette * notice, this list of conditions and the following disclaimer. 151.2Spgoyette * 2. Redistributions in binary form must reproduce the above copyright 161.2Spgoyette * notice, this list of conditions and the following disclaimer in the 171.2Spgoyette * documentation and/or other materials provided with the distribution. 181.2Spgoyette * 191.2Spgoyette * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 201.2Spgoyette * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 211.2Spgoyette * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 221.2Spgoyette * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 231.2Spgoyette * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 241.2Spgoyette * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 251.2Spgoyette * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 261.2Spgoyette * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 271.2Spgoyette * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 281.2Spgoyette * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 291.2Spgoyette * POSSIBILITY OF SUCH DAMAGE. 301.2Spgoyette */ 311.2Spgoyette 321.2Spgoyette#include <sys/cdefs.h> 331.2Spgoyette__KERNEL_RCSID(0, "$NetBSD: compat_sysv_14_mod.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $"); 341.2Spgoyette 351.2Spgoyette#ifdef _KERNEL_OPT 361.2Spgoyette#include "opt_compat_netbsd.h" 371.2Spgoyette#include "opt_sysv.h" 381.2Spgoyette#endif 391.2Spgoyette 401.2Spgoyette#include <sys/systm.h> 411.2Spgoyette#include <sys/module.h> 421.2Spgoyette#include <sys/syscall.h> 431.2Spgoyette#include <sys/syscallargs.h> 441.2Spgoyette#include <sys/syscallvar.h> 451.2Spgoyette#include <sys/sysctl.h> 461.2Spgoyette 471.2SpgoyetteMODULE(MODULE_CLASS_EXEC, compat_sysv_14, "compat_sysv_50,sysv_ipc"); 481.2Spgoyette 491.2Spgoyette/* Build the syscall package based on options specified */ 501.2Spgoyette 511.2Spgoyettestatic const struct syscall_package compat_sysv_14_syscalls[] = { 521.2Spgoyette#ifdef SYSVSHM 531.2Spgoyette { SYS_compat_14_shmctl, 0, (sy_call_t *)compat_14_sys_shmctl }, 541.2Spgoyette#endif 551.2Spgoyette#ifdef SYSVSEM 561.2Spgoyette { SYS_compat_14___semctl, 0, (sy_call_t *)compat_14_sys___semctl }, 571.2Spgoyette#endif 581.2Spgoyette#ifdef SYSVMSG 591.2Spgoyette { SYS_compat_14_msgctl, 0, (sy_call_t *)compat_14_sys_msgctl }, 601.2Spgoyette#endif 611.2Spgoyette { 0, 0, NULL } 621.2Spgoyette}; 631.2Spgoyette 641.2Spgoyettestatic int 651.2Spgoyettecompat_sysv_14_modcmd(modcmd_t cmd, void *arg) 661.2Spgoyette{ 671.2Spgoyette 681.2Spgoyette int error = 0; 691.2Spgoyette 701.2Spgoyette switch (cmd) { 711.2Spgoyette case MODULE_CMD_INIT: 721.2Spgoyette error = syscall_establish(NULL, compat_sysv_14_syscalls); 731.2Spgoyette if (error != 0) { 741.2Spgoyette break; 751.2Spgoyette } 761.2Spgoyette break; 771.2Spgoyette 781.2Spgoyette case MODULE_CMD_FINI: 791.2Spgoyette error = syscall_disestablish(NULL, compat_sysv_14_syscalls); 801.2Spgoyette if (error != 0) { 811.2Spgoyette break; 821.2Spgoyette } 831.2Spgoyette break; 841.2Spgoyette 851.2Spgoyette default: 861.2Spgoyette error = ENOTTY; 871.2Spgoyette break; 881.2Spgoyette } 891.2Spgoyette return error; 901.2Spgoyette} 91