/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1992-2010 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
#define FORMAT "region=%(region)p size=%(size)d segments=%(segments)d busy=(%(busy_size)d,%(busy_blocks)d,%(busy_max)d) free=(%(free_size)d,%(free_blocks)d,%(free_max)d)"
static const char usage[] =
"[-?\n@(#)$Id: vmstate (AT&T Research) 2010-03-05 $\n]"
"[+NAME?vmstate - list the calling process vmalloc region state]"
"[+DESCRIPTION?When invoked as a shell builtin, \bvmstate\b lists the "
"calling process \bvmalloc\b(3) state for all regions.]"
"[f:format?List the ids specified by \aformat\a. \aformat\a follows "
"\bprintf\b(3) conventions, except that \bsfio\b(3) inline ids are used "
"instead of arguments: "
"%[-+]][\awidth\a[.\aprecis\a[.\abase\a]]]]]](\aid\a)\achar\a. The "
"{"
"[+size?The total region size.]"
"[+segments?The number of segments in the region.]"
"[+busy_size?The total busy block size.]"
"[+busy_blocks?The number of busy blocks.]"
"[+busy_max?The maximum busy block size.]"
"[+free_size?The total free block size.]"
"[+free_blocks?The number of free blocks.]"
"[+free_max?The maximum free block size.]"
"}"
"[+SEE ALSO?\bvmalloc\b(3)]"
;
#include <cmd.h>
#include <vmalloc.h>
typedef struct State_s
{
char* format;
unsigned int regions;
} State_t;
/*
* sfkeyprintf() lookup
* handle==0 for heading
*/
static int
{
register char* s;
else if (streq(s, "region"))
else if (streq(s, "segments"))
else if (streq(s, "busy_size"))
else if (streq(s, "busy_blocks"))
else if (streq(s, "busy_max"))
else if (streq(s, "free_size"))
else if (streq(s, "free_blocks"))
else if (streq(s, "free_max"))
else if (streq(s, "format"))
else
{
return 0;
}
return 1;
}
static int
{
{
}
return 0;
}
int
{
register int i;
for (;;)
{
{
case 'f':
continue;
case '?':
continue;
case ':':
continue;
}
break;
}
/*
* the walk must do no allocations because it locks the regions
*/
/*
* now we can compute and list the state of each region
*/
{
}
return 0;
}