@@ -11,11 +11,12 @@ my $builder = Module::Build->new(
'IO::Handle' => '0',
'IO::Socket::INET' => '0',
'IPC::Open3' => '0',
- 'Module::Build' => '0.3601',
- 'Test::More' => '0'
+ 'Module::Build' => '0.28',
+ 'Test::More' => '0',
+ 'perl' => '5.006'
},
'configure_requires' => {
- 'Module::Build' => '0.3601'
+ 'Module::Build' => '0.28'
},
'requires' => {
'Exporter' => '5.57',
@@ -36,5 +37,9 @@ if ($^O eq 'MSWin32') {
elsif ($^O eq 'solaris') {
$builder->extra_linker_flags('-lsendfile');
}
+elsif($^O eq 'gnukfreebsd') {
+ $builder->extra_compiler_flags('-I/usr/include/freebsd');
+ $builder->extra_linker_flags('-lfreebsd-glue');
+}
$builder->create_build_script();
@@ -1,5 +1,18 @@
Revision history for Sys-Sendfile
+0.16 2015-02-17 16:34:45+01:00 Europe/Amsterdam
+ Moved PERL_VERSION_ATLEAST to after perl headers
+
+0.15 2015-02-16 01:09:00+01:00 Europe/Amsterdam
+ Convert descriptors to handles correctly on Windows
+
+0.14 2015-02-14 16:29:03+01:00 Europe/Amsterdam
+ Explicitly include winsock on Windows again
+
+0.13 2015-01-31 12:46:16+01:00 Europe/Amsterdam
+ Fix compilation issue on Windows
+ Document $offset parameter
+
0.12 2013-12-02 00:24:06 Europe/Amsterdam
Switched to Dist::Zilla
Also support GNU/kFreeBSD
@@ -22,7 +22,7 @@ This is free software, licensed under:
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
- 51 Franklin St, Suite 500, Boston, MA 02110-1335 USA
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.025.
Build.PL
Changes
INSTALL
@@ -3,8 +3,8 @@
"author" : [
"Leon Timmermans <leont@cpan.org>"
],
- "dynamic_config" : 1,
- "generated_by" : "Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.132830",
+ "dynamic_config" : "1",
+ "generated_by" : "Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.143240",
"license" : [
"perl_5"
],
@@ -16,12 +16,12 @@
"prereqs" : {
"build" : {
"requires" : {
- "Module::Build" : "0.3601"
+ "Module::Build" : "0.28"
}
},
"configure" : {
"requires" : {
- "Module::Build" : "0.3601"
+ "Module::Build" : "0.28"
}
},
"develop" : {
@@ -47,14 +47,15 @@
"IO::Handle" : "0",
"IO::Socket::INET" : "0",
"IPC::Open3" : "0",
- "Test::More" : "0"
+ "Test::More" : "0",
+ "perl" : "5.006"
}
}
},
"provides" : {
"Sys::Sendfile" : {
"file" : "lib/Sys/Sendfile.pm",
- "version" : "0.12"
+ "version" : "0.16"
}
},
"release_status" : "stable",
@@ -69,6 +70,6 @@
"web" : "https://github.com/Leont/sys-sendfile"
}
},
- "version" : "0.12"
+ "version" : "0.16"
}
@@ -3,33 +3,34 @@ abstract: 'Zero-copy data transfer'
author:
- 'Leon Timmermans <leont@cpan.org>'
build_requires:
- Fcntl: 0
- File::Spec: 0
- IO::Handle: 0
- IO::Socket::INET: 0
- IPC::Open3: 0
- Module::Build: 0.3601
- Test::More: 0
+ Fcntl: '0'
+ File::Spec: '0'
+ IO::Handle: '0'
+ IO::Socket::INET: '0'
+ IPC::Open3: '0'
+ Module::Build: '0.28'
+ Test::More: '0'
+ perl: '5.006'
configure_requires:
- Module::Build: 0.3601
-dynamic_config: 1
-generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.132830'
+ Module::Build: '0.28'
+dynamic_config: '1'
+generated_by: 'Dist::Zilla version 5.025, CPAN::Meta::Converter version 2.143240'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Sys-Sendfile
provides:
Sys::Sendfile:
file: lib/Sys/Sendfile.pm
- version: 0.12
+ version: '0.16'
requires:
- Exporter: 5.57
- XSLoader: 0
- perl: 5.006
- strict: 0
- warnings: 0
+ Exporter: '5.57'
+ XSLoader: '0'
+ perl: '5.006'
+ strict: '0'
+ warnings: '0'
resources:
bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Sys-Sendfile
repository: git://github.com/Leont/sys-sendfile.git
-version: 0.12
+version: '0.16'
@@ -1,7 +1,7 @@
This archive contains the distribution Sys-Sendfile,
-version 0.12:
+version 0.16:
Zero-copy data transfer
@@ -11,3 +11,5 @@ This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
+This README file was generated by Dist::Zilla::Plugin::Readme v5.025.
+
@@ -1,8 +1,5 @@
package Sys::Sendfile;
-{
- $Sys::Sendfile::VERSION = '0.12';
-}
-
+$Sys::Sendfile::VERSION = '0.16';
# This software is copyright (c) 2008, 2009 by Leon Timmermans <leont@cpan.org>.
#
# This is free software; you can redistribute it and/or modify it under
@@ -33,7 +30,7 @@ Sys::Sendfile - Zero-copy data transfer
=head1 VERSION
-version 0.12
+version 0.16
=head1 SYNOPSIS
@@ -46,9 +43,9 @@ Sys::Sendfile provides access to your operating system's C<sendfile> facility. I
=head1 FUNCTIONS
-=head2 sendfile $out, $in, $count
+=head2 sendfile $out, $in, $count, $offset
-This function sends up to C<$count> B<bytes> from C<$in> to C<$out>. If $count isn't given, it will try send all remaining bytes in $in, but on some operating systems sending only part of the bytes is a possible result. C<$in> and C<$out> can be a bareword, constant, scalar expression, typeglob, or a reference to a typeglob. It returns the number of bytes actually sent. On error, C<$!> is set appropriately and it returns undef. This function is exported by default.
+This function sends up to C<$count> B<bytes> starting from C<$offset> from C<$in> to C<$out>. If $count isn't given, it will try send all remaining bytes in $in, but on some operating systems sending only part of the bytes is a possible result. If C<$offset> isn't given, the function will get current offset of C<$in> (by calling lseek) and pass this information to underlying sendfile syscall. C<$in> and C<$out> can be a bareword, constant, scalar expression, typeglob, or a reference to a typeglob. It returns the number of bytes actually sent. On error, C<$!> is set appropriately and it returns undef. This function is exported by default.
=head1 BUGS AND LIMITATIONS
@@ -25,12 +25,10 @@
#include <sys/socket.h>
#include <sys/uio.h>
#elif defined OS_WIN32
+#include <windows.h>
+#ifndef _MSC_VER
#include <mswsock.h>
-#ifdef USE_SOCKETS_AS_HANDLES
-# define TO_SOCKET(x) _get_osfhandle(x)
-#else
-# define TO_SOCKET(x) (x)
-#endif /* USE_SOCKETS_AS_HANDLES */
+#endif
#else
#include <sys/mman.h>
#endif
@@ -47,6 +45,16 @@
#include "perl.h"
#include "XSUB.h"
+#define PERL_VERSION_ATLEAST(a,b,c) \
+ (PERL_VERSION > (b) \
+ || (PERL_VERSION == (b) && PERL_SUBVERSION >= (c)))
+
+#if defined(USE_SOCKETS_AS_HANDLES) || PERL_VERSION_ATLEAST(5,17,5)
+# define TO_SOCKET(x) _get_osfhandle(x)
+#else
+# define TO_SOCKET(x) (x)
+#endif /* USE_SOCKETS_AS_HANDLES */
+
MODULE = Sys::Sendfile PACKAGE = Sys::Sendfile
SV*
@@ -58,7 +66,7 @@ sendfile(out, in, count = 0, offset = &PL_sv_undef)
PROTOTYPE: **@
CODE:
{
- off_t real_offset = SvOK(offset) ? SvUV(offset) : (off_t)lseek(in, 0, SEEK_CUR);
+ Off_t real_offset = SvOK(offset) ? SvUV(offset) : (off_t)lseek(in, 0, SEEK_CUR);
#if defined OS_LINUX
if (count == 0) {
struct stat info;
@@ -92,7 +100,7 @@ sendfile(out, in, count = 0, offset = &PL_sv_undef)
int ret;
if (SvOK(offset))
SetFilePointer(hFile, real_offset, NULL, FILE_BEGIN);
- ret = TransmitFile(TO_SOCKET(out), hFile, count, 0, NULL, NULL, 0);
+ ret = TransmitFile(TO_SOCKET(out), hFile, (DWORD)count, 0, NULL, NULL, 0);
if (!ret)
XSRETURN_EMPTY;
else
@@ -1,11 +1,12 @@
+use 5.006;
use strict;
use warnings;
-# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.036
-
-use Test::More tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
+# this test was generated with Dist::Zilla::Plugin::Test::Compile 2.051
+use Test::More;
+plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0);
my @module_files = (
'Sys/Sendfile.pm'
@@ -15,17 +16,18 @@ my @module_files = (
# no fake home requested
-my $inc_switch = q[-Mblib];
+my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib';
use File::Spec;
use IPC::Open3;
use IO::Handle;
+open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
+
my @warnings;
for my $lib (@module_files)
{
# see L<perlfaq8/How can I capture STDERR from an external command?>
- open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!";
my $stderr = IO::Handle->new;
my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]");
@@ -43,6 +45,7 @@ for my $lib (@module_files)
-is(scalar(@warnings), 0, 'no warnings found') if $ENV{AUTHOR_TESTING};
+is(scalar(@warnings), 0, 'no warnings found')
+ or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING};
@@ -18,14 +18,14 @@ my $slurped = do { local $/; <$self> };
seek $self, 0, SEEK_SET or die "Could not seek: $!";
my $size = -s $self;
-is(sendfile($out, $self, $size), $size, "Wrote $size bytes when asked to send the whole file");
+is(sendfile($out, $self, $size), $size, "Wrote $size bytes when asked to send the whole file") or diag "Error message: $!";
defined recv $in, my $read, -s $self, 0 or die "Couldn't receive: $!";
is($read, $slurped, "Read the same as was written");
seek $self, 0, SEEK_SET or die "Could not seek: $!";
-is(sendfile($out, $self), $size, "Wrote $size bytes when asked to send the whole file");
+is(sendfile($out, $self), $size, "Wrote $size bytes when asked to send the whole file") or diag "Error message: $!";
defined recv $in, $read, -s $self, 0 or die "Couldn't receive: $!";
is($read, $slurped, "Read the same as was written");
@@ -7,15 +7,9 @@ BEGIN {
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodCoverageTests.
-use Test::More;
-
-eval "use Test::Pod::Coverage 1.08";
-plan skip_all => "Test::Pod::Coverage 1.08 required for testing POD coverage"
- if $@;
-
-eval "use Pod::Coverage::TrustPod";
-plan skip_all => "Pod::Coverage::TrustPod required for testing POD coverage"
- if $@;
+use Test::Pod::Coverage 1.08;
+use Pod::Coverage::TrustPod;
all_pod_coverage_ok({ coverage_class => 'Pod::Coverage::TrustPod' });
@@ -7,9 +7,8 @@ BEGIN {
}
}
+# This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests.
use Test::More;
-
-eval "use Test::Pod 1.41";
-plan skip_all => "Test::Pod 1.41 required for testing POD" if $@;
+use Test::Pod 1.41;
all_pod_files_ok();