/* This routine is called by sys_msgget, sys_semget() and sys_shmget() when the key is IPC_PRIVATE.  */
static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids, struct ipc_ops *ops, struct ipc_params *params)
/* This routine is called by sys_msgget, sys_semget() and sys_shmget() when the key is IPC_PRIVATE.  */
static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids, struct ipc_ops *ops, struct ipc_params *params)
{
	int err;
retry:
	err = idr_pre_get(&ids->ipcs_idr, GFP_KERNEL);
	if (!err)
		return -ENOMEM;
	down_write(&ids->rw_mutex);
	err = ops->getnew(ns, params);
	up_write(&ids->rw_mutex);
	if (err == -EAGAIN)
		goto retry;
	return err;
}