call.c revision 50476
142434Sdfr/*- 242434Sdfr * Copyright (c) 1999 Assar Westerlund 342434Sdfr * All rights reserved. 442434Sdfr * 542434Sdfr * Redistribution and use in source and binary forms, with or without 642434Sdfr * modification, are permitted provided that the following conditions 742434Sdfr * are met: 842434Sdfr * 1. Redistributions of source code must retain the above copyright 942434Sdfr * notice, this list of conditions and the following disclaimer. 1042434Sdfr * 2. Redistributions in binary form must reproduce the above copyright 1142434Sdfr * notice, this list of conditions and the following disclaimer in the 1242434Sdfr * documentation and/or other materials provided with the distribution. 1342434Sdfr * 1442434Sdfr * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1542434Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1642434Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1742434Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1842434Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1942434Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2042434Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2142434Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2242434Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2342434Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2442434Sdfr * SUCH DAMAGE. 2542434Sdfr * 2650476Speter * $FreeBSD: head/share/examples/kld/syscall/test/call.c 50476 1999-08-28 00:22:10Z peter $ 2742434Sdfr */ 2842434Sdfr 2942434Sdfr#include <stdio.h> 3042434Sdfr#include <sys/syscall.h> 3142436Sdfr#include <sys/types.h> 3242436Sdfr#include <sys/module.h> 3342434Sdfr 3442434Sdfrstatic void usage (void); 3542434Sdfr 3642434Sdfrstatic void 3742434Sdfrusage (void) 3842434Sdfr{ 3942434Sdfr fprintf (stderr, "call syscall-number\n"); 4042434Sdfr exit (1); 4142434Sdfr} 4242434Sdfr 4342434Sdfrint 4442434Sdfrmain(int argc, char **argv) 4542434Sdfr{ 4642434Sdfr char *endptr; 4742434Sdfr int syscall_num; 4842436Sdfr struct module_stat stat; 4942434Sdfr 5042436Sdfr stat.version = sizeof(stat); 5142436Sdfr modstat(modfind("syscall"), &stat); 5242436Sdfr syscall_num = stat.data.intval; 5342434Sdfr return syscall (syscall_num); 5442434Sdfr} 55