aix: add ahafs autoconf detection and README notes
The libuv filesystem events API on AIX requires the non-default IBM `bos.ahafs` package to be installed. The library should still compile and work on systems without this package. This patch adds proper detection to `configure.ac` and makes the API return `-ENOSYS` at runtime if the system does not support it. PR-URL: https://github.com/libuv/libuv/pull/372 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit is contained in:
parent
266ee6424f
commit
bb2632b339
12
README.md
12
README.md
@ -185,6 +185,18 @@ OS X using the GCC or XCode toolchain.
|
|||||||
|
|
||||||
Solaris 121 and later using GCC toolchain.
|
Solaris 121 and later using GCC toolchain.
|
||||||
|
|
||||||
|
AIX 6 and later using GCC toolchain (see notes).
|
||||||
|
|
||||||
|
### AIX Notes
|
||||||
|
|
||||||
|
AIX support for filesystem events requires the non-default IBM `bos.ahafs`
|
||||||
|
package to be installed. This package provides the AIX Event Infrastructure
|
||||||
|
that is detected by `autoconf`.
|
||||||
|
[IBM documentation](http://www.ibm.com/developerworks/aix/library/au-aix_event_infrastructure/)
|
||||||
|
describes the package in more detail.
|
||||||
|
|
||||||
|
AIX support for filesystem events is not compiled when building with `gyp`.
|
||||||
|
|
||||||
## Patches
|
## Patches
|
||||||
|
|
||||||
See the [guidelines for contributing][].
|
See the [guidelines for contributing][].
|
||||||
|
|||||||
@ -58,6 +58,7 @@ AM_CONDITIONAL([NETBSD], [AS_CASE([$host_os],[netbsd*], [true], [false])
|
|||||||
AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
|
AM_CONDITIONAL([OPENBSD], [AS_CASE([$host_os],[openbsd*], [true], [false])])
|
||||||
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
|
AM_CONDITIONAL([SUNOS], [AS_CASE([$host_os],[solaris*], [true], [false])])
|
||||||
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
|
AM_CONDITIONAL([WINNT], [AS_CASE([$host_os],[mingw*], [true], [false])])
|
||||||
|
AC_CHECK_HEADERS([sys/ahafs_evProds.h])
|
||||||
AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
|
AC_CHECK_PROG(PKG_CONFIG, pkg-config, yes)
|
||||||
AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"])
|
AM_CONDITIONAL([HAVE_PKG_CONFIG], [test "x$PKG_CONFIG" != "x"])
|
||||||
AS_IF([test "x$PKG_CONFIG" != "x"], [
|
AS_IF([test "x$PKG_CONFIG" != "x"], [
|
||||||
|
|||||||
@ -50,7 +50,9 @@
|
|||||||
|
|
||||||
#include <sys/pollset.h>
|
#include <sys/pollset.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
||||||
#include <sys/ahafs_evProds.h>
|
#include <sys/ahafs_evProds.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/mntctl.h>
|
#include <sys/mntctl.h>
|
||||||
#include <sys/vmount.h>
|
#include <sys/vmount.h>
|
||||||
@ -501,6 +503,7 @@ void uv_loadavg(double avg[3]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
||||||
static char *uv__rawname(char *cp) {
|
static char *uv__rawname(char *cp) {
|
||||||
static char rawbuf[FILENAME_MAX+1];
|
static char rawbuf[FILENAME_MAX+1];
|
||||||
char *dp = rindex(cp, '/');
|
char *dp = rindex(cp, '/');
|
||||||
@ -859,11 +862,16 @@ static void uv__ahafs_event(uv_loop_t* loop, uv__io_t* event_watch, unsigned int
|
|||||||
else /* Call the actual JavaScript callback function */
|
else /* Call the actual JavaScript callback function */
|
||||||
handle->cb(handle, (const char*)&fname, events, 0);
|
handle->cb(handle, (const char*)&fname, events, 0);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
|
int uv_fs_event_init(uv_loop_t* loop, uv_fs_event_t* handle) {
|
||||||
|
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
||||||
uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
|
uv__handle_init(loop, (uv_handle_t*)handle, UV_FS_EVENT);
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return -ENOSYS;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -871,6 +879,7 @@ int uv_fs_event_start(uv_fs_event_t* handle,
|
|||||||
uv_fs_event_cb cb,
|
uv_fs_event_cb cb,
|
||||||
const char* filename,
|
const char* filename,
|
||||||
unsigned int flags) {
|
unsigned int flags) {
|
||||||
|
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
||||||
int fd, rc, i = 0, res = 0;
|
int fd, rc, i = 0, res = 0;
|
||||||
char cwd[PATH_MAX];
|
char cwd[PATH_MAX];
|
||||||
char absolute_path[PATH_MAX];
|
char absolute_path[PATH_MAX];
|
||||||
@ -937,11 +946,14 @@ int uv_fs_event_start(uv_fs_event_t* handle,
|
|||||||
uv__io_start(handle->loop, &handle->event_watcher, UV__POLLIN);
|
uv__io_start(handle->loop, &handle->event_watcher, UV__POLLIN);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return -ENOSYS;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int uv_fs_event_stop(uv_fs_event_t* handle) {
|
int uv_fs_event_stop(uv_fs_event_t* handle) {
|
||||||
|
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
||||||
if (!uv__is_active(handle))
|
if (!uv__is_active(handle))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -959,11 +971,18 @@ int uv_fs_event_stop(uv_fs_event_t* handle) {
|
|||||||
handle->event_watcher.fd = -1;
|
handle->event_watcher.fd = -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
#else
|
||||||
|
return -ENOSYS;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void uv__fs_event_close(uv_fs_event_t* handle) {
|
void uv__fs_event_close(uv_fs_event_t* handle) {
|
||||||
|
#ifdef HAVE_SYS_AHAFS_EVPRODS_H
|
||||||
uv_fs_event_stop(handle);
|
uv_fs_event_stop(handle);
|
||||||
|
#else
|
||||||
|
UNREACHABLE();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user