Skip to content
Browse files

aix: add initial platform support for aix using gcc/gxlc

Adds initial libuv build/platform support for AIX. Builds work using gcc or the
IBM XL C compiler using its gxlc wrapper. Platform support is added for
uv_hrtime, uv_exepath, uv_get_free_memory, uv_get_total_memory, uv_loadavg,
uv_uptime, uv_cpu_info, uv_interface_addresses.
  • Loading branch information...
1 parent 9aead82 commit 900ad30b43599e9ac13a84e634db414846d0af6e @apaprocki apaprocki committed with piscisaureus Sep 14, 2012
Showing with 644 additions and 15 deletions.
  1. +8 −0 config-unix.mk
  2. +2 −1 include/uv.h
  3. +393 −0 src/unix/aix.c
  4. +84 −0 src/unix/eio/config_aix.h
  5. +1 −1 src/unix/eio/eio.c
  6. +2 −2 src/unix/eio/xthread.h
  7. +2 −0 src/unix/error.c
  8. +122 −0 src/unix/ev/config_aix.h
  9. +2 −2 src/unix/ev/ev.c
  10. +4 −6 test/test-fs.c
  11. +3 −3 test/test-thread.c
  12. +21 −0 uv.gyp
View
8 config-unix.mk
@@ -53,6 +53,14 @@ LINKFLAGS+=-lsocket -lnsl -lkstat
OBJS += src/unix/sunos.o
endif
+ifeq (AIX,$(uname_S))
+EV_CONFIG=config_aix.h
+EIO_CONFIG=config_aix.h
+CPPFLAGS += -Isrc/ares/config_aix -D_ALL_SOURCE -D_XOPEN_SOURCE=500
+LINKFLAGS+= -lperfstat
+OBJS += src/unix/aix.o
+endif
+
ifeq (Darwin,$(uname_S))
EV_CONFIG=config_darwin.h
EIO_CONFIG=config_darwin.h
View
3 include/uv.h
@@ -57,7 +57,8 @@ extern "C" {
# define __unix__
#endif
-#if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
+#if defined(__unix__) || defined(__POSIX__) || \
+ defined(__APPLE__) || defined(_AIX)
# include "uv-private/uv-unix.h"
#else
# include "uv-private/uv-win.h"
View
393 src/unix/aix.c
@@ -0,0 +1,393 @@
+/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+#include "uv.h"
+#include "internal.h"
+
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <assert.h>
+#include <errno.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <sys/time.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <utmp.h>
+
+#include <sys/protosw.h>
+#include <libperfstat.h>
+#include <sys/proc.h>
+#include <sys/procfs.h>
+
+uint64_t uv_hrtime() {
+ uint64_t G = 1000000000;
+ timebasestruct_t t;
+ read_wall_time(&t, TIMEBASE_SZ);
+ time_base_to_time(&t, TIMEBASE_SZ);
+ return (uint64_t) t.tb_high * G + t.tb_low;
+}
+
+
+/*
+ * We could use a static buffer for the path manipulations that we need outside
+ * of the function, but this function could be called by multiple consumers and
+ * we don't want to potentially create a race condition in the use of snprintf.
+ */
+int uv_exepath(char* buffer, size_t* size) {
+ ssize_t res;
+ char pp[64], cwdl[PATH_MAX];
+ size_t cwdl_len;
+ struct psinfo ps;
+ int fd;
+
+ if (buffer == NULL)
+ return (-1);
+
+ if (size == NULL)
+ return (-1);
+
+ (void) snprintf(pp, sizeof(pp), "/proc/%lu/cwd", (unsigned long) getpid());
+
+ res = readlink(pp, cwdl, sizeof(cwdl) - 1);
+ if (res < 0)
+ return res;
+
+ cwdl[res] = '\0';
+ cwdl_len = res;
+
+ (void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid());
+ fd = open(pp, O_RDONLY);
+ if (fd < 0)
+ return fd;
+
+ res = read(fd, &ps, sizeof(ps));
+ close(fd);
+ if (res < 0)
+ return res;
+
+ (void) snprintf(buffer, *size, "%s%s", cwdl, ps.pr_fname);
+ *size = strlen(buffer);
+ return 0;
+}
+
+
+uint64_t uv_get_free_memory(void) {
+ perfstat_memory_total_t mem_total;
+ int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1);
+ if (result == -1) {
+ return 0;
+ }
+ return mem_total.real_free * 4096;
+}
+
+
+uint64_t uv_get_total_memory(void) {
+ perfstat_memory_total_t mem_total;
+ int result = perfstat_memory_total(NULL, &mem_total, sizeof(mem_total), 1);
+ if (result == -1) {
+ return 0;
+ }
+ return mem_total.real_total * 4096;
+}
+
+
+void uv_loadavg(double avg[3]) {
+ perfstat_cpu_total_t ps_total;
+ int result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1);
+ if (result == -1) {
+ avg[0] = 0.; avg[1] = 0.; avg[2] = 0.;
+ return;
+ }
+ avg[0] = ps_total.loadavg[0] / (double)(1 << SBITS);
+ avg[1] = ps_total.loadavg[1] / (double)(1 << SBITS);
+ avg[2] = ps_total.loadavg[2] / (double)(1 << SBITS);
+}
+
+
+int uv_fs_event_init(uv_loop_t* loop,
+ uv_fs_event_t* handle,
+ const char* filename,
+ uv_fs_event_cb cb,
+ int flags) {
+ loop->counters.fs_event_init++;
+ uv__set_sys_error(loop, ENOSYS);
+ return -1;
+}
+
+
+void uv__fs_event_close(uv_fs_event_t* handle) {
+ UNREACHABLE();
+}
+
+
+char** uv_setup_args(int argc, char** argv) {
+ return argv;
+}
+
+
+uv_err_t uv_set_process_title(const char* title) {
+ return uv_ok_;
+}
+
+
+uv_err_t uv_get_process_title(char* buffer, size_t size) {
+ if (size > 0) {
+ buffer[0] = '\0';
+ }
+ return uv_ok_;
+}
+
+
+uv_err_t uv_resident_set_memory(size_t* rss) {
+ char pp[64];
+ psinfo_t psinfo;
+ uv_err_t err;
+ int fd;
+
+ (void) snprintf(pp, sizeof(pp), "/proc/%lu/psinfo", (unsigned long) getpid());
+
+ fd = open(pp, O_RDONLY);
+ if (fd == -1)
+ return uv__new_sys_error(errno);
+
+ err = uv_ok_;
+
+ if (read(fd, &psinfo, sizeof(psinfo)) == sizeof(psinfo))
+ *rss = (size_t)psinfo.pr_rssize * 1024;
+ else
+ err = uv__new_sys_error(EINVAL);
+
+ close(fd);
+
+ return err;
+}
+
+
+uv_err_t uv_uptime(double* uptime) {
+ struct utmp *utmp_buf;
+ size_t entries = 0;
+ time_t boot_time;
+
+ utmpname(UTMP_FILE);
+
+ setutent();
+
+ while ((utmp_buf = getutent()) != NULL) {
+ if (utmp_buf->ut_user[0] && utmp_buf->ut_type == USER_PROCESS)
+ ++entries;
+ if (utmp_buf->ut_type == BOOT_TIME)
+ boot_time = utmp_buf->ut_time;
+ }
+
+ endutent();
+
+ if (boot_time == 0)
+ return uv__new_artificial_error(UV_ENOSYS);
+
+ *uptime = time(NULL) - boot_time;
+ return uv_ok_;
+}
+
+
+uv_err_t uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ uv_cpu_info_t* cpu_info;
+ perfstat_cpu_total_t ps_total;
+ perfstat_cpu_t* ps_cpus;
+ perfstat_id_t cpu_id;
+ int result, ncpus, idx = 0;
+
+ result = perfstat_cpu_total(NULL, &ps_total, sizeof(ps_total), 1);
+ if (result == -1) {
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ ncpus = result = perfstat_cpu(NULL, NULL, sizeof(perfstat_cpu_t), 0);
+ if (result == -1) {
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ ps_cpus = (perfstat_cpu_t*) malloc(ncpus * sizeof(perfstat_cpu_t));
+ if (!ps_cpus) {
+ return uv__new_artificial_error(UV_ENOMEM);
+ }
+
+ strcpy(cpu_id.name, FIRST_CPU);
+ result = perfstat_cpu(&cpu_id, ps_cpus, sizeof(perfstat_cpu_t), ncpus);
+ if (result == -1) {
+ free(ps_cpus);
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ *cpu_infos = (uv_cpu_info_t*) malloc(ncpus * sizeof(uv_cpu_info_t));
+ if (!*cpu_infos) {
+ free(ps_cpus);
+ return uv__new_artificial_error(UV_ENOMEM);
+ }
+
+ *count = ncpus;
+
+ cpu_info = *cpu_infos;
+ while (idx < ncpus) {
+ cpu_info->speed = (int)(ps_total.processorHZ / 1000000);
+ cpu_info->model = strdup(ps_total.description);
+ cpu_info->cpu_times.user = ps_cpus[idx].user;
+ cpu_info->cpu_times.sys = ps_cpus[idx].sys;
+ cpu_info->cpu_times.idle = ps_cpus[idx].idle;
+ cpu_info->cpu_times.irq = ps_cpus[idx].wait;
+ cpu_info->cpu_times.nice = 0;
+ cpu_info++;
+ idx++;
+ }
+
+ free(ps_cpus);
+ return uv_ok_;
+}
+
+
+void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count) {
+ int i;
+
+ for (i = 0; i < count; ++i) {
+ free(cpu_infos[i].model);
+ }
+
+ free(cpu_infos);
+}
+
+
+uv_err_t uv_interface_addresses(uv_interface_address_t** addresses,
+ int* count) {
+ uv_interface_address_t* address;
+ int sockfd, size = 1;
+ struct ifconf ifc;
+ struct ifreq *ifr, *p, flg;
+
+ *count = 0;
+
+ if (0 > (sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP))) {
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ if (ioctl(sockfd, SIOCGSIZIFCONF, &size) == -1) {
+ close(sockfd);
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ ifc.ifc_req = (struct ifreq*)malloc(size);
+ ifc.ifc_len = size;
+ if (ioctl(sockfd, SIOCGIFCONF, &ifc) == -1) {
+ close(sockfd);
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+#define ADDR_SIZE(p) MAX((p).sa_len, sizeof(p))
+
+ /* Count all up and running ipv4/ipv6 addresses */
+ ifr = ifc.ifc_req;
+ while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
+ p = ifr;
+ ifr = (struct ifreq*)
+ ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));
+
+ if (!(p->ifr_addr.sa_family == AF_INET6 ||
+ p->ifr_addr.sa_family == AF_INET))
+ continue;
+
+ memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
+ if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
+ close(sockfd);
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
+ continue;
+
+ (*count)++;
+ }
+
+ /* Alloc the return interface structs */
+ *addresses = (uv_interface_address_t*)
+ malloc(*count * sizeof(uv_interface_address_t));
+ if (!(*addresses)) {
+ close(sockfd);
+ return uv__new_artificial_error(UV_ENOMEM);
+ }
+ address = *addresses;
+
+ ifr = ifc.ifc_req;
+ while ((char*)ifr < (char*)ifc.ifc_req + ifc.ifc_len) {
+ p = ifr;
+ ifr = (struct ifreq*)
+ ((char*)ifr + sizeof(ifr->ifr_name) + ADDR_SIZE(ifr->ifr_addr));
+
+ if (!(p->ifr_addr.sa_family == AF_INET6 ||
+ p->ifr_addr.sa_family == AF_INET))
+ continue;
+
+ memcpy(flg.ifr_name, p->ifr_name, sizeof(flg.ifr_name));
+ if (ioctl(sockfd, SIOCGIFFLAGS, &flg) == -1) {
+ close(sockfd);
+ return uv__new_artificial_error(UV_ENOSYS);
+ }
+
+ if (!(flg.ifr_flags & IFF_UP && flg.ifr_flags & IFF_RUNNING))
+ continue;
+
+ /* All conditions above must match count loop */
+
+ address->name = strdup(p->ifr_name);
+
+ if (p->ifr_addr.sa_family == AF_INET6) {
+ address->address.address6 = *((struct sockaddr_in6 *)&p->ifr_addr);
+ } else {
+ address->address.address4 = *((struct sockaddr_in *)&p->ifr_addr);
+ }
+
+ address->is_internal = flg.ifr_flags & IFF_LOOPBACK ? 1 : 0;
+
+ address++;
+ }
+
+#undef ADDR_SIZE
+
+ close(sockfd);
+ return uv_ok_;
+}
+
+
+void uv_free_interface_addresses(uv_interface_address_t* addresses,
+ int count) {
+ int i;
+
+ for (i = 0; i < count; ++i) {
+ free(addresses[i].name);
+ }
+
+ free(addresses);
+}
View
84 src/unix/eio/config_aix.h
@@ -0,0 +1,84 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* fdatasync(2) is available */
+/* #undef HAVE_FDATASYNC */
+
+/* utimes(2) is available */
+#define HAVE_UTIMES 1
+
+/* futimes(2) is available */
+/* #undef HAVE_FUTIMES */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* pread(2) and pwrite(2) are available */
+#define HAVE_PREADWRITE 1
+
+/* readahead(2) is available (linux) */
+/* #undef HAVE_READAHEAD */
+
+/* sendfile(2) is available and supported */
+/* #undef HAVE_SENDFILE */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* sync_file_range(2) is available */
+/* #undef HAVE_SYNC_FILE_RANGE */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "libeio"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "1.0"
View
2 src/unix/eio/eio.c
@@ -595,7 +595,7 @@ etp_start_thread (void)
X_LOCK (wrklock);
- if (thread_create (&wrk->tid, etp_proc, (void *)wrk))
+ if (xthread_create (&wrk->tid, etp_proc, (void *)wrk))
{
wrk->prev = &wrk_first;
wrk->next = wrk_first.next;
View
4 src/unix/eio/xthread.h
@@ -49,7 +49,7 @@ typedef pthread_t xthread_t;
#define X_THREAD_ATFORK(a,b,c)
static int
-thread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
+xthread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
{
int retval;
pthread_attr_t attr;
@@ -130,7 +130,7 @@ typedef pthread_t xthread_t;
#endif
static int
-thread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
+xthread_create (xthread_t *tid, void *(*proc)(void *), void *arg)
{
int retval;
sigset_t fullsigset, oldsigset;
View
2 src/unix/error.c
@@ -96,7 +96,9 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ETIMEDOUT: return UV_ETIMEDOUT;
case EXDEV: return UV_EXDEV;
case EBUSY: return UV_EBUSY;
+#if ENOTEMPTY != EEXIST
case ENOTEMPTY: return UV_ENOTEMPTY;
+#endif
case ENOSPC: return UV_ENOSPC;
case EROFS: return UV_EROFS;
case ENOMEM: return UV_ENOMEM;
View
122 src/unix/ev/config_aix.h
@@ -0,0 +1,122 @@
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define HAVE_CLOCK_GETTIME 1
+
+/* "use syscall interface for clock_gettime" */
+/* #undef HAVE_CLOCK_SYSCALL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+/* #undef HAVE_EPOLL_CTL */
+
+/* Define to 1 if you have the `eventfd' function. */
+/* #undef HAVE_EVENTFD */
+
+/* Define to 1 if you have the `inotify_init' function. */
+/* #undef HAVE_INOTIFY_INIT */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `kqueue' function. */
+/* #undef HAVE_KQUEUE */
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define HAVE_LIBRT 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `nanosleep' function. */
+#define HAVE_NANOSLEEP 1
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+#define HAVE_PORT_H 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `signalfd' function. */
+/* #undef HAVE_SIGNALFD */
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+/* #undef HAVE_SYS_EPOLL_H */
+
+/* Define to 1 if you have the <sys/eventfd.h> header file. */
+/* #undef HAVE_SYS_EVENTFD_H */
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+/* #undef HAVE_SYS_EVENT_H */
+
+/* Define to 1 if you have the <sys/inotify.h> header file. */
+/* #undef HAVE_SYS_INOTIFY_H */
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/signalfd.h> header file. */
+/* #undef HAVE_SYS_SIGNALFD_H */
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Name of package */
+#define PACKAGE "libev"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Version number of package */
+#define VERSION "3.9"
View
4 src/unix/ev/ev.c
@@ -3912,8 +3912,8 @@ ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w))
wl = wn;
}
#endif
-/* EV_STAT 0x00001000 /* stat data changed */
-/* EV_EMBED 0x00010000 /* embedded event loop needs sweep */
+/* EV_STAT 0x00001000 *//* stat data changed */
+/* EV_EMBED 0x00010000 *//* embedded event loop needs sweep */
}
#endif
View
10 test/test-fs.c
@@ -19,9 +19,6 @@
* IN THE SOFTWARE.
*/
-/* FIXME we shouldn't need to branch in this file */
-#define UNIX (defined(__unix__) || defined(__POSIX__) || defined(__APPLE__))
-
#include "uv.h"
#include "task.h"
@@ -30,8 +27,9 @@
#include <fcntl.h>
#include <sys/stat.h>
-
-#if UNIX
+/* FIXME we shouldn't need to branch in this file */
+#if defined(__unix__) || defined(__POSIX__) || \
+ defined(__APPLE__) || defined(_AIX)
#include <unistd.h> /* unlink, rmdir, etc. */
#else
# include <direct.h>
@@ -545,7 +543,7 @@ static void check_utime(const char* path, double atime, double mtime) {
ASSERT(req.result == 0);
s = req.ptr;
-#if _WIN32
+#if defined(_WIN32) || defined(_AIX)
ASSERT(s->st_atime == atime);
ASSERT(s->st_mtime == mtime);
#elif !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
View
6 test/test-thread.c
@@ -42,7 +42,7 @@ struct fs_req {
};
-struct thread {
+struct test_thread {
uv_thread_t thread_id;
volatile int thread_called;
};
@@ -109,7 +109,7 @@ static void do_work(void* arg) {
uv_loop_t* loop;
size_t i;
int r;
- struct thread* thread = arg;
+ struct test_thread* thread = arg;
loop = uv_loop_new();
ASSERT(loop != NULL);
@@ -162,7 +162,7 @@ TEST_IMPL(thread_create) {
* that each "finished" callback is run in its originating thread.
*/
TEST_IMPL(threadpool_multiple_event_loops) {
- struct thread threads[8];
+ struct test_thread threads[8];
size_t i;
int r;
View
21 uv.gyp
@@ -190,6 +190,21 @@
],
},
}],
+ [ 'OS=="aix"', {
+ 'include_dirs': [ 'src/ares/config_aix' ],
+ 'sources': [ 'src/unix/aix.c' ],
+ 'defines': [
+ '_ALL_SOURCE',
+ '_XOPEN_SOURCE=500',
+ 'EV_CONFIG_H="config_aix.h"',
+ 'EIO_CONFIG_H="config_aix.h"',
+ ],
+ 'direct_dependent_settings': {
+ 'libraries': [
+ '-lperfstat',
+ ],
+ },
+ }],
[ 'OS=="freebsd"', {
'sources': [ 'src/unix/freebsd.c' ],
'defines': [
@@ -329,6 +344,12 @@
'_XOPEN_SOURCE=500',
],
}],
+ [ 'OS=="aix"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
+ 'defines': [
+ '_ALL_SOURCE',
+ '_XOPEN_SOURCE=500',
+ ],
+ }],
],
'msvs-settings': {
'VCLinkerTool': {

0 comments on commit 900ad30

Please sign in to comment.
Something went wrong with that request. Please try again.