Various fixes and improvements.

This commit is contained in:
C. Guy Yarvin 2014-09-23 11:58:57 -07:00
parent 465562d921
commit 4a7f146b4a
7 changed files with 74 additions and 7 deletions

51
g/e.c
View File

@ -531,13 +531,64 @@ u3_ce_save(void)
_ce_patch_free(pat_u);
}
/* _ce_limits(): set up file and stack limits.
*/
static void
_ce_limits(void)
{
struct rlimit rlm;
c3_i ret_i;
#define LOOM_STACK (65536 << 10)
ret_i = getrlimit(RLIMIT_STACK, &rlm);
c3_assert(0 == ret_i);
rlm.rlim_cur = rlm.rlim_max > LOOM_STACK ? LOOM_STACK : rlm.rlim_max;
if ( 0 != setrlimit(RLIMIT_STACK, &rlm) ) {
perror("stack");
exit(1);
}
#undef LOOM_STACK
ret_i = getrlimit(RLIMIT_NOFILE, &rlm);
c3_assert(0 == ret_i);
rlm.rlim_cur = 4096;
if ( 0 != setrlimit(RLIMIT_NOFILE, &rlm) ) {
perror("file limit");
// no exit, not a critical limit
}
getrlimit(RLIMIT_CORE, &rlm);
rlm.rlim_cur = RLIM_INFINITY;
if ( 0 != setrlimit(RLIMIT_CORE, &rlm) ) {
perror("core limit");
// no exit, not a critical limit
}
}
#if 0
/* _ce_signals(): set up interrupts, etc.
*/
static void
_ce_signals(void)
{
if ( 0 != sigsegv_install_handler(u3_ce_fault) ) {
fprintf(stderr, "sigsegv install failed\n");
exit(1);
}
signal(SIGINT, _loom_stop);
}
#endif
/* u3_ce_boot(): start the memory system.
*/
void
u3_ce_boot(c3_c* cpu_c)
{
_ce_limits();
/* Map at fixed address.
*/
u3_Loom = (void *)U2_OS_LoomBase;
{
c3_w len_w = (1 << (u3_cc_bits + 2));
void* map_v;

16
g/j.c
View File

@ -580,6 +580,15 @@ u3_cj_mine(u3_noun clu,
free(nam_c);
printf("mine: bound jet %s, %d\r\n", cop_u->cos_c, cop_u->jax_l);
if ( 159 == jax_l ) {
printf("at 159, parent is %p %p %s %d %p\r\n",
u3D.ray_u[jax_l].par_u,
par_u,
par_u->cos_c,
par_l,
&u3D.ray_u[par_l]);
}
break;
}
i_l++;
@ -591,16 +600,21 @@ u3_cj_mine(u3_noun clu,
memset(&fak_u, 0, sizeof(u3_cs_core));
fak_u.cos_c = nam_c;
printf("mine: dummy %s\r\n", fak_u.cos_c);
fak_u.par_u = par_u;
fak_u.axe_l = axe_l;
jax_l =_cj_insert(&fak_u);
printf("mine: dummy %s %d\r\n", fak_u.cos_c, jax_l);
}
u3_ch_put(u3R->jed.har_u, u3h(cor), jax_l);
u3z(clu);
_cj_activate(&u3D.ray_u[jax_l], hud_u);
if ( 159 == jax_l ) {
printf("at 159, parent is %p\r\n",
u3D.ray_u[jax_l].par_u);
}
#if 0
{
u3_cs_core* cop_u = &u3D.ray_u[jax_l];

5
g/v.c
View File

@ -180,6 +180,8 @@ _cv_nock_poke(u3_noun ovo)
}
#endif
pro = u3_cn_slam_on(fun, sam);
#if 1
{
c3_c* ovi_c = u3_cr_string(u3h(u3t(ovo)));
@ -190,7 +192,6 @@ _cv_nock_poke(u3_noun ovo)
}
#endif
pro = u3_cn_slam_on(fun, sam);
return pro;
}
@ -221,7 +222,7 @@ _cv_nock_keep(u3_noun hap)
u3_noun
u3_cv_do(const c3_c* txt_c, u3_noun arg)
{
printf("cv_do: fn %s\r\n", txt_c);
// printf("cv_do: fn %s\r\n", txt_c);
return u3_cn_slam_on(u3_cv_gate(txt_c), arg);
}

View File

@ -53,6 +53,7 @@
u3_noun u3_cwc_mas(u3_noun);
u3_noun u3_cwc_met(u3_noun);
u3_noun u3_cwc_mix(u3_noun);
u3_noun u3_cwc_mug(u3_noun);
u3_noun u3_cwc_peg(u3_noun);
u3_noun u3_cwc_rap(u3_noun);
u3_noun u3_cwc_rip(u3_noun);

View File

@ -8,8 +8,7 @@
/* functions
*/
u3_noun
u3_cwc_mug(
u3_noun cor)
u3_cwc_mug(u3_noun cor)
{
u3_noun sam;

View File

@ -42,13 +42,14 @@ static u3_cs_harm _mood__hoon_con_a[] = {{".2", u3_cwc_con, u3_yes}, {}};
static u3_cs_harm _mood__hoon_cut_a[] = {{".2", u3_cwc_cut, u3_yes}, {}};
static u3_cs_harm _mood__hoon_dis_a[] = {{".2", u3_cwc_dis, u3_yes}, {}};
static u3_cs_harm _mood__hoon_dor_a[] = {{".2", u3_cwc_dor, u3_yes}, {}};
static u3_cs_harm _mood__hoon_end_a[] = {{".2", u3_cwc_end, u3_no}, {}};
static u3_cs_harm _mood__hoon_end_a[] = {{".2", u3_cwc_end, u3_yes}, {}};
static u3_cs_harm _mood__hoon_gor_a[] = {{".2", u3_cwc_gor, u3_yes}, {}};
static u3_cs_harm _mood__hoon_hor_a[] = {{".2", u3_cwc_hor, u3_yes}, {}};
static u3_cs_harm _mood__hoon_lsh_a[] = {{".2", u3_cwc_lsh, u3_yes}, {}};
static u3_cs_harm _mood__hoon_mas_a[] = {{".2", u3_cwc_mas, u3_yes}, {}};
static u3_cs_harm _mood__hoon_met_a[] = {{".2", u3_cwc_met, u3_yes}, {}};
static u3_cs_harm _mood__hoon_mix_a[] = {{".2", u3_cwc_mix, u3_yes}, {}};
static u3_cs_harm _mood__hoon_mug_a[] = {{".2", u3_cwc_mug, u3_yes}, {}};
static u3_cs_harm _mood__hoon_peg_a[] = {{".2", u3_cwc_peg, u3_yes}, {}};
static u3_cs_harm _mood__hoon_rap_a[] = {{".2", u3_cwc_rap, u3_yes}, {}};
static u3_cs_harm _mood__hoon_rip_a[] = {{".2", u3_cwc_rip, u3_yes}, {}};
@ -377,6 +378,7 @@ static u3_cs_core _mood__hoon_d[] =
{ "mas", _mood__hoon_mas_a },
{ "met", _mood__hoon_met_a },
{ "mix", _mood__hoon_mix_a },
{ "mug", _mood__hoon_mug_a },
{ "peg", _mood__hoon_peg_a },
{ "rap", _mood__hoon_rap_a },
{ "rip", _mood__hoon_rip_a },

View File

@ -248,7 +248,6 @@ _unix_file_watch(u3_ufil* fil_u,
c3_assert(0);
}
// note that we're doing something tricky here; see comment in _unix_fs_event_cb
//
ret_w = uv_fs_event_start(&fil_u->was_u, // uv_fs_event_t
_unix_fs_event_cb, // callback