* io/Makefile (routines): Add sendfile and sendfile64.
(headers): Add sys/sendfile.h to the list. * sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Don't add it here. * sysdeps/unix/sysv/linux/sys/sendfile.h: Moved to ... * io/sys/sendfile.h: ... here. * sysdeps/generic/sendfile.c: New file. * sysdeps/generic/sendfile64.c: New file. * sysdeps/unix/sysv/linux/Versions (GLIBC_2.1, GLIBC_2.3): Move sendfile, sendfile64 to ... * io/Versions (GLIBC_2.1, GLIBC_2.3): ... here. * sysdeps/mach/hurd/sendfile.c: New file. * sysdeps/mach/hurd/sendfile64.c: New file. * sysdeps/mach/nanosleep.c: New file.
This commit is contained in:
parent
17d7201a97
commit
7db20e36c8
17
ChangeLog
17
ChangeLog
@ -1,3 +1,20 @@
|
||||
2002-06-05 Roland McGrath <roland@frob.com>
|
||||
|
||||
* io/Makefile (routines): Add sendfile and sendfile64.
|
||||
(headers): Add sys/sendfile.h to the list.
|
||||
* sysdeps/unix/sysv/linux/Makefile (sysdep_headers): Don't add it here.
|
||||
* sysdeps/unix/sysv/linux/sys/sendfile.h: Moved to ...
|
||||
* io/sys/sendfile.h: ... here.
|
||||
* sysdeps/generic/sendfile.c: New file.
|
||||
* sysdeps/generic/sendfile64.c: New file.
|
||||
* sysdeps/unix/sysv/linux/Versions (GLIBC_2.1, GLIBC_2.3):
|
||||
Move sendfile, sendfile64 to ...
|
||||
* io/Versions (GLIBC_2.1, GLIBC_2.3): ... here.
|
||||
* sysdeps/mach/hurd/sendfile.c: New file.
|
||||
* sysdeps/mach/hurd/sendfile64.c: New file.
|
||||
|
||||
* sysdeps/mach/nanosleep.c: New file.
|
||||
|
||||
2002-06-04 Roland McGrath <roland@frob.com>
|
||||
|
||||
* sysdeps/alpha/elf/configure.in: New file. Check for TLS support.
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (C) 1992-1999, 2000, 2001 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1992-1999,2000,01,02 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 @@ subdir := io
|
||||
headers := sys/stat.h bits/stat.h sys/statfs.h bits/statfs.h sys/vfs.h \
|
||||
sys/statvfs.h bits/statvfs.h fcntl.h sys/fcntl.h bits/fcntl.h \
|
||||
poll.h sys/poll.h bits/poll.h \
|
||||
utime.h ftw.h fts.h
|
||||
utime.h ftw.h fts.h sys/sendfile.h
|
||||
|
||||
routines := \
|
||||
utime \
|
||||
@ -46,7 +46,8 @@ routines := \
|
||||
unlink rmdir \
|
||||
ftw ftw64 fts poll \
|
||||
posix_fadvise posix_fadvise64 \
|
||||
posix_fallocate posix_fallocate64
|
||||
posix_fallocate posix_fallocate64 \
|
||||
sendfile sendfile64
|
||||
|
||||
# These routines will be omitted from the libc shared object.
|
||||
# Instead the static object files will be included in a special archive
|
||||
|
@ -76,6 +76,7 @@ libc {
|
||||
open64;
|
||||
|
||||
# s*
|
||||
sendfile;
|
||||
statfs64; statvfs; statvfs64;
|
||||
}
|
||||
GLIBC_2.2 {
|
||||
@ -84,6 +85,10 @@ libc {
|
||||
|
||||
__open64;
|
||||
}
|
||||
GLIBC_2.3 {
|
||||
# s*
|
||||
sendfile64;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
# functions which have an additional interface since they are
|
||||
# cancelable.
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
|
||||
/* sendfile -- copy data directly from one file descriptor to another
|
||||
Copyright (C) 1998,99,01,2002 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
|
60
sysdeps/alpha/elf/configure
vendored
Executable file
60
sysdeps/alpha/elf/configure
vendored
Executable file
@ -0,0 +1,60 @@
|
||||
# Local configure fragment for sysdeps/alpha/elf.
|
||||
|
||||
if test "$usetls" != no; then
|
||||
# Check for support of thread-local storage handling in assembler and
|
||||
# linker.
|
||||
echo $ac_n "checking for Alpha TLS support""... $ac_c" 1>&6
|
||||
echo "configure:8: checking for Alpha TLS support" >&5
|
||||
if eval "test \"`echo '$''{'libc_cv_alpha_tls'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.s <<\EOF
|
||||
.section ".tdata", "awT", @progbits
|
||||
.globl foo
|
||||
foo: .quad 1
|
||||
.section ".tbss", "awT", @nobits
|
||||
.globl bar
|
||||
bar: .skip 8
|
||||
.text
|
||||
baz:
|
||||
.set nomacro
|
||||
ldq $27, __tls_get_addr($29) !literal!1
|
||||
ldq $16, a($29) !tlsgd!1
|
||||
jsr $26, ($27), __tls_get_addr !lituse_tlsgd!1
|
||||
|
||||
jsr $26, ($27), __tls_get_addr !lituse_tlsldm!2
|
||||
ldq $27, __tls_get_addr($29) !literal!2
|
||||
ldq $16, b($29) !tlsldm!2
|
||||
|
||||
ldq $16, c($29) !tlsgd
|
||||
ldq $16, d($29) !tlsldm
|
||||
|
||||
ldq $16, e($29) !tlsgd!3
|
||||
ldq $16, f($29) !tlsldm!4
|
||||
|
||||
ldq $16, g($29) !gotdtprel
|
||||
ldah $16, h($31) !dtprelhi
|
||||
lda $16, i($16) !dtprello
|
||||
lda $16, j($31) !dtprel
|
||||
|
||||
ldq $16, k($29) !gottprel
|
||||
ldah $16, l($31) !tprelhi
|
||||
lda $16, m($16) !tprello
|
||||
lda $16, n($31) !tprel
|
||||
EOF
|
||||
if { ac_try='${CC-cc} -c $CFLAGS conftest.s 1>&5'; { (eval echo configure:46: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; }; then
|
||||
libc_cv_alpha_tls=yes
|
||||
else
|
||||
libc_cv_alpha_tls=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
|
||||
echo "$ac_t""$libc_cv_alpha_tls" 1>&6
|
||||
if test $libc_cv_alpha_tls = yes; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define HAVE_TLS_SUPPORT 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
fi
|
32
sysdeps/generic/sendfile.c
Normal file
32
sysdeps/generic/sendfile.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* sendfile -- copy data directly from one file descriptor to another
|
||||
Copyright (C) 2002 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 Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sys/sendfile.h>
|
||||
|
||||
/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
|
||||
descriptor OUT_FD. */
|
||||
ssize_t
|
||||
sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (sendfile)
|
||||
|
||||
#include <stub-tag.h>
|
32
sysdeps/generic/sendfile64.c
Normal file
32
sysdeps/generic/sendfile64.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* sendfile -- copy data directly from one file descriptor to another
|
||||
Copyright (C) 2002 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 Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sys/sendfile.h>
|
||||
|
||||
/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
|
||||
descriptor OUT_FD. */
|
||||
ssize_t
|
||||
sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (sendfile64)
|
||||
|
||||
#include <stub-tag.h>
|
60
sysdeps/mach/hurd/sendfile.c
Normal file
60
sysdeps/mach/hurd/sendfile.c
Normal file
@ -0,0 +1,60 @@
|
||||
/* sendfile -- copy data directly from one file descriptor to another
|
||||
Copyright (C) 2002 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 Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sys/sendfile.h>
|
||||
#include <hurd.h>
|
||||
#include <hurd/fd.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
|
||||
descriptor OUT_FD. */
|
||||
ssize_t
|
||||
sendfile (int out_fd, int in_fd, off_t *offset, size_t count)
|
||||
{
|
||||
/* We just do a vanilla io_read followed by a vanilla io_write here.
|
||||
In theory the IN_FD filesystem can return us out-of-line data that
|
||||
we then send out-of-line to the OUT_FD filesystem and no copying
|
||||
takes place until those pages need to be flushed or packaged by
|
||||
that filesystem (e.g. packetized by a network socket). However,
|
||||
we momentarily consume COUNT bytes of our local address space,
|
||||
which might blow if it's huge or address space is real tight. */
|
||||
|
||||
char *data = 0;
|
||||
size_t datalen = 0;
|
||||
error_t err = HURD_DPORT_USE (in_fd,
|
||||
__io_read (port, &data, &datalen,
|
||||
offset ? *offset : (off_t) -1,
|
||||
count));
|
||||
if (err == 0)
|
||||
{
|
||||
size_t nwrote;
|
||||
if (datalen == 0)
|
||||
return 0;
|
||||
err = HURD_DPORT_USE (out_fd, __io_write (port, data, datalen,
|
||||
(off_t) -1, &nwrote));
|
||||
munmap (data, datalen);
|
||||
if (err == 0)
|
||||
{
|
||||
if (offset)
|
||||
*offset += datalen;
|
||||
return nwrote;
|
||||
}
|
||||
}
|
||||
return __hurd_fail (err);
|
||||
}
|
43
sysdeps/mach/hurd/sendfile64.c
Normal file
43
sysdeps/mach/hurd/sendfile64.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* sendfile -- copy data directly from one file descriptor to another
|
||||
Copyright (C) 2002 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 Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <sys/sendfile.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Send COUNT bytes from file associated with IN_FD starting at OFFSET to
|
||||
descriptor OUT_FD. */
|
||||
ssize_t
|
||||
sendfile64 (int out_fd, int in_fd, off64_t *offset, size_t count)
|
||||
{
|
||||
if (offset == NULL)
|
||||
return sendfile (out_fd, in_fd, NULL, count);
|
||||
else
|
||||
{
|
||||
off_t ofs = *offset;
|
||||
if (ofs != *offset)
|
||||
{
|
||||
__set_errno (EOVERFLOW);
|
||||
return -1;
|
||||
}
|
||||
ssize_t ret = sendfile (out_fd, in_fd, &ofs, count);
|
||||
*offset = ofs;
|
||||
return ret;
|
||||
}
|
||||
}
|
53
sysdeps/mach/nanosleep.c
Normal file
53
sysdeps/mach/nanosleep.c
Normal file
@ -0,0 +1,53 @@
|
||||
/* nanosleep -- sleep for a period specified with a struct timespec
|
||||
Copyright (C) 2002 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 Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with the GNU C Library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
||||
02111-1307 USA. */
|
||||
|
||||
#include <errno.h>
|
||||
#include <mach.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int
|
||||
__nanosleep (const struct timespec *requested_time,
|
||||
struct timespec *remaining)
|
||||
{
|
||||
mach_port_t recv;
|
||||
struct timeval before, after;
|
||||
const mach_msg_timeout_t ms
|
||||
= requested_time->tv_sec * 1000
|
||||
+ (requested_time->tv_nsec + 999999) / 1000000;
|
||||
|
||||
recv = __mach_reply_port ();
|
||||
|
||||
if (remaining && __gettimeofday (&before, NULL) < 0)
|
||||
return -1;
|
||||
(void) __mach_msg (NULL, MACH_RCV_MSG|MACH_RCV_TIMEOUT|MACH_RCV_INTERRUPT,
|
||||
0, 0, recv, ms, MACH_PORT_NULL);
|
||||
__mach_port_destroy (mach_task_self (), recv);
|
||||
if (remaining && __gettimeofday (&after, NULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (remaining)
|
||||
{
|
||||
timersub (&after, &before, &after);
|
||||
TIMEVAL_TO_TIMESPEC (&after, remaining);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
weak_alias (__nanosleep, nanosleep)
|
@ -20,7 +20,7 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
|
||||
sys/kd.h sys/soundcard.h sys/vt.h \
|
||||
sys/quota.h sys/fsuid.h \
|
||||
scsi/sg.h scsi/scsi.h scsi/scsi_ioctl.h sys/pci.h \
|
||||
sys/ultrasound.h sys/sendfile.h sys/raw.h
|
||||
sys/ultrasound.h sys/raw.h
|
||||
|
||||
install-others += $(inst_includedir)/bits/syscall.h
|
||||
|
||||
|
@ -73,9 +73,6 @@ libc {
|
||||
# n*
|
||||
ntp_adjtime; ntp_gettime;
|
||||
|
||||
# s*
|
||||
sendfile;
|
||||
|
||||
# u*
|
||||
umount2;
|
||||
}
|
||||
@ -93,8 +90,6 @@ libc {
|
||||
GLIBC_2.3 {
|
||||
# r*
|
||||
readahead;
|
||||
# s*
|
||||
sendfile64;
|
||||
}
|
||||
GLIBC_PRIVATE {
|
||||
# needed by libpthread.
|
||||
|
Loading…
Reference in New Issue
Block a user