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$
2742434Sdfr */
2842434Sdfr
29202602Swkoszek#include <sys/types.h>
30202602Swkoszek#include <sys/module.h>
31202602Swkoszek#include <sys/syscall.h>
32202602Swkoszek
33253420Sglebius#include <err.h>
3442434Sdfr#include <stdio.h>
35202601Swkoszek#include <stdlib.h>
36202601Swkoszek#include <unistd.h>
3742434Sdfr
3842434Sdfrint
39202602Swkoszekmain(int argc __unused, char **argv __unused)
4042434Sdfr{
41253420Sglebius	int modid, syscall_num;
4242436Sdfr	struct module_stat stat;
4342434Sdfr
4442436Sdfr	stat.version = sizeof(stat);
45253420Sglebius	if ((modid = modfind("sys/syscall")) == -1)
46253420Sglebius		err(1, "modfind");
47253420Sglebius	if (modstat(modid, &stat) != 0)
48253421Sglebius		err(1, "modstat");
4942436Sdfr	syscall_num = stat.data.intval;
5042434Sdfr	return syscall (syscall_num);
5142434Sdfr}
52