Example #1
0
int __fxstat (int vers, int fd, struct stat *buf)
{
  if (buf == NULL) {
    errno = EFAULT;
    return -1;
  }
  struct nacl_abi_stat nacl_buf;
  int result = NACL_SYSCALL (fstat) (fd, &nacl_buf);
  if (result < 0) {
    errno = -result;
    return -1;
  }
  __nacl_abi_stat_to_stat (&nacl_buf, buf);
  return result;
}
Example #2
0
// ARC MOD BEGIN
// Define fstat instead of __fxstat
int fstat(int fd, struct stat *buf)
// ARC MOD END
{
  if (buf == NULL) {
    errno = EFAULT;
    return -1;
  }
  struct nacl_abi_stat nacl_buf;
  int result = __nacl_irt_fstat (fd, &nacl_buf);
  if (result != 0) {
    errno = result;
    return -1;
  }
  __nacl_abi_stat_to_stat (&nacl_buf, buf);
  // ARC MOD BEGIN UPSTREAM treat-zero-and-neg-zero-the-same
  // Return 0 instead of -result.
  return 0;
  // ARC MOD END UPSTREAM
}
Example #3
0
int __xstat (int version, const char *path, struct stat *buf)
{
  if (buf == NULL || path == NULL)
    {
      errno = EFAULT;
      return -1;
    }
  struct nacl_abi_stat st;
  int result = NACL_SYSCALL (stat) (path, &st);
  if (result < 0)
    {
      errno = -result;
      return -1;
    }
  else
    {
      __nacl_abi_stat_to_stat (&st, buf);
      return 0;
    }
}
Example #4
0
// ARC MOD BEGIN
// Define stat instead of __xstat
int stat(const char *path, struct stat *buf)
// ARC MOD END
{
  if (buf == NULL || path == NULL)
    {
      errno = EFAULT;
      return -1;
    }
  struct nacl_abi_stat st;
  int result = __nacl_irt_stat (path, &st);
  if (result != 0)
    {
      errno = result;
      return -1;
    }
  else
    {
      __nacl_abi_stat_to_stat (&st, buf);
      return 0;
    }
}