Fix a bunch of memory leaks and stuff.

This commit is contained in:
C. Guy Yarvin 2013-11-11 23:09:11 -08:00
parent 8bd25d8b32
commit a4baea40fd
16 changed files with 132 additions and 200 deletions

View File

@ -459,6 +459,7 @@ _cm_jack(u2_noun old, u2_noun nuw)
}
}
#if 0
/* _cm_depth()
*/
static c3_w
@ -474,6 +475,7 @@ _cm_depth(u2_noun old, u2_noun nuw)
}
return dep_w;
}
#endif
/* u2_cm_wail(): produce and reset the local trace, without bailing.
*/
@ -495,7 +497,7 @@ u2_cm_wail()
return jaq;
}
static c3_w _num = 0;
// static c3_w _num = 0;
/* u2_cm_bail(): bail out to the local trap. Does not return.
*/

View File

@ -965,6 +965,7 @@ _sing_x(u2_noun a,
}
#ifdef U2_PROFILE
#if 0
/* _weight(): count subordinate nouns.
*/
static c3_w
@ -977,6 +978,7 @@ _weight(u2_noun n)
}
}
#endif
#endif
/* u2_sing():
**

View File

@ -4,9 +4,8 @@
*/
#include "all.h"
#if 0
int LEAK=0;
u2_ray LEAKY=0;
#ifdef U2_LEAK_DEBUG
c3_w COD_w;
#endif
/* _rl_feed():
@ -377,6 +376,9 @@ _rl_bloq_make(u2_ray ral_r,
{
*u2_at_ray(box_r) = siz_w;
*u2_at_ray(box_r + 1) = use_w;
#ifdef U2_LEAK_DEBUG
*u2_at_ray(box_r + 2) = COD_w;
#endif
*u2_at_ray(box_r + siz_w - 1) = siz_w;
}
}
@ -684,6 +686,9 @@ _rl_bloq_grab(u2_ray ral_r,
else {
c3_assert(u2_rail_box_use(box_r) == 0);
u2_rail_box_use(box_r) = 1;
# ifdef U2_LEAK_DEBUG
*u2_at_ray(box_r + 2) = COD_w;
# endif
_rl_live_grab(ral_r, u2_rail_hut_siz(box_r));
}
@ -696,30 +701,6 @@ _rl_bloq_grab(u2_ray ral_r,
}
}
#if 0
static int xzx=0;
/* _rl_bloq_grap()::
*/
static u2_ray
_rl_bloq_grap(u2_ray ral_r,
c3_w len_w)
{
u2_ray nov_r;
nov_r = _rl_bloq_grab(ral_r, len_w);
#if 0
if ( (nov_r - c3_wiseof(u2_loom_rail_box)) == 0x8acb5a ) {
printf("alloc leak %d - nov_r %x\n", xzx, nov_r);
if ( xzx == 45 ) { xzx++; c3_assert(0); }
xzx++;
}
#endif
return nov_r;
}
#endif
/* _rl_bloq_free():
**
** Release and coalesce a block.
@ -892,13 +873,6 @@ u2_rl_gain(u2_ray ral_r,
u2_ray box_r = (som_r - c3_wiseof(u2_loom_rail_box));
c3_w use_w = u2_rail_box_use(box_r);
#if 0
if ( LEAK && (som_r == LEAKY) ) {
printf("LEAK: gain %x, use %d\n", som, use_w);
// if ( LEAK == XXXX ) c3_assert(0);
LEAK++;
}
#endif
c3_assert(use_w != 0);
if ( use_w != 0x7fffffff ) {
u2_rail_box_use(box_r) = (use_w + 1);
@ -1021,13 +995,6 @@ top:
u2_ray box_r = (som_r - c3_wiseof(u2_loom_rail_box));
c3_w use_w = u2_rail_box_use(box_r);
#if 0
if ( LEAK && (som_r == LEAKY) ) {
printf("LEAK: lose %x, use %d\n", som, use_w);
// if ( 2 == LEAK ) c3_assert(0);
// LEAK++;
}
#endif
if ( 1 == use_w ) {
if ( u2_dog_is_pom(som) ) {
u2_noun h_som = u2_h(som);
@ -1635,8 +1602,17 @@ u2_rl_gc_sweep(u2_ray ral_r, c3_w sav_w)
c3_ws use_ws = (c3_ws) use_w;
if ( use_ws > 0 ) {
#if 0
fprintf(stderr, "leak: box %x, siz %d, use %d\r\n", box_r, siz_w, use_w);
# ifdef U2_LEAK_DEBUG
c3_w cod_w = u2_rail_box_cod(box_r);
if ( 0 == cod_w ) {
fprintf(stderr, "\rleak: <unknown> box %x, siz %d, use %d\r\n",
box_r, siz_w, use_w);
} else {
fprintf(stderr, "\rleak: %s: box %x, siz %d, use %d\r\n",
u2_cr_string(cod_w),
box_r, siz_w, use_w);
}
#endif
lek_w += siz_w;
u2_rail_box_use(box_r) = 0;
@ -2018,13 +1994,6 @@ u2_rl_cell(u2_ray ral_r,
*u2_at_pom_hed(nov) = a;
*u2_at_pom_tel(nov) = b;
#if 0
if ( LEAK && ((u2_fly_is_dog(a) && (u2_dog_a(a) == LEAKY)) ||
(u2_fly_is_dog(b) && (u2_dog_a(b) == LEAKY))) ) {
printf("LEAKY %x => %x\n", (LEAKY - 2), (nov_r - 2));
LEAKY = nov_r;
}
#endif
return nov;
}
}

View File

@ -635,6 +635,7 @@ u2_tx_task_out(u2_wire wir_r)
#endif
}
#if 0
/* _print_tape(): print a byte tape.
*/
static void
@ -649,7 +650,6 @@ _print_tape(u2_noun som,
}
}
#if 0
/* _print_term(): print a terminal.
*/
static void
@ -676,7 +676,6 @@ _print_space(c3_w feq_w,
putc(' ', fil_F);
}
}
#endif
/* _print_wall(): print debug wall.
*/
@ -691,6 +690,7 @@ _print_wall(u2_noun wal,
wal = u2_t(wal);
}
}
#endif
/* u2_tx_slog(): print debug syslog [0-3 tank] 0=debug 3=alarm
*/

