sysctl.c revision 78434
11553Srgrimes/* 21553Srgrimes * Copyright (c) 1993 31553Srgrimes * The Regents of the University of California. All rights reserved. 41553Srgrimes * 51553Srgrimes * Redistribution and use in source and binary forms, with or without 61553Srgrimes * modification, are permitted provided that the following conditions 71553Srgrimes * are met: 81553Srgrimes * 1. Redistributions of source code must retain the above copyright 91553Srgrimes * notice, this list of conditions and the following disclaimer. 101553Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111553Srgrimes * notice, this list of conditions and the following disclaimer in the 121553Srgrimes * documentation and/or other materials provided with the distribution. 131553Srgrimes * 3. All advertising materials mentioning features or use of this software 141553Srgrimes * must display the following acknowledgement: 151553Srgrimes * This product includes software developed by the University of 161553Srgrimes * California, Berkeley and its contributors. 171553Srgrimes * 4. Neither the name of the University nor the names of its contributors 181553Srgrimes * may be used to endorse or promote products derived from this software 191553Srgrimes * without specific prior written permission. 201553Srgrimes * 211553Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 221553Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 231553Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 241553Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 251553Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 261553Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 271553Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 281553Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 291553Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 301553Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 311553Srgrimes * SUCH DAMAGE. 321553Srgrimes */ 331553Srgrimes 341553Srgrimes#ifndef lint 3530602Scharnierstatic const char copyright[] = 361553Srgrimes"@(#) Copyright (c) 1993\n\ 371553Srgrimes The Regents of the University of California. All rights reserved.\n"; 381553Srgrimes#endif /* not lint */ 391553Srgrimes 401553Srgrimes#ifndef lint 4130602Scharnier#if 0 4230602Scharnierstatic char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93"; 4330602Scharnier#endif 446284Swollmanstatic const char rcsid[] = 4550476Speter "$FreeBSD: head/sbin/sysctl/sysctl.c 78434 2001-06-18 21:06:24Z pirzyk $"; 461553Srgrimes#endif /* not lint */ 471553Srgrimes 4812946Sphk#include <sys/types.h> 491553Srgrimes#include <sys/stat.h> 501553Srgrimes#include <sys/sysctl.h> 5112946Sphk#include <sys/resource.h> 521553Srgrimes 5330602Scharnier#include <ctype.h> 5430602Scharnier#include <err.h> 551553Srgrimes#include <errno.h> 561553Srgrimes#include <stdio.h> 571553Srgrimes#include <stdlib.h> 581553Srgrimes#include <string.h> 5930602Scharnier#include <unistd.h> 601553Srgrimes 6177330Sdesstatic int aflag, bflag, Nflag, nflag, oflag, xflag; 621553Srgrimes 6312946Sphkstatic int oidfmt(int *, int, char *, u_int *); 6412946Sphkstatic void parse(char *); 6512946Sphkstatic int show_var(int *, int); 6612946Sphkstatic int sysctl_all (int *oid, int len); 6712946Sphkstatic int name2oid(char *, int *); 681553Srgrimes 6912946Sphkstatic void 7012946Sphkusage(void) 7112946Sphk{ 721553Srgrimes 7377330Sdes (void)fprintf(stderr, "%s\n%s\n", 7477330Sdes "usage: sysctl [-bNnox] variable[=value] ...", 7577330Sdes " sysctl [-bNnox] -a"); 7612946Sphk exit(1); 7712946Sphk} 781553Srgrimes 791553Srgrimesint 8012946Sphkmain(int argc, char **argv) 811553Srgrimes{ 8212946Sphk int ch; 8312946Sphk setbuf(stdout,0); 8412946Sphk setbuf(stderr,0); 851553Srgrimes 8677330Sdes while ((ch = getopt(argc, argv, "AabNnowxX")) != -1) { 871553Srgrimes switch (ch) { 8871034Sdes case 'A': 8977330Sdes /* compatibility */ 9077330Sdes aflag = oflag = 1; 9171034Sdes break; 9271034Sdes case 'a': 9371034Sdes aflag = 1; 9471034Sdes break; 9571034Sdes case 'b': 9671034Sdes bflag = 1; 9771034Sdes break; 9871034Sdes case 'N': 9971034Sdes Nflag = 1; 10071034Sdes break; 10171034Sdes case 'n': 10271034Sdes nflag = 1; 10371034Sdes break; 10477330Sdes case 'o': 10577330Sdes oflag = 1; 10677330Sdes break; 10771034Sdes case 'w': 10877330Sdes /* compatibility */ 10977330Sdes /* ignored */ 11071034Sdes break; 11171034Sdes case 'X': 11277330Sdes /* compatibility */ 11377330Sdes aflag = xflag = 1; 11471034Sdes break; 11577330Sdes case 'x': 11677330Sdes xflag = 1; 11777330Sdes break; 11871034Sdes default: 11971034Sdes usage(); 1201553Srgrimes } 1211553Srgrimes } 1221553Srgrimes argc -= optind; 1231553Srgrimes argv += optind; 1241553Srgrimes 12577330Sdes if (Nflag && nflag) 12642456Sdes usage(); 12777330Sdes if (aflag && argc == 0) 12877330Sdes exit(sysctl_all(0, 0)); 1291553Srgrimes if (argc == 0) 1301553Srgrimes usage(); 1311553Srgrimes while (argc-- > 0) 13212946Sphk parse(*argv++); 1331553Srgrimes exit(0); 1341553Srgrimes} 1351553Srgrimes 1361553Srgrimes/* 1371553Srgrimes * Parse a name into a MIB entry. 1381553Srgrimes * Lookup and print out the MIB entry if it exists. 1391553Srgrimes * Set a new value if requested. 1401553Srgrimes */ 14112946Sphkstatic void 14212946Sphkparse(char *string) 1431553Srgrimes{ 14412946Sphk int len, i, j; 1451553Srgrimes void *newval = 0; 14678434Spirzyk int intval; 14778434Spirzyk unsigned int uintval; 14878434Spirzyk long longval; 14978434Spirzyk unsigned long ulongval; 15078434Spirzyk size_t newsize = 0; 1511553Srgrimes quad_t quadval; 1521553Srgrimes int mib[CTL_MAXNAME]; 15312946Sphk char *cp, *bufp, buf[BUFSIZ]; 15412946Sphk u_int kind; 1551553Srgrimes 1561553Srgrimes bufp = buf; 1571553Srgrimes snprintf(buf, BUFSIZ, "%s", string); 1581553Srgrimes if ((cp = strchr(string, '=')) != NULL) { 1591553Srgrimes *strchr(buf, '=') = '\0'; 1601553Srgrimes *cp++ = '\0'; 1611553Srgrimes while (isspace(*cp)) 1621553Srgrimes cp++; 1631553Srgrimes newval = cp; 1641553Srgrimes newsize = strlen(cp); 1651553Srgrimes } 16612946Sphk len = name2oid(bufp, mib); 1671553Srgrimes 16812946Sphk if (len < 0) 16930602Scharnier errx(1, "unknown oid '%s'", bufp); 1701553Srgrimes 17112946Sphk if (oidfmt(mib, len, 0, &kind)) 17230602Scharnier err(1, "couldn't find format of oid '%s'", bufp); 1731553Srgrimes 17477330Sdes if (newval == NULL) { 17512946Sphk if ((kind & CTLTYPE) == CTLTYPE_NODE) { 17612946Sphk sysctl_all(mib, len); 17712946Sphk } else { 17812946Sphk i = show_var(mib, len); 17912946Sphk if (!i && !bflag) 18012946Sphk putchar('\n'); 1811553Srgrimes } 18212946Sphk } else { 18312946Sphk if ((kind & CTLTYPE) == CTLTYPE_NODE) 18412946Sphk errx(1, "oid '%s' isn't a leaf node", bufp); 1851553Srgrimes 18612946Sphk if (!(kind&CTLFLAG_WR)) 18712946Sphk errx(1, "oid '%s' is read only", bufp); 18812946Sphk 18912946Sphk switch (kind & CTLTYPE) { 19012946Sphk case CTLTYPE_INT: 19153317Sgrog intval = (int) strtol(newval, NULL, 0); 19212946Sphk newval = &intval; 19377928Sdd newsize = sizeof(intval); 1941553Srgrimes break; 19578434Spirzyk case CTLTYPE_UINT: 19678434Spirzyk uintval = (int) strtoul(newval, NULL, 0); 19778434Spirzyk newval = &uintval; 19878434Spirzyk newsize = sizeof uintval; 19912946Sphk break; 20078434Spirzyk case CTLTYPE_LONG: 20178434Spirzyk longval = strtol(newval, NULL, 0); 20278434Spirzyk newval = &longval; 20378434Spirzyk newsize = sizeof longval; 20478434Spirzyk break; 20578434Spirzyk case CTLTYPE_ULONG: 20678434Spirzyk ulongval = strtoul(newval, NULL, 0); 20778434Spirzyk newval = &ulongval; 20878434Spirzyk newsize = sizeof ulongval; 20978434Spirzyk break; 21012946Sphk case CTLTYPE_STRING: 21112946Sphk break; 21212946Sphk case CTLTYPE_QUAD: 21312946Sphk break; 21412946Sphk sscanf(newval, "%qd", &quadval); 21512946Sphk newval = &quadval; 21677928Sdd newsize = sizeof(quadval); 21712946Sphk break; 21812946Sphk default: 21912946Sphk errx(1, "oid '%s' is type %d," 22031214Sjdp " cannot set that", bufp, 22131214Sjdp kind & CTLTYPE); 2221553Srgrimes } 2231553Srgrimes 22412946Sphk i = show_var(mib, len); 22512946Sphk if (sysctl(mib, len, 0, 0, newval, newsize) == -1) { 22612946Sphk if (!i && !bflag) 22712946Sphk putchar('\n'); 22812946Sphk switch (errno) { 22912946Sphk case EOPNOTSUPP: 23030602Scharnier errx(1, "%s: value is not available", 23112946Sphk string); 23212946Sphk case ENOTDIR: 23330602Scharnier errx(1, "%s: specification is incomplete", 23412946Sphk string); 23512946Sphk case ENOMEM: 23630602Scharnier errx(1, "%s: type is unknown to this program", 23712946Sphk string); 23812946Sphk default: 23930602Scharnier warn("%s", string); 24012946Sphk return; 24112946Sphk } 24212946Sphk } 24312946Sphk if (!bflag) 24412946Sphk printf(" -> "); 24512946Sphk i = nflag; 24612946Sphk nflag = 1; 24712946Sphk j = show_var(mib, len); 24812946Sphk if (!j && !bflag) 24912946Sphk putchar('\n'); 25012946Sphk nflag = i; 25112946Sphk } 25212946Sphk} 2531553Srgrimes 25412946Sphk/* These functions will dump out various interesting structures. */ 2551553Srgrimes 25612946Sphkstatic int 25712946SphkS_clockinfo(int l2, void *p) 25812946Sphk{ 25912946Sphk struct clockinfo *ci = (struct clockinfo*)p; 26077928Sdd if (l2 != sizeof(*ci)) 26177928Sdd err(1, "S_clockinfo %d != %d", l2, sizeof(*ci)); 26226899Sjhay printf("{ hz = %d, tick = %d, tickadj = %d, profhz = %d, stathz = %d }", 26326899Sjhay ci->hz, ci->tick, ci->tickadj, ci->profhz, ci->stathz); 26412946Sphk return (0); 26512946Sphk} 2661553Srgrimes 26712946Sphkstatic int 26812946SphkS_loadavg(int l2, void *p) 26912946Sphk{ 27012946Sphk struct loadavg *tv = (struct loadavg*)p; 2718857Srgrimes 27277928Sdd if (l2 != sizeof(*tv)) 27377928Sdd err(1, "S_loadavg %d != %d", l2, sizeof(*tv)); 2741553Srgrimes 27512946Sphk printf("{ %.2f %.2f %.2f }", 27612946Sphk (double)tv->ldavg[0]/(double)tv->fscale, 27712946Sphk (double)tv->ldavg[1]/(double)tv->fscale, 27812946Sphk (double)tv->ldavg[2]/(double)tv->fscale); 27912946Sphk return (0); 28012946Sphk} 2811553Srgrimes 28212946Sphkstatic int 28312946SphkS_timeval(int l2, void *p) 28412946Sphk{ 28512946Sphk struct timeval *tv = (struct timeval*)p; 28637266Sbde time_t tv_sec; 28712946Sphk char *p1, *p2; 2881553Srgrimes 28977928Sdd if (l2 != sizeof(*tv)) 29077928Sdd err(1, "S_timeval %d != %d", l2, sizeof(*tv)); 29112946Sphk printf("{ sec = %ld, usec = %ld } ", 29212946Sphk tv->tv_sec, tv->tv_usec); 29337266Sbde tv_sec = tv->tv_sec; 29437266Sbde p1 = strdup(ctime(&tv_sec)); 29512946Sphk for (p2=p1; *p2 ; p2++) 29612946Sphk if (*p2 == '\n') 29712946Sphk *p2 = '\0'; 29812946Sphk fputs(p1, stdout); 29912946Sphk return (0); 30012946Sphk} 3011553Srgrimes 30212946Sphkstatic int 30312946SphkT_dev_t(int l2, void *p) 30412946Sphk{ 30512946Sphk dev_t *d = (dev_t *)p; 30677928Sdd if (l2 != sizeof(*d)) 30777928Sdd err(1, "T_dev_T %d != %d", l2, sizeof(*d)); 30861514Sphk if ((int)(*d) != -1) { 30961514Sphk if (minor(*d) > 255 || minor(*d) < 0) 31061514Sphk printf("{ major = %d, minor = 0x%x }", 31161514Sphk major(*d), minor(*d)); 31261514Sphk else 31361514Sphk printf("{ major = %d, minor = %d }", 31461514Sphk major(*d), minor(*d)); 31561514Sphk } 31612946Sphk return (0); 31712946Sphk} 3181553Srgrimes 31912946Sphk/* 32012946Sphk * These functions uses a presently undocumented interface to the kernel 32112946Sphk * to walk the tree and get the type so it can print the value. 32212946Sphk * This interface is under work and consideration, and should probably 32312946Sphk * be killed with a big axe by the first person who can find the time. 32412946Sphk * (be aware though, that the proper interface isn't as obvious as it 32512946Sphk * may seem, there are various conflicting requirements. 32612946Sphk */ 3271553Srgrimes 32812946Sphkstatic int 32912946Sphkname2oid(char *name, int *oidp) 33012946Sphk{ 33112946Sphk int oid[2]; 33238533Sdfr int i; 33338533Sdfr size_t j; 3341553Srgrimes 33512946Sphk oid[0] = 0; 33612946Sphk oid[1] = 3; 3371553Srgrimes 33877928Sdd j = CTL_MAXNAME * sizeof(int); 33912946Sphk i = sysctl(oid, 2, oidp, &j, name, strlen(name)); 34012946Sphk if (i < 0) 34112946Sphk return i; 34277928Sdd j /= sizeof(int); 34312946Sphk return (j); 3441553Srgrimes} 3451553Srgrimes 34612946Sphkstatic int 34712946Sphkoidfmt(int *oid, int len, char *fmt, u_int *kind) 34812946Sphk{ 34912946Sphk int qoid[CTL_MAXNAME+2]; 35012946Sphk u_char buf[BUFSIZ]; 35138533Sdfr int i; 35238533Sdfr size_t j; 3531553Srgrimes 35412946Sphk qoid[0] = 0; 35512946Sphk qoid[1] = 4; 35612946Sphk memcpy(qoid + 2, oid, len * sizeof(int)); 3571553Srgrimes 35877928Sdd j = sizeof(buf); 35912946Sphk i = sysctl(qoid, len + 2, buf, &j, 0, 0); 36012946Sphk if (i) 36130602Scharnier err(1, "sysctl fmt %d %d %d", i, j, errno); 3621553Srgrimes 36312946Sphk if (kind) 36412946Sphk *kind = *(u_int *)buf; 36512946Sphk 36612946Sphk if (fmt) 36712946Sphk strcpy(fmt, (char *)(buf + sizeof(u_int))); 36812946Sphk return 0; 3691553Srgrimes} 3701553Srgrimes 3711553Srgrimes/* 37212946Sphk * This formats and outputs the value of one variable 37312946Sphk * 37412946Sphk * Returns zero if anything was actually output. 37512946Sphk * Returns one if didn't know what to do with this. 37612946Sphk * Return minus one if we had errors. 3771553Srgrimes */ 37812946Sphk 37912946Sphkstatic int 38012946Sphkshow_var(int *oid, int nlen) 3811553Srgrimes{ 38212946Sphk u_char buf[BUFSIZ], *val, *p; 38377567Sdd char name[BUFSIZ], *fmt; 38412946Sphk int qoid[CTL_MAXNAME+2]; 38538533Sdfr int i; 38638533Sdfr size_t j, len; 38712946Sphk u_int kind; 38877332Sdes int (*func)(int, void *); 3891553Srgrimes 39042456Sdes qoid[0] = 0; 39142456Sdes memcpy(qoid + 2, oid, nlen * sizeof(int)); 39242456Sdes 39342456Sdes qoid[1] = 1; 39477928Sdd j = sizeof(name); 39542456Sdes i = sysctl(qoid, nlen + 2, name, &j, 0, 0); 39642456Sdes if (i || !j) 39742456Sdes err(1, "sysctl name %d %d %d", i, j, errno); 39842456Sdes 39971034Sdes if (Nflag) { 40071034Sdes printf("%s", name); 40171034Sdes return (0); 40271034Sdes } 40371034Sdes 40412946Sphk /* find an estimate of how much we need for this var */ 40512946Sphk j = 0; 40612946Sphk i = sysctl(oid, nlen, 0, &j, 0, 0); 40712946Sphk j += j; /* we want to be sure :-) */ 40812946Sphk 40912946Sphk val = alloca(j); 41012946Sphk len = j; 41112946Sphk i = sysctl(oid, nlen, val, &len, 0, 0); 41212946Sphk if (i || !len) 41312946Sphk return (1); 41412946Sphk 41512946Sphk if (bflag) { 41612946Sphk fwrite(val, 1, len, stdout); 41712946Sphk return (0); 4181553Srgrimes } 41912946Sphk 42012946Sphk qoid[1] = 4; 42177928Sdd j = sizeof(buf); 42212946Sphk i = sysctl(qoid, nlen + 2, buf, &j, 0, 0); 42312946Sphk if (i || !j) 42430602Scharnier err(1, "sysctl fmt %d %d %d", i, j, errno); 42512946Sphk 42612946Sphk kind = *(u_int *)buf; 42712946Sphk 42812946Sphk fmt = (char *)(buf + sizeof(u_int)); 42912946Sphk 43012946Sphk p = val; 43112946Sphk switch (*fmt) { 43212946Sphk case 'A': 43312946Sphk if (!nflag) 43412946Sphk printf("%s: ", name); 43512946Sphk printf("%s", p); 43612946Sphk return (0); 43712946Sphk 43812946Sphk case 'I': 43912946Sphk if (!nflag) 44012946Sphk printf("%s: ", name); 44162622Sjhb fmt++; 44241019Sphk val = ""; 44341019Sphk while (len >= sizeof(int)) { 44462622Sjhb if(*fmt == 'U') 44562622Sjhb printf("%s%u", val, *(unsigned int *)p); 44662622Sjhb else 44762622Sjhb printf("%s%d", val, *(int *)p); 44841019Sphk val = " "; 44977332Sdes len -= sizeof(int); 45077332Sdes p += sizeof(int); 45141019Sphk } 45212946Sphk return (0); 45312946Sphk 45438533Sdfr case 'L': 45538533Sdfr if (!nflag) 45638533Sdfr printf("%s: ", name); 45762622Sjhb fmt++; 45862975Sphk val = ""; 45962975Sphk while (len >= sizeof(long)) { 46062975Sphk if(*fmt == 'U') 46162975Sphk printf("%s%lu", val, *(unsigned long *)p); 46262975Sphk else 46362975Sphk printf("%s%ld", val, *(long *)p); 46462975Sphk val = " "; 46577332Sdes len -= sizeof(long); 46677332Sdes p += sizeof(long); 46762975Sphk } 46838533Sdfr return (0); 46938533Sdfr 47038533Sdfr case 'P': 47138533Sdfr if (!nflag) 47238533Sdfr printf("%s: ", name); 47338533Sdfr printf("%p", *(void **)p); 47438533Sdfr return (0); 47538533Sdfr 47612946Sphk case 'T': 47712946Sphk case 'S': 47812946Sphk i = 0; 47977332Sdes if (strcmp(fmt, "S,clockinfo") == 0) 48077332Sdes func = S_clockinfo; 48177332Sdes else if (strcmp(fmt, "S,timeval") == 0) 48277332Sdes func = S_timeval; 48377332Sdes else if (strcmp(fmt, "S,loadavg") == 0) 48477332Sdes func = S_loadavg; 48577332Sdes else if (strcmp(fmt, "T,dev_t") == 0) 48677332Sdes func = T_dev_t; 48777332Sdes else 48877332Sdes func = NULL; 48912946Sphk if (func) { 49012946Sphk if (!nflag) 49112946Sphk printf("%s: ", name); 49212946Sphk return ((*func)(len, p)); 49312946Sphk } 49412946Sphk /* FALL THROUGH */ 49512946Sphk default: 49677330Sdes if (!oflag && !xflag) 49712946Sphk return (1); 49812946Sphk if (!nflag) 49912946Sphk printf("%s: ", name); 50012946Sphk printf("Format:%s Length:%d Dump:0x", fmt, len); 50177332Sdes while (len-- && (xflag || p < val + 16)) 50212946Sphk printf("%02x", *p++); 50377332Sdes if (!xflag && len > 16) 50412946Sphk printf("..."); 50512946Sphk return (0); 5061553Srgrimes } 50712946Sphk return (1); 5081553Srgrimes} 5091553Srgrimes 51012946Sphkstatic int 51112946Sphksysctl_all (int *oid, int len) 5121553Srgrimes{ 51312946Sphk int name1[22], name2[22]; 51438533Sdfr int i, j; 51538533Sdfr size_t l1, l2; 5161553Srgrimes 51712946Sphk name1[0] = 0; 51812946Sphk name1[1] = 2; 51912946Sphk l1 = 2; 52012946Sphk if (len) { 52177928Sdd memcpy(name1+2, oid, len * sizeof(int)); 52212946Sphk l1 += len; 52312946Sphk } else { 52412946Sphk name1[2] = 1; 52512946Sphk l1++; 52612946Sphk } 52777332Sdes for (;;) { 52877928Sdd l2 = sizeof(name2); 52912946Sphk j = sysctl(name1, l1, name2, &l2, 0, 0); 53048956Sbillf if (j < 0) { 53112946Sphk if (errno == ENOENT) 53212946Sphk return 0; 53312946Sphk else 53430602Scharnier err(1, "sysctl(getnext) %d %d", j, l2); 53548956Sbillf } 53612946Sphk 53777928Sdd l2 /= sizeof(int); 53812946Sphk 53912946Sphk if (l2 < len) 54012946Sphk return 0; 54112946Sphk 54212946Sphk for (i = 0; i < len; i++) 54312946Sphk if (name2[i] != oid[i]) 54412946Sphk return 0; 54512946Sphk 54612946Sphk i = show_var(name2, l2); 54712946Sphk if (!i && !bflag) 54812946Sphk putchar('\n'); 54912946Sphk 55077928Sdd memcpy(name1+2, name2, l2 * sizeof(int)); 55112946Sphk l1 = 2 + l2; 55212946Sphk } 5531553Srgrimes} 554