This commit is contained in:
Gavin Whelan 2014-06-02 09:19:06 -04:00
commit 94c3eef12f
3 changed files with 49 additions and 2 deletions

View File

@ -354,6 +354,15 @@
u2_bean alm; // alarm u2_bean alm; // alarm
u2_uhot* hot_u; // host state u2_uhot* hot_u; // host state
u2_usig* sig_u; // signal list u2_usig* sig_u; // signal list
#ifdef SYNCLOG
c3_w lot_w; // sync-slot
struct _u2_sylo {
u2_bean unx; // from unix
c3_m wer_m; // mote saying where
c3_m wot_m; // mote saying what
c3_c* pax_c; // path
} sylo[1024];
#endif
} u2_unix; } u2_unix;
/* u2_batz: just a timer for now /* u2_batz: just a timer for now

View File

@ -346,7 +346,7 @@ u2_reck_cold(u2_reck* rec_u, c3_w kno_w)
if ( u2_yes == u2_Host.ops_u.nuu ) { if ( u2_yes == u2_Host.ops_u.nuu ) {
snprintf(ful_c, 2048, "%s/urbit.pill", U2_LIB); snprintf(ful_c, 2048, "%s/urbit.pill", U2_LIB);
} else { } else {
snprintf(ful_c, 2048, "%s/urbit.pill", u2_Host.cpu_c); snprintf(ful_c, 2048, "%s/.urb/urbit.pill", u2_Host.cpu_c);
} }
printf("loading %s\n", ful_c); printf("loading %s\n", ful_c);

View File

@ -183,6 +183,16 @@ _unix_fs_event_cb(uv_fs_event_t* was_u,
{ {
u2_unod* nod_u = (void*)was_u; u2_unod* nod_u = (void*)was_u;
#ifdef SYNCLOG
c3_w slot = u2_Host.unx_u.lot_w++ % 1024;
free(u2_Host.unx_u.sylo[slot].pax_c);
u2_Host.unx_u.sylo[slot].pax_c = 0;
u2_Host.unx_u.sylo[slot].unx = u2_yes;
u2_Host.unx_u.sylo[slot].wer_m = c3_s4('u','v','s','y');
u2_Host.unx_u.sylo[slot].wot_m = 0;
u2_Host.unx_u.sylo[slot].pax_c = strdup(nod_u->pax_c);
#endif
// uL(fprintf(uH, "fs: %s in %s\n", pax_c, nod_u->pax_c)); // uL(fprintf(uH, "fs: %s in %s\n", pax_c, nod_u->pax_c));
u2_lo_open(); u2_lo_open();
{ {
@ -978,6 +988,12 @@ _unix_desk_sync_tofu(u2_udir* dir_u,
// uL(fprintf(uH, "tofu pox_c %s op %s\n", pox_c, u2_cr_string(u2h(mis)))); // uL(fprintf(uH, "tofu pox_c %s op %s\n", pox_c, u2_cr_string(u2h(mis))));
#ifdef SYNCLOG
c3_w slot = u2_Host.unx_u.lot_w++ % 1024;
free(u2_Host.unx_u.sylo[slot].pax_c);
u2_Host.unx_u.sylo[slot].pax_c = 0;
#endif
fil_u = &(dir_u->fil_u); fil_u = &(dir_u->fil_u);
while ( 1 ) { // XX crude! while ( 1 ) { // XX crude!
if ( !*fil_u || if ( !*fil_u ||
@ -992,6 +1008,13 @@ _unix_desk_sync_tofu(u2_udir* dir_u,
if ( *fil_u && (c3__del == u2h(mis)) ) { if ( *fil_u && (c3__del == u2h(mis)) ) {
u2_ufil* ded_u = *fil_u; u2_ufil* ded_u = *fil_u;
#ifdef SYNCLOG
u2_Host.unx_u.sylo[slot].unx = u2_no;
u2_Host.unx_u.sylo[slot].wer_m = c3_s4('t','o','f','u');
u2_Host.unx_u.sylo[slot].wot_m = c3__del;
u2_Host.unx_u.sylo[slot].pax_c = strdup(ded_u->pax_c);
#endif
*fil_u = ded_u->nex_u; *fil_u = ded_u->nex_u;
_unix_unlink(ded_u->pax_c); _unix_unlink(ded_u->pax_c);
_unix_file_free(ded_u); _unix_file_free(ded_u);
@ -1024,6 +1047,13 @@ _unix_desk_sync_tofu(u2_udir* dir_u,
pax_c = pox_c; free(pux_c); pax_c = pox_c; free(pux_c);
} }
#ifdef SYNCLOG
u2_Host.unx_u.sylo[slot].unx = u2_no;
u2_Host.unx_u.sylo[slot].wer_m = c3_s4('t','o','f','u');
u2_Host.unx_u.sylo[slot].wot_m = u2h(mis);
u2_Host.unx_u.sylo[slot].pax_c = strdup(pax_c);
#endif
_unix_save(pax_c, oat); _unix_save(pax_c, oat);
if ( *fil_u ) { if ( *fil_u ) {
@ -1363,6 +1393,10 @@ u2_unix_io_init(void)
sig_u->nex_u = unx_u->sig_u; sig_u->nex_u = unx_u->sig_u;
unx_u->sig_u = sig_u; unx_u->sig_u = sig_u;
} }
#if SYNCLOG
unx_u->lot_w = 0;
memset(unx_u->sylo, 0, sizeof(unx_u->sylo));
#endif
uv_check_init(u2_Host.lup_u, &u2_Host.unx_u.syn_u); uv_check_init(u2_Host.lup_u, &u2_Host.unx_u.syn_u);
} }
@ -1391,6 +1425,11 @@ u2_unix_io_exit(void)
u2_unix_release(hot_u->dir_u.pax_c); u2_unix_release(hot_u->dir_u.pax_c);
} }
} }
#ifdef SYNCLOG
for (int i = 0; i<1024; i++) {
free(u2_Host.unx_u.sylo[i].pax_c);
}
#endif
} }
/* u2_unix_io_poll(): update unix IO state. /* u2_unix_io_poll(): update unix IO state.
@ -1422,4 +1461,3 @@ u2_unix_io_poll(void)
} }
u2z(wen); u2z(wen);
} }