/*
 * call-seq:
 *      mq.unlink => mq
 *
 * Unlinks the message queue to prevent other processes from accessing it.
 * All existing queue descriptors to this queue including those opened by
 * other processes are unaffected.  The queue will only be destroyed
 * when the last process with open descriptors to this queue closes
 * the descriptors.
 */
static VALUE _unlink(VALUE self)
{
        struct posix_mq *mq = get(self, 0);
        int rv;

        if (NIL_P(mq->name)) {
                rb_raise(rb_eArgError, "can not unlink an adopted socket");
        }

        assert(TYPE(mq->name) == T_STRING && "mq->name is not a string");

        rv = mq_unlink(RSTRING_PTR(mq->name));
        if (rv < 0)
                rb_sys_fail("mq_unlink");

        return self;
}