Alien-uv

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

libuv/test/test-ping-pong.c
libuv/test/test-pipe-bind-error.c
libuv/test/test-pipe-close-stdout-read-stdin.c
libuv/test/test-pipe-connect-error.c
libuv/test/test-pipe-connect-multiple.c
libuv/test/test-pipe-connect-prepare.c
libuv/test/test-pipe-getsockname.c
libuv/test/test-pipe-pending-instances.c
libuv/test/test-pipe-sendmsg.c
libuv/test/test-pipe-server-close.c
libuv/test/test-pipe-set-fchmod.c
libuv/test/test-pipe-set-non-blocking.c
libuv/test/test-platform-output.c
libuv/test/test-poll-close-doesnt-corrupt-stack.c
libuv/test/test-poll-close.c
libuv/test/test-poll-closesocket.c
libuv/test/test-poll-oob.c
libuv/test/test-poll.c
libuv/test/test-process-priority.c
libuv/test/test-process-title-threadsafe.c
libuv/test/test-process-title.c

libuv/CMakeLists.txt  view on Meta::CPAN

    test/test-ping-pong.c
    test/test-pipe-bind-error.c
    test/test-pipe-close-stdout-read-stdin.c
    test/test-pipe-connect-error.c
    test/test-pipe-connect-multiple.c
    test/test-pipe-connect-prepare.c
    test/test-pipe-getsockname.c
    test/test-pipe-pending-instances.c
    test/test-pipe-sendmsg.c
    test/test-pipe-server-close.c
    test/test-pipe-set-fchmod.c
    test/test-pipe-set-non-blocking.c
    test/test-platform-output.c
    test/test-poll-close-doesnt-corrupt-stack.c
    test/test-poll-close.c
    test/test-poll-closesocket.c
    test/test-poll-oob.c
    test/test-poll.c
    test/test-process-priority.c
    test/test-process-title-threadsafe.c
    test/test-process-title.c

libuv/ChangeLog  view on Meta::CPAN



2018.06.23, Version 1.21.0 (Stable), e4983a9b0c152932f7553ff4a9ff189d2314cdcb

Changes since version 1.20.3:

* unix,windows: map EFTYPE errno (cjihrig)

* win: perform case insensitive PATH= comparison (cjihrig)

* win, fs: uv_fs_fchmod support for -A files (Bartosz Sosnowski)

* src,lib: fix comments (Tobias Nießen)

* win,process: allow child pipe handles to be opened in overlapped mode (Björn
  Linse)

* src,test: fix idiosyncratic comment style (Bert Belder)

* test: fs_fchmod_archive_readonly must return a value (Bert Belder)

* win,pipe: fix incorrect error code returned from uv_pipe_write_impl() (Bert
  Belder)

* win,pipe: properly set uv_write_t.send_handle in uv_write2() (Bert Belder)

* test: add vectored uv_write() ping-pong tests (Bert Belder)

* win,pipe: support vectored uv_write() calls (Bert Belder)

libuv/ChangeLog  view on Meta::CPAN

2018.04.19, Version 1.20.1 (Stable), 36ac2fc8edfd5ff3e9be529be1d4a3f0d5364e94

Changes since version 1.20.0:

* doc,fs: improve documentation (Bob Burger)

* win: return a floored double from uv_uptime() (Refael Ackermann)

* doc: clarify platform specific pipe naming (Thomas Versteeg)

* unix: fix uv_pipe_chmod() on macOS (zzzjim)

* unix: work around glibc semaphore race condition (Anna Henningsen)

* tcp,openbsd: disable Unix TCP check for IPV6_ONLY (Alex Arslan)

* test,openbsd: use RETURN_SKIP in UDP IPv6 tests (Alex Arslan)

* test,openbsd: fix multicast test (Alex Arslan)

* Revert "win, fs: use FILE_WRITE_ATTRIBUTES when opening files" (cjihrig)

libuv/ChangeLog  view on Meta::CPAN

2017.10.03, Version 1.15.0 (Stable), 8b69ce1419d2958011d415a636810705c36c2cc2

Changes since version 1.14.1:

* unix: limit uv__has_forked_with_cfrunloop to macOS (Kamil Rytarowski)

* win: fix buffer size in uv__getpwuid_r() (tux.uudiin)

* win,tty: improve SIGWINCH support (Bartosz Sosnowski)

* unix: use fchmod() in uv_fs_copyfile() (cjihrig)

* unix: support copying empty files (cjihrig)

* unix: truncate destination in uv_fs_copyfile() (Nick Logan)

* win,build: keep cwd when setting build environment (darobs)

* test: add NetBSD support to test-udp-ipv6.c (Kamil Rytarowski)

* unix: add NetBSD support in core.c (Kamil Rytarowski)

libuv/ChangeLog  view on Meta::CPAN

2013.10.30, Version 0.11.14 (Unstable), d7a6482f45c1b4eb4a853dbe1a9ce8090a35633a

Changes since version 0.11.13:

* darwin: create fsevents thread on demand (Ben Noordhuis)

* fsevents: FSEvents is most likely not thread-safe (Fedor Indutny)

* fsevents: use shared FSEventStream (Fedor Indutny)

* windows: make uv_fs_chmod() report errors correctly (Bert Belder)

* windows: make uv_shutdown() for write-only pipes work (Bert Belder)

* windows/fs: wrap multi-statement macros in do..while block (Bert Belder)

* windows/fs: make uv_fs_open() report EINVAL correctly (Bert Belder)

* windows/fs: handle _open_osfhandle() failure correctly (Bert Belder)

* windows/fs: wrap multi-statement macros in do..while block (Bert Belder)

libuv/ChangeLog  view on Meta::CPAN

Changes since version 0.10.15:

* windows: make uv_shutdown() for write-only pipes work (Bert Belder)

* windows: make uv_fs_open() report EINVAL when invalid arguments are passed
  (Bert Belder)

* windows: make uv_fs_open() report _open_osfhandle() failure correctly (Bert
  Belder)

* windows: make uv_fs_chmod() report errors correctly (Bert Belder)

* windows: wrap multi-statement macros in do..while block (Bert Belder)


