unix: stub file watcher implementation

The file watcher API has not been implemented on all Unices yet.
Provide stubs on those platforms so libuv at least compiles.
This commit is contained in:
Ben Noordhuis 2011-09-22 23:41:25 +02:00
parent 019e6edf47
commit 3368d6c1a2
6 changed files with 92 additions and 3 deletions

View File

@ -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; \
/* \

View File

@ -20,8 +20,10 @@
#include "uv.h"
#include <assert.h>
#include <stdint.h>
#include <stddef.h>
#include <errno.h>
#include <time.h>
#undef NANOSEC
@ -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");
}

View File

@ -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>
@ -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");
}

View File

@ -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);
@ -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");
}

View File

@ -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);
@ -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");
}

View File

@ -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() {
@ -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");
}