xref: /freebsd/share/examples/kld/syscall/test/call.c (revision bcb321b33e76175e4b71217f62bca7eda9f1d878)
1380a989bSDoug Rabson /*-
2380a989bSDoug Rabson  * Copyright (c) 1999 Assar Westerlund
3380a989bSDoug Rabson  * All rights reserved.
4380a989bSDoug Rabson  *
5380a989bSDoug Rabson  * Redistribution and use in source and binary forms, with or without
6380a989bSDoug Rabson  * modification, are permitted provided that the following conditions
7380a989bSDoug Rabson  * are met:
8380a989bSDoug Rabson  * 1. Redistributions of source code must retain the above copyright
9380a989bSDoug Rabson  *    notice, this list of conditions and the following disclaimer.
10380a989bSDoug Rabson  * 2. Redistributions in binary form must reproduce the above copyright
11380a989bSDoug Rabson  *    notice, this list of conditions and the following disclaimer in the
12380a989bSDoug Rabson  *    documentation and/or other materials provided with the distribution.
13380a989bSDoug Rabson  *
14380a989bSDoug Rabson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15380a989bSDoug Rabson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16380a989bSDoug Rabson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17380a989bSDoug Rabson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18380a989bSDoug Rabson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19380a989bSDoug Rabson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20380a989bSDoug Rabson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21380a989bSDoug Rabson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22380a989bSDoug Rabson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23380a989bSDoug Rabson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24380a989bSDoug Rabson  * SUCH DAMAGE.
25380a989bSDoug Rabson  *
26bcb321b3SDoug Rabson  *     $Id: call.c,v 1.1 1999/01/09 14:26:22 dfr Exp $
27380a989bSDoug Rabson  */
28380a989bSDoug Rabson 
29380a989bSDoug Rabson #include <stdio.h>
30380a989bSDoug Rabson #include <sys/syscall.h>
31bcb321b3SDoug Rabson #include <sys/types.h>
32bcb321b3SDoug Rabson #include <sys/module.h>
33380a989bSDoug Rabson 
34380a989bSDoug Rabson static void usage (void);
35380a989bSDoug Rabson 
36380a989bSDoug Rabson static void
37380a989bSDoug Rabson usage (void)
38380a989bSDoug Rabson {
39380a989bSDoug Rabson 	fprintf (stderr, "call syscall-number\n");
40380a989bSDoug Rabson 	exit (1);
41380a989bSDoug Rabson }
42380a989bSDoug Rabson 
43380a989bSDoug Rabson int
44380a989bSDoug Rabson main(int argc, char **argv)
45380a989bSDoug Rabson {
46380a989bSDoug Rabson 	char *endptr;
47380a989bSDoug Rabson 	int syscall_num;
48bcb321b3SDoug Rabson 	struct module_stat stat;
49380a989bSDoug Rabson 
50bcb321b3SDoug Rabson 	stat.version = sizeof(stat);
51bcb321b3SDoug Rabson 	modstat(modfind("syscall"), &stat);
52bcb321b3SDoug Rabson 	syscall_num = stat.data.intval;
53380a989bSDoug Rabson 	return syscall (syscall_num);
54380a989bSDoug Rabson }
55