Skip to content

Commit

Permalink
Merge branch 'v0.6-isolate' into v0.6-android
Browse files Browse the repository at this point in the history
  • Loading branch information
paddybyers committed Nov 29, 2011
2 parents 2aaa46a + 981d886 commit d02a476
Show file tree
Hide file tree
Showing 36 changed files with 967 additions and 183 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
BUILDTYPE ?= Release

all: out/Makefile
tools/gyp_node -f make
$(MAKE) -C out BUILDTYPE=$(BUILDTYPE)
-ln -fs out/Release/node node
-ln -fs out/Debug/node node_g
Expand All @@ -14,7 +13,8 @@ clean:
rm -rf out

distclean:
rm -rf out
-rm -rf out
-rm options.gypi

test: all
python tools/test.py --mode=release simple message
Expand Down
6 changes: 6 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
'cflags': [ '-Wall', '-pthread', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
'ldflags': [ '-pthread', ],
'defines': [
'V8_SHARED=1',
],
'conditions': [
[ 'target_arch=="ia32"', {
'cflags': [ '-m32' ],
Expand Down Expand Up @@ -155,6 +158,9 @@
'-Wno-unused-parameter',
],
},
'defines': [
'V8_SHARED=1',
],
'target_conditions': [
['_type!="static_library"', {
'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
Expand Down
10 changes: 9 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ parser.add_option("--with-dtrace",
dest="with_dtrace",
help="Build with DTrace (experimental)")

parser.add_option("--isolate",
action="store_true",
dest="isolate",
help="Build with Isolate support")

# CHECKME does this still work with recent releases of V8?
parser.add_option("--gdb",
action="store_true",
Expand Down Expand Up @@ -151,6 +156,7 @@ def configure_node(o):
o['variables']['node_use_dtrace'] = 'true' if options.with_dtrace else 'false'
o['variables']['host_arch'] = host_arch()
o['variables']['target_arch'] = target_arch()
o['variables']['node_isolate'] = 'true' if options.isolate else 'false'

# TODO move to node.gyp
if sys.platform == 'sunos5':
Expand Down Expand Up @@ -246,4 +252,6 @@ json.dump(output, f, indent=2, skipkeys=True)
f.write("\n")
f.close()

subprocess.call('tools/gyp_node')
gyp_target = 'xcode' if sys.platform == 'darwin' else 'make'

subprocess.call(['tools/gyp_node','-f', gyp_target])
1 change: 1 addition & 0 deletions deps/uv/config-unix.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ OBJS += src/unix/fs.o
OBJS += src/unix/cares.o
OBJS += src/unix/udp.o
OBJS += src/unix/error.o
OBJS += src/unix/thread.o
OBJS += src/unix/process.o
OBJS += src/unix/tcp.o
OBJS += src/unix/pipe.o
Expand Down
4 changes: 4 additions & 0 deletions deps/uv/include/uv-private/uv-unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <netdb.h>
#include <pthread.h>
#include <termios.h>
#include <pthread.h>

/* Note: May be cast to struct iovec. See writev(2). */
typedef struct {
Expand All @@ -44,6 +45,9 @@ typedef struct {

typedef int uv_file;

typedef pthread_mutex_t uv_mutex_t;
typedef pthread_rwlock_t uv_rwlock_t;

/* Platform-specific definitions for uv_dlopen support. */
typedef void* uv_lib_t;
#define UV_DYNAMIC /* empty */
Expand Down
11 changes: 11 additions & 0 deletions deps/uv/include/uv-private/uv-win.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ typedef struct uv_buf_t {

typedef int uv_file;

typedef CRITICAL_SECTION uv_mutex_t;

typedef union {
SRWLOCK srwlock_;
struct {
uv_mutex_t read_mutex_;
uv_mutex_t write_mutex_;
unsigned int num_readers_;
} fallback_;
} uv_rwlock_t;

/* Platform-specific definitions for uv_dlopen support. */
typedef HMODULE uv_lib_t;
#define UV_DYNAMIC FAR WINAPI
Expand Down
14 changes: 14 additions & 0 deletions deps/uv/include/uv.h
Original file line number Diff line number Diff line change
Expand Up @@ -1297,6 +1297,20 @@ UV_EXTERN uv_err_t uv_dlclose(uv_lib_t library);
*/
UV_EXTERN uv_err_t uv_dlsym(uv_lib_t library, const char* name, void** ptr);

UV_EXTERN int uv_mutex_init(uv_mutex_t* handle);
UV_EXTERN void uv_mutex_destroy(uv_mutex_t* handle);
UV_EXTERN void uv_mutex_lock(uv_mutex_t* handle);
UV_EXTERN int uv_mutex_trylock(uv_mutex_t* handle);
UV_EXTERN void uv_mutex_unlock(uv_mutex_t* handle);

UV_EXTERN int uv_rwlock_init(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_destroy(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_rdlock(uv_rwlock_t* rwlock);
UV_EXTERN int uv_rwlock_tryrdlock(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_rdunlock(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_wrlock(uv_rwlock_t* rwlock);
UV_EXTERN int uv_rwlock_trywrlock(uv_rwlock_t* rwlock);
UV_EXTERN void uv_rwlock_wrunlock(uv_rwlock_t* rwlock);

/* the presence of these unions force similar struct layout */
union uv_any_handle {
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/src/unix/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,8 +739,8 @@ int uv__accept(int sockfd, struct sockaddr* saddr, socklen_t slen) {
assert(sockfd >= 0);

while (1) {
#if HAVE_ACCEPT4
peerfd = accept4(sockfd, saddr, &slen, SOCK_NONBLOCK | SOCK_CLOEXEC);
#if HAVE_SYS_ACCEPT4
peerfd = sys_accept4(sockfd, saddr, &slen, SOCK_NONBLOCK | SOCK_CLOEXEC);

if (peerfd != -1)
break;
Expand Down
71 changes: 55 additions & 16 deletions deps/uv/src/unix/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,70 @@
#include <stddef.h> /* offsetof */

#undef HAVE_FUTIMES
#undef HAVE_PIPE2
#undef HAVE_ACCEPT4
#undef HAVE_KQUEUE
#undef HAVE_PORTS_FS

#if defined(ANDROID)
#elif defined(__linux__)

#include <linux/version.h>
#include <features.h>
# undef HAVE_SYS_UTIMESAT
# undef HAVE_SYS_PIPE2
# undef HAVE_SYS_ACCEPT4

/* futimes() requires linux >= 2.6.22 and glib >= 2.6 */
#if LINUX_VERSION_CODE >= 0x20616 && __GLIBC_PREREQ(2, 6)
#define HAVE_FUTIMES 1
#endif
# undef _GNU_SOURCE
# define _GNU_SOURCE

/* pipe2() requires linux >= 2.6.27 and glibc >= 2.9 */
#if LINUX_VERSION_CODE >= 0x2061B && __GLIBC_PREREQ(2, 9)
#define HAVE_PIPE2 1
#endif
# include <linux/version.h>
# include <sys/syscall.h>
# include <features.h>
# include <unistd.h>

/* accept4() requires linux >= 2.6.28 and glib >= 2.10 */
#if LINUX_VERSION_CODE >= 0x2061C && __GLIBC_PREREQ(2, 10)
#define HAVE_ACCEPT4 1
#endif
# if __NR_utimensat
# define HAVE_SYS_UTIMESAT 1
# endif
# if __NR_pipe2
# define HAVE_SYS_PIPE2 1
# endif
# if __NR_accept4
# define HAVE_SYS_ACCEPT4 1
# endif

# if HAVE_SYS_UTIMESAT
inline static int sys_utimesat(int dirfd,
const char* path,
const struct timespec times[2],
int flags)
{
return syscall(__NR_utimensat, dirfd, path, times, flags);
}
inline static int sys_futimes(int fd, const struct timeval times[2])
{
struct timespec ts[2];
ts[0].tv_sec = times[0].tv_sec, ts[0].tv_nsec = times[0].tv_usec * 1000;
ts[1].tv_sec = times[1].tv_sec, ts[1].tv_nsec = times[1].tv_usec * 1000;
return sys_utimesat(fd, NULL, ts, 0);
}
# undef HAVE_FUTIMES
# define HAVE_FUTIMES 1
# define futimes(fd, times) sys_futimes(fd, times)
# endif /* HAVE_SYS_FUTIMESAT */

# if HAVE_SYS_PIPE2
inline static int sys_pipe2(int pipefd[2], int flags)
{
return syscall(__NR_pipe2, pipefd, flags);
}
# endif /* HAVE_SYS_PIPE2 */

# if HAVE_SYS_ACCEPT4
inline static int sys_accept4(int fd,
struct sockaddr* addr,
socklen_t* addrlen,
int flags)
{
return syscall(__NR_accept4, fd, addr, addrlen, flags);
}
# endif /* HAVE_SYS_ACCEPT4 */

#endif /* __linux__ */

Expand Down
1 change: 1 addition & 0 deletions deps/uv/src/unix/kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ int uv_fs_event_init(uv_loop_t* loop,


void uv__fs_event_destroy(uv_fs_event_t* handle) {
uv__fs_event_stop(handle);
free(handle->filename);
uv__close(handle->fd);
handle->fd = -1;
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/src/unix/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ static int uv__make_socketpair(int fds[2], int flags) {


static int uv__make_pipe(int fds[2], int flags) {
#if HAVE_PIPE2
#if HAVE_SYS_PIPE2
int fl;

fl = O_CLOEXEC;

if (flags & UV__F_NONBLOCK)
fl |= O_NONBLOCK;

if (pipe2(fds, fl) == 0)
if (sys_pipe2(fds, fl) == 0)
return 0;

if (errno != ENOSYS)
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/src/unix/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void uv__stream_destroy(uv_stream_t* stream) {

req = ngx_queue_data(q, uv_write_t, queue);
if (req->cb) {
uv__set_sys_error(stream->loop, req->error);
uv__set_artificial_error(stream->loop, req->error);
req->cb(req, req->error ? -1 : 0);
}
}
Expand Down Expand Up @@ -490,7 +490,7 @@ static void uv__write_callbacks(uv_stream_t* stream) {

/* NOTE: call callback AFTER freeing the request data. */
if (req->cb) {
uv__set_sys_error(stream->loop, req->error);
uv__set_artificial_error(stream->loop, req->error);
req->cb(req, req->error ? -1 : 0);
}

Expand Down
Loading

0 comments on commit d02a476

Please sign in to comment.