View File

@ -92,10 +92,12 @@
for ( i_w = 0; i_w < loc_u->lev_w; i_w++ ) {
u2_noun how = loc_u->hev[i_w];
u2_weak hav = u2_ckd_by_get(u2k(loc_u->sev), u2k(how));
u2_noun teg = u2nc(u2_ci_words(1, &i_w),
u2_weak hav;
u2_noun teg;
hav = u2_ckd_by_get(u2k(loc_u->sev), u2k(how));
teg = u2nc(u2_ci_words(1, &i_w),
(hav == u2_none) ? u2_nul : hav);
loc_u->sev = u2_ckd_by_put(loc_u->sev, u2k(how), teg);
}
}
@ -243,7 +245,7 @@
u2_weak guy = u2_ckd_by_get(u2k(loc_u->sev), u2k(i_hel));
if ( u2_none != guy ) {
u2_noun gay = u2_ckb_flop(u2k(guy));
u2_noun gay = u2_ckb_flop(guy);
_merg(loc_u, 0, gay);
u2z(gay);
@ -260,7 +262,7 @@
{
u2_loss loc_u;
u2_noun lcs;
_lemp(&loc_u, hel, hev);
_loss(&loc_u);
lcs = _lexs(&loc_u);

View File

@ -222,6 +222,7 @@
return u2_bt
(wir_r, u2_rx(wir_r, p_gen), u2_rx(wir_r, q_gen), u2_rx(wir_r, r_gen));
}
#if 0
_open_do_p(clsg) // :~
{
if ( (u2_nul == p_gen) ) {
@ -235,6 +236,7 @@
_open_in_clsg(wir_r, tp_gen));
}
}
_open_do_p(cltr) // :*
{
if ( (u2_nul == p_gen) ) {
@ -253,6 +255,7 @@
}
}
}
#endif
/***
****
***/

View File

