示例#1
0
文件: fallocate.c 项目: gf-chen/glibc
/* Reserve storage for the data of the file associated with FD.  */
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
  int err;
  if (SINGLE_THREAD_P)
    err = __call_fallocate (fd, mode, offset, len);
  else
    {
      int oldtype = LIBC_CANCEL_ASYNC ();

      err = __call_fallocate (fd, mode, offset, len);

      LIBC_CANCEL_RESET (oldtype);
    }
  if (__builtin_expect (err, 0))
    {
      __set_errno (err);
      err = -1;
    }
  return err;
#else
  __set_errno (ENOSYS);
  return -1;
#endif
}
示例#2
0
/* Reserve storage for the data of the file associated with FD.  */
int
__posix_fallocate64_l64 (int fd, __off64_t offset, __off64_t len)
{
#ifdef __NR_fallocate
# ifndef __ASSUME_FALLOCATE
  if (__builtin_expect (__have_fallocate >= 0, 1))
# endif
    {
      int res = __call_fallocate (fd, 0, offset, len);

      if (! res)
	return 0;

# ifndef __ASSUME_FALLOCATE
      if (__builtin_expect (res == ENOSYS, 0))
	__have_fallocate = -1;
      else
# endif
	if (res != EOPNOTSUPP)
	  return res;
    }
#endif

  return internal_fallocate64 (fd, offset, len);
}
/* Reserve storage for the data of the file associated with FD.  */
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
#ifdef __NR_fallocate
  int err = __call_fallocate (fd, mode, offset, len);
  if (__builtin_expect (err, 0))
    {
      __set_errno (err);
      err = -1;
    }
  return err;
#else
  __set_errno (ENOSYS);
  return -1;
#endif
}
示例#4
0
/* Reserve storage for the data of the file associated with FD.  */
int
fallocate (int fd, int mode, __off_t offset, __off_t len)
{
  return __call_fallocate (fd, mode, offset, len);
}