Re: Introduction

From: Evgeny Kotsuba <evgen__k@dont-contact.us>
Date: Fri, 29 Apr 2005 11:52:08 +0400

On Thu, 28 Apr 2005 13:50:33 +0200
  Serassio Guido <guido.serassio@acmeconsulting.it> wrote:
>>>>>Now I plan to port diskd filesystem to Windows.
>>>SG> They are currently some Squid aspect that needs more work in the
>>>Windows
>>>SG> port. some of they could be integrated in Squid 3.0, in priority
>>>order they
>>>SG> are:
>>>SG> - Integration of Windows and Unix IPC models (partially done from
>>>Robert, a
>>>SG> blocker for complete Squid 3.0 integration)
>>>Could you please be more specific on this?
>>>SG> - Override the 2048 FD limit
>>>Unmortunately, I forgot already what is the case of this limit...
>>>SG> and native socket handling (could go in 3.1)
>>>Do you mean getting rid of such macros:
>>>#define read(fd,buf,siz) \
>>> (_so_err_siz = sizeof(_so_err), \
>>> getsockopt((fd),SOL_SOCKET,SO_ERROR,&_so_err,&_so_err_siz) \
>>> == 0 ? recv((fd),(buf),(siz),0) : _read((fd),(buf),(siz)))
>>>I see there is already 'type' member in struct _fde and FD_SOCKET
>>>enum constant. We could do something like this:
>>>#define read _w32_read
>>>int _w32_read(int fd, char* buf, int siz)
>>>{
>>> switch (fd_table[fd].type) {
>>> case FD_FILE:
>>> return _read(fd, buf, siz);
>>> case FD_SOCKET:
>>> return recv(fd, buf, siz, 0);
>>> ...
>>> }
>>>}
>>
>>This is right what I do in my OS/2 port of squid
>
>FD_READ_METHOD/FD_WRITE_METHOD macros should be more efficient.
> Look here:
>
> http://cvs.sourceforge.net/viewcvs.py/squid/squid/src/fd.c?rev=1.7.16.9&only_with_tag=nt-2_5&view=auto
>
I don't understand why macros may be more efficient.
I use things like
int squid_fde::read(char *buf, int len)
{ int rc=-1;
    switch(type)
    { case FD_SOCKET:
           if(fh < 0)
           { debug(91, 0) ("squid_fde::read WARNING: fh=%i\n",fh);
              rc = -1;
              break;
           }
          rc = recv(fh, buf, len, 0 /* MSG_DONTWAIT ? */);
           break;
       case FD_NONE:
              fatalf("Attempt to Read with FD_NONE type handle %i
bytes", len);
            return -1;
       case FD_PIPE:
       case FD_PIPE_READ:
           rc = ::read(fh, buf, len);
           break;
       default:
           rc = ::read(fh, buf, len);
   }
   if(rc>0) bytes_read += rc;
   return rc;
}

SY,
Evgeny Kotsuba
Received on Fri Apr 29 2005 - 01:52:10 MDT

This archive was generated by hypermail pre-2.1.9 : Sun May 01 2005 - 12:00:06 MDT