logo

Crowdly

The following code is taken from the ipc/msg.c file of the Linux Kernel 4.19.22...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

The following code is taken from the ipc/msg.c file of the Linux Kernel 4.19.225. Check all the true claims that follow.

/**

 * newque - Create a new msg queue

 * @ns: namespace

 * @params: ptr to the structure that contains the key and msgflg

 *

 * Called with msg_ids.rwsem held (writer)

 */

static int newque(struct ipc_namespace *ns, struct ipc_params *params)

{

        struct msg_queue *msq;

        int retval;

        key_t key = params->key;

        int msgflg = params->flg;

        msq = kvmalloc(sizeof(*msq), GFP_KERNEL);

        if (unlikely(!msq))

                return -ENOMEM;

        msq->q_perm.mode = msgflg & S_IRWXUGO;

        msq->q_perm.key = key;

        msq->q_perm.security = NULL;

        retval = security_msg_queue_alloc(&msq->q_perm);

        if (retval) {

                kvfree(msq);

                return retval;

        }

        msq->q_stime = msq->q_rtime = 0;

        msq->q_ctime = ktime_get_real_seconds();

        msq->q_cbytes = msq->q_qnum = 0;

        msq->q_qbytes = ns->msg_ctlmnb;

        msq->q_lspid = msq->q_lrpid = NULL;

        INIT_LIST_HEAD(&msq->q_messages);

        INIT_LIST_HEAD(&msq->q_receivers);

        INIT_LIST_HEAD(&msq->q_senders);

        /* ipc_addid() locks msq upon success. */

        retval = ipc_addid(&msg_ids(ns), &msq->q_perm, ns->msg_ctlmni);

        if (retval < 0) {

                ipc_rcu_putref(&msq->q_perm, msg_rcu_free);

                return retval;

        }

        ipc_unlock_object(&msq->q_perm);

        rcu_read_unlock();

        return msq->q_perm.id;

}

0%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.eurecom.fr?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!