site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=j+QUEn7NqzxrK/tWClDJjVZKwSH9IYzTy5Zb7bLDBj8=; b=hsmpFsNtnb32AGWK4wwaR95U7Aoj5MfbJO8qjIh9zj+2LfiGcbM1eGp65AywtDHsm+ XFjF3ux7VWohSNjnRGgUehmJfaPJl/I4sjH7E9A8c4vb/T5h1xa3V/GwEUaWLKS2NFfG uOR5AMxdgyHsHWjRwNoXl5F0Mnvat3btVQwj4= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Wu0qR6Kp++gjyFJh5Br3qh7tXFz4K6ACshX9uN8mCLhmcHRcWQwg5fm7+JinhBcfQZ tJw4qbI0YPN/bS6MRF+1yik0LgQx2oAOZ6ATMLSZuKl1xs9tfG3pGElzGXPN5pBfBClf OfLpwHirAeg+TdHleEKXCmS9CIa8wlwxwkpOg= Thanks M and Shawn. I have already handler for SIGPIPE in which it is doing nothing, just ignoring. When I get SIGPIPE, I am not getting any error in write() call, does it mean my app is getting SIGPIPE due to some other thing? Shawn, I do not have any socket() in my app. I am communicating to serial port through read() and write(), after setting some parameters. Regards rksinghal On Thu, Feb 19, 2009 at 5:23 AM, Shawn Erickson <shawnce@gmail.com> wrote:
On Feb 17, 2009, at 2:06 PM, Rakesh Singhal wrote:
Hi all,
I am getting SIGPIPE (broken pipe) signal. I have implemented signal handler.
I do not know, why I am getting it in my app. I do not have any sockets in my app. I am communicating with serial port and my own dynamic libraries. How can I find the cause of this signal? Please suggest.
You are writing to descriptor which has nothing on the other side (reading). You should ignore the SIGPIPE signal on all threads and check for errno==EPIPE instead.
To get EPIPE you need set socket to return such a value instead of fire a SIGPIPE.
"SO_NOSIGPIPE is an option that prevents SIGPIPE from being raised when a write fails on a socket to which there is no reader; instead, the write to the socket returns with the error EPIPE when there is no reader."
int sigPipe = 1; ::setsockopt(_fd, SOL_SOCKET, SO_NOSIGPIPE, (const char*)&sigPipe, sizeof(sigPipe));
Anyway how are you talking with the serial port?
-Shawn
_______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com