call.c revision 202602
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 202602 2010-01-18 23:09:07Z wkoszek $
2742434Sdfr */
2842434Sdfr
29202602Swkoszek#include <sys/types.h>
30202602Swkoszek#include <sys/module.h>
31202602Swkoszek#include <sys/syscall.h>
32202602Swkoszek
3342434Sdfr#include <stdio.h>
34202601Swkoszek#include <stdlib.h>
35202601Swkoszek#include <unistd.h>
3642434Sdfr
3742434Sdfrint
38202602Swkoszekmain(int argc __unused, char **argv __unused)
3942434Sdfr{
4042434Sdfr	int syscall_num;
4142436Sdfr	struct module_stat stat;
4242434Sdfr
4342436Sdfr	stat.version = sizeof(stat);
4442436Sdfr	modstat(modfind("syscall"), &stat);
4542436Sdfr	syscall_num = stat.data.intval;
4642434Sdfr	return syscall (syscall_num);
4742434Sdfr}
48