Alien-uv

 view release on metacpan or  search on metacpan

libuv/ChangeLog  view on Meta::CPAN


* Revert "win, test: fix double close in test runner" (Bartosz Sosnowski)

* win, test: remove surplus CloseHandle (Bartosz Sosnowski)


2017.08.17, Version 1.14.0 (Stable), e0d31e9e21870f88277746b6d59cf07b977cdfea

Changes since version 1.13.1:

* unix: check for NULL in uv_os_unsetenv for parameter name (André Klitzing)

* doc: add thread safety warning for process title (Matthew Taylor)

* unix: always copy process title into local buffer (Matthew Taylor)

* poll: add support for OOB TCP and GPIO interrupts (CurlyMoo)

* win,build: fix appveyor properly (Refael Ackermann)

* win: include filename in dlopen error message (Ben Noordhuis)

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

    in `buffer`, including the null terminator. If the environment variable
    exceeds the storage available in `buffer`, `UV_ENOBUFS` is returned, and
    `size` is set to the amount of storage required to hold the value. If no
    matching environment variable exists, `UV_ENOENT` is returned.

    .. warning::
        This function is not thread safe.

    .. versionadded:: 1.12.0

.. c:function:: int uv_os_setenv(const char* name, const char* value)

    Creates or updates the environment variable specified by `name` with
    `value`.

    .. warning::
        This function is not thread safe.

    .. versionadded:: 1.12.0

.. c:function:: int uv_os_unsetenv(const char* name)

    Deletes the environment variable specified by `name`. If no such environment
    variable exists, this function returns successfully.

    .. warning::
        This function is not thread safe.

    .. versionadded:: 1.12.0

.. c:function:: int uv_os_gethostname(char* buffer, size_t* size)

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


UV_EXTERN int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count);
UV_EXTERN void uv_free_cpu_info(uv_cpu_info_t* cpu_infos, int count);

UV_EXTERN int uv_interface_addresses(uv_interface_address_t** addresses,
                                     int* count);
UV_EXTERN void uv_free_interface_addresses(uv_interface_address_t* addresses,
                                           int count);

UV_EXTERN int uv_os_getenv(const char* name, char* buffer, size_t* size);
UV_EXTERN int uv_os_setenv(const char* name, const char* value);
UV_EXTERN int uv_os_unsetenv(const char* name);

#ifdef MAXHOSTNAMELEN
# define UV_MAXHOSTNAMESIZE (MAXHOSTNAMELEN + 1)
#else
  /*
    Fallback for the maximum hostname size, including the null terminator. The
    Windows gethostname() documentation states that 256 bytes will always be
    large enough to hold the null-terminated hostname.
  */
# define UV_MAXHOSTNAMESIZE 256

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

    return UV_ENOBUFS;
  }

  memcpy(buffer, var, len + 1);
  *size = len;

  return 0;
}


int uv_os_setenv(const char* name, const char* value) {
  if (name == NULL || value == NULL)
    return UV_EINVAL;

  if (setenv(name, value, 1) != 0)
    return UV__ERR(errno);

  return 0;
}


int uv_os_unsetenv(const char* name) {
  if (name == NULL)
    return UV_EINVAL;

  if (unsetenv(name) != 0)
    return UV__ERR(errno);

  return 0;
}