2013.09.05, Version 0.11.13 (Unstable), f5b6db6c1d7f93d28281207fd47c3841c9a9792e

Changes since version 0.11.12:

* unix: define _GNU_SOURCE, exposes glibc-isms (Ben Noordhuis)

libuv/ChangeLog  view on Meta::CPAN

2013.08.25, Version 0.11.10 (Unstable), 742dadcb7154cc7bb89c0c228a223b767a36cf0d

* windows: Re-implement uv_fs_stat. The st_ctime field now contains the change
  time, not the creation time, like on unix systems. st_dev, st_ino, st_blocks
  and st_blksize are now also filled out. (Bert Belder)

* linux: fix setsockopt(SO_REUSEPORT) error handling (Ben Noordhuis)

* windows: report uv_process_t exit code correctly (Bert Belder)

* windows: make uv_fs_chmod() report errors correctly (Bert Belder)

* windows: make some more NT apis available for libuv's internal use (Bert
  Belder)

* windows: squelch some compiler warnings (Bert Belder)


2013.08.24, Version 0.11.9 (Unstable), a2d29b5b068cbac93dc16138fb30a74e2669daad

Changes since version 0.11.8:

libuv/Makefile.am  view on Meta::CPAN

                         test/test-pipe-bind-error.c \
                         test/test-pipe-connect-error.c \
                         test/test-pipe-connect-multiple.c \
                         test/test-pipe-connect-prepare.c \
                         test/test-pipe-getsockname.c \
                         test/test-pipe-pending-instances.c \
                         test/test-pipe-sendmsg.c \
                         test/test-pipe-server-close.c \
                         test/test-pipe-close-stdout-read-stdin.c \
                         test/test-pipe-set-non-blocking.c \
                         test/test-pipe-set-fchmod.c \
                         test/test-platform-output.c \
                         test/test-poll.c \
                         test/test-poll-close.c \
                         test/test-poll-close-doesnt-corrupt-stack.c \
                         test/test-poll-closesocket.c \
                         test/test-poll-oob.c \
                         test/test-process-priority.c \
                         test/test-process-title.c \
                         test/test-process-title-threadsafe.c \
                         test/test-queue-foreach-delete.c \

libuv/docs/src/fs.rst  view on Meta::CPAN

        `UV_FS_COPYFILE_FICLONE_FORCE` are supported.

.. c:function:: int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd, int64_t in_offset, size_t length, uv_fs_cb cb)

    Limited equivalent to :man:`sendfile(2)`.

.. c:function:: int uv_fs_access(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb)

    Equivalent to :man:`access(2)` on Unix. Windows uses ``GetFileAttributesW()``.

.. c:function:: int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode, uv_fs_cb cb)
.. c:function:: int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file file, int mode, uv_fs_cb cb)

    Equivalent to :man:`chmod(2)` and :man:`fchmod(2)` respectively.

.. c:function:: int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime, double mtime, uv_fs_cb cb)
.. c:function:: int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime, double mtime, uv_fs_cb cb)

    Equivalent to :man:`utime(2)` and :man:`futime(2)` respectively.

    .. note::
      AIX: This function only works for AIX 7.1 and newer. It can still be called on older
      versions but will return ``UV_ENOSYS``.

libuv/docs/src/pipe.rst  view on Meta::CPAN

.. c:function:: uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle)

    Used to receive handles over IPC pipes.

    First - call :c:func:`uv_pipe_pending_count`, if it's > 0 then initialize
    a handle of the given `type`, returned by :c:func:`uv_pipe_pending_type`
    and call ``uv_accept(pipe, handle)``.

.. seealso:: The :c:type:`uv_stream_t` API functions also apply.

.. c:function:: int uv_pipe_chmod(uv_pipe_t* handle, int flags)

    Alters pipe permissions, allowing it to be accessed from processes run by
    different users. Makes the pipe writable or readable by all users. Mode can
    be ``UV_WRITABLE``, ``UV_READABLE`` or ``UV_WRITABLE | UV_READABLE``. This
    function is blocking.

    .. versionadded:: 1.16.0

libuv/include/uv.h  view on Meta::CPAN

                               uv_connect_cb cb);
UV_EXTERN int uv_pipe_getsockname(const uv_pipe_t* handle,
                                  char* buffer,
                                  size_t* size);
UV_EXTERN int uv_pipe_getpeername(const uv_pipe_t* handle,
                                  char* buffer,
                                  size_t* size);
UV_EXTERN void uv_pipe_pending_instances(uv_pipe_t* handle, int count);
UV_EXTERN int uv_pipe_pending_count(uv_pipe_t* handle);
UV_EXTERN uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle);
UV_EXTERN int uv_pipe_chmod(uv_pipe_t* handle, int flags);


struct uv_poll_s {
  UV_HANDLE_FIELDS
  uv_poll_cb poll_cb;
  UV_POLL_PRIVATE_FIELDS
};

enum uv_poll_event {
  UV_READABLE = 1,

libuv/include/uv.h  view on Meta::CPAN

                             uv_file out_fd,
                             uv_file in_fd,
                             int64_t in_offset,
                             size_t length,
                             uv_fs_cb cb);
UV_EXTERN int uv_fs_access(uv_loop_t* loop,
                           uv_fs_t* req,
                           const char* path,
                           int mode,
                           uv_fs_cb cb);
UV_EXTERN int uv_fs_chmod(uv_loop_t* loop,
                          uv_fs_t* req,
                          const char* path,
                          int mode,
                          uv_fs_cb cb);
UV_EXTERN int uv_fs_utime(uv_loop_t* loop,
                          uv_fs_t* req,
                          const char* path,
                          double atime,
                          double mtime,
                          uv_fs_cb cb);

libuv/include/uv.h  view on Meta::CPAN

                            int flags,
                            uv_fs_cb cb);
UV_EXTERN int uv_fs_readlink(uv_loop_t* loop,
                             uv_fs_t* req,
                             const char* path,
                             uv_fs_cb cb);
UV_EXTERN int uv_fs_realpath(uv_loop_t* loop,
                             uv_fs_t* req,
                             const char* path,
                             uv_fs_cb cb);