@ -270,12 +270,11 @@
(wir_r, van, sut, pi_mew, p_zil, p_yom);
u2_noun dof = j2_mcy(Pt6, ut, tock)
(wir_r, van, sut, pi_mew, q_zil, q_yom);
u2_noun vov = u2_sing(u2_h(cuf), u2_h(dof))
? u2_bl_error(wir_r, "mull-bonk-a")
: 0;
vov = vov;
if ( u2_sing(u2_h(cuf), u2_h(dof)) ) {
u2_bl_error(wir_r, "mull-bonk-a");
}
u2_rz(wir_r, p_yom);
p_yom = u2_rx(wir_r, u2_t(cuf));
@ -617,26 +616,27 @@
u2_noun q_vug = u2_t(vug);
u2_noun pq_vug = u2_h(q_vug);
u2_noun qq_vug = u2_t(q_vug);
u2_noun zoz = u2_and(u2_sing(p_lar, p_vug), u2_sing(pq_lar, pq_vug))
? u2_bl_error(wir_r, "mull-bonk-e")
: 0;
u2_noun mew = j2_mcy(Pt6, ut, swab)(wir_r, van, sut, q_gen);
u2_noun yom = _mull_edit
(wir_r, van, sut, dox, mew, u2_rx(wir_r, qq_lar),
u2_rx(wir_r, qq_vug));
u2_noun von = u2_bn_molt(wir_r, van, j2_ut_van_vet, u2_no, 0);
u2_noun p_ret = j2_mcy(Pt6, ut, fire)(wir_r, van, sut, u2_h(yom));
u2_noun q_ret = j2_mcy(Pt6, ut, fire)(wir_r, von, sut, u2_t(yom));
if ( u2_and(u2_sing(p_lar, p_vug), u2_sing(pq_lar, pq_vug)) ) {
u2_bl_error(wir_r, "mull-bonk-e");
}
{
u2_noun mew = j2_mcy(Pt6, ut, swab)(wir_r, van, sut, q_gen);
u2_noun yom = _mull_edit
(wir_r, van, sut, dox, mew, u2_rx(wir_r, qq_lar),
u2_rx(wir_r, qq_vug));
u2_noun von = u2_bn_molt(wir_r, van, j2_ut_van_vet, u2_no, 0);
u2_noun p_ret = j2_mcy(Pt6, ut, fire)(wir_r, van, sut, u2_h(yom));
u2_noun q_ret = j2_mcy(Pt6, ut, fire)(wir_r, von, sut, u2_t(yom));
zoz = zoz;
u2_rz(wir_r, von);
u2_rz(wir_r, yom);
u2_rz(wir_r, mew);
u2_rz(wir_r, vug);
u2_rz(wir_r, lar);
u2_rz(wir_r, von);
u2_rz(wir_r, yom);
u2_rz(wir_r, mew);
u2_rz(wir_r, vug);
u2_rz(wir_r, lar);
return u2_bc(wir_r, _mull_nice(wir_r, van, gol, p_ret), q_ret);
return u2_bc(wir_r, _mull_nice(wir_r, van, gol, p_ret), q_ret);
}
}
case c3__pmcl: u2_bi_cell(wir_r, u2_t(gen), &p_gen, &q_gen);
_mull_used(wir_r);

View File

@ -24,6 +24,7 @@
}
}
#if 0
static u2_noun // transfer
_seek_silk_yew(u2_wire wir_r,
u2_noun van, // retain
@ -54,8 +55,6 @@
}
}
}
#if 0
static u2_noun // retain
_seek_silk_yaw(u2_noun wir_r,
u2_noun hey) // retain

View File