int uv_os_gethostname(char* buffer, size_t* size) {
  /*
    On some platforms, if the input buffer is not large enough, gethostname()
    succeeds, but truncates the result. libuv can detect this and return ENOBUFS

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

                                NULL);

  if (bufsize == 0)
    return uv_translate_sys_error(GetLastError());

  *size = bufsize - 1;
  return 0;
}


int uv_os_setenv(const char* name, const char* value) {
  wchar_t* name_w;
  wchar_t* value_w;
  int r;

  if (name == NULL || value == NULL)
    return UV_EINVAL;

  r = uv__convert_utf8_to_utf16(name, -1, &name_w);

  if (r != 0)

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

  uv__free(name_w);
  uv__free(value_w);

  if (r == 0)
    return uv_translate_sys_error(GetLastError());

  return 0;
}


int uv_os_unsetenv(const char* name) {
  wchar_t* name_w;
  int r;

  if (name == NULL)
    return UV_EINVAL;

  r = uv__convert_utf8_to_utf16(name, -1, &name_w);

  if (r != 0)
    return r;

libuv/test/runner-unix.c  view on Meta::CPAN

void notify_parent_process(void) {
  char* arg;
  int fd;

  arg = getenv("UV_TEST_RUNNER_FD");
  if (arg == NULL)
    return;

  fd = atoi(arg);
  assert(fd > STDERR_FILENO);
  unsetenv("UV_TEST_RUNNER_FD");
  closefd(fd);
}


/* Do platform-specific initialization. */
int platform_init(int argc, char **argv) {
  /* Disable stdio output buffering. */
  setvbuf(stdout, NULL, _IONBF, 0);
  setvbuf(stderr, NULL, _IONBF, 0);
  signal(SIGPIPE, SIG_IGN);

libuv/test/runner-unix.c  view on Meta::CPAN

    return -1;
  }

  if (is_helper) {
    if (pipe(pipefd)) {
      perror("pipe");
      return -1;
    }

    snprintf(fdstr, sizeof(fdstr), "%d", pipefd[1]);
    if (setenv("UV_TEST_RUNNER_FD", fdstr, /* overwrite */ 1)) {
      perror("setenv");
      return -1;
    }
  }

  p->terminated = 0;
  p->status = 0;

  pid = fork();

  if (pid < 0) {

libuv/test/runner-unix.c  view on Meta::CPAN


  /* parent */
  p->pid = pid;
  p->name = strdup(name);
  p->stdout_file = stdout_file;

  if (!is_helper)
    return 0;

  closefd(pipefd[1]);
  unsetenv("UV_TEST_RUNNER_FD");

  do
    rc = read(pipefd[0], &n, 1);
  while (rc == -1 && errno == EINTR);

  closefd(pipefd[0]);

  if (rc == -1) {
    perror("read");
    return -1;

libuv/test/test-env-vars.c  view on Meta::CPAN


#define BUF_SIZE 10

TEST_IMPL(env_vars) {
  const char* name = "UV_TEST_FOO";
  char buf[BUF_SIZE];
  size_t size;
  int r;

  /* Reject invalid inputs when setting an environment variable */
  r = uv_os_setenv(NULL, "foo");
  ASSERT(r == UV_EINVAL);
  r = uv_os_setenv(name, NULL);
  ASSERT(r == UV_EINVAL);
  r = uv_os_setenv(NULL, NULL);
  ASSERT(r == UV_EINVAL);

  /* Reject invalid inputs when retrieving an environment variable */
  size = BUF_SIZE;
  r = uv_os_getenv(NULL, buf, &size);
  ASSERT(r == UV_EINVAL);
  r = uv_os_getenv(name, NULL, &size);
  ASSERT(r == UV_EINVAL);
  r = uv_os_getenv(name, buf, NULL);
  ASSERT(r == UV_EINVAL);
  size = 0;
  r = uv_os_getenv(name, buf, &size);
  ASSERT(r == UV_EINVAL);

  /* Reject invalid inputs when deleting an environment variable */
  r = uv_os_unsetenv(NULL);
  ASSERT(r == UV_EINVAL);

  /* Successfully set an environment variable */
  r = uv_os_setenv(name, "123456789");
  ASSERT(r == 0);

  /* Successfully read an environment variable */
  size = BUF_SIZE;
  buf[0] = '\0';
  r = uv_os_getenv(name, buf, &size);
  ASSERT(r == 0);
  ASSERT(strcmp(buf, "123456789") == 0);
  ASSERT(size == BUF_SIZE - 1);

  /* Return UV_ENOBUFS if the buffer cannot hold the environment variable */
  size = BUF_SIZE - 1;
  buf[0] = '\0';
  r = uv_os_getenv(name, buf, &size);
  ASSERT(r == UV_ENOBUFS);
  ASSERT(size == BUF_SIZE);

  /* Successfully delete an environment variable */
  r = uv_os_unsetenv(name);
  ASSERT(r == 0);

  /* Return UV_ENOENT retrieving an environment variable that does not exist */
  r = uv_os_getenv(name, buf, &size);
  ASSERT(r == UV_ENOENT);

  /* Successfully delete an environment variable that does not exist */
  r = uv_os_unsetenv(name);
  ASSERT(r == 0);

  return 0;
}



( run in 0.646 second using v1.01-cache-2.11-cpan-3989ada0592 )