dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / ipf / lib / common / kvatoname.c
blobb3f4af932cdc8e3b2c778ede2130ac7a9eafe7fb
1 #include "ipf.h"
3 #include <fcntl.h>
4 #include <sys/ioctl.h>
6 char *kvatoname(func, iocfunc)
7 ipfunc_t func;
8 ioctlfunc_t iocfunc;
10 static char funcname[40];
11 ipfunc_resolve_t res;
12 int fd;
14 res.ipfu_addr = func;
15 res.ipfu_name[0] = '\0';
16 fd = -1;
18 if ((opts & OPT_DONOTHING) == 0) {
19 fd = open(IPL_NAME, O_RDONLY);
20 if (fd == -1)
21 return NULL;
23 (void) (*iocfunc)(fd, SIOCFUNCL, &res);
24 if (fd >= 0)
25 close(fd);
26 strncpy(funcname, res.ipfu_name, sizeof(funcname));
27 funcname[sizeof(funcname) - 1] = '\0';
28 return funcname;