@ -11,6 +11,7 @@
# define c3__amat c3_s4('a','m','a','t')
# define c3__ames c3_s4('a','m','e','s')
# define c3__and c3_s3('a','n','d')
# define c3__ankh c3_s4('a','n','k','h')
# define c3__any c3_s3('a','n','y')
# define c3__ap c3_s2('a','p')
# define c3__aro c3_s3('a','r','o')
@ -584,6 +585,7 @@
# define c3__lorb c3_s4('l','o','r','b')
# define c3__lort c3_s4('l','o','r','t')
# define c3__lose c3_s4('l','o','s','e')
# define c3__loss c3_s4('l','o','s','s')
# define c3__lost c3_s4('l','o','s','t')
# define c3__low c3_s3('l','o','w')
# define c3__lsh c3_s3('l','s','h')
@ -659,6 +661,7 @@
# define c3__new c3_s3('n','e','w')
# define c3__next c3_s4('n','e','x','t')
# define c3__nich c3_s4('n','i','b','h')
# define c3__nick c3_s4('n','i','b','k')
# define c3__nil c3_s3('n','i','l')
# define c3__nilk c3_s4('n','i','l','k')
# define c3__no c3_s2('n','o')
@ -750,6 +753,7 @@
# define c3__pnut c3_s4('p','n','u','t')
# define c3__pock c3_s4('p','o','c','k')
# define c3__poke c3_s4('p','o','k','e')
# define c3__poll c3_s4('p','o','l','l')
# define c3__poly c3_s4('p','o','l','y')
# define c3__pont c3_s4('p','o','n','t')
# define c3__poos c3_s4('p','o','o','s')
@ -771,6 +775,7 @@
# define c3__pull c3_s4('p','u','l','l')
# define c3__pult c3_s4('p','u','l','t')
# define c3__pung c3_s4('p','u','n','g')
# define c3__punk c3_s4('p','u','n','k')
# define c3__punt c3_s4('p','u','n','t')
# define c3__pure c3_s4('p','u','r','e')
# define c3__push c3_s4('p','u','s','h')
@ -865,6 +870,7 @@
# define c3__sgts c3_s4('s','g','t','s')
# define c3__show c3_s4('s','h','o','w')
# define c3__shud c3_s4('s','h','u','d')
# define c3__shut c3_s4('s','h','u','t')
# define c3__sibl c3_s4('s','i','b','l')
# define c3__sift c3_s4('s','i','f','t')
# define c3__sing c3_s4('s','i','n','g')
@ -1059,6 +1065,7 @@
# define c3__with c3_s4('w','i','t','h')
# define c3__wnut c3_s4('w','n','u','t')
# define c3__wood c3_s4('w','o','o','d')
# define c3__work c3_s4('w','o','r','k')
# define c3__wost c3_s4('w','o','s','t')
# define c3__wrap c3_s4('w','r','a','p')
# define c3__wtbr c3_s4('w','t','b','r')

View File

@ -2,6 +2,16 @@
**
** This file is in the public domain.
*/
/** Configurations.
**/
# undef U2_LEAK_DEBUG
# ifdef U2_LEAK_DEBUG
# define u2_leak_on(x) (COD_w = x)
extern c3_w COD_w;
# define u2_leak_off (COD_w = 0)
# endif
/** Data types.
**/
/** Ray types.
@ -80,10 +90,14 @@
typedef struct _u2_loom_rail_box {
c3_w siz_w; // size of this box
c3_w use_w; // reference count; free if 0
#ifdef U2_LEAK_DEBUG
c3_w cod_w; // allocation code
#endif
} u2_loom_rail_box;
# define u2_rail_box_siz(box) *u2_at(box, u2_loom_rail_box, siz_w)
# define u2_rail_box_use(box) *u2_at(box, u2_loom_rail_box, use_w)
# define u2_rail_box_cod(box) *u2_at(box, u2_loom_rail_box, cod_w)
/* A free node. Addressed from the box.
*/

133
v/loop.c
View File

