[Asterisk-code-review] core: Use ast alertpipe for Asterisk signal monitoring thread. (asterisk[master])

Kevin Harwell asteriskteam at digium.com
Mon Nov 13 16:52:06 CST 2017


Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/7169 )

Change subject: core: Use ast_alertpipe for Asterisk signal monitoring thread.
......................................................................


Patch Set 2:

(1 comment)

> I tested SIGHUP and SIGTERM against the asterisk PID on Fedora 26. 
 > Both signals worked immediately with console, no fork and forking.
 > 
 > ast_alertpipe enables non-blocking mode but I think this is fine
 > because we're using ast_poll (rather than letting read block).
 > 
 > One thing I noticed ast_alertpipe_write says to see write(2) for
 > return value, but it actually returns zero on success and non-zero
 > on error.  I don't know if we fix the implementation or docs?

I think both are fine? According to write(2) 0 is returned if nothing is written. Otherwise either the number of bytes written is returned or -1 on error. In some cases it might be prudent or even required to see if the number of bytes written matches the number of bytes attempted to be written.

https://gerrit.asterisk.org/#/c/7169/2/main/asterisk.c
File main/asterisk.c:

https://gerrit.asterisk.org/#/c/7169/2/main/asterisk.c@1769
PS2, Line 1769: 	if (ast_alertpipe_write(sig_alert_pipe)) {
This should check if the return is -1. According to write(2) the number of bytes written is returned, so most of the time this will be true and then print an error when there was none.



-- 
To view, visit https://gerrit.asterisk.org/7169
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id4041a237d481ff699639e153ea6982fee14a462
Gerrit-Change-Number: 7169
Gerrit-PatchSet: 2
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Comment-Date: Mon, 13 Nov 2017 22:52:06 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171113/e58c08c8/attachment.html>


More information about the asterisk-code-review mailing list