Merge remote-tracking branch 'origin/release-candidate' into lighter-than-eyre

This commit is contained in:
Elliot Glaysher 2018-12-17 10:09:11 -08:00
commit 4ebaf49b02
10 changed files with 42 additions and 26 deletions

View File

@ -188,12 +188,7 @@
/* Entropy
*/
# if defined(U3_OS_bsd) && defined(__OpenBSD__)
# define c3_rand(rd) (getentropy((void*)rd, 64) == 0 ? \
(void)0 : c3_assert(!"ent"))
# else
#define c3_rand u3_sist_rand
# endif
/* Static assertion
*/

View File

@ -12,5 +12,6 @@
#mesondefine U3_MEMORY_DEBUG
#mesondefine U3_CPU_DEBUG
#mesondefine U3_EVENT_TIME_DEBUG
#endif /*CONFIG_H*/

View File

@ -240,6 +240,7 @@ conf_data = configuration_data()
conf_data.set('URBIT_VERSION', '"0.6.0"')
conf_data.set('U3_MEMORY_DEBUG', get_option('gc'))
conf_data.set('U3_CPU_DEBUG', get_option('prof'))
conf_data.set('U3_EVENT_TIME_DEBUG', get_option('event-time'))
osdet = build_machine.system()
os_c_flags = ['-funsigned-char','-ffast-math']
@ -271,13 +272,20 @@ elif osdet == 'darwin'
os_deps = os_deps + [ncurses_dep]
elif osdet == 'bsd'
elif osdet == 'bsd' or osdet == 'freebsd'
conf_data.set('U3_OS_bsd', true)
pthread_dep = meson.get_compiler('c').find_library('pthread')
kvm_dep = meson.get_compiler('c').find_library('kvm')
ncurses_dep = dependency('ncurses')
os_deps = os_deps + [kvm_dep, pthread_dep, ncurses_dep]
elif osdet == 'openbsd'
conf_data.set('U3_OS_bsd', true)
os_link_flags = ['-L/usr/local/lib', '-lgmp', '-lsigsegv', '-lcurses']
gmp_dep = []
sigsegv_dep = []
else
error('Unsupported OS detected:' + osdet)
endif
@ -295,7 +303,7 @@ configure_file(input : 'include/config.h.in',
configuration : conf_data)
# We expect these libs to supplied with the distribution
curl_dep = dependency('libcurl', version: '>=7.35.0')
curl_dep = dependency('libcurl', version: '>=7.19.0')
if osdet == 'darwin' and not get_option('nix')
libcrypto = meson.get_compiler('c').find_library('crypto', dirs: [ '/usr/local/opt/openssl/lib/' ])
@ -308,7 +316,7 @@ endif
if(legacy_meson)
gmp_dep = find_library('gmp')
sigsegv_dep = find_library('sigsegv')
else
elif osdet != 'openbsd'
gmp_dep = meson.get_compiler('c').find_library('gmp')
sigsegv_dep = meson.get_compiler('c').find_library('sigsegv')
endif

View File

@ -2,5 +2,7 @@ option('gc', type : 'boolean', value : false,
description : 'Add debugging information to heap. Run with -g. Breaks image.')
option('prof', type : 'boolean', value : false,
description : 'Activate profiling. Run with -P.')
option('event-time', type : 'boolean', value : false,
description : 'Print timing information per event.')
option('nix', type: 'boolean', value: false,
description: 'Build using nix.')

View File

