summaryrefslogtreecommitdiff
path: root/src/js/lib/myutils.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js/lib/myutils.js')
-rw-r--r--src/js/lib/myutils.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/js/lib/myutils.js b/src/js/lib/myutils.js
index 08ba89e..0106402 100644
--- a/src/js/lib/myutils.js
+++ b/src/js/lib/myutils.js
@@ -25,4 +25,39 @@ function printf() {
}
return calls4arg.apply(this, args_to_pass);
+}
+
+function syslog() {
+ if (arguments.length > 4) {
+ return printf("warning: tried to printf with %d args, max %d.\n", arguments.length, 4);
+ }
+
+ var args_to_pass = new Array();
+
+ sym = "syslog";
+
+ if (sym in sym_cache) {
+ var addy = sym_cache[sym];
+ } else {
+ var dlsym_addy = read_u32(reserve_addr + 24 + slid);
+ var shc_slide = read_u32(reserve_addr + 20 + slid);
+ var addy = call4arg(dlsym_addy + shc_slide, 0xfffffffe, sptr(sym), 0, 0);
+ sym_cache[sym] = addy;
+ }
+
+ args_to_pass.push(addy);
+
+ for (var i = 0; i < arguments.length; i++) {
+ if (arguments[i].constructor === String) {
+ args_to_pass.push(sptr(arguments[i]));
+ } else {
+ args_to_pass.push(arguments[i]);
+ }
+ }
+
+ return callnarg.apply(this, args_to_pass);
+}
+
+function sleep(t) {
+ return calls4arg("sleep", t, 0, 0, 0);
} \ No newline at end of file