Skip to content

Commit a784aba

Browse files
committed
uv: Upgrade to v0.11.8
1 parent 41f55dc commit a784aba

28 files changed

Lines changed: 513 additions & 268 deletions

deps/uv/ChangeLog

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,55 @@
1-
2013.08.07, Version 0.11.7 (Unstable)
1+
2013.08.22, Version 0.11.8 (Unstable)
2+
3+
Changes since version 0.11.7:
4+
5+
* unix: fix missing return value warning in stream.c (Ben Noordhuis)
6+
7+
* build: serial-tests was added in automake v1.12 (Ben Noordhuis)
8+
9+
* windows: fix uninitialized local variable warning (Ben Noordhuis)
10+
11+
* windows: fix missing return value warning (Ben Noordhuis)
12+
13+
* build: fix string comparisons in autogen.sh (Ben Noordhuis)
14+
15+
* windows: move INLINE macro, remove UNUSED (Ben Noordhuis)
16+
17+
* unix: clean up __attribute__((quux)) usage (Ben Noordhuis)
18+
19+
* sunos: remove futimes() macro (Ben Noordhuis)
20+
21+
* unix: fix uv__signal_unlock() prototype (Ben Noordhuis)
22+
23+
* unix, windows: allow NULL async callback (Ben Noordhuis)
24+
25+
* build: apply dtrace -G to all object files (Timothy J. Fontaine)
26+
27+
* darwin: fix indentation in uv__hrtime() (Ben Noordhuis)
28+
29+
* darwin: create fsevents thread on demand (Ben Noordhuis)
30+
31+
* darwin: reduce fsevents thread stack size (Ben Noordhuis)
32+
33+
* darwin: call pthread_setname_np() if available (Ben Noordhuis)
34+
35+
* build: fix automake serial-tests check again (Ben Noordhuis)
36+
37+
* unix: retry waitpid() on EINTR (Ben Noordhuis)
38+
39+
* darwin: fix ios build error (Ben Noordhuis)
40+
41+
* darwin: fix ios compiler warning (Ben Noordhuis)
42+
43+
* test: simplify test-ip6-addr.c (Ben Noordhuis)
44+
45+
* unix, windows: fix ipv6 link-local address parsing (Ben Noordhuis)
46+
47+
* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny)
48+
49+
* windows: omit stdint.h, fix msvc 2008 build error (Ben Noordhuis)
50+
51+
52+
2013.08.07, Version 0.11.7 (Unstable), 3cad361f8776f70941b39d65bd9426bcb1aa817b
253

354
Changes since version 0.11.6:
455

deps/uv/Makefile.am

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ test_run_tests_SOURCES = test/blackhole-server.c \
6363
test/task.h \
6464
test/test-active.c \
6565
test/test-async.c \
66+
test/test-async-null-cb.c \
6667
test/test-barrier.c \
6768
test/test-callback-order.c \
6869
test/test-callback-stack.c \
@@ -215,7 +216,7 @@ src/unix/uv-dtrace.o: src/unix/uv-dtrace.d ${libuv_la_OBJECTS}
215216
# every created .o, most projects don't need to include more than one .d
216217
.d.o:
217218
$(AM_V_GEN)$(DTRACE) $(DTRACEFLAGS) -G -o $(top_builddir)/uv-dtrace.o -s $< \
218-
`grep '^pic_object' $$(find ${top_builddir} -name "*.lo") | cut -f 2 -d\'`
219+
`find ${top_builddir}/src -name "*.o"`
219220
$(AM_V_GEN)printf %s\\n \
220221
'# ${top_builddir}/uv-dtrace.lo - a libtool object file' \
221222
'# Generated by libtool (GNU libtool) 2.4' \

deps/uv/autogen.sh

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,33 @@
1414
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1515
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1616

17-
if [ "$LIBTOOLIZE" == "" ] && [ "`uname`" == "Darwin" ]; then
17+
cd `dirname "$0"`
18+
19+
if [ "$LIBTOOLIZE" = "" ] && [ "`uname`" = "Darwin" ]; then
1820
LIBTOOLIZE=glibtoolize
1921
fi
2022