UV_EXTERN int uv_fs_fchmod(uv_loop_t* loop,
                           uv_fs_t* req,
                           uv_file file,
                           int mode,
                           uv_fs_cb cb);
UV_EXTERN int uv_fs_chown(uv_loop_t* loop,
                          uv_fs_t* req,
                          const char* path,
                          uv_uid_t uid,
                          uv_gid_t gid,
                          uv_fs_cb cb);

libuv/src/unix/fs.c  view on Meta::CPAN

                     dst_flags,
                     statsbuf.st_mode,
                     NULL);
  uv_fs_req_cleanup(&fs_req);

  if (dstfd < 0) {
    err = dstfd;
    goto out;
  }

  if (fchmod(dstfd, statsbuf.st_mode) == -1) {
    err = UV__ERR(errno);
    goto out;
  }

#ifdef FICLONE
  if (req->flags & UV_FS_COPYFILE_FICLONE ||
      req->flags & UV_FS_COPYFILE_FICLONE_FORCE) {
    if (ioctl(dstfd, FICLONE, srcfd) == -1) {
      /* If an error occurred that the sendfile fallback also won't handle, or
         this is a force clone then exit. Otherwise, fall through to try using

libuv/src/unix/fs.c  view on Meta::CPAN

  do {
    errno = 0;

#define X(type, action)                                                       \
  case UV_FS_ ## type:                                                        \
    r = action;                                                               \
    break;

    switch (req->fs_type) {
    X(ACCESS, access(req->path, req->flags));
    X(CHMOD, chmod(req->path, req->mode));
    X(CHOWN, chown(req->path, req->uid, req->gid));
    X(CLOSE, uv__fs_close(req->file));
    X(COPYFILE, uv__fs_copyfile(req));
    X(FCHMOD, fchmod(req->file, req->mode));
    X(FCHOWN, fchown(req->file, req->uid, req->gid));
    X(LCHOWN, lchown(req->path, req->uid, req->gid));
    X(FDATASYNC, uv__fs_fdatasync(req));
    X(FSTAT, uv__fs_fstat(req->file, &req->statbuf));
    X(FSYNC, uv__fs_fsync(req));
    X(FTRUNCATE, ftruncate(req->file, req->off));
    X(FUTIME, uv__fs_futime(req));
    X(LSTAT, uv__fs_lstat(req->path, &req->statbuf));
    X(LINK, link(req->path, req->new_path));
    X(MKDIR, mkdir(req->path, req->mode));

libuv/src/unix/fs.c  view on Meta::CPAN

                 const char* path,
                 int flags,
                 uv_fs_cb cb) {
  INIT(ACCESS);
  PATH;
  req->flags = flags;
  POST;
}


int uv_fs_chmod(uv_loop_t* loop,
                uv_fs_t* req,
                const char* path,
                int mode,
                uv_fs_cb cb) {
  INIT(CHMOD);
  PATH;
  req->mode = mode;
  POST;
}

libuv/src/unix/fs.c  view on Meta::CPAN

}


int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
  INIT(CLOSE);
  req->file = file;
  POST;
}


int uv_fs_fchmod(uv_loop_t* loop,
                 uv_fs_t* req,
                 uv_file file,
                 int mode,
                 uv_fs_cb cb) {
  INIT(FCHMOD);
  req->file = file;
  req->mode = mode;
  POST;
}

libuv/src/unix/pipe.c  view on Meta::CPAN

  if (!handle->ipc)
    return UV_UNKNOWN_HANDLE;

  if (handle->accepted_fd == -1)
    return UV_UNKNOWN_HANDLE;
  else
    return uv__handle_type(handle->accepted_fd);
}


int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
  unsigned desired_mode;
  struct stat pipe_stat;
  char* name_buffer;
  size_t name_len;
  int r;

  if (handle == NULL || uv__stream_fd(handle) == -1)
    return UV_EBADF;

  if (mode != UV_READABLE &&
      mode != UV_WRITABLE &&
      mode != (UV_WRITABLE | UV_READABLE))
    return UV_EINVAL;

  /* Unfortunately fchmod does not work on all platforms, we will use chmod. */
  name_len = 0;
  r = uv_pipe_getsockname(handle, NULL, &name_len);
  if (r != UV_ENOBUFS)
    return r;

  name_buffer = uv__malloc(name_len);
  if (name_buffer == NULL)
    return UV_ENOMEM;

  r = uv_pipe_getsockname(handle, name_buffer, &name_len);

libuv/src/unix/pipe.c  view on Meta::CPAN

    desired_mode |= S_IWUSR | S_IWGRP | S_IWOTH;

  /* Exit early if pipe already has desired mode. */
  if ((pipe_stat.st_mode & desired_mode) == desired_mode) {
    uv__free(name_buffer);
    return 0;
  }

  pipe_stat.st_mode |= desired_mode;

  r = chmod(name_buffer, pipe_stat.st_mode);
  uv__free(name_buffer);

  return r != -1 ? 0 : UV__ERR(errno);
}

libuv/src/win/fs.c  view on Meta::CPAN

  }

  /* Todo: st_mode should probably always be 0666 for everyone. We might also
   * want to report 0777 if the file is a .exe or a directory.
   *
   * Currently it's based on whether the 'readonly' attribute is set, which
   * makes little sense because the semantics are so different: the 'read-only'
   * flag is just a way for a user to protect against accidental deletion, and
   * serves no security purpose. Windows uses ACLs for that.
   *
   * Also people now use uv_fs_chmod() to take away the writable bit for good
   * reasons. Windows however just makes the file read-only, which makes it
   * impossible to delete the file afterwards, since read-only files can't be
   * deleted.
   *
   * IOW it's all just a clusterfuck and we should think of something that
   * makes slightly more sense.
   *
   * And uv_fs_chmod should probably just fail on windows or be a total no-op.
   * There's nothing sensible it can do anyway.
   */
  statbuf->st_mode = 0;

  /*
  * On Windows, FILE_ATTRIBUTE_REPARSE_POINT is a general purpose mechanism
  * by which filesystem drivers can intercept and alter file system requests.
  *
  * The only reparse points we care about are symlinks and mount points, both
  * of which are treated as POSIX symlinks. Further, we only care when

libuv/src/win/fs.c  view on Meta::CPAN

      !(attr & FILE_ATTRIBUTE_READONLY) ||
      (attr & FILE_ATTRIBUTE_DIRECTORY)) {
    SET_REQ_RESULT(req, 0);
  } else {
    SET_REQ_WIN32_ERROR(req, UV_EPERM);
  }

}


static void fs__chmod(uv_fs_t* req) {
  int result = _wchmod(req->file.pathw, req->fs.info.mode);
  SET_REQ_RESULT(req, result);
}


static void fs__fchmod(uv_fs_t* req) {
  int fd = req->file.fd;
  int clear_archive_flag;
  HANDLE handle;
  NTSTATUS nt_status;
  IO_STATUS_BLOCK io_status;
  FILE_BASIC_INFORMATION file_info;

  VERIFY_FD(fd, req);

  handle = ReOpenFile(uv__get_osfhandle(fd), FILE_WRITE_ATTRIBUTES, 0, 0);

libuv/src/win/fs.c  view on Meta::CPAN

  }

  nt_status = pNtQueryInformationFile(handle,
                                      &io_status,
                                      &file_info,
                                      sizeof file_info,
                                      FileBasicInformation);

  if (!NT_SUCCESS(nt_status)) {
    SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
    goto fchmod_cleanup;
  }

  /* Test if the Archive attribute is cleared */
  if ((file_info.FileAttributes & FILE_ATTRIBUTE_ARCHIVE) == 0) {
      /* Set Archive flag, otherwise setting or clearing the read-only
         flag will not work */
      file_info.FileAttributes |= FILE_ATTRIBUTE_ARCHIVE;
      nt_status = pNtSetInformationFile(handle,
                                        &io_status,
                                        &file_info,
                                        sizeof file_info,
                                        FileBasicInformation);
      if (!NT_SUCCESS(nt_status)) {
        SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
        goto fchmod_cleanup;
      }
      /* Remeber to clear the flag later on */
      clear_archive_flag = 1;
  } else {
      clear_archive_flag = 0;
  }

  if (req->fs.info.mode & _S_IWRITE) {
    file_info.FileAttributes &= ~FILE_ATTRIBUTE_READONLY;
  } else {

libuv/src/win/fs.c  view on Meta::CPAN

  }

  nt_status = pNtSetInformationFile(handle,
                                    &io_status,
                                    &file_info,
                                    sizeof file_info,
                                    FileBasicInformation);

  if (!NT_SUCCESS(nt_status)) {
    SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
    goto fchmod_cleanup;
  }

  if (clear_archive_flag) {
      file_info.FileAttributes &= ~FILE_ATTRIBUTE_ARCHIVE;
      if (file_info.FileAttributes == 0) {
          file_info.FileAttributes = FILE_ATTRIBUTE_NORMAL;
      }
      nt_status = pNtSetInformationFile(handle,
                                        &io_status,
                                        &file_info,
                                        sizeof file_info,
                                        FileBasicInformation);
      if (!NT_SUCCESS(nt_status)) {
        SET_REQ_WIN32_ERROR(req, pRtlNtStatusToDosError(nt_status));
        goto fchmod_cleanup;
      }
  }

  SET_REQ_SUCCESS(req);
