Changeset 372

Show
Ignore:
Timestamp:
08/01/05 19:37:41 (5 years ago)
Author:
bradfitz
Message:

use Sys::Syscall, not syscall directly

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/Makefile.PL

    r370 r372  
    2626    PREREQ_PM               => { 
    2727        'Danga::Socket' => '1.43', 
     28        'Sys::Syscall'  => 0, 
    2829        'BSD::Resource' => 0, 
    29         'Test::More' => 0, 
    30         'File::Find' => 0, 
     30        'Test::More'    => 0, 
     31        'File::Find'    => 0, 
    3132    }, 
    3233    dist                    => { 
  • trunk/lib/Perlbal/ClientHTTPBase.pm

    r369 r372  
    1111# Copyright 2005, Six Apart, Ltd. 
    1212 
    13 package main; 
    14  
    15 # loading syscall.ph into package main in case some other module wants 
    16 # to use it (like Danga::Socket, or whoever else) 
    17 eval { require 'syscall.ph'; 1 } || eval { require 'sys/syscall.ph'; 1 }; 
    18  
    1913package Perlbal::ClientHTTPBase; 
    2014use strict; 
     
    2216no  warnings qw(deprecated); 
    2317 
     18use Sys::Syscall; 
    2419use base "Perlbal::Socket"; 
    2520use HTTP::Date (); 
     
    4439use Errno qw( EPIPE ECONNRESET ); 
    4540use POSIX (); 
    46  
    47 our $SYS_sendfile = $ENV{NR_SENDFILE} || &::SYS_sendfile; 
    4841 
    4942# ghetto hard-coding.  should let siteadmin define or something. 
     
    234227        my $to_send = $self->{reproxy_file_size} - $self->{reproxy_file_offset}; 
    235228        $self->tcp_cork(1) if $self->{reproxy_file_offset} == 0; 
    236         my $sent = syscall($SYS_sendfile, 
    237                            $self->{fd}, 
    238                            fileno($self->{reproxy_fh}), 
    239                            0, # NULL offset means kernel moves offset 
    240                            $to_send); 
     229        my $sent = Sys::Syscall::sendfile( 
     230                                          $self->{fd}, 
     231                                          fileno($self->{reproxy_fh}), 
     232                                          $to_send); 
    241233        print "REPROXY Sent: $sent\n" if Perlbal::DEBUG >= 2; 
    242234        if ($sent < 0) {