For GCC (including MinGW) there are two methods building: via normal
makefiles or via GYP. GYP is a meta-build system which can generate MSVS,
Makefile, and XCode backends. It is best used for integration into other
-projects. The old (more stable) system is using Makefiles.
+projects. The old system is using plain GNU Makefiles.
To build via Makefile simply execute:
Windows users can also build from cmd-line using msbuild. This is
done by running vcbuild.bat from Visual Studio command prompt.
-To have GYP generate build script for another system you will need to
-checkout GYP into the project tree manually:
+To have GYP generate build script for another system, make sure that
+you have Python 2.6 or 2.7 installed, then checkout GYP into the
+project tree manually:
+ mkdir -p build
svn co http://gyp.googlecode.com/svn/trunk build/gyp
+Or:
+
+ mkdir -p build
+ git clone https://git.chromium.org/external/gyp.git build/gyp
+
Unix users run
./gyp_uv -f make
- make
+ make -C out
Macintosh users run
/* utimesat() has nanosecond resolution but we stick to microseconds
* for the sake of consistency with other platforms.
*/
+ static int no_utimesat;
struct timespec ts[2];
+ struct timeval tv[2];
+ char path[sizeof("/proc/self/fd/") + 3 * sizeof(int)];
+ int r;
+
+ if (no_utimesat)
+ goto skip;
+
ts[0].tv_sec = req->atime;
ts[0].tv_nsec = (unsigned long)(req->atime * 1000000) % 1000000 * 1000;
ts[1].tv_sec = req->mtime;
ts[1].tv_nsec = (unsigned long)(req->mtime * 1000000) % 1000000 * 1000;
- return uv__utimesat(req->file, NULL, ts, 0);
+
+ r = uv__utimesat(req->file, NULL, ts, 0);
+ if (r == 0)
+ return r;
+
+ if (errno != ENOSYS)
+ return r;
+
+ no_utimesat = 1;
+
+skip:
+
+ tv[0].tv_sec = req->atime;
+ tv[0].tv_usec = (unsigned long)(req->atime * 1000000) % 1000000;
+ tv[1].tv_sec = req->mtime;
+ tv[1].tv_usec = (unsigned long)(req->mtime * 1000000) % 1000000;
+ snprintf(path, sizeof(path), "/proc/self/fd/%d", (int) req->file);
+
+ r = utimes(path, tv);
+ if (r == 0)
+ return r;
+
+ switch (errno) {
+ case ENOENT:
+ if (fcntl(req->file, F_GETFL) == -1 && errno == EBADF)
+ break;
+ /* Fall through. */
+
+ case EACCES:
+ case ENOTDIR:
+ errno = ENOSYS;
+ break;
+ }
+
+ return r;
+
#elif defined(__APPLE__) \
|| defined(__DragonFly__) \
|| defined(__FreeBSD__) \
}
-int uv__inotify_add_watch(int fd, const char* path, __u32 mask) {
+int uv__inotify_add_watch(int fd, const char* path, uint32_t mask) {
#if defined(__NR_inotify_add_watch)
return syscall(__NR_inotify_add_watch, fd, path, mask);
#else
}
-int uv__inotify_rm_watch(int fd, __s32 wd) {
+int uv__inotify_rm_watch(int fd, int32_t wd) {
#if defined(__NR_inotify_rm_watch)
return syscall(__NR_inotify_rm_watch, fd, wd);
#else
#undef _GNU_SOURCE
#define _GNU_SOURCE
+#include <stdint.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
-#include <linux/types.h>
#define UV__O_NONBLOCK 0x800
#define UV__O_CLOEXEC 0x80000
#if defined(__x86_64__)
struct uv__epoll_event {
- __u32 events;
- __u64 data;
+ uint32_t events;
+ uint64_t data;
} __attribute__((packed));
#else
struct uv__epoll_event {
- __u32 events;
- __u64 data;
+ uint32_t events;
+ uint64_t data;
};
#endif
struct uv__inotify_event {
- __s32 wd;
- __u32 mask;
- __u32 cookie;
- __u32 len;
+ int32_t wd;
+ uint32_t mask;
+ uint32_t cookie;
+ uint32_t len;
/* char name[0]; */
};
int uv__eventfd2(unsigned int count, int flags);
int uv__inotify_init(void);
int uv__inotify_init1(int flags);
-int uv__inotify_add_watch(int fd, const char* path, __u32 mask);
-int uv__inotify_rm_watch(int fd, __s32 wd);
+int uv__inotify_add_watch(int fd, const char* path, uint32_t mask);
+int uv__inotify_rm_watch(int fd, int32_t wd);
int uv__pipe2(int pipefd[2], int flags);
int uv__recvmmsg(int fd,
struct uv__mmsghdr* mmsg,
optname = IP_DROP_MEMBERSHIP;
break;
default:
- uv__set_sys_error(handle->loop, EFAULT);
- return -1;
+ return uv__set_artificial_error(handle->loop, UV_EINVAL);
}
if (setsockopt(handle->io_watcher.fd, IPPROTO_IP, optname, (void*) &mreq, sizeof mreq) == -1) {
int uv_tcp_bind(uv_tcp_t* handle, struct sockaddr_in addr) {
if (handle->type != UV_TCP || addr.sin_family != AF_INET) {
- uv__set_artificial_error(handle->loop, UV_EFAULT);
+ uv__set_artificial_error(handle->loop, UV_EINVAL);
return -1;
}
int uv_tcp_bind6(uv_tcp_t* handle, struct sockaddr_in6 addr) {
if (handle->type != UV_TCP || addr.sin6_family != AF_INET6) {
- uv__set_artificial_error(handle->loop, UV_EFAULT);
+ uv__set_artificial_error(handle->loop, UV_EINVAL);
return -1;
}
int uv_udp_bind(uv_udp_t* handle, struct sockaddr_in addr,
unsigned int flags) {
if (handle->type != UV_UDP || addr.sin_family != AF_INET) {
- uv__set_artificial_error(handle->loop, UV_EFAULT);
+ uv__set_artificial_error(handle->loop, UV_EINVAL);
return -1;
}
int uv_udp_bind6(uv_udp_t* handle, struct sockaddr_in6 addr,
unsigned int flags) {
if (handle->type != UV_UDP || addr.sin6_family != AF_INET6) {
- uv__set_artificial_error(handle->loop, UV_EFAULT);
+ uv__set_artificial_error(handle->loop, UV_EINVAL);
return -1;
}
optname = IP_DROP_MEMBERSHIP;
break;
default:
- uv__set_artificial_error(handle->loop, UV_EFAULT);
- return -1;
+ return uv__set_artificial_error(handle->loop, UV_EINVAL);
}
if (setsockopt(handle->socket,
r = uv_tcp_bind(&server, *garbage_addr);
ASSERT(r == -1);
- ASSERT(uv_last_error(uv_default_loop()).code == UV_EFAULT);
+ ASSERT(uv_last_error(uv_default_loop()).code == UV_EINVAL);
uv_close((uv_handle_t*)&server, close_cb);
r = uv_tcp_bind6(&server, *garbage_addr);
ASSERT(r == -1);
- ASSERT(uv_last_error(uv_default_loop()).code == UV_EFAULT);
+ ASSERT(uv_last_error(uv_default_loop()).code == UV_EINVAL);
uv_close((uv_handle_t*)&server, close_cb);
cleanup_threadpool();
+ MAKE_VALGRIND_HAPPY();
return 0;
}
cleanup_threadpool();
+ MAKE_VALGRIND_HAPPY();
return 0;
}
cleanup_threadpool();
+ MAKE_VALGRIND_HAPPY();
return 0;
}
ASSERT(0 == uv_run(loop, UV_RUN_DEFAULT));
ASSERT(req.data != NULL); /* Should have been updated by nop_done_cb(). */
+ MAKE_VALGRIND_HAPPY();
return 0;
}
'defines': [
'_LARGEFILE_SOURCE',
'_FILE_OFFSET_BITS=64',
- '_POSIX_C_SOURCE=200112',
],
}],
['OS == "mac"', {
- 'defines': [
- '_DARWIN_USE_64_BIT_INODE=1',
- '_DARWIN_C_SOURCE', # _POSIX_C_SOURCE hides SysV definitions.
- ],
+ 'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ],
+ }],
+ ['OS == "linux"', {
+ 'defines': [ '_POSIX_C_SOURCE=200112' ],
}],
],
},