call.c revision 42434
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 * 2642434Sdfr * $Id$ 2742434Sdfr */ 2842434Sdfr 2942434Sdfr#include <stdio.h> 3042434Sdfr#include <sys/syscall.h> 3142434Sdfr 3242434Sdfrstatic void usage (void); 3342434Sdfr 3442434Sdfrstatic void 3542434Sdfrusage (void) 3642434Sdfr{ 3742434Sdfr fprintf (stderr, "call syscall-number\n"); 3842434Sdfr exit (1); 3942434Sdfr} 4042434Sdfr 4142434Sdfrint 4242434Sdfrmain(int argc, char **argv) 4342434Sdfr{ 4442434Sdfr char *endptr; 4542434Sdfr int syscall_num; 4642434Sdfr 4742434Sdfr if (argc != 2) 4842434Sdfr usage (); 4942434Sdfr syscall_num = strtol (argv[1], &endptr, 0); 5042434Sdfr if (syscall_num == 0 && argv[1] == endptr) 5142434Sdfr errx (1, "Bad number `%s'", argv[1]); 5242434Sdfr return syscall (syscall_num); 5342434Sdfr} 54