Skip to content

Instantly share code, notes, and snippets.

View bnoordhuis's full-sized avatar

Ben Noordhuis bnoordhuis

View GitHub Profile
@bnoordhuis
bnoordhuis / deamontest.js
Created February 5, 2012 22:35 — forked from AndreasMadsen/deamontest.js
Frist draft on a simple javascript deamon
var child_process = require('child_process');
function startDeamon(child, args) {
var newEnv = JSON.parse(JSON.stringify(process.env));
newEnv.deamonOptions = JSON.stringify({exec: child, args: args});
var deamonWatcher = child_process.fork(process.argv[1], ['deamon'], {
@bnoordhuis
bnoordhuis / trace-all-events.js
Created January 3, 2012 14:38
Trace all events in a node.js application
(function() {
var EventEmitter = require('events').EventEmitter;
var inspect = require('util').inspect;
var emit_ = EventEmitter.prototype.emit;
EventEmitter.prototype.emit = function(name) {
var args = Array.prototype.slice.call(arguments);
if (!(this === process.stderr && name === 'drain')) {
console.error("Event '%s', arguments: %s",
name, inspect(args.slice(1), false, 1));
}
From 61dbe66f45a86d5519bf25e403caf34f60ad9dd8 Mon Sep 17 00:00:00 2001
From: Ryan Dahl <ry@tinyclouds.org>
Date: Thu, 29 Dec 2011 16:06:14 -0800
Subject: [PATCH] Potential fix for #2438
---
src/node_http_parser.cc | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc
/*
* Copyright (c) 2011, Ben Noordhuis <info@bnoordhuis.nl>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@bnoordhuis
bnoordhuis / watch.c
Created November 22, 2011 14:03
file watching + event ports = disaster
/*
* Copyright (c) 2011, Ben Noordhuis <info@bnoordhuis.nl>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index c1e197b..cdc39de 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -54,8 +54,11 @@
return ThrowException(Exception::TypeError(String::New("Not a string or buffer"))); \
}
-static const char *PUBLIC_KEY_PFX = "-----BEGIN PUBLIC KEY-----";
-static const int PUBLIC_KEY_PFX_LEN = strlen(PUBLIC_KEY_PFX);
diff --git a/src/uv-common.c b/src/uv-common.c
index 3143bd2..9ace0f3 100644
--- a/src/uv-common.c
+++ b/src/uv-common.c
@@ -55,8 +55,7 @@ const char* uv_err_name(uv_err_t err) {
switch (err.code) {
UV_ERRNO_MAP(UV_ERR_NAME_GEN)
default:
- assert(0);
- return NULL;
diff --git a/src/unix/process.c b/src/unix/process.c
index c5a4592..59e1006 100644
--- a/src/unix/process.c
+++ b/src/unix/process.c
@@ -156,9 +156,14 @@ static int uv__process_init_pipe(uv_pipe_t* handle, int fds[2], int flags) {
return uv__make_pipe(fds, flags);
}
+#ifndef HAVE_VFORK
+# define HAVE_VFORK 1
@bnoordhuis
bnoordhuis / sunos-event-ports-fs.patch
Created November 10, 2011 14:28
libuv: check if event ports supports fs watching
diff --git a/include/uv-private/uv-unix.h b/include/uv-private/uv-unix.h
index b07781f..21078fe 100644
--- a/include/uv-private/uv-unix.h
+++ b/include/uv-private/uv-unix.h
@@ -204,10 +204,14 @@ typedef void* uv_lib_t;
#include <sys/port.h>
#include <port.h>
-#define UV_FS_EVENT_PRIVATE_FIELDS \
+#ifdef PORT_SOURCE_FILE