@ -625,14 +625,15 @@ u3m_bail(u3_noun how)
}
else {
c3_assert(_(u3ud(u3h(how))));
fprintf(stderr, "\r\nbail: %d\r\n", u3h(how));
u3m_p("bail", u3t(how));
}
}
switch ( how ) {
case c3__fail:
case c3__fail: {
break;
}
case c3__meme: {
fprintf(stderr, "bailing out\r\n");
abort();

View File

@ -45,7 +45,7 @@ u3_lo_tank(c3_l tab_l, u3_noun tac);
void
u3t_slog(u3_noun hod)
{
#ifdef GHETTO
#ifdef U3_EVENT_TIME_DEBUG
static int old;
static struct timeval b4, f2, d0;
c3_w ms_w;
@ -604,7 +604,7 @@ u3t_boot(void)
setitimer(ITIMER_PROF, &itm_v, 0);
}
#elif defined(U3_OS_bsd)
# error "Profiling isn't yet supported on BSD"
// XX "Profiling isn't yet supported on BSD"
#else
# error "port: profiling"
#endif
@ -644,7 +644,7 @@ u3t_boff(void)
}
#elif defined(U3_OS_bsd)
# error "Profiling isn't yet supported on BSD"
// XX "Profiling isn't yet supported on BSD"
#else
# error "port: profiling"
#endif

@ -1 +1 @@
Subproject commit 66a72cf2084799d0799874d4fa3c530a73713d81
Subproject commit 87f73ffad3d3047baf1ed134fb7827a9dca163ee

View File

@ -186,6 +186,13 @@ _main_getopt(c3_i argc, c3_c** argv)
}
}
#if defined(U3_OS_bsd)
if (u3_Host.ops_u.pro == c3y) {
fprintf(stderr, "profiling isn't yet supported on BSD\r\n");
return c3n;
}
#endif
if ( 0 != u3_Host.ops_u.fak_c ) {
if ( 28 < strlen(u3_Host.ops_u.fak_c) ) {
fprintf(stderr, "fake comets are disallowed\r\n");

View File

@ -1559,7 +1559,7 @@ _raft_lame(u3_noun ovo, u3_noun why, u3_noun tan)
static u3_noun
_raft_punk(u3_noun ovo)
{
#ifdef GHETTO
#ifdef U3_EVENT_TIME_DEBUG
c3_c* txt_c = u3r_string(u3h(u3t(ovo)));
#endif
c3_w sec_w;
@ -1574,7 +1574,7 @@ _raft_punk(u3_noun ovo)
sec_w = 0;
} else sec_w = 600;
#ifdef GHETTO
#ifdef U3_EVENT_TIME_DEBUG
struct timeval b4, f2, d0;
gettimeofday(&b4, 0);
if( c3__belt != u3h(u3t(ovo)) ){
@ -1587,7 +1587,7 @@ _raft_punk(u3_noun ovo)
gon = u3m_soft(sec_w, u3v_poke, u3k(ovo));
u3t_event_trace("Running", 'e');
#ifdef GHETTO
#ifdef U3_EVENT_TIME_DEBUG
c3_w ms_w;
c3_w clr_w;
@ -2015,8 +2015,7 @@ _raft_pump(u3_noun ovo)
ron = u3ke_jam(u3nc(u3k(u3A->now), ovo));
c3_assert(u3A->key);
// don't encrypt for the moment, bootstrapping
// ron = u3dc("en:crua", u3k(u3A->key), ron);
ron = u3dc("en:crub:crypto", u3k(u3A->key), ron);
len_w = u3r_met(5, ron);
bob_w = c3_malloc(len_w * 4L);

View File

@ -415,12 +415,18 @@ _sist_bask(c3_c* pop_c, u3_noun may)
void
u3_sist_rand(c3_w* rad_w)
{
#if defined(U3_OS_bsd) && defined(__OpenBSD__)
if (-1 == getentropy(rad_w, 64)) {
c3_assert(!"lo_rand");
}
#else
c3_i fid_i = open(DEVRANDOM, O_RDONLY);
if ( 64 != read(fid_i, (c3_y*) rad_w, 64) ) {
c3_assert(!"lo_rand");
}
close(fid_i);
#endif
}
/* _sist_fast(): offer to save passcode by mug in home directory.
@ -971,13 +977,10 @@ _sist_rest()
continue;
}
#if 0
// disable encryption for now
//
if ( u3A->key ) {
u3_noun dep;
dep = u3dc("de:crua", u3k(u3A->key), ron);
dep = u3dc("de:crub:crypto", u3k(u3A->key), ron);
if ( c3n == u3du(dep) ) {
uL(fprintf(uH, "record (%s) is corrupt (k)\n", ful_c));
u3_lo_bail();
@ -987,7 +990,7 @@ _sist_rest()
u3z(dep);
}
}
#endif
roe = u3nc(u3ke_cue(ron), roe);
}
u3A->ent_d = c3_max(las_d + 1ULL, old_d);