mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 02:40:08 +00:00
update.
2000-04-14 Ulrich Drepper <drepper@redhat.com> * include/sys/statfs.h: Add prototypes for __statfs64 and __fstatfs64. * sysdeps/generic/fstatfs64.c (__fstatfs64): Renamed to fstatfs64. Make old name weak alias. * sysdeps/unix/sysv/linux/fstatfs64.c: Likewise. * sysdeps/generic/statfs64.c (__statfs64): Renamed to statfs64. Make old name weak alias. * sysdeps/unix/sysv/linux/statfs64.c: Likewise. * io/Makefile (routines): Add posix_fadvise, posix_fadvise64, posix_fallocate, and posix_fallocate64. * io/Versions [libc] (GLIBC_2.2): Add posix_fadvise, posix_fadvise64, posix_fallocate, and posix_fallocate64. * io/fcntl.h: Declare posix_fadvise, posix_fadvise64, posix_fallocate, and posix_fallocate64. * sysdeps/generic/fadvise.c: New file. * sysdeps/generic/fadvise64.c: New file. * sysdeps/generic/fallocate.c: New file. * sysdeps/generic/fallocate64.c: New file. * sysdeps/posix/fallocate.c: New file. * sysdeps/posix/fallocate64.c: New file. * sysdeps/generic/bits/fcntl.h: Define POSIX_FADV_NORMAL, POSIX_FADV_RANDOM, POSIX_FADV_SEQUENTIAL, POSIX_FADV_WILLNEED, POSIX_FADV_DONTNEED, and POSIX_FADV_NOREUSE. * sysdeps/mach/hurd/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise. * sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise. * sysdeps/generic/madvise.c (__madvise): Renamed to posix_madvise. * sysdeps/unix/sysv/linux/syscalls.list: Likewise.
This commit is contained in:
parent
8f6f7a31c9
commit
bb8e0116cd
35
ChangeLog
35
ChangeLog
@ -1,3 +1,38 @@
|
||||
2000-04-14 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* include/sys/statfs.h: Add prototypes for __statfs64 and __fstatfs64.
|
||||
* sysdeps/generic/fstatfs64.c (__fstatfs64): Renamed to fstatfs64.
|
||||
Make old name weak alias.
|
||||
* sysdeps/unix/sysv/linux/fstatfs64.c: Likewise.
|
||||
* sysdeps/generic/statfs64.c (__statfs64): Renamed to statfs64.
|
||||
Make old name weak alias.
|
||||
* sysdeps/unix/sysv/linux/statfs64.c: Likewise.
|
||||
|
||||
* io/Makefile (routines): Add posix_fadvise, posix_fadvise64,
|
||||
posix_fallocate, and posix_fallocate64.
|
||||
* io/Versions [libc] (GLIBC_2.2): Add posix_fadvise, posix_fadvise64,
|
||||
posix_fallocate, and posix_fallocate64.
|
||||
* io/fcntl.h: Declare posix_fadvise, posix_fadvise64,
|
||||
posix_fallocate, and posix_fallocate64.
|
||||
* sysdeps/generic/fadvise.c: New file.
|
||||
* sysdeps/generic/fadvise64.c: New file.
|
||||
* sysdeps/generic/fallocate.c: New file.
|
||||
* sysdeps/generic/fallocate64.c: New file.
|
||||
* sysdeps/posix/fallocate.c: New file.
|
||||
* sysdeps/posix/fallocate64.c: New file.
|
||||
* sysdeps/generic/bits/fcntl.h: Define POSIX_FADV_NORMAL,
|
||||
POSIX_FADV_RANDOM, POSIX_FADV_SEQUENTIAL, POSIX_FADV_WILLNEED,
|
||||
POSIX_FADV_DONTNEED, and POSIX_FADV_NOREUSE.
|
||||
* sysdeps/mach/hurd/bits/fcntl.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/alpha/bits/fcntl.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/bits/fcntl.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/mips/bits/fcntl.h: Likewise.
|
||||
* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
|
||||
|
||||
* sysdeps/generic/madvise.c (__madvise): Renamed to posix_madvise.
|
||||
* sysdeps/unix/sysv/linux/syscalls.list: Likewise.
|
||||
|
||||
2000-04-13 Ulrich Drepper <drepper@redhat.com>
|
||||
|
||||
* misc/Versions [libc] (GLIBC_2.2): Add posix_madvice.
|
||||
|
12
bits/fcntl.h
12
bits/fcntl.h
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for stub configuration.
|
||||
Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -83,3 +83,13 @@ struct flock
|
||||
#define F_RDLCK 1 /* Read lock. */
|
||||
#define F_WRLCK 2 /* Write lock. */
|
||||
#define F_UNLCK 3 /* Remove lock. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -4,4 +4,6 @@
|
||||
/* Now define the internal interfaces. */
|
||||
extern int __statfs (__const char *__file, struct statfs *__buf);
|
||||
extern int __fstatfs (int __fildes, struct statfs *__buf);
|
||||
extern int __statfs64 (__const char *__file, struct statfs64 *__buf);
|
||||
extern int __fstatfs64 (int __fildes, struct statfs64 *__buf);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992-1999, 2000 Free Software Foundation, Inc.
|
||||
# This file is part of the GNU C Library.
|
||||
|
||||
# The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -44,7 +44,9 @@ routines := \
|
||||
ttyname ttyname_r isatty \
|
||||
link symlink readlink \
|
||||
unlink rmdir \
|
||||
ftw ftw64 fts poll
|
||||
ftw ftw64 fts poll \
|
||||
posix_fadvise posix_fadvise64 \
|
||||
posix_fallocate posix_fallocate64
|
||||
|
||||
# These routines will be omitted from the libc shared object.
|
||||
# Instead the static object files will be included in a special archive
|
||||
|
@ -91,4 +91,8 @@ libc {
|
||||
# For the cancelation wrappers.
|
||||
__libc_open64; __libc_lseek64;
|
||||
}
|
||||
GLIBC_2.2 {
|
||||
# p*
|
||||
posix_fadvise; posix_fadvise64; posix_fallocate; posix_fallocate64;
|
||||
}
|
||||
}
|
||||
|
41
io/fcntl.h
41
io/fcntl.h
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1991,92,94,95,96,97,98,99, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -125,6 +125,45 @@ extern int lockf64 (int __fd, int __cmd, __off64_t __len) __THROW;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __USE_XOPEN2K
|
||||
/* Advice the system about the expected behaviour of the application with
|
||||
respect to the file associated with FD. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int posix_fadvise (int __fd, __off_t __offset, size_t __len,
|
||||
int __advise) __THROW;
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (posix_fadvise, (int __fd, __off64_t __offset,
|
||||
size_t __len, int __advise) __THROW,
|
||||
posix_fadvise64);
|
||||
# else
|
||||
# define posix_fadvise posix_fadvise64
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int posix_fadvise64 (int __fd, __off64_t __offset, size_t __len,
|
||||
int __advise) __THROW;
|
||||
# endif
|
||||
|
||||
|
||||
/* Reserve storage for the data of the file associated with FD. */
|
||||
# ifndef __USE_FILE_OFFSET64
|
||||
extern int posix_fallocate (int __fd, __off_t __offset, size_t __len) __THROW;
|
||||
# else
|
||||
# ifdef __REDIRECT
|
||||
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
|
||||
size_t __len) __THROW,
|
||||
posix_fallocate64);
|
||||
# else
|
||||
# define posix_fallocate posix_fallocate64
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __USE_LARGEFILE64
|
||||
extern int posix_fallocate64 (int __fd, __off64_t __offset, size_t __len)
|
||||
__THROW;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* fcntl.h */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for stub configuration.
|
||||
Copyright (C) 1991, 1992, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1991, 1992, 1997, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -83,3 +83,13 @@ struct flock
|
||||
#define F_RDLCK 1 /* Read lock. */
|
||||
#define F_WRLCK 2 /* Write lock. */
|
||||
#define F_UNLCK 3 /* Remove lock. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -21,11 +21,12 @@
|
||||
|
||||
/* Return information about the filesystem on which FD resides. */
|
||||
int
|
||||
fstatfs64 (int fd, struct statfs64 *buf)
|
||||
__fstatfs64 (int fd, struct statfs64 *buf)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
weak_alias (__fstatfs64, fstatfs64)
|
||||
|
||||
stub_warning (fstatfs64)
|
||||
#include <stub-tag.h>
|
||||
|
@ -24,12 +24,11 @@
|
||||
for the region starting at ADDR and extending LEN bytes. */
|
||||
|
||||
int
|
||||
__madvise (__ptr_t addr, size_t len, int advice)
|
||||
posix_madvise (__ptr_t addr, size_t len, int advice)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
weak_alias (__madvice, madvice)
|
||||
weak_alias (__madvice, posix_madvise)
|
||||
weak_alias (posix_madvice, madvice)
|
||||
stub_warning (madvise)
|
||||
#include <stub-tag.h>
|
||||
|
32
sysdeps/generic/posix_fadvise.c
Normal file
32
sysdeps/generic/posix_fadvise.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Advice the system about the expected behaviour of the application with
|
||||
respect to the file associated with FD. */
|
||||
|
||||
int
|
||||
posix_fadvise (int fd, __off_t offset, size_t len, int advise)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (posix_fadvise)
|
||||
#include <stub-tag.h>
|
32
sysdeps/generic/posix_fadvise64.c
Normal file
32
sysdeps/generic/posix_fadvise64.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Advice the system about the expected behaviour of the application with
|
||||
respect to the file associated with FD. */
|
||||
|
||||
int
|
||||
posix_fadvise64 (int fd, __off64_t offset, size_t len, int advise)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (posix_fadvise64)
|
||||
#include <stub-tag.h>
|
31
sysdeps/generic/posix_fallocate.c
Normal file
31
sysdeps/generic/posix_fallocate.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Reserve storage for the data of the file associated with FD. */
|
||||
|
||||
int
|
||||
posix_fallocate (int fd, __off_t offset, size_t len)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (posix_fallocate)
|
||||
#include <stub-tag.h>
|
31
sysdeps/generic/posix_fallocate64.c
Normal file
31
sysdeps/generic/posix_fallocate64.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
/* Reserve storage for the data of the file associated with FD. */
|
||||
|
||||
int
|
||||
posix_fallocate64 (int fd, __off64_t offset, size_t len)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (posix_fallocate64)
|
||||
#include <stub-tag.h>
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -21,11 +21,12 @@
|
||||
|
||||
/* Return information about the filesystem on which FILE resides. */
|
||||
int
|
||||
statfs64 (const char *file, struct statfs64 *buf)
|
||||
__statfs64 (const char *file, struct statfs64 *buf)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
weak_alias (__statfs64, statfs64)
|
||||
|
||||
stub_warning (statfs64)
|
||||
#include <stub-tag.h>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for GNU.
|
||||
Copyright (C) 1993,94,96,97,98,99 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993,94,96,97,98,99, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -193,3 +193,13 @@ struct flock64
|
||||
#define F_RDLCK 1 /* Read lock. */
|
||||
#define F_WRLCK 2 /* Write lock. */
|
||||
#define F_UNLCK 3 /* Remove lock. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
71
sysdeps/posix/posix_fallocate.c
Normal file
71
sysdeps/posix/posix_fallocate.c
Normal file
@ -0,0 +1,71 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statfs.h>
|
||||
|
||||
/* Reserve storage for the data of the file associated with FD. */
|
||||
|
||||
int
|
||||
posix_fallocate (int fd, __off_t offset, size_t len)
|
||||
{
|
||||
struct stat st;
|
||||
struct statfs f;
|
||||
size_t step;
|
||||
|
||||
/* `off_t´ is a signed type. Therefore we can determine whether
|
||||
OFFSET + LEN is too large if it is a negative value. */
|
||||
if (offset < 0 || len == 0)
|
||||
return EINVAL;
|
||||
if (offset + len < 0)
|
||||
return EFBIG;
|
||||
|
||||
/* First thing we have to make sure is that this is really a regular
|
||||
file. */
|
||||
if (__fxstat (_STAT_VER, fd, &st) != 0)
|
||||
return EBADF;
|
||||
if (S_ISFIFO (st.st_mode))
|
||||
return ESPIPE;
|
||||
if (! S_ISREG (st.st_mode))
|
||||
return ENODEV;
|
||||
|
||||
/* We have to know the block size of the filesystem to get at least some
|
||||
sort of performance. */
|
||||
if (__fstatfs (fd, &f) != 0)
|
||||
return errno;
|
||||
|
||||
/* Align OFFSET to block size and adjust LEN. */
|
||||
step = (offset + f.f_bsize - 1) % ~f.f_bsize;
|
||||
offset += step;
|
||||
|
||||
/* Write something to every block. */
|
||||
while (len > step)
|
||||
{
|
||||
len -= step;
|
||||
|
||||
if (pwrite (fd, "", 1, offset) != 1)
|
||||
return errno;
|
||||
|
||||
offset += step;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
71
sysdeps/posix/posix_fallocate64.c
Normal file
71
sysdeps/posix/posix_fallocate64.c
Normal file
@ -0,0 +1,71 @@
|
||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU C Library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/statfs.h>
|
||||
|
||||
/* Reserve storage for the data of the file associated with FD. */
|
||||
|
||||
int
|
||||
posix_fallocate64 (int fd, __off64_t offset, size_t len)
|
||||
{
|
||||
struct stat64 st;
|
||||
struct statfs64 f;
|
||||
size_t step;
|
||||
|
||||
/* `off64_t´ is a signed type. Therefore we can determine whether
|
||||
OFFSET + LEN is too large if it is a negative value. */
|
||||
if (offset < 0 || len == 0)
|
||||
return EINVAL;
|
||||
if (offset + len < 0)
|
||||
return EFBIG;
|
||||
|
||||
/* First thing we have to make sure is that this is really a regular
|
||||
file. */
|
||||
if (__fxstat64 (_STAT_VER, fd, &st) != 0)
|
||||
return EBADF;
|
||||
if (S_ISFIFO (st.st_mode))
|
||||
return ESPIPE;
|
||||
if (! S_ISREG (st.st_mode))
|
||||
return ENODEV;
|
||||
|
||||
/* We have to know the block size of the filesystem to get at least some
|
||||
sort of performance. */
|
||||
if (__fstatfs64 (fd, &f) != 0)
|
||||
return errno;
|
||||
|
||||
/* Align OFFSET to block size and adjust LEN. */
|
||||
step = (offset + f.f_bsize - 1) % ~f.f_bsize;
|
||||
offset += step;
|
||||
|
||||
/* Write something to every block. */
|
||||
while (len > step)
|
||||
{
|
||||
len -= step;
|
||||
|
||||
if (pwrite64 (fd, "", 1, offset) != 1)
|
||||
return errno;
|
||||
|
||||
offset += step;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for Linux.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -133,9 +133,19 @@ struct flock64
|
||||
/* Define some more compatibility macros to be backward compatible with
|
||||
BSD systems which did not managed to hide these kernel macros. */
|
||||
#ifdef __USE_BSD
|
||||
# define FAPPEND O_APPEND
|
||||
# define FAPPEND O_APPEND
|
||||
# define FFSYNC O_FSYNC
|
||||
# define FASYNC O_ASYNC
|
||||
# define FNONBLOCK O_NONBLOCK
|
||||
# define FNDELAY O_NDELAY
|
||||
# define FNDELAY O_NDELAY
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 6 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 7 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for Linux.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -139,3 +139,13 @@ struct flock64
|
||||
# define FNONBLOCK O_NONBLOCK
|
||||
# define FNDELAY O_NDELAY
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Return information about the filesystem on which FD resides.
|
||||
Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/* Return information about the filesystem on which FD resides. */
|
||||
int
|
||||
fstatfs64 (int fd, struct statfs64 *buf)
|
||||
__fstatfs64 (int fd, struct statfs64 *buf)
|
||||
{
|
||||
struct statfs buf32;
|
||||
|
||||
@ -44,3 +44,4 @@ fstatfs64 (int fd, struct statfs64 *buf)
|
||||
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__fstatfs64, fstatfs64)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for Linux.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -139,3 +139,13 @@ struct flock64
|
||||
# define FNONBLOCK O_NONBLOCK
|
||||
# define FNDELAY O_NDELAY
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* O_*, F_*, FD_* bit values for Linux.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -145,3 +145,13 @@ struct flock64
|
||||
# define FNONBLOCK O_NONBLOCK
|
||||
# define FNDELAY O_NDELAY
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -17,8 +17,9 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef _FCNTLBITS_H
|
||||
#define _FCNTLBITS_H 1
|
||||
#ifndef _FCNTL_H
|
||||
# error "Never use <bits/fcntl.h> directly; include <fcntl.h> instead."
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <bits/wordsize.h>
|
||||
@ -150,4 +151,12 @@ struct flock64
|
||||
# define FNDELAY O_NDELAY
|
||||
#endif /* Use BSD. */
|
||||
|
||||
/* Advise to `posix_fadvise'. */
|
||||
#ifdef __USE_XOPEN2K
|
||||
# define POSIX_FADV_NORMAL 0 /* No further special treatment. */
|
||||
# define POSIX_FADV_RANDOM 1 /* Expect random page references. */
|
||||
# define POSIX_FADV_SEQUENTIAL 2 /* Expect sequential page references. */
|
||||
# define POSIX_FADV_WILLNEED 3 /* Will need these pages. */
|
||||
# define POSIX_FADV_DONTNEED 4 /* Don't need these pages. */
|
||||
# define POSIX_FADV_NOREUSE 5 /* Data will be accessed once. */
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Return information about the filesystem on which FILE resides.
|
||||
Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
/* Return information about the filesystem on which FILE resides. */
|
||||
int
|
||||
statfs64 (const char *file, struct statfs64 *buf)
|
||||
__statfs64 (const char *file, struct statfs64 *buf)
|
||||
{
|
||||
struct statfs buf32;
|
||||
|
||||
@ -44,3 +44,4 @@ statfs64 (const char *file, struct statfs64 *buf)
|
||||
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__statfs64, statfs64)
|
||||
|
@ -24,7 +24,7 @@ ioperm - ioperm 3 ioperm
|
||||
iopl - iopl 1 iopl
|
||||
klogctl EXTRA syslog 3 klogctl
|
||||
lchown - lchown 3 __lchown lchown
|
||||
madvise - madvise 3 __madvise madvise posix_madvise
|
||||
madvise - madvise 3 posix_madvise madvise
|
||||
mincore - mincore 3 mincore
|
||||
mlock EXTRA mlock 2 __mlock mlock
|
||||
mlockall EXTRA mlockall 1 __mlockall mlockall
|
||||
|
Loading…
Reference in New Issue
Block a user