Re: event notifier problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thank you Ellie and Michael, I agree with both of you.
Unfortunately seems that in Solaris Illumos Unix sockets works differently compared to Linux and there is no parameter that can be tweaked in order to obtain a larger bufsiz using SOCK_DGRAM.

Guided by Illumos developers, we ended up in this solution:
...
    /* Get send buffer size */
    optlen = sizeof(bufsiz);
    r = getsockopt(soc, SOL_SOCKET, SO_SNDBUF, &bufsiz, &optlen);
    if (r == -1) {
        syslog(LOG_ERR, "unable to getsockopt(SO_SNDBUF) on notify socket: %m");
        goto out;
    }

    /*
     * Use maximum of 1/10 of send buffer size (-overhead), but at least
     * NOTIFY_MAXSIZE
     */
    if (bufsiz < NOTIFY_MAXSIZE) {
        int req_bufsize = NOTIFY_MAXSIZE;

        if (setsockopt(soc, SOL_SOCKET, SO_SNDBUF, &req_bufsize,
            sizeof (req_bufsize)) != 0) {
                syslog(LOG_ERR, "unable to setsockopt(SO_SNDBUF) "
                       "on notify socket: %m");
                goto out;
        }
        bufsiz = req_bufsize;
    }
    else {
        bufsiz = MIN(bufsiz / 10 - 32, NOTIFY_MAXSIZE);
    }

    /*
     * build request of the form:
     *
     * method NUL class NUL priority NUL user NUL mailbox NUL
     *   nopt NUL N(option NUL) message NUL
     */
...

Thank you,
Matteo

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux