Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
uv: upgrade to 61a6e06e
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny committed Jun 18, 2012
1 parent 30ab1f5 commit 057b806
Show file tree
Hide file tree
Showing 18 changed files with 497 additions and 23 deletions.
4 changes: 2 additions & 2 deletions deps/uv/config-mingw.mk
Expand Up @@ -37,8 +37,8 @@ RUNNER_LINKFLAGS=$(LINKFLAGS)
RUNNER_LIBS=-lws2_32 -lpsapi -liphlpapi
RUNNER_SRC=test/runner-win.c

uv.a: $(WIN_OBJS) src/cares.o src/uv-common.o $(CARES_OBJS)
$(AR) rcs uv.a $(WIN_OBJS) src/cares.o src/uv-common.o $(CARES_OBJS)
uv.a: $(WIN_OBJS) src/cares.o src/fs-poll.o src/uv-common.o $(CARES_OBJS)
$(AR) rcs uv.a $^

src/%.o: src/%.c include/uv.h include/uv-private/uv-win.h
$(CC) $(CFLAGS) -c $< -o $@
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/config-unix.mk
Expand Up @@ -129,8 +129,8 @@ endif
RUNNER_LIBS=
RUNNER_SRC=test/runner-unix.c

uv.a: $(OBJS) src/cares.o src/uv-common.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o $(CARES_OBJS)
$(AR) rcs uv.a $(OBJS) src/cares.o src/uv-common.o src/unix/uv-eio.o src/unix/ev/ev.o src/unix/eio/eio.o $(CARES_OBJS)
uv.a: $(OBJS) src/cares.o src/fs-poll.o src/uv-common.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o $(CARES_OBJS)
$(AR) rcs uv.a $^

src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
$(CC) $(CSTDFLAG) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
Expand Down
8 changes: 7 additions & 1 deletion deps/uv/include/uv-private/uv-unix.h
Expand Up @@ -28,13 +28,17 @@
#include "eio.h"

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <pwd.h>

#include <termios.h>
#include <pwd.h>

#include <semaphore.h>
#include <pthread.h>
Expand All @@ -55,6 +59,8 @@ typedef int uv_file;

typedef int uv_os_sock_t;

typedef struct stat uv_statbuf_t;

#define UV_ONCE_INIT PTHREAD_ONCE_INIT

typedef pthread_once_t uv_once_t;
Expand Down
2 changes: 2 additions & 0 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -165,6 +165,8 @@ typedef struct uv_buf_t {

typedef int uv_file;

typedef struct _stati64 uv_statbuf_t;

typedef SOCKET uv_os_sock_t;

typedef HANDLE uv_thread_t;
Expand Down
68 changes: 58 additions & 10 deletions deps/uv/include/uv.h
Expand Up @@ -140,6 +140,7 @@ typedef enum {
XX(ASYNC, async) \
XX(CHECK, check) \
XX(FS_EVENT, fs_event) \
XX(FS_POLL, fs_poll) \
XX(IDLE, idle) \
XX(NAMED_PIPE, pipe) \
XX(POLL, poll) \
Expand Down Expand Up @@ -209,6 +210,7 @@ typedef struct uv_udp_send_s uv_udp_send_t;
typedef struct uv_fs_s uv_fs_t;
/* uv_fs_event_t is a subclass of uv_handle_t. */
typedef struct uv_fs_event_s uv_fs_event_t;
typedef struct uv_fs_poll_s uv_fs_poll_t;
typedef struct uv_work_s uv_work_t;


Expand Down Expand Up @@ -312,6 +314,11 @@ typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg);
typedef void (*uv_fs_event_cb)(uv_fs_event_t* handle, const char* filename,
int events, int status);

typedef void (*uv_fs_poll_cb)(uv_fs_poll_t* handle,
int status,
uv_statbuf_t* prev,
uv_statbuf_t* curr);

typedef enum {
UV_LEAVE_GROUP = 0,
UV_JOIN_GROUP
Expand Down Expand Up @@ -1510,6 +1517,46 @@ struct uv_fs_event_s {
};


/*
* uv_fs_stat() based polling file watcher.
*/
struct uv_fs_poll_s {
UV_HANDLE_FIELDS
/* Private, don't touch. */
int busy_polling; /* TODO(bnoordhuis) Fold into flags field. */
unsigned int interval;
uint64_t start_time;
char* path;
uv_fs_poll_cb poll_cb;
uv_timer_t timer_handle;
uv_fs_t* fs_req;
uv_statbuf_t statbuf;
};

UV_EXTERN int uv_fs_poll_init(uv_loop_t* loop, uv_fs_poll_t* handle);

/*
* Check the file at `path` for changes every `interval` milliseconds.
*
* Your callback i invoked with `status == -1` if `path` does not exist
* or is inaccessible. The watcher is *not* stopped but your callback is
* not called again until something changes (e.g. when the file is created
* or the error reason changes).
*
* When `status == 0`, your callback receives pointers to the old and new
* `uv_statbuf_t` structs. They are valid for the duration of the callback
* only!
*
* For maximum portability, use multi-second intervals. Sub-second intervals
* will not detect all changes on many file systems.
*/
UV_EXTERN int uv_fs_poll_start(uv_fs_poll_t* handle,
uv_fs_poll_cb poll_cb,
const char* path,
unsigned int interval);

UV_EXTERN int uv_fs_poll_stop(uv_fs_poll_t* handle);

/*
* Gets load avg
* See: http://en.wikipedia.org/wiki/Load_(computing)
Expand Down Expand Up @@ -1683,22 +1730,23 @@ union uv_any_req {


struct uv_counters_s {
uint64_t async_init;
uint64_t check_init;
uint64_t eio_init;
uint64_t req_init;
uint64_t fs_event_init;
uint64_t fs_poll_init;
uint64_t handle_init;
uint64_t stream_init;
uint64_t tcp_init;
uint64_t udp_init;
uint64_t idle_init;
uint64_t pipe_init;
uint64_t tty_init;
uint64_t poll_init;
uint64_t prepare_init;
uint64_t check_init;
uint64_t idle_init;
uint64_t async_init;
uint64_t timer_init;
uint64_t process_init;
uint64_t fs_event_init;
uint64_t req_init;
uint64_t stream_init;
uint64_t tcp_init;
uint64_t timer_init;
uint64_t tty_init;
uint64_t udp_init;
};


Expand Down

0 comments on commit 057b806

Please sign in to comment.