• 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: errno 40 (EMSGSIZE, message too long)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: errno 40 (EMSGSIZE, message too long)


  • Subject: Re: errno 40 (EMSGSIZE, message too long)
  • From: Ryan McGann <email@hidden>
  • Date: Sat, 25 Jan 2003 12:10:41 -0800

Can anybody tell me why our NKE can receive this error when sending a
12 byte structure to our daemon? Our messages are infrequent, yet we
get this error 1 in 10 times at least. Putting a tsleep for 5
millseconds in the NKE before calling sosend helps bring down the odds
to 1 in 5, but that's still quite frequent for a 12 byte message
that's sent at most once per second.
Can you tell us where this error occurs? It's hard to diagnose without
some salient details.

Sure. My NKE has a listen() callback, and if the socket is bound to a non-local address I send a message off to the daemon. The code below is for my send to daemon. The structure is 12 bytes long.

static void SymSendToDaemon( register struct SymDaemonMessageData *inData )
{
boolean_t funnel_state;
int err;
struct mbuf* sendBuf;
static int recursed = 0;

// Grab the network flock.
funnel_state = thread_funnel_set( network_flock, TRUE );

// Allocate a new mbuf to hold the data.
sendBuf = m_get( M_DONTWAIT, MT_DATA );
if ( sendBuf != NULL )
{
m_copyback( sendBuf, 0, sizeof(struct NPFDaemonMessageData), inData );

// Send the data. This will dispose of the mbuf, regardless of success.
err = sosend( gNKEInfo.sCommSocket, (struct sockaddr*)(&gNKEInfo.sCommAddress), NULL, (void *)sendBuf, NULL, M_WAIT );

// Restore the funnel.
thread_funnel_set( network_flock, funnel_state );
if ( err != KERN_SUCCESS )
{
log( LOG_ERR, "Could not send message (%u) to the daemon (%d). You should restart the computer.\n", inData->sHeader.sCommandID, err );
if ( recursed == 0 )
{
// If an error occurs, try again after sleeping
recursed = 1;
tsleep( gNKEInfo.sCommSocket, PSOCK, "com.symantec.kext.NPF", 10 * 100 );
SymSendToDaemon( inData );
recursed = 0;
return;
}
}
}

if (( err == EPIPE ) || ( err == ENOTCONN ))
{
// Error handling removed for brevity
}
}

Recursing with a tsleep in between calls seems to help, but it doesn't solve the problem completely. It doesnt' seem to matter how long I tsleep for either; I've gone as high as 1 second.

Thanks,

Ryan

iSurf, iSaw and iType.
_______________________________________________
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:
    • Re(2): errno 40 (EMSGSIZE, message too long)
      • From: "Peter Lovell" <email@hidden>
  • Prev by Date: Re: OTNotifier in shared libraries
  • Next by Date: Re(2): errno 40 (EMSGSIZE, message too long)
  • Previous by thread: Re: errno 40 (EMSGSIZE, message too long)
  • Next by thread: Re(2): errno 40 (EMSGSIZE, message too long)
  • Index(es):
    • Date
    • Thread