mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* kernel error in system call accept() under kernel 2.6.8
@ 2005-09-20 14:25 Peter Duellings
       [not found] ` <20050920150755.GH32751@kvack.org>
  2005-09-20 15:32 ` Alan Cox
  0 siblings, 2 replies; 10+ messages in thread
From: Peter Duellings @ 2005-09-20 14:25 UTC (permalink / raw)
  To: linux-kernel

----------------------------------------------------------------------
One line summary of the problem:
linux accept() system call does not set always errno if the
returnvalue is negative.

----------------------------------------------------------------------
Full description of the problem/report:
Obviously there are some cases where the accept() system call does
not set the errno variable if the accept() system call returns
with a value less than zero:

Distribution : Linux Fedora Core 2 - but with kernel 2.6.8
Sample code:
--snip----------
....
//accept may return with a protocol error, simply try again
while( (n = accept(m_ListenFd, (struct sockaddr *) cliaddr, &len)) < 0)
{
   Log.Log("Error accept, fd=%d, addrlen=%d, len=%d, errno=%d, %s",
m_ListenFd,
m_AddrLen, len, errno, strerror_r(errno, l_strebuf, sizeof(l_strebuf)));
   if (errno == EPROTO || errno == ECONNABORTED)   //connection already
aborted
   {
     Log.Log("connection aborted, wait for next");
     continue;   //next try
   } else if (errno == EINTR) {    //signal
     if (CnThread::TestCancel(m_Log)) {
       Log.Log("thread is cancelled");
       delete[] cliaddr;
       return -1;
     } else {
       Log.Log("EINTR, try again");
       continue;   //next try
     }
   }
   else
   {
     throw CnException(__FILE__, __LINE__, "accept error errno=%d, %s",
errno,
strerror_r(errno, l_strebuf, sizeof(l_strebuf)));
   }
}
...
--snip-----
output:
CnTcpServer::WaitClient   Error accept, fd=19, addrlen=16, len=16,
errno=0, Success


----------------------------------------------------------------------
Keywords (i.e., modules, networking, kernel):
network accept errno error return value
----------------------------------------------------------------------
Kernel version (from /proc/version):
cat /proc/version
Linux version 2.6.8-1.521 (root@wsa92_D2_FEDTest) (gcc version 3.3.3
20040412 (Red Hat Linux 3.3.3-7)) #3 Fri Jul 8 11:08:56 CEST
2005
----------------------------------------------------------------------
----------------------------------------------------------------------
Question:
Is there any update/information/explanation about this behaviour available??



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-10-05 17:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-20 14:25 kernel error in system call accept() under kernel 2.6.8 Peter Duellings
     [not found] ` <20050920150755.GH32751@kvack.org>
2005-09-20 15:20   ` Peter Duellings
2005-09-20 15:28     ` Benjamin LaHaise
2005-09-20 15:32       ` Peter Duellings
2005-09-20 15:35         ` Benjamin LaHaise
2005-09-20 15:32 ` Alan Cox
2005-09-20 15:19   ` Peter Duellings
2005-10-05 15:41   ` Peter Duellings
2005-10-05 17:39     ` linux-os (Dick Johnson)
2005-10-05 17:53     ` Bernd Petrovitsch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome