• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Spurious EBADF?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Spurious EBADF?


  • Subject: Re: Spurious EBADF?
  • From: Avi Drissman <email@hidden>
  • Date: Mon, 18 Nov 2002 10:19:41 -0500

At 11:16 PM +0000 11/13/02, Quinn wrote:

Is your code threaded?

Yeah, that's what I was thinking too for a while. Isn't errno now per-thread, or is there any chance that it might be getting overwritten?

The code looks something like:

DebugPrintf("netReadIncomingDataMemory: reading from socket %d", otEndpointPtr->socket);
osStatus = read(otEndpointPtr->socket, bufPtr, bufSize);
if (osStatus < 0)
{
otEndpointPtr->error = errno;
if (otEndpointPtr->error != EWOULDBLOCK)
DebugPrintf("netReadIncomingDataMemory: got error %d", otEndpointPtr->error);
goto return_point;
}

And now, instead of EBADF (which is at least a documented error message for read()) I'm getting ENOENT (No such file or directory) which is even more bizarre:

netReadIncomingDataMemory: reading from socket 19
netReadIncomingDataMemory: got error 2
deleteOTEndpoint: closing socket 19

And I _am_ checking for errors on socket close:

DebugPrintf("deleteOTEndpoint: closing socket %d", otEndpointPtr->socket);
if (close(otEndpointPtr->socket) == -1)
DebugPrintf("deleteOTEndpoint: error %d on closing socket", errno);

You'd think that if I got an error reading, I'd get an error closing, but I don't.

Something is really wrong here. Time for even more logging, and maybe a trip into Darwinland.

Avi

--
Avi 'rlwimi' Drissman
email@hidden
Argh! This darn mail server is trunca
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Why am I not getting per-thread errno? (was Re: Spurious EBADF?)
      • From: Avi Drissman <email@hidden>
References: 
 >Spurious EBADF? (From: Avi Drissman <email@hidden>)
 >Re: Spurious EBADF? (From: Quinn <email@hidden>)

  • Prev by Date: Headers incompatibility
  • Next by Date: Re: CFStream Problem on Jaguar
  • Previous by thread: Re: Spurious EBADF?
  • Next by thread: Why am I not getting per-thread errno? (was Re: Spurious EBADF?)
  • Index(es):
    • Date
    • Thread