Changeset a2317e


Ignore:
Timestamp:
02/25/10 00:46:13 (2 years ago)
Author:
Tomash Brechko <tomash.brechko@…>
Branches:
master
Children:
957de1
Parents:
0f1abf
git-author:
Tomash Brechko <tomash.brechko@…> (02/25/10 00:46:13)
git-committer:
Tomash Brechko <tomash.brechko@…> (02/25/10 00:46:13)
Message:

Fix t/command.t on some Solaris systems where it fails.

The problem was that I used an old name MAX_IOVEC for the max number
of struct iovec passed to writev()/sendmsg(). When it wasn't defined
a value of 1024 was used. This was too much for some Solaris
distributions, which returned EINVAL in this case (other systems either
support this number natively, or compensate for it in libc).

Now we use either sysconf(_SC_IOV_MAX), or IOV_MAX, or safe minimum of
16 (64 on Win32).

Thanks to joyent.com for providing necessary Solaris traces.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • Changes

    r50ab04 ra2317e  
    66 
    77        Changes since 0.17: 
     8 
     9        Fix t/command.t failure on some Solaris distributions. 
    810 
    911        Make module thread-safe with Perl >= 5.7.2. 
  • src/client.c

    r34bb6d ra2317e  
    11/* 
    2   Copyright (C) 2007-2009 Tomash Brechko.  All rights reserved. 
     2  Copyright (C) 2007-2010 Tomash Brechko.  All rights reserved. 
    33 
    44  When used to build Perl module: 
     
    4242 
    4343 
    44 #ifndef MAX_IOVEC 
    45 #define MAX_IOVEC  1024 
    46 #endif 
    47  
    48  
    4944/* REPLY_BUF_SIZE should be large enough to contain first reply line.  */ 
    5045#define REPLY_BUF_SIZE  1536 
     
    298293  struct array index_list; 
    299294  struct array str_buf; 
     295  int iov_max; 
    300296 
    301297  generation_type generation; 
     
    400396  c->nowait = 0; 
    401397  c->hash_namespace = 0; 
     398 
     399  c->iov_max = get_iov_max(); 
    402400 
    403401  c->generation = 1;            /* Different from initial command state.  */ 
     
    11931191      size_t len; 
    11941192 
    1195       count = (state->iov_count < MAX_IOVEC 
    1196                ? state->iov_count : MAX_IOVEC); 
     1193      count = (state->iov_count < state->client->iov_max 
     1194               ? state->iov_count : state->client->iov_max); 
    11971195 
    11981196      state->iov->iov_base = 
  • src/socket_posix.h

    rb495a1 ra2317e  
    11/* 
    2   Copyright (C) 2008 Tomash Brechko.  All rights reserved. 
     2  Copyright (C) 2008, 2010 Tomash Brechko.  All rights reserved. 
    33 
    44  When used to build Perl module: 
     
    2929#include <sys/socket.h> 
    3030#include <sys/time.h> 
     31#include <limits.h> 
    3132#include <errno.h> 
     33 
     34 
     35#if defined(_SC_IOV_MAX) 
     36 
     37#define get_iov_max()  sysconf(_SC_IOV_MAX) 
     38 
     39#elif defined(IOV_MAX) 
     40 
     41#define get_iov_max()  IOV_MAX 
     42 
     43#else 
     44 
     45#define get_iov_max()  16 
     46 
     47#endif 
     48 
    3249 
    3350#if defined(HAVE_POLL_H) 
  • src/socket_win32.h

    r6bb9a6 ra2317e  
    11/* 
    2   Copyright (C) 2008-2009 Tomash Brechko.  All rights reserved. 
     2  Copyright (C) 2008-2010 Tomash Brechko.  All rights reserved. 
    33 
    44  When used to build Perl module: 
     
    2828#include <ws2tcpip.h> 
    2929#include <sys/types.h> 
     30 
     31 
     32#define get_iov_max()  64 
    3033 
    3134 
Note: See TracChangeset for help on using the changeset viewer.