The "fds" variable in main needs to be increased to 4 elements
Somehow that change ended up in the immnd patch, will move it before push
/Hans

On 12/19/2013 09:28 AM, Hans Feldt wrote:
>   osaf/services/saf/immsv/immd/immd_main.c |  20 +++++++++++++++-----
>   1 files changed, 15 insertions(+), 5 deletions(-)
>
>
> diff --git a/osaf/services/saf/immsv/immd/immd_main.c 
> b/osaf/services/saf/immsv/immd/immd_main.c
> --- a/osaf/services/saf/immsv/immd/immd_main.c
> +++ b/osaf/services/saf/immsv/immd/immd_main.c
> @@ -40,10 +40,11 @@
>   static IMMD_CB _immd_cb;
>   IMMD_CB *immd_cb = &_immd_cb;
>
> -#define FD_USR1 0
> -#define FD_AMF 0
> -#define FD_MBCSV 1
> -#define FD_MBX 2
> +#define FD_TERM 0
> +#define FD_USR1 1
> +#define FD_AMF 1
> +#define FD_MBCSV 2
> +#define FD_MBX 3
>
>   /* ========================================================================
>    *   FUNCTION PROTOTYPES
> @@ -208,6 +209,7 @@ int main(int argc, char *argv[])
>       int32_t total_wait = (-1);
>       int64_t start_time = 0LL;
>       uint32_t print_at_secs = 1LL;
> +     int term_fd;
>
>       daemonize(argc, argv);
>
> @@ -216,6 +218,8 @@ int main(int argc, char *argv[])
>               goto done;
>       }
>
> +     daemon_sigterm_install(&term_fd);
> +
>       if(peerWaitStr) {
>               int32_t peerMaxWait = atoi(peerWaitStr);
>               if(peerMaxWait < peerMaxWaitMin) {
> @@ -239,6 +243,8 @@ int main(int argc, char *argv[])
>       mbx_fd = ncs_ipc_get_sel_obj(&immd_cb->mbx);
>
>       /* Set up all file descriptors to listen to */
> +     fds[FD_TERM].fd = term_fd;
> +     fds[FD_TERM].events = POLLIN;
>       fds[FD_USR1].fd = immd_cb->usr1_sel_obj.rmv_obj;
>       fds[FD_USR1].events = POLLIN;
>       fds[FD_MBCSV].fd = immd_cb->mbcsv_sel_obj;
> @@ -247,7 +253,7 @@ int main(int argc, char *argv[])
>       fds[FD_MBX].events = POLLIN;
>
>       while (1) {
> -             int ret = poll(fds, 3, timeout);
> +             int ret = poll(fds, 4, timeout);
>
>               if (ret == -1) {
>                       if (errno == EINTR)
> @@ -257,6 +263,10 @@ int main(int argc, char *argv[])
>                       break;
>               }
>
> +             if (fds[FD_TERM].revents & POLLIN) {
> +                     daemon_exit();
> +             }
> +
>               if (fds[FD_MBCSV].revents & POLLIN) {
>                       if (immd_mbcsv_dispatch(immd_cb) != NCSCC_RC_SUCCESS) {
>                               LOG_ER("MBCSv Dispatch Failed");
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
> _______________________________________________
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>
>

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to