Skip to content

Instantly share code, notes, and snippets.

@ThisIsMissEm
Created October 14, 2010 06:23
Show Gist options
  • Select an option

  • Save ThisIsMissEm/625682 to your computer and use it in GitHub Desktop.

Select an option

Save ThisIsMissEm/625682 to your computer and use it in GitHub Desktop.
// Copyright 2009 Ryan Dahl <ry@tinyclouds.org>
#ifndef SRC_OS_H_
#define SRC_OS_H_
#include <node.h>
#include <v8.h>
#include <sys/types.h>
#include <pwd.h> /* getpwuid() */
#include <grp.h> /* getgrgid() */
namespace node {
#define THROW_BAD_ARGS \
ThrowException(Exception::TypeError(String::New("Bad argument")))
#define ASYNC_CUSTOM_CALL(func, callback, data) \
eio_req *req = eio_custom(func, EIO_PRI_DEFAULT, callback, data); \
assert(req); \
ev_ref(EV_DEFAULT_UC); \
return Undefined();
struct user_request {
void *cb;
int type; // 0 is with uid, 1 is with uname
uid_t uid;
char name[1];
struct passwd result;
int errorno;
};
class Os {
public:
static void Initialize(v8::Handle<v8::Object> target);
};
} // namespace node
#endif // SRC_OS_H_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment