Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: stub file watcher implementation
Browse files Browse the repository at this point in the history
The file watcher API has not been implemented on all Unices yet.
Provide stubs on those platforms so libuv at least compiles.
  • Loading branch information
bnoordhuis committed Sep 22, 2011
1 parent 019e6ed commit 3368d6c
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 3 deletions.
5 changes: 5 additions & 0 deletions include/uv-private/uv-unix.h
Expand Up @@ -46,6 +46,11 @@ typedef struct {

typedef int uv_file;

/* Stub. Remove it once all platforms support the file watcher API. */
#ifndef UV_FS_EVENT_PRIVATE_FIELDS
#define UV_FS_EVENT_PRIVATE_FIELDS /* empty */
#endif

#define UV_LOOP_PRIVATE_FIELDS \
ares_channel channel; \
/* \
Expand Down
16 changes: 16 additions & 0 deletions src/unix/cygwin.c
Expand Up @@ -20,8 +20,10 @@

#include "uv.h"

#include <assert.h>
#include <stdint.h>
#include <stddef.h>
#include <errno.h>
#include <time.h>

#undef NANOSEC
Expand Down Expand Up @@ -50,3 +52,17 @@ int uv_exepath(char* buffer, size_t* size) {
buffer[*size] = '\0';
return 0;
}


int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb) {
uv_err_new(loop, ENOSYS);
return -1;
}


void uv__fs_event_destroy(uv_fs_event_t* handle) {
assert(0 && "implement me");
}
17 changes: 17 additions & 0 deletions src/unix/darwin.c
Expand Up @@ -20,7 +20,10 @@

#include "uv.h"

#include <assert.h>
#include <stdint.h>
#include <errno.h>

#include <CoreServices/CoreServices.h>
#include <mach/mach.h>
#include <mach/mach_time.h>
Expand Down Expand Up @@ -63,3 +66,17 @@ int uv_exepath(char* buffer, size_t* size) {
*size = strlen(buffer);
return 0;
}


int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb) {
uv_err_new(loop, ENOSYS);
return -1;
}


void uv__fs_event_destroy(uv_fs_event_t* handle) {
assert(0 && "implement me");
}
19 changes: 18 additions & 1 deletion src/unix/freebsd.c
Expand Up @@ -20,15 +20,18 @@

#include "uv.h"

#include <assert.h>
#include <string.h>
#include <time.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/sysctl.h>
#include <time.h>

#undef NANOSEC
#define NANOSEC 1000000000


uint64_t uv_hrtime(void) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
Expand Down Expand Up @@ -63,3 +66,17 @@ int uv_exepath(char* buffer, size_t* size) {

return 0;
}


int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb) {
uv_err_new(loop, ENOSYS);
return -1;
}


void uv__fs_event_destroy(uv_fs_event_t* handle) {
assert(0 && "implement me");
}
19 changes: 18 additions & 1 deletion src/unix/netbsd.c
Expand Up @@ -20,17 +20,20 @@

#include "uv.h"

#include <assert.h>
#include <string.h>
#include <time.h>
#include <errno.h>

#include <sys/types.h>
#include <sys/sysctl.h>

#include <unistd.h>
#include <time.h>

#undef NANOSEC
#define NANOSEC 1000000000


uint64_t uv_hrtime(void) {
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
Expand Down Expand Up @@ -66,3 +69,17 @@ int uv_exepath(char* buffer, size_t* size) {

return 0;
}


int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb) {
uv_err_new(loop, ENOSYS);
return -1;
}


void uv__fs_event_destroy(uv_fs_event_t* handle) {
assert(0 && "implement me");
}
19 changes: 18 additions & 1 deletion src/unix/sunos.c
Expand Up @@ -22,8 +22,11 @@

#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>

#include <sys/time.h>
#include <unistd.h>


uint64_t uv_hrtime() {
Expand Down Expand Up @@ -58,3 +61,17 @@ int uv_exepath(char* buffer, size_t* size) {
*size = res;
return (0);
}


int uv_fs_event_init(uv_loop_t* loop,
uv_fs_event_t* handle,
const char* filename,
uv_fs_event_cb cb) {
uv_err_new(loop, ENOSYS);
return -1;
}


void uv__fs_event_destroy(uv_fs_event_t* handle) {
assert(0 && "implement me");
}

0 comments on commit 3368d6c

Please sign in to comment.