@ -526,7 +526,12 @@ _lo_sing(u2_reck* rec_u, u2_noun ovo)
if ( u2_blip != u2h(gon) ) {
uL(fprintf(uH, "sing: ovum failed!\n"));
uL(fprintf(uH, "lame %s\n", u2_cr_string(u2h(u2t(ovo)))));
{
c3_c* hed_c = u2_cr_string(u2h(u2t(ovo)));
uL(fprintf(uH, "fail %s\n", hed_c));
free(hed_c);
}
u2_lo_punt(2, u2_ckb_flop(u2k(u2t(gon))));
c3_assert(0);
@ -561,7 +566,7 @@ _lo_sing(u2_reck* rec_u, u2_noun ovo)
static u2_noun
_lo_pike(u2_reck* rec_u, u2_noun ovo, u2_noun cor)
{
u2_noun fun = u2_cn_nock(u2k(cor), u2k(u2_cx_at(42, cor)));
u2_noun fun = u2_cn_nock(cor, u2k(u2_cx_at(42, cor)));
u2_noun sam = u2nc(u2k(rec_u->now), ovo);
return _lo_mung(rec_u, 0, fun, sam);
@ -617,13 +622,13 @@ _lo_sure(u2_reck* rec_u, u2_noun ovo, u2_noun vir, u2_noun cor)
while ( u2_nul != vir ) {
u2_noun ovo = u2k(u2h(vir));
u2_noun nex = u2k(u2t(vir));
c3_c* hed_c = u2_cr_string(u2h(u2t(ovo)));
// c3_c* hed_c = u2_cr_string(u2h(u2t(ovo)));
u2z(vir); vir = nex;
// uL(fprintf(uH, "kick: %s\n", hed_c));
u2_reck_kick(rec_u, ovo);
}
u2z(vir);
}
}
@ -634,6 +639,13 @@ _lo_lame(u2_reck* rec_u, u2_noun ovo, u2_noun why, u2_noun tan)
{
u2_noun bov, gon;
{
c3_c* oik_c = u2_cr_string(u2h(u2t(ovo)));
uL(fprintf(uH, "lame: %s\n", oik_c));
free(oik_c);
}
// Formal error in a network packet generates a hole card.
//
// There should be a separate path for crypto failures,
@ -649,7 +661,6 @@ _lo_lame(u2_reck* rec_u, u2_noun ovo, u2_noun why, u2_noun tan)
else {
bov = u2nc(u2k(u2h(ovo)), u2nt(c3__crud, why, u2k(tan)));
}
// uL(fprintf(uH, "lame %s\n", u2_cr_string(u2h(u2t(ovo)))));
// u2_lo_show("data", u2k(u2t(u2t(ovo))));
u2z(ovo);
@ -849,8 +860,6 @@ _lo_work(u2_reck* rec_u)
void
u2_lo_open(void)
{
// u2_lo_grab("lo_open", u2_none);
// update time
//
u2_reck_time(u2A);
@ -861,26 +870,35 @@ u2_lo_open(void)
void
u2_lo_shut(u2_bean inn)
{
// u2_lo_grab("lo_shut a", u2_none);
// process actions
//
_lo_work(u2A);
// u2_lo_grab("lo_shut b", u2_none);
// update time
//
u2_reck_time(u2A);
// u2_lo_grab("lo_shut c", u2_none);
// for input operations, poll fs (XX not permanent)
//
if ( u2_yes == inn ) {
u2_unix_ef_look();
}
// u2_lo_grab("lo_shut d", u2_none);
// clean shutdown
//
if ( u2_no == u2_Host.liv ) {
// direct save and die
//
u2_cm_purge();
// u2_lo_grab("lo_exit", u2_none);
u2_loom_save(u2A->ent_w);
_lo_exit();
@ -893,96 +911,6 @@ u2_lo_shut(u2_bean inn)
}
}
#if 0
/* u2_lo_call(): central callback.
*/
void
u2_lo_call(u2_reck* rec_u,
struct ev_loop* lup_u,
void* wev_u,
u2_noun how,
c3_i revents)
{
u2_bean inn = (revents & EV_READ) ? u2_yes : u2_no;
u2_bean out = (revents & EV_WRITE) ? u2_yes : u2_no;
u2_bean tim = (revents & EV_TIMEOUT) ? u2_yes : u2_no;
u2_bean sig = (revents & EV_SIGNAL) ? u2_yes : u2_no;
u2_bean sat = (revents & EV_STAT) ? u2_yes : u2_no;
_lo_stop(rec_u, lup_u);
#if 0
{
uL(fprintf(uH, "call %s inn %s out %s tim %s sig %s sat %s\n",
_lo_how(how),
(inn == u2_yes) ? "yes" : "no",
(out == u2_yes) ? "yes" : "no",
(tim == u2_yes) ? "yes" : "no",
(sig == u2_yes) ? "yes" : "no",
(sat == u2_yes) ? "yes" : "no"));
}
#endif
{
// update time
//
u2_reck_time(rec_u);
// XX poll the filesystem on genuine input
//
if ( u2_yes == inn ) {
u2_unix_ef_look(rec_u);
}
// process input on this socket
//
if ( u2_yes == inn ){
_lo_suck(rec_u, wev_u, how);
}
// process output on this socket
//
if ( u2_yes == out ) {
_lo_fuck(rec_u, wev_u, how);
}
if ( u2_yes == tim ) {
_lo_time(rec_u, wev_u, how);
}
if ( u2_yes == sig ) {
_lo_sign(rec_u, wev_u, how);
}
if ( u2_yes == sat ) {
_lo_stat(rec_u, wev_u, how);
}
// process actions
//
_lo_work(rec_u);
// update time
//
u2_reck_time(rec_u);
// clean shutdown
//
if ( u2_no == u2_Host.liv ) {
// direct save and die
//
u2_cm_purge();
u2_loom_save(rec_u->ent_w);
_lo_exit(rec_u);
exit(0);
}
}
_lo_poll(rec_u, lup_u);
_lo_spin(rec_u, lup_u);
}
#endif
/* _lo_home(): create ship directory.
*/
static void
@ -1193,6 +1121,7 @@ _lo_staf(u2_reck* rec_u, c3_l key_l)
u2_noun txt;
snprintf(ful_c, 2048, "%s/.urbit/%s.txt", hom_c, gum_c);
u2z(gum);
txt = u2_walk_safe(ful_c);
if ( 0 == txt ) {
@ -1450,6 +1379,7 @@ _lo_rest(u2_reck* rec_u)
while ( 1 ) {
pas = pas ? pas : _lo_cask(rec_u, u2_Host.cpu_c, u2_no);
key = _lo_fatt(sal_l, pas);
if ( u2_mug(key) != key_l ) {
@ -1458,6 +1388,7 @@ _lo_rest(u2_reck* rec_u)
pas = 0;
}
else {
u2z(rec_u->key);
rec_u->key = key;
break;
}
@ -1865,7 +1796,6 @@ u2_lo_loop(u2_reck* rec_u)
_lo_init();
_lo_boot();
{
u2_unix_ef_look();
u2_reck_plan(rec_u, u2nt(c3__gold, c3__ames, u2_nul),
@ -1910,7 +1840,7 @@ _lo_mark_reck(u2_reck* rec_u)
{
u2_cart* egg_u;
egg_w = 0;
for ( egg_u = rec_u->ova.egg_u; egg_u; egg_u = egg_u->nex_u ) {
egg_w += u2_cm_mark_noun(egg_u->egg);
@ -1988,9 +1918,8 @@ u2_lo_grab(c3_c* cap_c, u2_noun som, ...)
}
lec_w = u2_cm_sweep(siz_w);
if ( lec_w || (u2_yes == u2_Flag_Verbose) )
// if ( lec_w )
{
// if ( lec_w || (u2_yes == u2_Flag_Verbose) )
if ( lec_w || !strcmp("init", cap_c) ) {
uL(fprintf(uH, "%s: gc: ", cap_c));
if ( lec_w ) {
_lo_word(4 * lec_w);

View File

@ -236,6 +236,8 @@ main(c3_i argc,
u2_Arv->ova.egg_u = u2_Arv->ova.geg_u = 0;
u2_lo_grab("init", u2_none);
// Horrible ancient stuff.
//
kno_w = u2_Host.arv_u->kno_w;

View File

@ -517,7 +517,7 @@ _reck_kick_term(u2_reck* rec_u, u2_noun pox, c3_l tid_l, u2_noun fav)
u2_reck_sync(rec_u);
// u2_reck_plan(rec_u, pox, u2nc(c3__helo, u2_nul));
u2z(fav); return u2_yes;
u2z(pox); u2z(fav); return u2_yes;
} break;
case c3__blit: p_fav = u2t(fav);

View File

@ -45,7 +45,7 @@ _save_time_cb(uv_timer_t* tim_u, c3_i sas_i)
// uL(fprintf(uH, "autosaving... ent_w %d\n", u2A->ent_w));
u2_cm_purge();
// u2_ve_grab(0);
u2_lo_grab("save", u2_none);
#ifdef FORKPT
c3_w pid_w;
@ -79,15 +79,12 @@ u2_save_ef_chld(void)
*/
uL(fprintf(uH, "checkpoint: complete %d\n", sav_u->pid_w));
pid_w = wait(&loc_i);
if (0 != sav_u->pid_w)
{
c3_assert(pid_w == sav_u->pid_w);
if (0 != sav_u->pid_w) {
c3_assert(pid_w == sav_u->pid_w);
}
else
{
c3_assert(pid_w > 0);
else {
c3_assert(pid_w > 0);
}
sav_u->pid_w = 0;
}
@ -102,7 +99,7 @@ u2_save_io_init(void)
sav_u->pid_w = 0;
uv_timer_init(u2L, &sav_u->tim_u);
uv_timer_start(&sav_u->tim_u, _save_time_cb, 5000, 5000);
uv_timer_start(&sav_u->tim_u, _save_time_cb, 15000, 15000);
uv_signal_start(&sav_u->sil_u, _save_sign_cb, SIGCHLD);
}

View File

@ -22,11 +22,14 @@
#include "all.h"
#include "v/vere.h"
#if 0
static void _term_read_cb(uv_stream_t*, ssize_t, uv_buf_t);
#endif
#if 1
static void _term_poll_cb(uv_poll_t*, c3_i, c3_i);
#endif
#if 0
/* _term_alloc(): libuv buffer allocator.
*/
static uv_buf_t
@ -34,6 +37,7 @@ _term_alloc(uv_handle_t* had_u, size_t len_i)
{
return uv_buf_init(malloc(len_i), len_i);
}
#endif
/* u2_term_io_init(): initialize terminal.
*/
@ -293,6 +297,7 @@ _term_it_buf(c3_w len_w, const c3_y* hun_y)
c3_y* buf_y;
} _u2_write_t;
#if 0
/* _term_write_cb(): general write callback.
*/
static void
@ -306,7 +311,7 @@ _term_write_cb(uv_write_t* wri_u, c3_i sas_i)
free(ruq_u->buf_y);
free(ruq_u);
}
/* _term_it_write_buf(): write buffer uv style.
*/
static void
@ -324,6 +329,7 @@ _term_it_write_buf(u2_utty* uty_u, uv_buf_t buf_u)
uL(fprintf(uH, "terminal: %s\n", uv_strerror(uv_last_error(u2L))));
}
}
#endif
/* _term_it_write_old(): write buffer, transferring pointer.
*/
@ -746,6 +752,7 @@ _term_poll_cb(uv_poll_t* pol_u, c3_i sas_i, c3_i evt_i)
_term_ef_poll(uty_u);
}
#if 0
/* _term_read_cb(): server read callback.
*/
static void
@ -772,7 +779,7 @@ _term_read_cb(uv_stream_t* str_u,
}
u2_lo_shut(u2_yes);
}
#endif
/* _term_main(): return main or console terminal.
*/
@ -880,7 +887,7 @@ u2_term_ef_winc(void)
{
u2_noun pax = u2nq(c3__gold, c3__term, '1', u2_nul);
u2_reck_plan(u2A, u2k(pax), u2nc(c3__blew, u2_term_get_blew(1)));
u2_reck_plan(u2A, pax, u2nc(c3__blew, u2_term_get_blew(1)));
}
/* u2_term_ef_ctlc(): send ^C on console.
@ -890,7 +897,7 @@ u2_term_ef_ctlc(void)
{
u2_noun pax = u2nq(c3__gold, c3__term, '1', u2_nul);
u2_reck_plan(u2A, u2k(pax), u2nt(c3__belt, c3__ctl, 'c'));
u2_reck_plan(u2A, pax, u2nt(c3__belt, c3__ctl, 'c'));
}
/* u2_term_ef_boil(): initial effects for loaded servers.

View File

@ -1175,7 +1175,6 @@ u2_unix_ef_look(void)
}
}
/* _unix_time_cb(): timer callback.
*/
static void