• 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
Kernel log: app uses send/recv on a pipe
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Kernel log: app uses send/recv on a pipe


  • Subject: Kernel log: app uses send/recv on a pipe
  • From: Tomasz Kukielka <email@hidden>
  • Date: Tue, 28 Nov 2006 22:38:24 -0800
  • Thread-topic: Kernel log: app uses send/recv on a pipe

Hi,
I noticed the following kernel message in system log:

Nov 28 20:10:42 TK-MB kernel[0]: CommandDroplet[1993] uses send/recv on a
pipe

CommandDroplet is the application that I develop as part of OnMyCommand
which wraps Unix or AppleScript scripts with some GUI. I have been
experimenting with it recently trying to make popen execution non-blocking.
The problem is with pipe caching (you cannot work it around) which locks the
reading and you get stuck in in fread (or fgets). I wanted to improve it but
nothing seemed to work until I created a CFSocket on the file description
from the stream. It works beautifully as a CFRunLoop source - providing a
data in callback and not blocking.
But the kernel message is a signal that there might be something wrong with
it. See below for the code I used. When I #undef USE_CFSOCKET the kernel
does not complain. I would really hate to go back to the previous
synchronous/blocking code.

Thanks,
Tom
http://www.abracode.com/free/cmworkshop/



bool
POpenExecutor::Execute( const char *inCommand )
{
    if(inCommand == NULL)
        return true;

    FILE *fp = popen( inCommand, "r" );
    if ( fp != NULL )
    {
#ifdef USE_CFSOCKET

        CFSocketContext context;
        context.version = 0;
        context.info = this;
        context.retain = NULL;
        context.release = NULL;
        context.copyDescription = NULL;

        int fileDesc = fileno(fp);

        mFileDescSocket = ::CFSocketCreateWithNative(
                                                kCFAllocatorDefault,
fileDesc, kCFSocketDataCallBack,
                                                PopenCFSocketCallback,
&context);
        if(mFileDescSocket != NULL)
        {
            mSource = ::CFSocketCreateRunLoopSource(kCFAllocatorDefault,
mFileDescSocket, 0);
            if(mSource != NULL)
                ::CFRunLoopAddSource( ::CFRunLoopGetCurrent(), mSource,
kCFRunLoopDefaultMode );
        }

        return false; //not finished yet

#else //USE_CFSOCKET

        static char oneLine[1024];
        oneLine[0] = 0;
        do
        {
            fgets (oneLine, sizeof(oneLine), fp);
        }
        while( feof(fp) == 0 );

        (void) pclose( fp );

        return true; //finished
#endif //USE_CFSOCKET

    }

    return true; //error condition. finished
}



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Kernel log: app uses send/recv on a pipe
      • From: Vincent Lubet <email@hidden>
  • Prev by Date: Re: Deleting BSD Flags files
  • Next by Date: kdebug_chudhook: need finer grained kdebug
  • Previous by thread: Re: Deleting BSD Flags files
  • Next by thread: Re: Kernel log: app uses send/recv on a pipe
  • Index(es):
    • Date
    • Thread