New java 11 on latest Ubuntu calls sysconf to get value
of _SC_THREAD_STACK_MIN parameter to inquire about minimal
stack size and crashes when gets -1 from OSv. This patch
makes sysconf() return the same value Linux returns.

Similarly one of the libraries libtsm.so used by cli
needs value of _SC_LINE_MAX and this patch makes sysconf
handle this parameter as well.

Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
---
 runtime.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/runtime.cc b/runtime.cc
index 64a9b225..10c72cca 100644
--- a/runtime.cc
+++ b/runtime.cc
@@ -362,6 +362,8 @@ long sysconf(int name)
     switch (name) {
     case _SC_CLK_TCK: return CLOCKS_PER_SEC;
     case _SC_PAGESIZE: return mmu::page_size;
+    case _SC_THREAD_STACK_MIN: return 16384;
+    case _SC_LINE_MAX: return 2048;
     case _SC_THREAD_PROCESS_SHARED: return true;
     case _SC_NPROCESSORS_ONLN: return sched::cpus.size();
     case _SC_NPROCESSORS_CONF: return sched::cpus.size();
-- 
2.32.0

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20220104031833.83919-3-jwkozaczuk%40gmail.com.

Reply via email to