fchmod_cleanup:
  CloseHandle(handle);
}


INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) {
  FILETIME filetime_a, filetime_m;

  TIME_T_TO_FILETIME(atime, &filetime_a);
  TIME_T_TO_FILETIME(mtime, &filetime_m);

libuv/src/win/fs.c  view on Meta::CPAN

    XX(WRITE, write)
    XX(COPYFILE, copyfile)
    XX(SENDFILE, sendfile)
    XX(STAT, stat)
    XX(LSTAT, lstat)
    XX(FSTAT, fstat)
    XX(FTRUNCATE, ftruncate)
    XX(UTIME, utime)
    XX(FUTIME, futime)
    XX(ACCESS, access)
    XX(CHMOD, chmod)
    XX(FCHMOD, fchmod)
    XX(FSYNC, fsync)
    XX(FDATASYNC, fdatasync)
    XX(UNLINK, unlink)
    XX(RMDIR, rmdir)
    XX(MKDIR, mkdir)
    XX(MKDTEMP, mkdtemp)
    XX(RENAME, rename)
    XX(SCANDIR, scandir)
    XX(READDIR, readdir)
    XX(OPENDIR, opendir)

libuv/src/win/fs.c  view on Meta::CPAN

  INIT(UV_FS_ACCESS);
  err = fs__capture_path(req, path, NULL, cb != NULL);
  if (err)
    return uv_translate_sys_error(err);

  req->fs.info.mode = flags;
  POST;
}


int uv_fs_chmod(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
    uv_fs_cb cb) {
  int err;

  INIT(UV_FS_CHMOD);
  err = fs__capture_path(req, path, NULL, cb != NULL);
  if (err) {
    return uv_translate_sys_error(err);
  }

  req->fs.info.mode = mode;
  POST;
}


int uv_fs_fchmod(uv_loop_t* loop, uv_fs_t* req, uv_file fd, int mode,
    uv_fs_cb cb) {
  INIT(UV_FS_FCHMOD);
  req->file.fd = fd;
  req->fs.info.mode = mode;
  POST;
}


int uv_fs_utime(uv_loop_t* loop, uv_fs_t* req, const char* path, double atime,
    double mtime, uv_fs_cb cb) {

libuv/src/win/pipe.c  view on Meta::CPAN


uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) {
  if (!handle->ipc)
    return UV_UNKNOWN_HANDLE;
  if (handle->pipe.conn.ipc_xfer_queue_length == 0)
    return UV_UNKNOWN_HANDLE;
  else
    return UV_TCP;
}

