| Index: ports/libevent/nacl.patch
|
| diff --git a/ports/libevent/nacl.patch b/ports/libevent/nacl.patch
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..0cc281d77a7090b00f9f513baff48271ff34280a
|
| --- /dev/null
|
| +++ b/ports/libevent/nacl.patch
|
| @@ -0,0 +1,65 @@
|
| +diff --git a/evutil.c b/evutil.c
|
| +--- a/evutil.c
|
| ++++ b/evutil.c
|
| +@@ -183,9 +183,15 @@ int
|
| + evutil_socketpair(int family, int type, int protocol, evutil_socket_t fd[2])
|
| + {
|
| + #ifndef WIN32
|
| +- return socketpair(family, type, protocol, fd);
|
| ++ #ifdef __native_client__
|
| ++ // nacl.io lacks socketpair implementation.
|
| ++ // TODO(dt) remove this once socketpair is available on nacl.io
|
| ++ return evutil_ersatz_socketpair(family, type, protocol, fd);
|
| ++ #else
|
| ++ return socketpair(family, type, protocol, fd);
|
| ++ #endif
|
| + #else
|
| +- return evutil_ersatz_socketpair(family, type, protocol, fd);
|
| ++ return evutil_ersatz_socketpair(family, type, protocol, fd);
|
| + #endif
|
| + }
|
| +
|
| +@@ -2187,4 +2193,3 @@ evutil_load_windows_system_library(const TCHAR *library_name)
|
| + return LoadLibrary(path);
|
| + }
|
| + #endif
|
| +-
|
| +diff --git a/sample/hello-world.c b/sample/hello-world.c
|
| +--- a/sample/hello-world.c
|
| ++++ b/sample/hello-world.c
|
| +@@ -66,14 +66,18 @@ main(int argc, char **argv)
|
| + if (!listener) {
|
| + fprintf(stderr, "Could not create a listener!\n");
|
| + return 1;
|
| +- }
|
| ++ }else{
|
| ++ printf("\n listening on port %d\n",PORT);
|
| ++ }
|
| +
|
| ++// nacl do not support signals
|
| ++/*
|
| + signal_event = evsignal_new(base, SIGINT, signal_cb, (void *)base);
|
| +
|
| + if (!signal_event || event_add(signal_event, NULL)<0) {
|
| + fprintf(stderr, "Could not create/add a signal event!\n");
|
| + return 1;
|
| +- }
|
| ++ }*/
|
| +
|
| + event_base_dispatch(base);
|
| +
|
| +@@ -129,6 +133,8 @@ conn_eventcb(struct bufferevent *bev, short events, void *user_data)
|
| + bufferevent_free(bev);
|
| + }
|
| +
|
| ++// nacl don't support signals
|
| ++/*
|
| + static void
|
| + signal_cb(evutil_socket_t sig, short events, void *user_data)
|
| + {
|
| +@@ -138,4 +144,4 @@ signal_cb(evutil_socket_t sig, short events, void *user_data)
|
| + printf("Caught an interrupt signal; exiting cleanly in two seconds.\n");
|
| +
|
| + event_base_loopexit(base, &delay);
|
| +-}
|
| ++}*/
|
|
|