_PROTOTYPE( u32_t micros_to_ticks, (u32_t micros));
_PROTOTYPE( void ser_putc, (char c));
_PROTOTYPE( void get_randomness, (struct k_randomness *, int));
+_PROTOTYPE( u32_t sqrt_approx, (u32_t));
#define asynsend(ep, msg) asynsend3(ep, msg, 0)
_PROTOTYPE( int asynsend3, (endpoint_t ep, message *msg, int flags));
sef_signal.c \
ser_putc.c \
spin.c \
+ sqrt_approx.c \
stacktrace.c \
sys_abort.c \
sys_clear.c \
vm_yield_get_block.c \
vprintf.c \
+
CPPFLAGS.sched_start.c+= -I${MINIXSRCDIR}
.if (${NBSD_LIBC} != "no")
--- /dev/null
+#include <minix/sysutil.h>
+
+u32_t sqrt_approx(u32_t in)
+{
+ int b, v = 0;
+ for(b = (sizeof(in)*8)/2-1; b >= 0; b--) {
+ u32_t n = v | (1UL << b);
+ if(n*n <= in)
+ v = n;
+ }
+
+ return v;
+}
+
write.c inode.c main.c path.c super.c
DPADD+= ${LIBM} ${LIBSYS}
-LDADD+= -lm -lsys
+LDADD+= -lsys
MAN=
/* heuristic for a desired cache size based on FS usage;
* but never bigger than half of the total filesystem
*/
- kb_fsmax = sqrt(kbytes_used_fs)*40;
+ kb_fsmax = sqrt_approx(kbytes_used_fs)*40;
kb_fsmax = MIN(kb_fsmax, kbytes_total_fs/2);
/* heuristic for a maximum usage - 10% of remaining memory */