Fix up mix of man(7)/mdoc(7).
[netbsd-mini2440.git] / dist / ipf / lib / kvatoname.c
blobd46fe96229b9ba2e72ec546c45f311d7da827b49
1 /* $NetBSD$ */
3 /*
4 * Copyright (C) 2002 by Darren Reed.
5 *
6 * See the IPFILTER.LICENCE file for details on licencing.
7 *
8 * Id: kvatoname.c,v 1.1.4.1 2006/06/16 17:21:05 darrenr Exp
9 */
11 #include "ipf.h"
13 #include <fcntl.h>
14 #include <sys/ioctl.h>
16 char *kvatoname(func, iocfunc)
17 ipfunc_t func;
18 ioctlfunc_t iocfunc;
20 static char funcname[40];
21 ipfunc_resolve_t res;
22 int fd;
24 res.ipfu_addr = func;
25 res.ipfu_name[0] = '\0';
26 fd = -1;
28 if ((opts & OPT_DONOTHING) == 0) {
29 fd = open(IPL_NAME, O_RDONLY);
30 if (fd == -1)
31 return NULL;
33 (void) (*iocfunc)(fd, SIOCFUNCL, &res);
34 if (fd >= 0)
35 close(fd);
36 strncpy(funcname, res.ipfu_name, sizeof(funcname));
37 funcname[sizeof(funcname) - 1] = '\0';
38 return funcname;