23+
ACLOCAL=${ACLOCAL:-aclocal}
24+
AUTOCONF=${AUTOCONF:-autoconf}
25+
AUTOMAKE=${AUTOMAKE:-automake}
26+
LIBTOOLIZE=${LIBTOOLIZE:-libtoolize}
27+
28+
automake_version=`"$AUTOMAKE" --version | head -n 1 | sed 's/[^.0-9]//g'`
29+
automake_version_major=`echo "$automake_version" | cut -d. -f1`
30+
automake_version_minor=`echo "$automake_version" | cut -d. -f2`
31+
32+
UV_EXTRA_AUTOMAKE_FLAGS=
33+
if test "$automake_version_major" -gt 1 || \
34+
test "$automake_version_major" -eq 1 && \
35+
test "$automake_version_minor" -gt 11; then
36+
# serial-tests is available in v0.12 and newer.
37+
UV_EXTRA_AUTOMAKE_FLAGS="$UV_EXTRA_AUTOMAKE_FLAGS serial-tests"
38+
fi
39+
echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [$UV_EXTRA_AUTOMAKE_FLAGS])" \
40+
> m4/libuv-extra-automake-flags.m4
41+
2142
set -ex
22-
${LIBTOOLIZE:-libtoolize}
23-
${ACLOCAL:-aclocal -I m4}
24-
${AUTOCONF:-autoconf}
25-
${AUTOMAKE:-automake} --add-missing
43+
"$LIBTOOLIZE"
44+
"$ACLOCAL" -I m4
45+
"$AUTOCONF"
46+
"$AUTOMAKE" --add-missing --copy

deps/uv/configure.ac

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,9 @@
1414

1515
AC_PREREQ(2.57)
1616
AC_INIT([libuv], [0.11.5], [https://github.com/joyent/libuv/issues])
17-
# Use AM_SILENT_RULES as an ad-hoc version check to find out if it's safe
18-
# to use the serial-tests directive. Both were added in automake v0.11.
19-
AM_INIT_AUTOMAKE(m4_ifdef([AM_SILENT_RULES],
20-
[-Wall -Werror foreign subdir-objects serial-tests],
21-
[-Wall -Werror foreign subdir-objects]))
2217
AC_CONFIG_MACRO_DIR([m4])
18+
m4_include([m4/libuv-extra-automake-flags.m4])
19+
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects] UV_EXTRA_AUTOMAKE_FLAGS)
2320
AC_CANONICAL_HOST
2421
AC_ENABLE_SHARED
2522
AC_ENABLE_STATIC

deps/uv/include/uv.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,12 @@ struct uv_async_s {
12391239
UV_ASYNC_PRIVATE_FIELDS
12401240
};
12411241

1242+
/*
1243+
* Initialize the uv_async_t handle. A NULL callback is allowed.
1244+
*
1245+
* Note that uv_async_init(), unlike other libuv functions, immediately
1246+
* starts the handle. To stop the handle again, close it with uv_close().
1247+
*/
12421248
UV_EXTERN int uv_async_init(uv_loop_t*, uv_async_t* async,
12431249
uv_async_cb async_cb);
12441250

deps/uv/src/queue.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#ifndef QUEUE_H_
1717
#define QUEUE_H_
1818

19-
#include <stdint.h>
20-
2119
typedef void *QUEUE[2];
2220

2321
/* Private macros. */
@@ -28,7 +26,7 @@ typedef void *QUEUE[2];
2826

2927
/* Public macros. */
3028
#define QUEUE_DATA(ptr, type, field) \
31-
((type *) ((char *) (ptr) - ((uintptr_t) &((type *) 0)->field)))
29+
((type *) ((char *) (ptr) - ((char *) &((type *) 0)->field)))
3230

3331
#define QUEUE_FOREACH(q, h) \
3432
for ((q) = (QUEUE *) (*(h))[0]; (q) != (h); (q) = (QUEUE *) (*(q))[0])

deps/uv/src/unix/async.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,13 @@ static void uv__async_event(uv_loop_t* loop,
7878

7979
QUEUE_FOREACH(q, &loop->async_handles) {
8080
h = QUEUE_DATA(q, uv_async_t, queue);
81-
if (!h->pending) continue;
81+
82+
if (h->pending == 0)
83+
continue;
8284
h->pending = 0;
85+
86+
if (h->async_cb == NULL)
87+
continue;
8388
h->async_cb(h, 0);
8489
}
8590
}