int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
  SID_IDENTIFIER_AUTHORITY sid_world = { SECURITY_WORLD_SID_AUTHORITY };
  PACL old_dacl, new_dacl;
  PSECURITY_DESCRIPTOR sd;
  EXPLICIT_ACCESS ea;
  PSID everyone;
  int error;

  if (handle == NULL || handle->handle == INVALID_HANDLE_VALUE)
    return UV_EBADF;

libuv/test/test-fs-copyfile.c  view on Meta::CPAN

                     NULL);
  ASSERT(r == 0 || r == UV_ENOSYS || r == UV_ENOTSUP);

  if (r == 0)
    handle_result(&req);

#ifndef _WIN32
  /* Copying respects permissions/mode. */
  unlink(dst);
  touch_file(dst, 0);
  chmod(dst, S_IRUSR|S_IRGRP|S_IROTH); /* Sets file mode to 444 (read-only). */
  r = uv_fs_copyfile(NULL, &req, fixture, dst, 0, NULL);
  ASSERT(req.result == UV_EACCES);
  ASSERT(r == UV_EACCES);
  uv_fs_req_cleanup(&req);
#endif

  unlink(dst); /* Cleanup */
  return 0;
}

libuv/test/test-fs.c  view on Meta::CPAN

static int rmdir_cb_count;
static int scandir_cb_count;
static int stat_cb_count;
static int rename_cb_count;
static int fsync_cb_count;
static int fdatasync_cb_count;
static int ftruncate_cb_count;
static int sendfile_cb_count;
static int fstat_cb_count;
static int access_cb_count;
static int chmod_cb_count;
static int fchmod_cb_count;
static int chown_cb_count;
static int fchown_cb_count;
static int lchown_cb_count;
static int link_cb_count;
static int symlink_cb_count;
static int readlink_cb_count;
static int realpath_cb_count;
static int utime_cb_count;
static int futime_cb_count;

libuv/test/test-fs.c  view on Meta::CPAN

  uv_fs_t req;
  uv_stat_t* s;

  r = uv_fs_stat(NULL, &req, filename, NULL);
  ASSERT(r == 0);
  ASSERT(req.result == 0);

  s = &req.statbuf;
#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MSYS__)
  /*
   * On Windows, chmod can only modify S_IWUSR (_S_IWRITE) bit,
   * so only testing for the specified flags.
   */
  ASSERT((s->st_mode & 0777) & mode);
#else
  ASSERT((s->st_mode & 0777) == mode);
#endif

  uv_fs_req_cleanup(&req);
}

libuv/test/test-fs.c  view on Meta::CPAN

}


static void access_cb(uv_fs_t* req) {
  ASSERT(req->fs_type == UV_FS_ACCESS);
  access_cb_count++;
  uv_fs_req_cleanup(req);
}


static void fchmod_cb(uv_fs_t* req) {
  ASSERT(req->fs_type == UV_FS_FCHMOD);
  ASSERT(req->result == 0);
  fchmod_cb_count++;
  uv_fs_req_cleanup(req);
  check_permission("test_file", *(int*)req->data);
}


static void chmod_cb(uv_fs_t* req) {
  ASSERT(req->fs_type == UV_FS_CHMOD);
  ASSERT(req->result == 0);
  chmod_cb_count++;
  uv_fs_req_cleanup(req);
  check_permission("test_file", *(int*)req->data);
}


static void fchown_cb(uv_fs_t* req) {
  ASSERT(req->fs_type == UV_FS_FCHOWN);
  ASSERT(req->result == 0);
  fchown_cb_count++;
  uv_fs_req_cleanup(req);

libuv/test/test-fs.c  view on Meta::CPAN


  /* Cleanup. */
  unlink("test_file");
  rmdir("test_dir");

  MAKE_VALGRIND_HAPPY();
  return 0;
}


TEST_IMPL(fs_chmod) {
  int r;
  uv_fs_t req;
  uv_file file;

  /* Setup. */
  unlink("test_file");

  loop = uv_default_loop();

  r = uv_fs_open(NULL, &req, "test_file", O_RDWR | O_CREAT,

libuv/test/test-fs.c  view on Meta::CPAN

  uv_fs_req_cleanup(&req);

  iov = uv_buf_init(test_buf, sizeof(test_buf));
  r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
  ASSERT(r == sizeof(test_buf));
  ASSERT(req.result == sizeof(test_buf));
  uv_fs_req_cleanup(&req);

#ifndef _WIN32
  /* Make the file write-only */
  r = uv_fs_chmod(NULL, &req, "test_file", 0200, NULL);
  ASSERT(r == 0);
  ASSERT(req.result == 0);
  uv_fs_req_cleanup(&req);

  check_permission("test_file", 0200);
#endif

  /* Make the file read-only */
  r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL);
  ASSERT(r == 0);
  ASSERT(req.result == 0);
  uv_fs_req_cleanup(&req);

  check_permission("test_file", 0400);

  /* Make the file read+write with sync uv_fs_fchmod */
  r = uv_fs_fchmod(NULL, &req, file, 0600, NULL);
  ASSERT(r == 0);
  ASSERT(req.result == 0);
  uv_fs_req_cleanup(&req);

  check_permission("test_file", 0600);

#ifndef _WIN32
  /* async chmod */
  {
    static int mode = 0200;
    req.data = &mode;
  }
  r = uv_fs_chmod(loop, &req, "test_file", 0200, chmod_cb);
  ASSERT(r == 0);
  uv_run(loop, UV_RUN_DEFAULT);
  ASSERT(chmod_cb_count == 1);
  chmod_cb_count = 0; /* reset for the next test */
#endif

  /* async chmod */
  {
    static int mode = 0400;
    req.data = &mode;
  }
  r = uv_fs_chmod(loop, &req, "test_file", 0400, chmod_cb);
  ASSERT(r == 0);
  uv_run(loop, UV_RUN_DEFAULT);
  ASSERT(chmod_cb_count == 1);

  /* async fchmod */
  {
    static int mode = 0600;
    req.data = &mode;
  }
  r = uv_fs_fchmod(loop, &req, file, 0600, fchmod_cb);
  ASSERT(r == 0);
  uv_run(loop, UV_RUN_DEFAULT);
  ASSERT(fchmod_cb_count == 1);

  close(file);

  /*
   * Run the loop just to check we don't have make any extraneous uv_ref()
   * calls. This should drop out immediately.
   */
  uv_run(loop, UV_RUN_DEFAULT);

  /* Cleanup. */

libuv/test/test-fs.c  view on Meta::CPAN


  iov = uv_buf_init(test_buf, sizeof(test_buf));
  r = uv_fs_write(NULL, &req, file, &iov, 1, -1, NULL);
  ASSERT(r == sizeof(test_buf));
  ASSERT(req.result == sizeof(test_buf));
  uv_fs_req_cleanup(&req);

  close(file);

  /* Make the file read-only */
  r = uv_fs_chmod(NULL, &req, "test_file", 0400, NULL);
  ASSERT(r == 0);
  ASSERT(req.result == 0);
  uv_fs_req_cleanup(&req);

  check_permission("test_file", 0400);

  /* Try to unlink the file */
  r = uv_fs_unlink(NULL, &req, "test_file", NULL);
  ASSERT(r == 0);
  ASSERT(req.result == 0);
  uv_fs_req_cleanup(&req);

  /*
  * Run the loop just to check we don't have make any extraneous uv_ref()
  * calls. This should drop out immediately.
  */
  uv_run(loop, UV_RUN_DEFAULT);

  /* Cleanup. */
  uv_fs_chmod(NULL, &req, "test_file", 0600, NULL);
  uv_fs_req_cleanup(&req);
  unlink("test_file");

  MAKE_VALGRIND_HAPPY();
  return 0;
}

