renamed --memsize to --heapsize in bin/main.c

allowed 0 as a heap size to indicate no use of xma
This commit is contained in:
hyung-hwan 2021-01-01 07:34:21 +00:00
parent 1828b4f29b
commit 2c49ebe558

View File

@ -951,7 +951,7 @@ static void print_synerr (hcl_t* hcl)
hcl_logbfmt (hcl, HCL_LOG_STDERR, "\n"); hcl_logbfmt (hcl, HCL_LOG_STDERR, "\n");
} }
#define MIN_MEMSIZE 512000ul #define DEFAULT_HEAPSIZE 512000ul
int main (int argc, char* argv[]) int main (int argc, char* argv[])
{ {
@ -963,22 +963,23 @@ int main (int argc, char* argv[])
hcl_bci_t c; hcl_bci_t c;
static hcl_bopt_lng_t lopt[] = static hcl_bopt_lng_t lopt[] =
{ {
{ ":log", 'l' },
{ ":memsize", 'm' },
{ "large-pages", '\0' },
#if defined(HCL_BUILD_DEBUG) #if defined(HCL_BUILD_DEBUG)
{ ":debug", '\0' }, /* NOTE: there is no short option for --debug */ { ":debug", '\0' },
#endif #endif
{ ":heapsize", '\0' },
{ ":log", 'l' },
{ "large-pages", '\0' },
{ HCL_NULL, '\0' } { HCL_NULL, '\0' }
}; };
static hcl_bopt_t opt = static hcl_bopt_t opt =
{ {
"l:m:v", "l:v",
lopt lopt
}; };
const char* logopt = HCL_NULL; const char* logopt = HCL_NULL;
hcl_oow_t memsize = MIN_MEMSIZE; hcl_oow_t heapsize = DEFAULT_HEAPSIZE;
int verbose = 0; int verbose = 0;
int large_pages = 0; int large_pages = 0;
@ -1004,17 +1005,17 @@ int main (int argc, char* argv[])
logopt = opt.arg; logopt = opt.arg;
break; break;
case 'm':
memsize = strtoul(opt.arg, HCL_NULL, 0);
if (memsize <= MIN_MEMSIZE) memsize = MIN_MEMSIZE;
break;
case 'v': case 'v':
verbose = 1; verbose = 1;
break; break;
case '\0': case '\0':
if (hcl_comp_bcstr(opt.lngopt, "large-pages") == 0) if (hcl_comp_bcstr(opt.lngopt, "heapsize") == 0)
{
heapsize = strtoul(opt.arg, HCL_NULL, 0);
break;
}
else if (hcl_comp_bcstr(opt.lngopt, "large-pages") == 0)
{ {
large_pages = 1; large_pages = 1;
break; break;
@ -1062,7 +1063,7 @@ int main (int argc, char* argv[])
vmprim.vm_gettime = hcl_vmprim_vm_gettime; vmprim.vm_gettime = hcl_vmprim_vm_gettime;
vmprim.vm_sleep = hcl_vmprim_vm_sleep; vmprim.vm_sleep = hcl_vmprim_vm_sleep;
hcl = hcl_open(&sys_mmgr, HCL_SIZEOF(xtn_t), memsize, &vmprim, HCL_NULL); hcl = hcl_open(&sys_mmgr, HCL_SIZEOF(xtn_t), heapsize, &vmprim, HCL_NULL);
if (!hcl) if (!hcl)
{ {
printf ("ERROR: cannot open hcl\n"); printf ("ERROR: cannot open hcl\n");