/*
 * call-seq:
 *      mq.attr = POSIX_MQ::Attr(IO::NONBLOCK)               => mq_attr
 *
 * Only the IO::NONBLOCK flag may be set or unset (zero) in this manner.
 * See the mq_setattr(3) manpage for more details.
 *
 * Consider using the POSIX_MQ#nonblock= method as it is easier and
 * more natural to use.
 */
static VALUE setattr(VALUE self, VALUE astruct)
{
        struct posix_mq *mq = get(self, 1);
        struct mq_attr newattr;

        rstruct2mqattr(&newattr, astruct, 0);

        if (mq_setattr(mq->des, &newattr, NULL) < 0)
                rb_sys_fail("mq_setattr");

        return astruct;
}