#ifdef _WIN32
TEST_IMPL(fs_unlink_archive_readonly) {
  int r;

libuv/test/test-fs.c  view on Meta::CPAN

  ASSERT(req.result == 0);
  uv_fs_req_cleanup(&req);

  /*
  * Run the loop just to check we don't have make any extraneous uv_ref()
  * calls. This should drop out immediately.
  */
  uv_run(loop, UV_RUN_DEFAULT);

  /* Cleanup. */
  uv_fs_chmod(NULL, &req, "test_file", 0600, NULL);
  uv_fs_req_cleanup(&req);
  unlink("test_file");

  MAKE_VALGRIND_HAPPY();
  return 0;
}
#endif

TEST_IMPL(fs_chown) {
  int r;

libuv/test/test-fs.c  view on Meta::CPAN


  r = uv_fs_copyfile(NULL, NULL, NULL, NULL, 0, NULL);
  ASSERT(r == UV_EINVAL);

  r = uv_fs_sendfile(NULL, NULL, 0, 0, 0, 0, NULL);
  ASSERT(r == UV_EINVAL);

  r = uv_fs_access(NULL, NULL, NULL, 0, NULL);
  ASSERT(r == UV_EINVAL);

  r = uv_fs_chmod(NULL, NULL, NULL, 0, NULL);
  ASSERT(r == UV_EINVAL);

  r = uv_fs_fchmod(NULL, NULL, 0, 0, NULL);
  ASSERT(r == UV_EINVAL);

  r = uv_fs_utime(NULL, NULL, NULL, 0.0, 0.0, NULL);
  ASSERT(r == UV_EINVAL);

  r = uv_fs_futime(NULL, NULL, 0, 0.0, 0.0, NULL);
  ASSERT(r == UV_EINVAL);

  /* This should be a no-op. */
  uv_fs_req_cleanup(NULL);

libuv/test/test-fs.c  view on Meta::CPAN

            attrib -r test_file_icacls
            del test_file_icacls
    */

    /* Setup - clear the ACL and remove the file */
    loop = uv_default_loop();
    r = uv_os_get_passwd(&pwd);
    ASSERT(r == 0);
    call_icacls("icacls test_file_icacls /remove \"%s\" /inheritance:e",
                pwd.username);
    uv_fs_chmod(loop, &req, "test_file_icacls", S_IWUSR, NULL);
    unlink("test_file_icacls");

    /* Create the file */
    r = uv_fs_open(loop,
                   &open_req1,
                   "test_file_icacls",
                   O_RDONLY | O_CREAT,
                   S_IRUSR,
                   NULL);
    ASSERT(r >= 0);

libuv/test/test-fs.c  view on Meta::CPAN

                pwd.username);
    unlink("test_file_icacls");
    uv_os_free_passwd(&pwd);
    ASSERT(r == 0);
    MAKE_VALGRIND_HAPPY();
    return 0;
}
#endif

