Merge branch 'v0.4'
authorRyan Dahl <ry@tinyclouds.org>
Thu, 14 Apr 2011 01:11:21 +0000 (01:11 +0000)
committerRyan Dahl <ry@tinyclouds.org>
Thu, 14 Apr 2011 01:11:21 +0000 (01:11 +0000)
Conflicts:
src/platform_sunos.cc
test/simple/test-os.js

1  2 
doc/api/buffers.markdown
doc/api/fs.markdown
lib/fs.js
lib/http.js
lib/net.js
src/node_buffer.cc
src/node_script.cc
src/platform_sunos.cc
test/simple/test-buffer.js
test/simple/test-os.js
wscript

Simple merge
Simple merge
diff --cc lib/fs.js
Simple merge
diff --cc lib/http.js
Simple merge
diff --cc lib/net.js
Simple merge
Simple merge
Simple merge
@@@ -128,12 -223,30 +224,30 @@@ double Platform::GetTotalMemory() 
    return 0.0;
  }
  
 -double Platform::GetUptime() {
 +double Platform::GetUptimeImpl() {
-   // http://munin-monitoring.org/attachment/ticket/419/uptime
-   return 0.0;
- }
+   kstat_ctl_t   *kc;
+   kstat_t       *ksp;
+   kstat_named_t *knp;
+   long hz = sysconf(_SC_CLK_TCK);
+   ulong_t clk_intr;
+   if ((kc = kstat_open()) == NULL)
+     throw "could not open kstat";
+   ksp = kstat_lookup(kc, "unix", 0, "system_misc");
  
+   if (kstat_read(kc, ksp, NULL) == -1) {
+     throw "unable to read kstat";
+   } else {
+     knp = (kstat_named_t *) kstat_data_lookup(ksp, "clk_intr");
+     clk_intr = knp->value.ul;
+   }
+   kstat_close(kc);
+   return static_cast<double>( clk_intr / hz );
+ }
  
  int Platform::GetLoadAvg(Local<Array> *loads) {
    return 0;
Simple merge
@@@ -23,20 -23,29 +23,39 @@@ var common = require('../common')
  var assert = require('assert');
  var os = require('os');
  
- assert.ok(os.hostname().length > 0);
- assert.ok(os.loadavg().length > 0);
- assert.ok(os.uptime() > 0);
- assert.ok(os.freemem() > 0);
- assert.ok(os.totalmem() > 0);
- assert.ok(os.cpus().length > 0);
- assert.ok(os.type().length > 0);
- assert.ok(os.release().length > 0);
++
+ var hostname = os.hostname()
+ console.log("hostname = %s", hostname);
+ assert.ok(hostname.length > 0);
+ var uptime = os.uptime();
+ console.log("uptime = %d", uptime);
+ assert.ok(uptime > 0);
+ var cpus = os.cpus();
+ console.log("cpus = ", cpus);
+ assert.ok(cpus.length > 0);
+ var type = os.type();
+ console.log("type = ", type);
+ assert.ok(type.length > 0);
+ var release = os.release();
+ console.log("release = ", release);
+ assert.ok(release.length > 0);
+ if (process.platform != 'sunos') {
+   // not implemeneted yet
+   assert.ok(os.loadavg().length > 0);
+   assert.ok(os.freemem() > 0);
+   assert.ok(os.totalmem() > 0);
+ }
 +
 +
 +var interfaces = os.getNetworkInterfaces();
 +console.error(interfaces);
 +switch (process.platform) {
 +  case 'linux':
 +    assert.equal('127.0.0.1', interfaces.lo.ip);
 +    break;
 +}
diff --cc wscript
Simple merge