mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-16 10:49:26 +03:00
Various fixes and improvements.
This commit is contained in:
parent
f3fba50144
commit
dfbd88b7b9
4
i/n/a.h
4
i/n/a.h
@ -125,8 +125,8 @@
|
||||
} all;
|
||||
|
||||
struct { // jet dashboard
|
||||
u3p(u3h_root) har_p; // jet index (old style)
|
||||
u3_noun das; // dashboard (new style)
|
||||
u3p(u3h_root) har_p; // warm state
|
||||
u3_noun das; // cold state
|
||||
} jed;
|
||||
|
||||
struct { // namespace
|
||||
|
11
i/n/e.h
11
i/n/e.h
@ -40,7 +40,7 @@
|
||||
/* u3e_pool: entire memory system.
|
||||
*/
|
||||
typedef struct _u3e_pool {
|
||||
c3_c* cpu_c; // path to
|
||||
c3_c* dir_c; // path to
|
||||
c3_d evt_d; // last patch written at event
|
||||
c3_w dit_w[u3a_pages >> 5]; // touched since last save
|
||||
u3e_image nor_u; // north segment
|
||||
@ -68,10 +68,15 @@
|
||||
void
|
||||
u3e_save(void);
|
||||
|
||||
/* u3e_boot(): start the memory system.
|
||||
/* u3e_live(): start the persistence system.
|
||||
*/
|
||||
void
|
||||
u3e_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c);
|
||||
u3e_live(c3_o nuu_o, c3_c* dir_c);
|
||||
|
||||
/* u3e_boot(): start the u3 system.
|
||||
*/
|
||||
void
|
||||
u3e_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c);
|
||||
|
||||
/* u3e_init(): start the environment, with/without checkpointing.
|
||||
*/
|
||||
|
57
i/n/j.h
57
i/n/j.h
@ -9,12 +9,18 @@
|
||||
++ bash ,@uvH :: ctx identity hash
|
||||
++ bosh ,@uvH :: local battery hash
|
||||
++ batt ,* :: battery
|
||||
++ calx :: cached by battery
|
||||
++ calf ::
|
||||
$: jax=,@ud :: jet index
|
||||
pax=,@ud :: parent axis or 0
|
||||
hap=(map ,@ud ,@ud) :: axis/jet
|
||||
huc=(map term nock) :: name/tool
|
||||
== ::
|
||||
++ calx (trel calf ,* (map term nock)) :: cached by battery
|
||||
++ chum $? lef=term :: jet name
|
||||
[std=term kel=@] :: kelvin version
|
||||
[ven=term pro=term kel=@] :: vendor and product
|
||||
[ven=term pro=term ver=@ kel=@] :: all of the above
|
||||
== ::
|
||||
++ clue ,[p=chum q=nock r=(list (pair term nock))] :: battery definition
|
||||
++ clog (pair cope (map batt (map term nock))) :: identity record
|
||||
++ cope (trel bane axis (each bash noun)) :: core pattern
|
||||
++ dash :: jet system
|
||||
@ -60,39 +66,35 @@
|
||||
|
||||
/** Data structures.
|
||||
***
|
||||
*** All of these are transient structures allocated with malloc.
|
||||
*** All of these are process structures on the heap or data segment.
|
||||
**/
|
||||
/* u3j_harm: jet arm.
|
||||
*/
|
||||
typedef struct _u3j_harm {
|
||||
c3_c* fcs_c; // `.axe` or name
|
||||
u3_noun (*fun_f)(u3_noun); // compute or 0 / semitransfer
|
||||
// c3_o (*val_f)(u3_noun); // validate or 0 / retain
|
||||
c3_o ice; // perfect (don't test)
|
||||
c3_o tot; // total (never punts)
|
||||
c3_o liv; // live (enabled)
|
||||
c3_l axe_l; // computed/discovered axis
|
||||
struct _u3j_core* cop_u; // containing core
|
||||
c3_c* fcs_c; // `.axe` or name
|
||||
u3_noun (*fun_f)(u3_noun); // compute or 0 / semitransfer
|
||||
c3_o ice; // perfect (don't test)
|
||||
c3_o tot; // total (never punts)
|
||||
c3_o liv; // live (enabled)
|
||||
} u3j_harm;
|
||||
|
||||
/* u3j_core: driver definition.
|
||||
*/
|
||||
typedef struct _u3j_core {
|
||||
c3_c* cos_c; // control string
|
||||
struct _u3j_harm* arm_u; // blank-terminated static list
|
||||
struct _u3j_core* dev_u; // blank-terminated static list
|
||||
struct _u3j_core* par_u; // dynamic parent pointer
|
||||
c3_l axe_l; // axis to parent
|
||||
c3_l jax_l; // index in global dashboard
|
||||
c3_c* cos_c; // control string
|
||||
struct _u3j_harm* arm_u; // blank-terminated static list
|
||||
struct _u3j_core* dev_u; // blank-terminated static list
|
||||
struct _u3j_core* par_u; // initialized parent pointer
|
||||
c3_l jax_l; // initialized jet index
|
||||
} u3j_core;
|
||||
|
||||
/* u3e_dash, u3_Dash, u3D: jet dashboard singleton
|
||||
*/
|
||||
typedef struct _u3e_dash {
|
||||
u3j_core* dev_u; // null-terminated static list
|
||||
c3_l len_l; // dynamic array length
|
||||
c3_l all_l; // allocated length
|
||||
u3j_core* ray_u; // dynamic array by axis
|
||||
u3j_core* dev_u; // null-terminated static list
|
||||
c3_l len_l; // dynamic array length
|
||||
c3_l all_l; // allocated length
|
||||
u3j_core* ray_u; // dynamic array by axis
|
||||
} u3j_dash;
|
||||
|
||||
/** Globals.
|
||||
@ -110,11 +112,6 @@
|
||||
void
|
||||
u3j_boot(void);
|
||||
|
||||
/* u3j_clear(): clear jet table to re-register.
|
||||
*/
|
||||
void
|
||||
u3j_clear(void);
|
||||
|
||||
/* u3j_hook():
|
||||
**
|
||||
** Execute hook from core.
|
||||
@ -145,19 +142,17 @@
|
||||
*/
|
||||
u3_weak
|
||||
u3j_kick(u3_noun cor,
|
||||
u3_noun axe);
|
||||
u3_noun axe);
|
||||
|
||||
/* u3j_kink(): kick either by jet or by nock.
|
||||
*/
|
||||
u3_noun
|
||||
u3j_kink(u3_noun cor,
|
||||
u3_noun axe);
|
||||
u3j_kink(u3_noun cor, u3_noun axe);
|
||||
|
||||
/* u3j_mine(): register core for jets.
|
||||
*/
|
||||
void
|
||||
u3j_mine(u3_noun clu,
|
||||
u3_noun cor);
|
||||
u3j_mine(u3_noun clu, u3_noun cor);
|
||||
|
||||
/* u3j_ream(): refresh after restoring from checkpoint.
|
||||
*/
|
||||
|
90
i/n/m.h
90
i/n/m.h
@ -4,24 +4,10 @@
|
||||
*/
|
||||
/** System management.
|
||||
**/
|
||||
/* u3m_boot(): set up top-level road.
|
||||
/* u3m_boot(): start the u3 system.
|
||||
*/
|
||||
void
|
||||
u3m_boot(c3_o nuu_o, c3_o bug_o);
|
||||
|
||||
/* u3m_trap(): setjmp within road.
|
||||
*/
|
||||
#if 0
|
||||
c3_o
|
||||
u3m_trap(void);
|
||||
#else
|
||||
# define u3m_trap() (u3_noun)(setjmp(u3R->esc.buf))
|
||||
#endif
|
||||
|
||||
/* u3m_signal(): treat a nock-level exception as a signal interrupt.
|
||||
*/
|
||||
void
|
||||
u3m_signal(u3_noun sig_l);
|
||||
u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c);
|
||||
|
||||
/* u3m_bail(): bail out. Does not return.
|
||||
**
|
||||
@ -34,45 +20,22 @@
|
||||
** %foul :: assert failure
|
||||
** %need :: network block
|
||||
** %meme :: out of memory
|
||||
** %time :: timed out
|
||||
** %oops :: assertion failure
|
||||
*/
|
||||
c3_i
|
||||
u3m_bail(c3_m how_m);
|
||||
|
||||
/* u3m_dump(): dump the current road to stderr.
|
||||
*/
|
||||
void
|
||||
u3m_dump(void);
|
||||
|
||||
/* u3m_file(): load file, as atom, or bail.
|
||||
*/
|
||||
u3_noun
|
||||
u3m_file(c3_c* pas_c);
|
||||
|
||||
/* u3m_clear(): clear all allocated data in road.
|
||||
*/
|
||||
void
|
||||
u3m_clear(void);
|
||||
|
||||
/* u3m_mark(): mark all nouns in the road.
|
||||
*/
|
||||
void
|
||||
u3m_mark(void);
|
||||
|
||||
/* u3m_error(): bail out with %exit, ct_pushing error.
|
||||
*/
|
||||
c3_i
|
||||
u3m_error(c3_c* str_c);
|
||||
|
||||
/* u3m_check(): checkpoint memory to file. Asserts u3R == u3H.
|
||||
*/
|
||||
void
|
||||
u3m_check(void);
|
||||
|
||||
/* u3m_fall(): return to parent road.
|
||||
*/
|
||||
void
|
||||
u3m_fall(void);
|
||||
|
||||
/* u3m_hate(): new, integrated leap mechanism (enter).
|
||||
*/
|
||||
void
|
||||
@ -83,32 +46,6 @@
|
||||
u3_noun
|
||||
u3m_love(u3_noun pro);
|
||||
|
||||
/* u3m_leap(): in u3R, create a new road within the existing one.
|
||||
*/
|
||||
void
|
||||
u3m_leap(c3_w pad_w);
|
||||
|
||||
/* u3m_golf(): record cap length for u3_flog().
|
||||
*/
|
||||
c3_w
|
||||
u3m_golf(void);
|
||||
|
||||
/* u3m_flog(): pop the cap.
|
||||
**
|
||||
** A common sequence for inner allocation is:
|
||||
**
|
||||
** c3_w gof_w = u3m_golf();
|
||||
** u3m_leap();
|
||||
** // allocate some inner stuff...
|
||||
** u3m_fall();
|
||||
** // inner stuff is still valid, but on cap
|
||||
** u3m_flog(gof_w);
|
||||
**
|
||||
** u3m_flog(0) simply clears the cap.
|
||||
*/
|
||||
void
|
||||
u3m_flog(c3_w gof_w);
|
||||
|
||||
/* u3m_soft(): system soft wrapper. unifies unix and nock errors.
|
||||
**
|
||||
** Produces [%$ result] or [%error (list tank)].
|
||||
@ -116,19 +53,16 @@
|
||||
u3_noun
|
||||
u3m_soft(c3_w sec_w, u3_funk fun_f, u3_noun arg);
|
||||
|
||||
/* u3m_soft_top(): top-level safety wrapper.
|
||||
*/
|
||||
u3_noun
|
||||
u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
c3_w pad_w, // base memory pad
|
||||
u3_funk fun_f,
|
||||
u3_noun arg);
|
||||
|
||||
/* u3m_soft_slam: top-level call.
|
||||
*/
|
||||
u3_noun
|
||||
u3m_soft_slam(u3_noun gat, u3_noun sam);
|
||||
|
||||
/* u3m_soft_nock: top-level nock.
|
||||
*/
|
||||
u3_noun
|
||||
u3m_soft_nock(u3_noun bus, u3_noun fol);
|
||||
|
||||
/* u3m_soft_sure(): top-level call assumed correct.
|
||||
*/
|
||||
u3_noun
|
||||
@ -138,9 +72,9 @@
|
||||
*/
|
||||
u3_noun
|
||||
u3m_soft_run(u3_noun fly,
|
||||
u3_funq fun_f,
|
||||
u3_noun aga,
|
||||
u3_noun agb);
|
||||
u3_funq fun_f,
|
||||
u3_noun aga,
|
||||
u3_noun agb);
|
||||
|
||||
/* u3m_soft_esc(): namespace lookup to (unit ,*).
|
||||
*/
|
||||
|
@ -537,8 +537,7 @@
|
||||
*/
|
||||
typedef struct _u3_host {
|
||||
c3_w kno_w; // current executing stage
|
||||
c3_c* cpu_c; // computer path
|
||||
|
||||
c3_c* dir_c; // pier path
|
||||
c3_d now_d; // event tick
|
||||
uv_loop_t* lup_u; // libuv event loop
|
||||
u3_http* htp_u; // http servers
|
||||
|
@ -36,8 +36,7 @@
|
||||
}
|
||||
}
|
||||
u3_noun
|
||||
u3wdb_get(
|
||||
u3_noun cor)
|
||||
u3wdb_get(u3_noun cor)
|
||||
{
|
||||
u3_noun a, b;
|
||||
|
||||
|
202
n/e.c
202
n/e.c
@ -5,9 +5,6 @@
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sigsegv.h>
|
||||
#include <pmmintrin.h>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#include "all.h"
|
||||
|
||||
@ -168,16 +165,16 @@ _ce_image_open(u3e_image* img_u, c3_o nuu_o)
|
||||
c3_i mod_i = _(nuu_o) ? (O_RDWR | O_CREAT) : O_RDWR;
|
||||
c3_c ful_c[8193];
|
||||
|
||||
snprintf(ful_c, 8192, "%s", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/%s.bin", u3P.cpu_c, img_u->nam_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/%s.bin", u3P.dir_c, img_u->nam_c);
|
||||
if ( -1 == (img_u->fid_i = open(ful_c, mod_i, 0666)) ) {
|
||||
perror(ful_c);
|
||||
return c3n;
|
||||
@ -266,18 +263,18 @@ _ce_patch_create(u3_ce_patch* pat_u)
|
||||
{
|
||||
c3_c ful_c[8193];
|
||||
|
||||
snprintf(ful_c, 8192, "%s", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.dir_c);
|
||||
if ( -1 == (pat_u->ctl_i = open(ful_c, O_RDWR | O_CREAT | O_EXCL, 0666)) ) {
|
||||
c3_assert(0);
|
||||
}
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.dir_c);
|
||||
if ( -1 == (pat_u->mem_i = open(ful_c, O_RDWR | O_CREAT | O_EXCL, 0666)) ) {
|
||||
c3_assert(0);
|
||||
}
|
||||
@ -290,10 +287,10 @@ _ce_patch_delete(void)
|
||||
{
|
||||
c3_c ful_c[8193];
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.dir_c);
|
||||
unlink(ful_c);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.dir_c);
|
||||
unlink(ful_c);
|
||||
}
|
||||
|
||||
@ -358,18 +355,18 @@ _ce_patch_open(void)
|
||||
c3_c ful_c[8193];
|
||||
c3_i ctl_i, mem_i;
|
||||
|
||||
snprintf(ful_c, 8192, "%s", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb", u3P.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/control.bin", u3P.dir_c);
|
||||
if ( -1 == (ctl_i = open(ful_c, O_RDWR)) ) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.cpu_c);
|
||||
snprintf(ful_c, 8192, "%s/.urb/chk/memory.bin", u3P.dir_c);
|
||||
if ( -1 == (mem_i = open(ful_c, O_RDWR)) ) {
|
||||
close(ctl_i);
|
||||
|
||||
@ -808,149 +805,12 @@ u3e_save(void)
|
||||
_ce_patch_free(pat_u);
|
||||
}
|
||||
|
||||
/* _ce_limits(): set up global modes and limits.
|
||||
*/
|
||||
static void
|
||||
_ce_limits(void)
|
||||
{
|
||||
struct rlimit rlm;
|
||||
c3_i ret_i;
|
||||
|
||||
/* Set compatible floating-point modes.
|
||||
*/
|
||||
{
|
||||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
|
||||
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
|
||||
}
|
||||
|
||||
/* Moar stack.
|
||||
*/
|
||||
{
|
||||
ret_i = getrlimit(RLIMIT_STACK, &rlm);
|
||||
c3_assert(0 == ret_i);
|
||||
rlm.rlim_cur = (rlm.rlim_max > (65536 << 10))
|
||||
? (65536 << 10)
|
||||
: rlm.rlim_max;
|
||||
if ( 0 != setrlimit(RLIMIT_STACK, &rlm) ) {
|
||||
perror("stack");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Moar filez.
|
||||
*/
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/* Moar core.
|
||||
*/
|
||||
{
|
||||
getrlimit(RLIMIT_CORE, &rlm);
|
||||
rlm.rlim_cur = RLIM_INFINITY;
|
||||
if ( 0 != setrlimit(RLIMIT_CORE, &rlm) ) {
|
||||
perror("core limit");
|
||||
// no exit, not a critical limit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* _ce_signals(): set up interrupts, etc.
|
||||
*/
|
||||
static void
|
||||
_ce_signals(void)
|
||||
{
|
||||
if ( 0 != sigsegv_install_handler(u3e_fault) ) {
|
||||
fprintf(stderr, "sigsegv install failed\n");
|
||||
exit(1);
|
||||
}
|
||||
// signal(SIGINT, _loom_stop);
|
||||
}
|
||||
|
||||
/* u3e_init(): start the environment, with/without checkpointing.
|
||||
/* u3e_live(): start the persistence system.
|
||||
*/
|
||||
void
|
||||
u3e_init(c3_o chk_o)
|
||||
u3e_live(c3_o nuu_o, c3_c* dir_c)
|
||||
{
|
||||
_ce_limits();
|
||||
_ce_signals();
|
||||
|
||||
/* Make sure GMP uses our malloc.
|
||||
*/
|
||||
mp_set_memory_functions(u3a_malloc, u3a_realloc2, u3a_free2);
|
||||
|
||||
/* Map at fixed address.
|
||||
*/
|
||||
{
|
||||
c3_w len_w = u3a_bytes;
|
||||
void* map_v;
|
||||
|
||||
map_v = mmap((void *)u3_Loom,
|
||||
len_w,
|
||||
_(chk_o) ? PROT_READ : (PROT_READ | PROT_WRITE),
|
||||
(MAP_ANON | MAP_FIXED | MAP_PRIVATE),
|
||||
-1, 0);
|
||||
|
||||
if ( -1 == (c3_ps)map_v ) {
|
||||
map_v = mmap((void *)0,
|
||||
len_w,
|
||||
PROT_READ,
|
||||
MAP_ANON | MAP_PRIVATE,
|
||||
-1, 0);
|
||||
|
||||
if ( -1 == (c3_ps)map_v ) {
|
||||
fprintf(stderr, "boot: map failed twice\r\n");
|
||||
} else {
|
||||
fprintf(stderr, "boot: map failed - try U3_OS_LoomBase %p\r\n", map_v);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
printf("loom: mapped %dMB\r\n", len_w >> 20);
|
||||
}
|
||||
}
|
||||
|
||||
/* u3e_grab(): garbage-collect the world, plus extra roots, then
|
||||
*/
|
||||
void
|
||||
u3e_grab(c3_c* cap_c, u3_noun som, ...) // terminate with u3_none
|
||||
{
|
||||
// u3h_free(u3R->cax.har_p);
|
||||
// u3R->cax.har_p = u3h_new();
|
||||
|
||||
u3v_mark();
|
||||
u3m_mark();
|
||||
{
|
||||
va_list vap;
|
||||
u3_noun tur;
|
||||
|
||||
va_start(vap, som);
|
||||
|
||||
if ( som != u3_none ) {
|
||||
u3a_mark_noun(som);
|
||||
|
||||
while ( u3_none != (tur = va_arg(vap, u3_noun)) ) {
|
||||
u3a_mark_noun(tur);
|
||||
}
|
||||
}
|
||||
va_end(vap);
|
||||
}
|
||||
u3a_sweep(cap_c);
|
||||
}
|
||||
|
||||
/* u3e_boot(): start the u3 system.
|
||||
*/
|
||||
void
|
||||
u3e_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c)
|
||||
{
|
||||
u3e_init(nuu_o);
|
||||
|
||||
u3P.cpu_c = cpu_c;
|
||||
u3P.dir_c = dir_c;
|
||||
u3P.nor_u.nam_c = "north";
|
||||
u3P.sou_u.nam_c = "south";
|
||||
|
||||
@ -1019,32 +879,4 @@ u3e_boot(c3_o nuu_o, c3_o bug_o, c3_c* cpu_c)
|
||||
nuu_o = c3y;
|
||||
}
|
||||
}
|
||||
|
||||
/* Construct or activate the allocator.
|
||||
*/
|
||||
u3m_boot(nuu_o, bug_o);
|
||||
|
||||
/* Initialize the jet system.
|
||||
*/
|
||||
u3j_boot();
|
||||
|
||||
/* Install the kernel.
|
||||
*/
|
||||
if ( _(nuu_o) ) {
|
||||
c3_c pas_c[2049];
|
||||
struct stat buf_u;
|
||||
|
||||
snprintf(pas_c, 2048, "%s/.urb/urbit.pill", cpu_c);
|
||||
if ( -1 == stat(pas_c, &buf_u) ) {
|
||||
snprintf(pas_c, 2048, "%s/urbit.pill", U3_LIB);
|
||||
}
|
||||
printf("boot: loading %s\r\n", pas_c);
|
||||
u3v_make(pas_c);
|
||||
|
||||
u3v_jack();
|
||||
}
|
||||
else {
|
||||
u3v_hose();
|
||||
u3j_ream();
|
||||
}
|
||||
}
|
||||
|
14
n/j.c
14
n/j.c
@ -355,12 +355,12 @@ _cj_warm_hump(c3_l jax_l, u3_noun huc)
|
||||
return hap;
|
||||
}
|
||||
|
||||
/* _cj_boil_mean(): in parent, declare a core. RETAINS.
|
||||
/* _cj_hot_mean(): in parent, declare a core. RETAINS.
|
||||
**
|
||||
** XX bat is used only for printing, remove.
|
||||
*/
|
||||
static c3_l
|
||||
_cj_boil_mean(c3_l par_l, u3_noun mop, u3_noun bat)
|
||||
_cj_hot_mean(c3_l par_l, u3_noun mop, u3_noun bat)
|
||||
{
|
||||
u3j_core* par_u;
|
||||
u3j_core* dev_u;
|
||||
@ -395,10 +395,10 @@ _cj_boil_mean(c3_l par_l, u3_noun mop, u3_noun bat)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* _cj_boil_mine(): in boiling state, declare a core. RETAINS.
|
||||
/* _cj_hot_mine(): in boiling state, declare a core. RETAINS.
|
||||
*/
|
||||
static c3_l
|
||||
_cj_boil_mine(u3_noun mop, u3_noun cor)
|
||||
_cj_hot_mine(u3_noun mop, u3_noun cor)
|
||||
{
|
||||
u3_noun p_mop, q_mop, r_mop, hr_mop, tr_mop;
|
||||
|
||||
@ -417,7 +417,7 @@ _cj_boil_mine(u3_noun mop, u3_noun cor)
|
||||
}
|
||||
else par_l = 0;
|
||||
|
||||
return _cj_boil_mean(par_l, mop, u3h(cor));
|
||||
return _cj_hot_mean(par_l, mop, u3h(cor));
|
||||
}
|
||||
}
|
||||
|
||||
@ -498,7 +498,7 @@ _cj_warm_ream_at(u3_noun soh, u3_noun cag)
|
||||
}
|
||||
else par_l = 0;
|
||||
|
||||
jax_l = _cj_boil_mean(par_l, mop, 0);
|
||||
jax_l = _cj_hot_mean(par_l, mop, 0);
|
||||
|
||||
_cj_warm_ream_is(jax_l, q_mop, sab);
|
||||
return jax_l;
|
||||
@ -569,7 +569,7 @@ _cj_warm_mine(u3_noun clu, u3_noun cor)
|
||||
u3_noun mop;
|
||||
|
||||
if ( u3_none != (mop = _cj_cold_mine(cey, cor)) ) {
|
||||
c3_l jax_l = _cj_boil_mine(mop, cor);
|
||||
c3_l jax_l = _cj_hot_mine(mop, cor);
|
||||
|
||||
// fprintf(stderr, "warm: bat %x\r\n", u3r_mug(bat));
|
||||
u3h_put(u3R->jed.har_p,
|
||||
|
286
n/m.c
286
n/m.c
@ -7,9 +7,75 @@
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h>
|
||||
#include <sigsegv.h>
|
||||
#include <pmmintrin.h>
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#include "all.h"
|
||||
|
||||
/* (u3_noun)setjmp(u3R->esc.buf): setjmp within road.
|
||||
*/
|
||||
#if 0
|
||||
c3_o
|
||||
u3m_trap(void);
|
||||
#else
|
||||
# define u3m_trap() (u3_noun)(setjmp(u3R->esc.buf))
|
||||
#endif
|
||||
|
||||
/* u3m_signal(): treat a nock-level exception as a signal interrupt.
|
||||
*/
|
||||
void
|
||||
u3m_signal(u3_noun sig_l);
|
||||
|
||||
/* u3m_dump(): dump the current road to stderr.
|
||||
*/
|
||||
void
|
||||
u3m_dump(void);
|
||||
|
||||
/* u3m_mark(): mark all nouns in the road.
|
||||
*/
|
||||
void
|
||||
u3m_mark(void);
|
||||
|
||||
/* u3m_fall(): return to parent road.
|
||||
*/
|
||||
void
|
||||
u3m_fall(void);
|
||||
|
||||
/* u3m_leap(): in u3R, create a new road within the existing one.
|
||||
*/
|
||||
void
|
||||
u3m_leap(c3_w pad_w);
|
||||
|
||||
/* u3m_golf(): record cap length for u3_flog().
|
||||
*/
|
||||
c3_w
|
||||
u3m_golf(void);
|
||||
|
||||
/* u3m_flog(): pop the cap.
|
||||
**
|
||||
** A common sequence for inner allocation is:
|
||||
**
|
||||
** c3_w gof_w = u3m_golf();
|
||||
** u3m_leap();
|
||||
** // allocate some inner stuff...
|
||||
** u3m_fall();
|
||||
** // inner stuff is still valid, but on cap
|
||||
** u3m_flog(gof_w);
|
||||
**
|
||||
** u3m_flog(0) simply clears the cap.
|
||||
*/
|
||||
void
|
||||
u3m_flog(c3_w gof_w);
|
||||
|
||||
/* u3m_soft_top(): top-level safety wrapper.
|
||||
*/
|
||||
u3_noun
|
||||
u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
c3_w pad_w, // base memory pad
|
||||
u3_funk fun_f,
|
||||
u3_noun arg);
|
||||
|
||||
|
||||
static jmp_buf u3_Signal;
|
||||
|
||||
#ifndef SIGSTKSZ
|
||||
@ -294,7 +360,7 @@ _find_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
#endif
|
||||
|
||||
static u3_road*
|
||||
_boot_north(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
_pave_north(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
{
|
||||
c3_w* rut_w = mem_w;
|
||||
c3_w* hat_w = rut_w;
|
||||
@ -314,10 +380,10 @@ _boot_north(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
return rod_u;
|
||||
}
|
||||
|
||||
/* _boot_south(): install a south road.
|
||||
/* _pave_south(): install a south road.
|
||||
*/
|
||||
static u3_road*
|
||||
_boot_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
_pave_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
{
|
||||
c3_w* rut_w = (mem_w + len_w);
|
||||
c3_w* hat_w = rut_w;
|
||||
@ -337,10 +403,10 @@ _boot_south(c3_w* mem_w, c3_w siz_w, c3_w len_w)
|
||||
return rod_u;
|
||||
}
|
||||
|
||||
/* _boot_parts(): build internal tables.
|
||||
/* _pave_parts(): build internal tables.
|
||||
*/
|
||||
static void
|
||||
_boot_parts(void)
|
||||
_pave_parts(void)
|
||||
{
|
||||
u3R->cax.har_p = u3h_new();
|
||||
u3R->jed.har_p = u3h_new();
|
||||
@ -362,18 +428,18 @@ u3m_mark(void)
|
||||
u3h_mark(u3R->cax.har_p);
|
||||
}
|
||||
|
||||
/* u3m_boot(): instantiate or activate image.
|
||||
/* _cm_pave(): instantiate or activate image.
|
||||
*/
|
||||
void
|
||||
u3m_boot(c3_o nuu_o, c3_o bug_o)
|
||||
static void
|
||||
_cm_pave(c3_o nuu_o, c3_o bug_o)
|
||||
{
|
||||
if ( c3y == nuu_o ) {
|
||||
u3H = (void *)_boot_north(u3_Loom + 1,
|
||||
u3H = (void *)_pave_north(u3_Loom + 1,
|
||||
c3_wiseof(u3v_home),
|
||||
u3a_words - 1);
|
||||
u3R = &u3H->rod_u;
|
||||
|
||||
_boot_parts();
|
||||
_pave_parts();
|
||||
}
|
||||
else {
|
||||
u3H = (void *)_find_north(u3_Loom + 1,
|
||||
@ -387,6 +453,7 @@ u3m_boot(c3_o nuu_o, c3_o bug_o)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* u3m_clear(): clear all allocated data in road.
|
||||
*/
|
||||
void
|
||||
@ -397,7 +464,6 @@ u3m_clear(void)
|
||||
u3a_lose(u3R->jed.das);
|
||||
}
|
||||
|
||||
#if 0
|
||||
void
|
||||
u3m_dump(void)
|
||||
{
|
||||
@ -578,7 +644,7 @@ u3m_leap(c3_w pad_w)
|
||||
bot_p = (u3R->cap_p - len_w);
|
||||
u3R->cap_p -= len_w;
|
||||
|
||||
rod_u = _boot_south(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
|
||||
rod_u = _pave_south(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
|
||||
#if 0
|
||||
fprintf(stderr, "leap: from north %p (cap %x), to south %p\r\n",
|
||||
u3R,
|
||||
@ -590,7 +656,7 @@ u3m_leap(c3_w pad_w)
|
||||
bot_p = u3R->cap_p;
|
||||
u3R->cap_p += len_w;
|
||||
|
||||
rod_u = _boot_north(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
|
||||
rod_u = _pave_north(u3a_into(bot_p), c3_wiseof(u3a_road), len_w);
|
||||
#if 0
|
||||
fprintf(stderr, "leap: from north %p (cap %p), to south %p\r\n",
|
||||
u3R,
|
||||
@ -615,7 +681,7 @@ u3m_leap(c3_w pad_w)
|
||||
rod_u->how.fag_w |= u3a_flag_debug;
|
||||
}
|
||||
u3R = rod_u;
|
||||
_boot_parts();
|
||||
_pave_parts();
|
||||
}
|
||||
}
|
||||
|
||||
@ -755,7 +821,7 @@ u3m_soft_top(c3_w sec_w, // timer seconds
|
||||
|
||||
/* Trap for ordinary nock exceptions.
|
||||
*/
|
||||
if ( 0 == (why = u3m_trap()) ) {
|
||||
if ( 0 == (why = (u3_noun)setjmp(u3R->esc.buf)) ) {
|
||||
pro = fun_f(arg);
|
||||
|
||||
/* Make sure the inner routine did not create garbage.
|
||||
@ -814,6 +880,15 @@ u3m_soft_slam(u3_noun gat, u3_noun sam)
|
||||
return u3m_soft_sure(_cm_slam, u3nc(gat, sam));
|
||||
}
|
||||
|
||||
/* u3m_soft_nock: top-level nock.
|
||||
*/
|
||||
u3_noun _cm_nock(u3_noun arg) { return u3n_nock_on(u3h(arg), u3t(arg)); }
|
||||
u3_noun
|
||||
u3m_soft_nock(u3_noun bus, u3_noun fol)
|
||||
{
|
||||
return u3m_soft_sure(_cm_nock, u3nc(bus, fol));
|
||||
}
|
||||
|
||||
/* u3m_soft_run(): descend into virtualization context.
|
||||
*/
|
||||
u3_noun
|
||||
@ -838,7 +913,7 @@ u3m_soft_run(u3_noun fly,
|
||||
|
||||
/* Trap for exceptions.
|
||||
*/
|
||||
if ( 0 == (why = u3m_trap()) ) {
|
||||
if ( 0 == (why = (u3_noun)setjmp(u3R->esc.buf)) ) {
|
||||
pro = fun_f(aga, agb);
|
||||
|
||||
if ( u3R->how.fag_w & u3a_flag_debug ) {
|
||||
@ -926,7 +1001,7 @@ u3m_soft_esc(u3_noun sam)
|
||||
|
||||
/* Trap for exceptions.
|
||||
*/
|
||||
if ( 0 == (why = u3m_trap()) ) {
|
||||
if ( 0 == (why = (u3_noun)setjmp(u3R->esc.buf)) ) {
|
||||
pro = u3n_slam_on(fly, sam);
|
||||
|
||||
/* Fall back to the old road, leaving temporary memory intact.
|
||||
@ -1189,3 +1264,180 @@ u3m_wall(u3_noun wol)
|
||||
}
|
||||
u3z(wol);
|
||||
}
|
||||
|
||||
/* _cm_limits(): set up global modes and limits.
|
||||
*/
|
||||
static void
|
||||
_cm_limits(void)
|
||||
{
|
||||
struct rlimit rlm;
|
||||
c3_i ret_i;
|
||||
|
||||
/* Set compatible floating-point modes.
|
||||
*/
|
||||
{
|
||||
_MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON);
|
||||
_MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON);
|
||||
}
|
||||
|
||||
/* Moar stack.
|
||||
*/
|
||||
{
|
||||
ret_i = getrlimit(RLIMIT_STACK, &rlm);
|
||||
c3_assert(0 == ret_i);
|
||||
rlm.rlim_cur = (rlm.rlim_max > (65536 << 10))
|
||||
? (65536 << 10)
|
||||
: rlm.rlim_max;
|
||||
if ( 0 != setrlimit(RLIMIT_STACK, &rlm) ) {
|
||||
perror("stack");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Moar filez.
|
||||
*/
|
||||
{
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
/* Moar core.
|
||||
*/
|
||||
{
|
||||
getrlimit(RLIMIT_CORE, &rlm);
|
||||
rlm.rlim_cur = RLIM_INFINITY;
|
||||
if ( 0 != setrlimit(RLIMIT_CORE, &rlm) ) {
|
||||
perror("core limit");
|
||||
// no exit, not a critical limit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* _cm_signals(): set up interrupts, etc.
|
||||
*/
|
||||
static void
|
||||
_cm_signals(void)
|
||||
{
|
||||
if ( 0 != sigsegv_install_handler(u3e_fault) ) {
|
||||
fprintf(stderr, "sigsegv install failed\n");
|
||||
exit(1);
|
||||
}
|
||||
// signal(SIGINT, _loom_stop);
|
||||
}
|
||||
|
||||
/* _cm_init(): start the environment, with/without checkpointing.
|
||||
*/
|
||||
void
|
||||
_cm_init(c3_o chk_o)
|
||||
{
|
||||
_cm_limits();
|
||||
_cm_signals();
|
||||
|
||||
/* Make sure GMP uses our malloc.
|
||||
*/
|
||||
mp_set_memory_functions(u3a_malloc, u3a_realloc2, u3a_free2);
|
||||
|
||||
/* Map at fixed address.
|
||||
*/
|
||||
{
|
||||
c3_w len_w = u3a_bytes;
|
||||
void* map_v;
|
||||
|
||||
map_v = mmap((void *)u3_Loom,
|
||||
len_w,
|
||||
_(chk_o) ? PROT_READ : (PROT_READ | PROT_WRITE),
|
||||
(MAP_ANON | MAP_FIXED | MAP_PRIVATE),
|
||||
-1, 0);
|
||||
|
||||
if ( -1 == (c3_ps)map_v ) {
|
||||
map_v = mmap((void *)0,
|
||||
len_w,
|
||||
PROT_READ,
|
||||
MAP_ANON | MAP_PRIVATE,
|
||||
-1, 0);
|
||||
|
||||
if ( -1 == (c3_ps)map_v ) {
|
||||
fprintf(stderr, "boot: map failed twice\r\n");
|
||||
} else {
|
||||
fprintf(stderr, "boot: map failed - try U3_OS_LoomBase %p\r\n", map_v);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
printf("loom: mapped %dMB\r\n", len_w >> 20);
|
||||
}
|
||||
}
|
||||
|
||||
/* u3e_grab(): garbage-collect the world, plus extra roots, then
|
||||
*/
|
||||
void
|
||||
u3e_grab(c3_c* cap_c, u3_noun som, ...) // terminate with u3_none
|
||||
{
|
||||
// u3h_free(u3R->cax.har_p);
|
||||
// u3R->cax.har_p = u3h_new();
|
||||
|
||||
u3v_mark();
|
||||
u3m_mark();
|
||||
{
|
||||
va_list vap;
|
||||
u3_noun tur;
|
||||
|
||||
va_start(vap, som);
|
||||
|
||||
if ( som != u3_none ) {
|
||||
u3a_mark_noun(som);
|
||||
|
||||
while ( u3_none != (tur = va_arg(vap, u3_noun)) ) {
|
||||
u3a_mark_noun(tur);
|
||||
}
|
||||
}
|
||||
va_end(vap);
|
||||
}
|
||||
u3a_sweep(cap_c);
|
||||
}
|
||||
|
||||
/* u3m_boot(): start the u3 system.
|
||||
*/
|
||||
void
|
||||
u3m_boot(c3_o nuu_o, c3_o bug_o, c3_c* dir_c)
|
||||
{
|
||||
/* Activate the loom.
|
||||
*/
|
||||
_cm_init(nuu_o);
|
||||
|
||||
/* Activate the storage system.
|
||||
*/
|
||||
u3e_live(nuu_o, dir_c);
|
||||
|
||||
/* Construct or activate the allocator.
|
||||
*/
|
||||
_cm_pave(nuu_o, bug_o);
|
||||
|
||||
/* Initialize the jet system.
|
||||
*/
|
||||
u3j_boot();
|
||||
|
||||
/* Install or reactivate the kernel.
|
||||
*/
|
||||
if ( _(nuu_o) ) {
|
||||
c3_c pas_c[2049];
|
||||
struct stat buf_u;
|
||||
|
||||
snprintf(pas_c, 2048, "%s/.urb/urbit.pill", dir_c);
|
||||
if ( -1 == stat(pas_c, &buf_u) ) {
|
||||
snprintf(pas_c, 2048, "%s/urbit.pill", U3_LIB);
|
||||
}
|
||||
printf("boot: loading %s\r\n", pas_c);
|
||||
u3v_make(pas_c);
|
||||
|
||||
u3v_jack();
|
||||
}
|
||||
else {
|
||||
u3v_hose();
|
||||
u3j_ream();
|
||||
}
|
||||
}
|
||||
|
8
v/main.c
8
v/main.c
@ -164,7 +164,7 @@ _main_getopt(c3_i argc, c3_c** argv)
|
||||
}
|
||||
}
|
||||
|
||||
u3_Host.cpu_c = strdup(argv[optind]);
|
||||
u3_Host.dir_c = strdup(argv[optind]);
|
||||
return c3y;
|
||||
}
|
||||
}
|
||||
@ -195,7 +195,7 @@ u3_ve_panic(c3_i argc, c3_c** argv)
|
||||
static void
|
||||
u3_ve_sysopt()
|
||||
{
|
||||
u3_Local = strdup(u3_Host.cpu_c);
|
||||
u3_Local = strdup(u3_Host.dir_c);
|
||||
u3_System = U3_LIB;
|
||||
u3_Flag_Abort = u3_Host.ops_u.abo;
|
||||
u3_Flag_Garbage = u3_Host.ops_u.gab;
|
||||
@ -294,7 +294,7 @@ main(c3_i argc,
|
||||
|
||||
printf("~\n");
|
||||
printf("welcome.\n");
|
||||
printf("vere: urbit home is %s\n", u3_Host.cpu_c);
|
||||
printf("vere: urbit home is %s\n", u3_Host.dir_c);
|
||||
printf("vere: hostname is %s\n", u3_Host.ops_u.nam_c);
|
||||
|
||||
if ( c3y == u3_Host.ops_u.dem && c3n == u3_Host.ops_u.bat ) {
|
||||
@ -309,7 +309,7 @@ main(c3_i argc,
|
||||
{
|
||||
/* Boot the image and checkpoint.
|
||||
*/
|
||||
u3e_boot(u3_Host.ops_u.nuu, u3_Host.ops_u.gab, u3_Host.cpu_c);
|
||||
u3m_boot(u3_Host.ops_u.nuu, u3_Host.ops_u.gab, u3_Host.dir_c);
|
||||
|
||||
/* Start Arvo.
|
||||
*/
|
||||
|
40
v/sist.c
40
v/sist.c
@ -100,7 +100,7 @@ u3_sist_put(const c3_c* key_c, const c3_y* val_y, size_t siz_i)
|
||||
c3_i ret_i;
|
||||
c3_i fid_i;
|
||||
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.cpu_c, key_c);
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.dir_c, key_c);
|
||||
c3_assert(ret_i < 2048);
|
||||
|
||||
if ( (fid_i = open(ful_c, O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0 ) {
|
||||
@ -132,7 +132,7 @@ u3_sist_has(const c3_c* key_c)
|
||||
c3_i ret_i;
|
||||
struct stat sat_u;
|
||||
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.cpu_c, key_c);
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.dir_c, key_c);
|
||||
c3_assert(ret_i < 2048);
|
||||
|
||||
if ( (ret_i = stat(ful_c, &sat_u)) < 0 ) {
|
||||
@ -161,7 +161,7 @@ u3_sist_get(const c3_c* key_c, c3_y* val_y)
|
||||
c3_i fid_i;
|
||||
struct stat sat_u;
|
||||
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.cpu_c, key_c);
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.dir_c, key_c);
|
||||
c3_assert(ret_i < 2048);
|
||||
|
||||
if ( (fid_i = open(ful_c, O_RDONLY)) < 0 ) {
|
||||
@ -193,7 +193,7 @@ u3_sist_nil(const c3_c* key_c)
|
||||
c3_c ful_c[2048];
|
||||
c3_i ret_i;
|
||||
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.cpu_c, key_c);
|
||||
ret_i = snprintf(ful_c, 2048, "%s/.urb/sis/_%s", u3_Host.dir_c, key_c);
|
||||
c3_assert(ret_i < 2048);
|
||||
|
||||
if ( (ret_i = unlink(ful_c)) < 0 ) {
|
||||
@ -281,24 +281,24 @@ _sist_home()
|
||||
// Create subdirectories.
|
||||
//
|
||||
{
|
||||
mkdir(u3_Host.cpu_c, 0700);
|
||||
mkdir(u3_Host.dir_c, 0700);
|
||||
|
||||
snprintf(ful_c, 2048, "%s/.urb", u3_Host.cpu_c);
|
||||
snprintf(ful_c, 2048, "%s/.urb", u3_Host.dir_c);
|
||||
mkdir(ful_c, 0700);
|
||||
|
||||
snprintf(ful_c, 2048, "%s/.urb/get", u3_Host.cpu_c);
|
||||
snprintf(ful_c, 2048, "%s/.urb/get", u3_Host.dir_c);
|
||||
if ( 0 != mkdir(ful_c, 0700) ) {
|
||||
perror(ful_c);
|
||||
u3_lo_bail();
|
||||
}
|
||||
|
||||
snprintf(ful_c, 2048, "%s/.urb/put", u3_Host.cpu_c);
|
||||
snprintf(ful_c, 2048, "%s/.urb/put", u3_Host.dir_c);
|
||||
if ( 0 != mkdir(ful_c, 0700) ) {
|
||||
perror(ful_c);
|
||||
u3_lo_bail();
|
||||
}
|
||||
|
||||
snprintf(ful_c, 2048, "%s/.urb/sis", u3_Host.cpu_c);
|
||||
snprintf(ful_c, 2048, "%s/.urb/sis", u3_Host.dir_c);
|
||||
if ( 0 != mkdir(ful_c, 0700) ) {
|
||||
perror(ful_c);
|
||||
u3_lo_bail();
|
||||
@ -309,7 +309,7 @@ _sist_home()
|
||||
//
|
||||
{
|
||||
snprintf(ful_c, 2048, "cp %s/urbit.pill %s/.urb",
|
||||
U3_LIB, u3_Host.cpu_c);
|
||||
U3_LIB, u3_Host.dir_c);
|
||||
printf("%s\r\n", ful_c);
|
||||
if ( 0 != system(ful_c) ) {
|
||||
uL(fprintf(uH, "could not %s\n", ful_c));
|
||||
@ -322,7 +322,7 @@ _sist_home()
|
||||
//
|
||||
if ( u3_Host.ops_u.imp_c ) {
|
||||
snprintf(ful_c, 2048, "cp -r %s/zod %s/%s",
|
||||
U3_LIB, u3_Host.cpu_c, u3_Host.ops_u.imp_c+1);
|
||||
U3_LIB, u3_Host.dir_c, u3_Host.ops_u.imp_c+1);
|
||||
printf("%s\r\n", ful_c);
|
||||
if ( 0 != system(ful_c) ) {
|
||||
uL(fprintf(uH, "could not %s\n", ful_c));
|
||||
@ -464,7 +464,7 @@ static void
|
||||
_sist_fast(u3_noun pas, c3_l key_l)
|
||||
{
|
||||
c3_c ful_c[2048];
|
||||
c3_c* hom_c = u3_Host.cpu_c;
|
||||
c3_c* hom_c = u3_Host.dir_c;
|
||||
u3_noun gum = u3dc("scot", 'p', key_l);
|
||||
c3_c* gum_c = u3r_string(gum);
|
||||
u3_noun yek = u3dc("scot", 'p', pas);
|
||||
@ -496,7 +496,7 @@ static u3_noun
|
||||
_sist_staf(c3_l key_l)
|
||||
{
|
||||
c3_c ful_c[2048];
|
||||
c3_c* hom_c = u3_Host.cpu_c;
|
||||
c3_c* hom_c = u3_Host.dir_c;
|
||||
u3_noun gum = u3dc("scot", 'p', key_l);
|
||||
c3_c* gum_c = u3r_string(gum);
|
||||
u3_noun txt;
|
||||
@ -568,7 +568,7 @@ _sist_zest()
|
||||
#ifdef O_DSYNC
|
||||
pig_i |= O_DSYNC;
|
||||
#endif
|
||||
snprintf(ful_c, 2048, "%s/.urb/egz.hope", u3_Host.cpu_c);
|
||||
snprintf(ful_c, 2048, "%s/.urb/egz.hope", u3_Host.dir_c);
|
||||
|
||||
if ( ((fid_i = open(ful_c, pig_i, 0600)) < 0) ||
|
||||
(fstat(fid_i, &buf_b) < 0) )
|
||||
@ -731,7 +731,7 @@ _sist_rest_nuu(u3_ulog* lug_u, u3_uled led_u, c3_c* old_c)
|
||||
u3_lo_bail();
|
||||
}
|
||||
|
||||
ret_i = snprintf(nuu_c, 2048, "%s/.urb/ham.hope", u3_Host.cpu_c);
|
||||
ret_i = snprintf(nuu_c, 2048, "%s/.urb/ham.hope", u3_Host.dir_c);
|
||||
c3_assert(ret_i < 2048);
|
||||
|
||||
if ( (fud_i = open(nuu_c, O_CREAT | O_TRUNC | O_RDWR, 0600)) < 0 ) {
|
||||
@ -834,7 +834,7 @@ _sist_rest()
|
||||
#ifdef O_DSYNC
|
||||
pig_i |= O_DSYNC;
|
||||
#endif
|
||||
snprintf(ful_c, 2048, "%s/.urb/egz.hope", u3_Host.cpu_c);
|
||||
snprintf(ful_c, 2048, "%s/.urb/egz.hope", u3_Host.dir_c);
|
||||
if ( ((fid_i = open(ful_c, pig_i)) < 0) || (fstat(fid_i, &buf_b) < 0) ) {
|
||||
uL(fprintf(uH, "rest: can't open record (%s)\n", ful_c));
|
||||
u3_lo_bail();
|
||||
@ -904,7 +904,7 @@ _sist_rest()
|
||||
u3_noun key;
|
||||
|
||||
while ( 1 ) {
|
||||
pas = pas ? pas : _sist_cask(u3_Host.cpu_c, c3n);
|
||||
pas = pas ? pas : _sist_cask(u3_Host.dir_c, c3n);
|
||||
|
||||
key = _sist_fatt(sal_l, pas);
|
||||
|
||||
@ -1123,9 +1123,9 @@ _sist_rest()
|
||||
c3_c* fil_c;
|
||||
c3_c* who_c;
|
||||
|
||||
if ( (fil_c = strrchr(u3_Host.cpu_c, '/')) ) {
|
||||
if ( (fil_c = strrchr(u3_Host.dir_c, '/')) ) {
|
||||
fil_c++;
|
||||
} else fil_c = u3_Host.cpu_c;
|
||||
} else fil_c = u3_Host.dir_c;
|
||||
|
||||
who = u3dc("scot", 'p', u3k(u3A->our)));
|
||||
who_c = u3r_string(who);
|
||||
@ -1219,7 +1219,7 @@ u3_sist_boot(void)
|
||||
|
||||
if ( 0 == u3_Host.ops_u.imp_c ) {
|
||||
c3_c get_c[2049];
|
||||
snprintf(get_c, 2048, "%s/.urb/get", u3_Host.cpu_c);
|
||||
snprintf(get_c, 2048, "%s/.urb/get", u3_Host.dir_c);
|
||||
if ( 0 == access(get_c, 0) ) {
|
||||
uL(fprintf(uH, "pier: already built\n"));
|
||||
u3_lo_bail();
|
||||
|
4
v/term.c
4
v/term.c
@ -617,7 +617,7 @@ _term_it_path(u3_noun fyl, u3_noun pax)
|
||||
|
||||
// measure
|
||||
//
|
||||
len_w = strlen(u3_Host.cpu_c);
|
||||
len_w = strlen(u3_Host.dir_c);
|
||||
{
|
||||
u3_noun wiz = pax;
|
||||
|
||||
@ -630,7 +630,7 @@ _term_it_path(u3_noun fyl, u3_noun pax)
|
||||
// cut
|
||||
//
|
||||
pas_c = c3_malloc(len_w + 1);
|
||||
strncpy(pas_c, u3_Host.cpu_c, len_w);
|
||||
strncpy(pas_c, u3_Host.dir_c, len_w);
|
||||
pas_c[len_w] = '\0';
|
||||
{
|
||||
u3_noun wiz = pax;
|
||||
|
6
v/unix.c
6
v/unix.c
@ -1026,7 +1026,7 @@ _unix_hot_gain(u3_noun who, u3_noun mek)
|
||||
{
|
||||
u3_noun hox = u3dc("scot", 'p', u3k(who));
|
||||
c3_c* hox_c = u3r_string(hox);
|
||||
c3_c* pax_c = _unix_down(u3_Host.cpu_c, hox_c + 1);
|
||||
c3_c* pax_c = _unix_down(u3_Host.dir_c, hox_c + 1);
|
||||
DIR* rid_u = opendir(pax_c);
|
||||
|
||||
if ( !rid_u ) {
|
||||
@ -1527,7 +1527,7 @@ u3_unix_io_init(void)
|
||||
void
|
||||
u3_unix_io_talk()
|
||||
{
|
||||
u3_unix_acquire(u3_Host.cpu_c);
|
||||
u3_unix_acquire(u3_Host.dir_c);
|
||||
u3_unix_ef_move();
|
||||
uv_check_start(&u3_Host.unx_u.syn_u, _unix_ef_sync);
|
||||
}
|
||||
@ -1538,7 +1538,7 @@ void
|
||||
u3_unix_io_exit(void)
|
||||
{
|
||||
uv_check_stop(&u3_Host.unx_u.syn_u);
|
||||
u3_unix_release(u3_Host.cpu_c);
|
||||
u3_unix_release(u3_Host.dir_c);
|
||||
|
||||
{
|
||||
u3_uhot* hot_u;
|
||||
|
Loading…
Reference in New Issue
Block a user