+25
-1
@@ -400,3 +400,3 @@ #include <assert.h> | ||
| err = sprintf(cidr, "%s/%d", address_ip, cidr_value); | ||
| err = snprintf(cidr, sizeof(cidr), "%s/%d", address_ip, cidr_value); | ||
| assert(err > 0); | ||
@@ -688,2 +688,24 @@ | ||
| static js_value_t * | ||
| bare_os_available_memory(js_env_t *env, js_callback_info_t *info) { | ||
| int err; | ||
| js_value_t *result; | ||
| err = js_create_int64(env, uv_get_available_memory(), &result); | ||
| assert(err == 0); | ||
| return result; | ||
| } | ||
| static js_value_t * | ||
| bare_os_constrained_memory(js_env_t *env, js_callback_info_t *info) { | ||
| int err; | ||
| js_value_t *result; | ||
| err = js_create_int64(env, uv_get_constrained_memory(), &result); | ||
| assert(err == 0); | ||
| return result; | ||
| } | ||
| static js_value_t * | ||
| bare_os_uptime(js_env_t *env, js_callback_info_t *info) { | ||
@@ -1157,2 +1179,4 @@ int err; | ||
| V("totalmem", bare_os_totalmem) | ||
| V("availableMemory", bare_os_available_memory) | ||
| V("constrainedMemory", bare_os_constrained_memory) | ||
| V("uptime", bare_os_uptime) | ||
@@ -1159,0 +1183,0 @@ V("loadavg", bare_os_loadavg) |
+4
-0
@@ -104,2 +104,6 @@ export const constants: { | ||
| export function availableMemory(): number | ||
| export function constrainedMemory(): number | ||
| export function uptime(): number | ||
@@ -106,0 +110,0 @@ |
+2
-0
@@ -92,2 +92,4 @@ const binding = require('./binding') | ||
| exports.totalmem = binding.totalmem | ||
| exports.availableMemory = binding.availableMemory | ||
| exports.constrainedMemory = binding.constrainedMemory | ||
| exports.uptime = binding.uptime | ||
@@ -94,0 +96,0 @@ exports.loadavg = binding.loadavg |
+1
-1
| { | ||
| "name": "bare-os", | ||
| "version": "3.7.0", | ||
| "version": "3.7.1", | ||
| "description": "Operating system utilities for Javascript", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
897615
0.61%221
1.84%