#ifdef _WIN32
TEST_IMPL(fs_fchmod_archive_readonly) {
    uv_fs_t req;
    uv_file file;
    int r;
    /* Test clearing read-only flag from files with Archive flag cleared */

    /* Setup*/
    unlink("test_file");
    r = uv_fs_open(NULL,
                   &req,
                   "test_file",

libuv/test/test-fs.c  view on Meta::CPAN

    ASSERT(req.result >= 0);
    file = req.result;
    uv_fs_req_cleanup(&req);
    r = uv_fs_close(NULL, &req, file, NULL);
    ASSERT(r == 0);
    uv_fs_req_cleanup(&req);
    /* Make the file read-only and clear archive flag */
    r = SetFileAttributes("test_file", FILE_ATTRIBUTE_READONLY);
    ASSERT(r != 0);
    check_permission("test_file", 0400);
    /* Try fchmod */
    r = uv_fs_open(NULL, &req, "test_file", O_RDONLY, 0, NULL);
    ASSERT(r >= 0);
    ASSERT(req.result >= 0);
    file = req.result;
    uv_fs_req_cleanup(&req);
    r = uv_fs_fchmod(NULL, &req, file, S_IWUSR, NULL);
    ASSERT(r == 0);
    ASSERT(req.result == 0);
    uv_fs_req_cleanup(&req);
    r = uv_fs_close(NULL, &req, file, NULL);
    ASSERT(r == 0);
    uv_fs_req_cleanup(&req);
    check_permission("test_file", S_IWUSR);

    /* Restore Archive flag for rest of the tests */
    r = SetFileAttributes("test_file", FILE_ATTRIBUTE_ARCHIVE);

libuv/test/test-list.h  view on Meta::CPAN

TEST_DECLARE   (udp_ref2)
TEST_DECLARE   (udp_ref3)
TEST_DECLARE   (pipe_ref)
TEST_DECLARE   (pipe_ref2)
TEST_DECLARE   (pipe_ref3)
TEST_DECLARE   (pipe_ref4)
#ifndef _WIN32
TEST_DECLARE   (pipe_close_stdout_read_stdin)
#endif
TEST_DECLARE   (pipe_set_non_blocking)
TEST_DECLARE   (pipe_set_chmod)
TEST_DECLARE   (process_ref)
TEST_DECLARE   (process_priority)
TEST_DECLARE   (has_ref)
TEST_DECLARE   (active)
TEST_DECLARE   (embed)
TEST_DECLARE   (async)
TEST_DECLARE   (async_null_cb)
TEST_DECLARE   (eintr_handling)
TEST_DECLARE   (get_currentexe)
TEST_DECLARE   (process_title)

libuv/test/test-list.h  view on Meta::CPAN

TEST_DECLARE   (fs_file_nametoolong)
TEST_DECLARE   (fs_file_loop)
TEST_DECLARE   (fs_file_async)
TEST_DECLARE   (fs_file_sync)
TEST_DECLARE   (fs_file_write_null_buffer)
TEST_DECLARE   (fs_async_dir)
TEST_DECLARE   (fs_async_sendfile)
TEST_DECLARE   (fs_mkdtemp)
TEST_DECLARE   (fs_fstat)
TEST_DECLARE   (fs_access)
TEST_DECLARE   (fs_chmod)
TEST_DECLARE   (fs_copyfile)
TEST_DECLARE   (fs_unlink_readonly)
#ifdef _WIN32
TEST_DECLARE   (fs_unlink_archive_readonly)
#endif
TEST_DECLARE   (fs_chown)
TEST_DECLARE   (fs_link)
TEST_DECLARE   (fs_readlink)
TEST_DECLARE   (fs_realpath)
TEST_DECLARE   (fs_symlink)

libuv/test/test-list.h  view on Meta::CPAN

TEST_DECLARE   (fs_write_alotof_bufs_with_offset)
TEST_DECLARE   (fs_partial_read)
TEST_DECLARE   (fs_partial_write)
TEST_DECLARE   (fs_file_pos_after_op_with_offset)
TEST_DECLARE   (fs_null_req)
TEST_DECLARE   (fs_read_dir)
#ifdef _WIN32
TEST_DECLARE   (fs_exclusive_sharing_mode)
TEST_DECLARE   (fs_file_flag_no_buffering)
TEST_DECLARE   (fs_open_readonly_acl)
TEST_DECLARE   (fs_fchmod_archive_readonly)
#endif
TEST_DECLARE   (strscpy)
TEST_DECLARE   (threadpool_queue_work_simple)
TEST_DECLARE   (threadpool_queue_work_einval)
TEST_DECLARE   (threadpool_multiple_event_loops)
TEST_DECLARE   (threadpool_cancel_getaddrinfo)
TEST_DECLARE   (threadpool_cancel_getnameinfo)
TEST_DECLARE   (threadpool_cancel_work)
TEST_DECLARE   (threadpool_cancel_fs)
TEST_DECLARE   (threadpool_cancel_single)

libuv/test/test-list.h  view on Meta::CPAN


  TEST_ENTRY  (pipe_connect_bad_name)
  TEST_ENTRY  (pipe_connect_to_file)
  TEST_ENTRY  (pipe_connect_on_prepare)

  TEST_ENTRY  (pipe_server_close)
#ifndef _WIN32
  TEST_ENTRY  (pipe_close_stdout_read_stdin)
#endif
  TEST_ENTRY  (pipe_set_non_blocking)
  TEST_ENTRY  (pipe_set_chmod)
  TEST_ENTRY  (tty)
#ifdef _WIN32
  TEST_ENTRY  (tty_raw)
  TEST_ENTRY  (tty_empty_write)
  TEST_ENTRY  (tty_large_write)
  TEST_ENTRY  (tty_raw_cancel)
  TEST_ENTRY  (tty_duplicate_vt100_fn_key)
  TEST_ENTRY  (tty_duplicate_alt_modifier_key)
  TEST_ENTRY  (tty_composing_character)
#endif

libuv/test/test-list.h  view on Meta::CPAN

  TEST_ENTRY  (fs_file_nametoolong)
  TEST_ENTRY  (fs_file_loop)
  TEST_ENTRY  (fs_file_async)
  TEST_ENTRY  (fs_file_sync)
  TEST_ENTRY  (fs_file_write_null_buffer)
  TEST_ENTRY  (fs_async_dir)
  TEST_ENTRY  (fs_async_sendfile)
  TEST_ENTRY  (fs_mkdtemp)
  TEST_ENTRY  (fs_fstat)
  TEST_ENTRY  (fs_access)
  TEST_ENTRY  (fs_chmod)
  TEST_ENTRY  (fs_copyfile)
  TEST_ENTRY  (fs_unlink_readonly)
#ifdef _WIN32
  TEST_ENTRY  (fs_unlink_archive_readonly)
#endif
  TEST_ENTRY  (fs_chown)
  TEST_ENTRY  (fs_utime)
  TEST_ENTRY  (fs_futime)
  TEST_ENTRY  (fs_readlink)
  TEST_ENTRY  (fs_realpath)

libuv/test/test-list.h  view on Meta::CPAN

  TEST_ENTRY  (fs_partial_read)
  TEST_ENTRY  (fs_partial_write)
  TEST_ENTRY  (fs_read_write_null_arguments)
  TEST_ENTRY  (fs_file_pos_after_op_with_offset)
  TEST_ENTRY  (fs_null_req)
  TEST_ENTRY  (fs_read_dir)
#ifdef _WIN32
  TEST_ENTRY  (fs_exclusive_sharing_mode)
  TEST_ENTRY  (fs_file_flag_no_buffering)
  TEST_ENTRY  (fs_open_readonly_acl)
  TEST_ENTRY  (fs_fchmod_archive_readonly)
#endif
  TEST_ENTRY  (get_osfhandle_valid_handle)
  TEST_ENTRY  (open_osfhandle_valid_handle)
  TEST_ENTRY  (strscpy)
  TEST_ENTRY  (threadpool_queue_work_simple)
  TEST_ENTRY  (threadpool_queue_work_einval)
  TEST_ENTRY  (threadpool_multiple_event_loops)
  TEST_ENTRY  (threadpool_cancel_getaddrinfo)
  TEST_ENTRY  (threadpool_cancel_getnameinfo)
  TEST_ENTRY  (threadpool_cancel_work)

libuv/test/test-pipe-set-fchmod.c  view on Meta::CPAN

* 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 "task.h"

TEST_IMPL(pipe_set_chmod) {
  uv_pipe_t pipe_handle;
  uv_loop_t* loop;
  int r;
#ifndef _WIN32
  struct stat stat_buf;
#endif

  loop = uv_default_loop();

  r = uv_pipe_init(loop, &pipe_handle, 0);
  ASSERT(r == 0);

  r = uv_pipe_bind(&pipe_handle, TEST_PIPENAME);
  ASSERT(r == 0);

  /* No easy way to test if this works, we will only make sure that the call is
   * successful. */
  r = uv_pipe_chmod(&pipe_handle, UV_READABLE);
  if (r == UV_EPERM) {
    MAKE_VALGRIND_HAPPY();
    RETURN_SKIP("Insufficient privileges to alter pipe fmode");
  }
  ASSERT(r == 0);
#ifndef _WIN32
  stat(TEST_PIPENAME, &stat_buf);
  ASSERT(stat_buf.st_mode & S_IRUSR);
  ASSERT(stat_buf.st_mode & S_IRGRP);
  ASSERT(stat_buf.st_mode & S_IROTH);
#endif

  r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE);
  ASSERT(r == 0);
#ifndef _WIN32
  stat(TEST_PIPENAME, &stat_buf);
  ASSERT(stat_buf.st_mode & S_IWUSR);
  ASSERT(stat_buf.st_mode & S_IWGRP);
  ASSERT(stat_buf.st_mode & S_IWOTH);
#endif

  r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
  ASSERT(r == 0);
#ifndef _WIN32
  stat(TEST_PIPENAME, &stat_buf);
  ASSERT(stat_buf.st_mode & S_IRUSR);
  ASSERT(stat_buf.st_mode & S_IRGRP);
  ASSERT(stat_buf.st_mode & S_IROTH);
  ASSERT(stat_buf.st_mode & S_IWUSR);
  ASSERT(stat_buf.st_mode & S_IWGRP);
  ASSERT(stat_buf.st_mode & S_IWOTH);
#endif

  r = uv_pipe_chmod(NULL, UV_WRITABLE | UV_READABLE);
  ASSERT(r == UV_EBADF);

  r = uv_pipe_chmod(&pipe_handle, 12345678);
  ASSERT(r == UV_EINVAL);

  uv_close((uv_handle_t*)&pipe_handle, NULL);
  r = uv_pipe_chmod(&pipe_handle, UV_WRITABLE | UV_READABLE);
  ASSERT(r == UV_EBADF);

  MAKE_VALGRIND_HAPPY();
  return 0;
}

libuv/test/test-threadpool-cancel.c  view on Meta::CPAN

  unsigned n;
  uv_buf_t iov;

  INIT_CANCEL_INFO(&ci, reqs);
  loop = uv_default_loop();
  saturate_threadpool();
  iov = uv_buf_init(NULL, 0);

  /* Needs to match ARRAY_SIZE(fs_reqs). */
  n = 0;
  ASSERT(0 == uv_fs_chmod(loop, reqs + n++, "/", 0, fs_cb));
  ASSERT(0 == uv_fs_chown(loop, reqs + n++, "/", 0, 0, fs_cb));
  ASSERT(0 == uv_fs_close(loop, reqs + n++, 0, fs_cb));
  ASSERT(0 == uv_fs_fchmod(loop, reqs + n++, 0, 0, fs_cb));
  ASSERT(0 == uv_fs_fchown(loop, reqs + n++, 0, 0, 0, fs_cb));
  ASSERT(0 == uv_fs_fdatasync(loop, reqs + n++, 0, fs_cb));
  ASSERT(0 == uv_fs_fstat(loop, reqs + n++, 0, fs_cb));
  ASSERT(0 == uv_fs_fsync(loop, reqs + n++, 0, fs_cb));
  ASSERT(0 == uv_fs_ftruncate(loop, reqs + n++, 0, 0, fs_cb));
  ASSERT(0 == uv_fs_futime(loop, reqs + n++, 0, 0, 0, fs_cb));
  ASSERT(0 == uv_fs_link(loop, reqs + n++, "/", "/", fs_cb));
  ASSERT(0 == uv_fs_lstat(loop, reqs + n++, "/", fs_cb));
  ASSERT(0 == uv_fs_mkdir(loop, reqs + n++, "/", 0, fs_cb));
  ASSERT(0 == uv_fs_open(loop, reqs + n++, "/", 0, 0, fs_cb));

libuv/test/test.gyp  view on Meta::CPAN

        'test-pipe-bind-error.c',
        'test-pipe-connect-error.c',
        'test-pipe-connect-multiple.c',
        'test-pipe-connect-prepare.c',
        'test-pipe-getsockname.c',
        'test-pipe-pending-instances.c',
        'test-pipe-sendmsg.c',
        'test-pipe-server-close.c',
        'test-pipe-close-stdout-read-stdin.c',
        'test-pipe-set-non-blocking.c',
        'test-pipe-set-fchmod.c',
        'test-platform-output.c',
        'test-poll.c',
        'test-poll-close.c',
        'test-poll-close-doesnt-corrupt-stack.c',
        'test-poll-closesocket.c',
        'test-poll-oob.c',
        'test-process-priority.c',
        'test-process-title.c',
        'test-process-title-threadsafe.c',
        'test-queue-foreach-delete.c',



( run in 0.339 second using v1.01-cache-2.11-cpan-496ff517765 )