Skip to content

Commit

Permalink
Set pthread stacksize in a less invasive manner.
Browse files Browse the repository at this point in the history
  • Loading branch information
anttikantee committed Jun 23, 2015
1 parent 4666c1d commit a4b16b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
3 changes: 3 additions & 0 deletions include/rumprun-base/config.h
Expand Up @@ -26,6 +26,9 @@
#ifndef _BMKCOMMON_RUMPRUN_CONFIG_H_
#define _BMKCOMMON_RUMPRUN_CONFIG_H_

/* yeah, simple */
#define RUMPRUN_DEFAULTUSERSTACK ((32*(sizeof(void *)/4)*4096)/1024)

extern int rumprun_cmdline_argc;
extern char **rumprun_cmdline_argv;

Expand Down
18 changes: 12 additions & 6 deletions lib/librumprun_base/netbsd_initfini.c
Expand Up @@ -34,12 +34,17 @@
#include <string.h>

#include <bmk-core/core.h>
#include <bmk-core/printf.h>

#include <rumprun-base/config.h>

#include "rumprun-private.h"

static char *empty_env[1];
static char ssbuf[32];
static char *initial_env[] = {
ssbuf,
NULL,
};

extern void *environ;
void _libc_init(void);
Expand All @@ -49,7 +54,6 @@ extern char *__progname;
static struct ps_strings thestrings;
static AuxInfo myaux[2];
extern struct ps_strings *__ps_strings;
extern size_t pthread__stacksize;

typedef void (*initfini_fn)(void);
extern const initfini_fn __init_array_start[1];
Expand Down Expand Up @@ -80,18 +84,20 @@ runfini(void)
void
_netbsd_userlevel_init(void)
{
int rv;

thestrings.ps_argvstr = (void *)((char *)&myaux - 2);
__ps_strings = &thestrings;

/* XXX? */
pthread__stacksize = 32*bmk_pagesize;

/*
* We get no "environ" from the kernel. The initial
* environment is created by rumprun_boot() depending on
* what environ arguments were given (if any).
*/
environ = empty_env;
rv = bmk_snprintf(ssbuf, sizeof(ssbuf),
"PTHREAD_STACKSIZE=%zu", RUMPRUN_DEFAULTUSERSTACK);
bmk_assert(rv < (int)sizeof(ssbuf));
environ = initial_env;

runinit();
_libc_init();
Expand Down

0 comments on commit a4b16b6

Please sign in to comment.