deps/uv/src/unix/darwin-proctitle.c

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
* IN THE SOFTWARE.
1919
*/
2020

21+
#include <dlfcn.h>
22+
#include <errno.h>
23+
#include <stdlib.h>
24+
2125
#include <TargetConditionals.h>
2226

2327
#if !TARGET_OS_IPHONE
@@ -26,9 +30,30 @@
2630
#endif
2731

2832

33+
static int uv__pthread_setname_np(const char* name) {
34+
int (*dynamic_pthread_setname_np)(const char* name);
35+
char namebuf[64]; /* MAXTHREADNAMESIZE */
36+
int err;
37+
38+
/* pthread_setname_np() first appeared in OS X 10.6 and iOS 3.2. */
39+
dynamic_pthread_setname_np = dlsym(RTLD_DEFAULT, "pthread_setname_np");
40+
if (dynamic_pthread_setname_np == NULL)
41+
return -ENOSYS;
42+
43+
strncpy(namebuf, name, sizeof(namebuf) - 1);
44+
namebuf[sizeof(namebuf) - 1] = '\0';
45+
46+
err = dynamic_pthread_setname_np(namebuf);
47+
if (err)
48+
return -err;
49+
50+
return 0;
51+
}
52+
53+
2954
int uv__set_process_title(const char* title) {
3055
#if TARGET_OS_IPHONE
31-
return -ENOSYS;
56+
return uv__pthread_setname_np(title);
3257
#else
3358
typedef CFTypeRef (*LSGetCurrentApplicationASNType)(void);
3459
typedef OSStatus (*LSSetApplicationInformationItemType)(int,
@@ -84,6 +109,8 @@ int uv__set_process_title(const char* title) {
84109
if (err != noErr)
85110
return -ENOENT;
86111

112+
uv__pthread_setname_np(title); /* Don't care if it fails. */
113+
87114
return 0;
88115
#endif /* !TARGET_OS_IPHONE */
89116
}

deps/uv/src/unix/darwin.c

Lines changed: 6 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -29,163 +29,36 @@
2929
#include <net/if.h>
3030
#include <net/if_dl.h>
3131

32-
#include <CoreFoundation/CFRunLoop.h>
33-
3432
#include <mach/mach.h>
3533
#include <mach/mach_time.h>
3634
#include <mach-o/dyld.h> /* _NSGetExecutablePath */
3735
#include <sys/resource.h>
3836
#include <sys/sysctl.h>
3937
#include <unistd.h> /* sysconf */
4038

41-
/* Forward declarations */
42-
static void uv__cf_loop_runner(void* arg);
43-
static void uv__cf_loop_cb(void* arg);
44-
45-
typedef struct uv__cf_loop_signal_s uv__cf_loop_signal_t;
46-
struct uv__cf_loop_signal_s {
47-
void* arg;
48-
cf_loop_signal_cb cb;
49-
QUEUE member;
50-
};
51-
5239

5340
int uv__platform_loop_init(uv_loop_t* loop, int default_loop) {
54-
CFRunLoopSourceContext ctx;
55-
int r;
41+
loop->cf_loop = NULL;
5642

5743
if (uv__kqueue_init(loop))
5844
return -errno;
5945

60-
loop->cf_loop = NULL;
61-
if ((r = uv_mutex_init(&loop->cf_mutex)))
62-
return r;
63-
if ((r = uv_sem_init(&loop->cf_sem, 0)))
64-
return r;
65-
QUEUE_INIT(&loop->cf_signals);
66-
67-
memset(&ctx, 0, sizeof(ctx));
68-
ctx.info = loop;
69-
ctx.perform = uv__cf_loop_cb;
70-
loop->cf_cb = CFRunLoopSourceCreate(NULL, 0, &ctx);
71-
72-
if ((r = uv_thread_create(&loop->cf_thread, uv__cf_loop_runner, loop)))
73-
return r;
74-
75-
/* Synchronize threads */
76-
uv_sem_wait(&loop->cf_sem);
77-
assert(ACCESS_ONCE(CFRunLoopRef, loop->cf_loop) != NULL);
78-
7946
return 0;
8047
}
8148

8249

8350
void uv__platform_loop_delete(uv_loop_t* loop) {
84-
QUEUE* item;
85-
uv__cf_loop_signal_t* s;
86-
87-
assert(loop->cf_loop != NULL);
88-
uv__cf_loop_signal(loop, NULL, NULL);
89-
uv_thread_join(&loop->cf_thread);
90-
91-
uv_sem_destroy(&loop->cf_sem);
92-
uv_mutex_destroy(&loop->cf_mutex);
93-
94-
/* Free any remaining data */
95-
while (!QUEUE_EMPTY(&loop->cf_signals)) {
96-
item = QUEUE_HEAD(&loop->cf_signals);
97-
98-
s = QUEUE_DATA(item, uv__cf_loop_signal_t, member);
99-
100-
QUEUE_REMOVE(item);
101-
free(s);
102-
}
103-
}
104-
105-
106-
static void uv__cf_loop_runner(void* arg) {
107-
uv_loop_t* loop;
108-
109-
loop = arg;
110-
111-
/* Get thread's loop */
112-
ACCESS_ONCE(CFRunLoopRef, loop->cf_loop) = CFRunLoopGetCurrent();
113-
114-
CFRunLoopAddSource(loop->cf_loop,
115-
loop->cf_cb,
116-
kCFRunLoopDefaultMode);
117-
118-
uv_sem_post(&loop->cf_sem);
119-
120-
CFRunLoopRun();
121-
122-
CFRunLoopRemoveSource(loop->cf_loop,
123-
loop->cf_cb,
124-
kCFRunLoopDefaultMode);
125-
}
126-
127-
128-
static void uv__cf_loop_cb(void* arg) {
129-
uv_loop_t* loop;
130-
QUEUE* item;
131-
QUEUE split_head;
132-
uv__cf_loop_signal_t* s;
133-
134-
loop = arg;
135-
136-
uv_mutex_lock(&loop->cf_mutex);
137-
QUEUE_INIT(&split_head);
138-
if (!QUEUE_EMPTY(&loop->cf_signals)) {
139-
QUEUE* split_pos = QUEUE_HEAD(&loop->cf_signals);
140-
QUEUE_SPLIT(&loop->cf_signals, split_pos, &split_head);
141-
}
142-
uv_mutex_unlock(&loop->cf_mutex);
143-
144-
while (!QUEUE_EMPTY(&split_head)) {
145-
item = QUEUE_HEAD(&split_head);
146-
147-
s = QUEUE_DATA(item, uv__cf_loop_signal_t, member);
148-
149-
/* This was a termination signal */
150-
if (s->cb == NULL)
151-
CFRunLoopStop(loop->cf_loop);
152-
else
153-
s->cb(s->arg);
154-
155-
QUEUE_REMOVE(item);
156-
free(s);
157-
}
158-
}
159-
160-
161-
void uv__cf_loop_signal(uv_loop_t* loop, cf_loop_signal_cb cb, void* arg) {
162-
uv__cf_loop_signal_t* item;
163-
164-
item = malloc(sizeof(*item));
165-
/* XXX: Fail */
166-
if (item == NULL)
167-
abort();
168-
169-
item->arg = arg;
170-
item->cb = cb;
171-
172-
uv_mutex_lock(&loop->cf_mutex);
173-
QUEUE_INSERT_TAIL(&loop->cf_signals, &item->member);
174-
uv_mutex_unlock(&loop->cf_mutex);
175-
176-
assert(loop->cf_loop != NULL);
177-
CFRunLoopSourceSignal(loop->cf_cb);
178-
CFRunLoopWakeUp(loop->cf_loop);
51+
uv__fsevents_loop_delete(loop);
17952
}
18053

18154

18255
uint64_t uv__hrtime(void) {
183-
mach_timebase_info_data_t info;
56+
mach_timebase_info_data_t info;
18457

185-
if (mach_timebase_info(&info) != KERN_SUCCESS)
186-
abort();
58+
if (mach_timebase_info(&info) != KERN_SUCCESS)
59+
abort();
18760

188-
return mach_absolute_time() * info.numer / info.denom;
61+
return mach_absolute_time() * info.numer / info.denom;
18962
}
19063

19164

0 commit comments

Comments
 (0)