当前位置: 首页>>代码示例>>C++>>正文


C++ shm_ids函数代码示例

本文整理汇总了C++中shm_ids函数的典型用法代码示例。如果您正苦于以下问题:C++ shm_ids函数的具体用法?C++ shm_ids怎么用?C++ shm_ids使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了shm_ids函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: shm_destroy_orphaned

void shm_destroy_orphaned(struct ipc_namespace *ns)
{
	down_write(&shm_ids(ns).rwsem);
	if (shm_ids(ns).in_use)
		idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_orphaned, ns);
	up_write(&shm_ids(ns).rwsem);
}
开发者ID:SiddheshK15,项目名称:kernel_htc_820,代码行数:7,代码来源:shm.c

示例2: krg_shm_exit_ns

void krg_shm_exit_ns(struct ipc_namespace *ns)
{
	if (shm_ids(ns).krgops) {

		_destroy_kddm_set(shm_ids(ns).krgops->data_kddm_set);
		_destroy_kddm_set(shm_ids(ns).krgops->key_kddm_set);
		_destroy_kddm_set(shm_ids(ns).krgops->map_kddm_set);

		kfree(shm_ids(ns).krgops);
	}
}
开发者ID:jeanparpaillon,项目名称:kerrighed-kernel,代码行数:11,代码来源:shm_handler.c

示例3: exit_shm

void exit_shm(struct task_struct *task)
{
	struct ipc_namespace *ns = task->nsproxy->ipc_ns;

	if (shm_ids(ns).in_use == 0)
		return;

	/* Destroy all already created segments, but not mapped yet */
	down_write(&shm_ids(ns).rwsem);
	if (shm_ids(ns).in_use)
		idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_current, ns);
	up_write(&shm_ids(ns).rwsem);
}
开发者ID:SiddheshK15,项目名称:kernel_htc_820,代码行数:13,代码来源:shm.c

示例4: ipc_obtain_object_check

static inline struct shmid_kernel *shm_obtain_object_check(struct ipc_namespace *ns, int id)
{
	struct kern_ipc_perm *ipcp = ipc_obtain_object_check(&shm_ids(ns), id);

	if (IS_ERR(ipcp))
		return ERR_CAST(ipcp);

	return container_of(ipcp, struct shmid_kernel, shm_perm);
}
开发者ID:SiddheshK15,项目名称:kernel_htc_820,代码行数:9,代码来源:shm.c

示例5: krg_ipc_shm_newseg

/** Notify the creation of a new shm segment to Kerrighed.
 *
 *  @author Renaud Lottiaux
 */
int krg_ipc_shm_newseg (struct ipc_namespace *ns, struct shmid_kernel *shp)
{
	shmid_object_t *shp_object;
	struct kddm_set *kddm;
	long *key_index;
	int index, err;

	BUG_ON(!shm_ids(ns).krgops);

	index = ipcid_to_idx(shp->shm_perm.id);

	shp_object = _kddm_grab_object_manual_ft(
		shm_ids(ns).krgops->data_kddm_set, index);

	BUG_ON(shp_object);

	shp_object = kmem_cache_alloc(shmid_object_cachep, GFP_KERNEL);
	if (!shp_object) {
		err = -ENOMEM;
		goto err_put;
	}

	/* Create a KDDM set to host segment pages */
	kddm = _create_new_kddm_set (kddm_def_ns, 0, SHM_MEMORY_LINKER,
				     kerrighed_node_id, PAGE_SIZE,
				     &shp->shm_perm.id, sizeof(int), 0);

	if (IS_ERR(kddm)) {
		err = PTR_ERR(kddm);
		goto err_put;
	}

	shp->shm_file->f_dentry->d_inode->i_mapping->kddm_set = kddm;
	shp->shm_file->f_op = &krg_shm_file_operations;

	shp_object->set_id = kddm->id;

	shp_object->local_shp = shp;

	_kddm_set_object(shm_ids(ns).krgops->data_kddm_set, index, shp_object);

	if (shp->shm_perm.key != IPC_PRIVATE)
	{
		key_index = _kddm_grab_object(shm_ids(ns).krgops->key_kddm_set,
					      shp->shm_perm.key);
		*key_index = index;
		_kddm_put_object (shm_ids(ns).krgops->key_kddm_set,
				  shp->shm_perm.key);
	}

	shp->shm_perm.krgops = shm_ids(ns).krgops;

err_put:
	_kddm_put_object(shm_ids(ns).krgops->data_kddm_set, index);

	return 0;

}
开发者ID:jeanparpaillon,项目名称:kerrighed-kernel,代码行数:62,代码来源:shm_handler.c

示例6: ipc_lock_down

/*
 * shm_lock_(check_)down routines are called in the paths where the rw_mutex
 * is held to protect access to the idr tree.
 */
static inline struct shmid_kernel *shm_lock_down(struct ipc_namespace *ns,
						int id)
{
	struct kern_ipc_perm *ipcp = ipc_lock_down(&shm_ids(ns), id);

	if (IS_ERR(ipcp))
		return (struct shmid_kernel *)ipcp;

	return container_of(ipcp, struct shmid_kernel, shm_perm);
}
开发者ID:maraz,项目名称:linux-2.6,代码行数:14,代码来源:shm.c

示例7: shm_close

/*
 * remove the attach descriptor vma.
 * free memory for segment if it is marked destroyed.
 * The descriptor has already been removed from the current->mm->mmap list
 * and will later be kfree()d.
 */
static void shm_close(struct vm_area_struct *vma)
{
	struct file * file = vma->vm_file;
	struct shm_file_data *sfd = shm_file_data(file);
	struct shmid_kernel *shp;
	struct ipc_namespace *ns = sfd->ns;

	down_write(&shm_ids(ns).rwsem);
	/* remove from the list of attaches of the shm segment */
	shp = shm_lock(ns, sfd->id);
	BUG_ON(IS_ERR(shp));
	shp->shm_lprid = task_tgid_vnr(current);
	shp->shm_dtim = get_seconds();
	shp->shm_nattch--;
	if (shm_may_destroy(ns, shp))
		shm_destroy(ns, shp);
	else
		shm_unlock(shp);
	up_write(&shm_ids(ns).rwsem);
}
开发者ID:SiddheshK15,项目名称:kernel_htc_820,代码行数:26,代码来源:shm.c

示例8: krg_ipc_shm_destroy

void krg_ipc_shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp)
{
	struct kddm_set *mm_set;
	int index;
	key_t key;

	index = ipcid_to_idx(shp->shm_perm.id);
	key = shp->shm_perm.key;

	mm_set = shp->shm_file->f_dentry->d_inode->i_mapping->kddm_set;

	if (key != IPC_PRIVATE) {
		_kddm_grab_object_no_ft(shm_ids(ns).krgops->key_kddm_set, key);
		_kddm_remove_frozen_object(shm_ids(ns).krgops->key_kddm_set, key);
	}

	local_shm_unlock(shp);

	_kddm_remove_frozen_object(shm_ids(ns).krgops->data_kddm_set, index);
	_destroy_kddm_set(mm_set);

	krg_ipc_rmid(&shm_ids(ns), index);
}
开发者ID:jeanparpaillon,项目名称:kerrighed-kernel,代码行数:23,代码来源:shm_handler.c

示例9: krg_shm_flush_set

int krg_shm_flush_set(struct ipc_namespace *ns)
{
	struct krgipc_ops *shmops;

	down_write(&sem_ids(ns).rw_mutex);

	shmops = shm_ids(ns).krgops;

	_kddm_flush_set(shmops->data_kddm_set, ipc_flusher, NULL);
	_kddm_flush_set(shmops->map_kddm_set, ipc_flusher, NULL);
	_kddm_flush_set(shmops->key_kddm_set, ipc_flusher, NULL);

	up_write(&sem_ids(ns).rw_mutex);

	return 0;
}
开发者ID:jeanparpaillon,项目名称:kerrighed-kernel,代码行数:16,代码来源:shm_handler.c

示例10: krg_ipc_shm_rmkey

void krg_ipc_shm_rmkey(struct ipc_namespace *ns, key_t key)
{
	_kddm_remove_object(shm_ids(ns).krgops->key_kddm_set, key);
}
开发者ID:jeanparpaillon,项目名称:kerrighed-kernel,代码行数:4,代码来源:shm_handler.c

示例11: krg_shm_init_ns

int krg_shm_init_ns(struct ipc_namespace *ns)
{
	int r;

	struct krgipc_ops *shm_ops = kmalloc(sizeof(struct krgipc_ops),
					     GFP_KERNEL);
	if (!shm_ops) {
		r = -ENOMEM;
		goto err;
	}

	shm_ops->map_kddm_set = create_new_kddm_set(kddm_def_ns,
						    SHMMAP_KDDM_ID,
						    IPCMAP_LINKER,
						    KDDM_RR_DEF_OWNER,
						    sizeof(ipcmap_object_t),
						    KDDM_LOCAL_EXCLUSIVE);
	if (IS_ERR(shm_ops->map_kddm_set)) {
		r = PTR_ERR(shm_ops->map_kddm_set);
		goto err_map;
	}

	shm_ops->key_kddm_set = create_new_kddm_set(kddm_def_ns,
						    SHMKEY_KDDM_ID,
						    SHMKEY_LINKER,
						    KDDM_RR_DEF_OWNER,
						    sizeof(long),
						    KDDM_LOCAL_EXCLUSIVE);
	if (IS_ERR(shm_ops->key_kddm_set)) {
		r = PTR_ERR(shm_ops->key_kddm_set);
		goto err_key;
	}

	shm_ops->data_kddm_set = create_new_kddm_set(kddm_def_ns,
						     SHMID_KDDM_ID,
						     SHMID_LINKER,
						     KDDM_RR_DEF_OWNER,
						     sizeof(shmid_object_t),
						     KDDM_LOCAL_EXCLUSIVE
						     | KDDM_NEED_SAFE_WALK);
	if (IS_ERR(shm_ops->data_kddm_set)) {
		r = PTR_ERR(shm_ops->data_kddm_set);
		goto err_data;
	}

	shm_ops->ipc_lock = kcb_ipc_shm_lock;
	shm_ops->ipc_unlock = kcb_ipc_shm_unlock;
	shm_ops->ipc_findkey = kcb_ipc_shm_findkey;

	shm_ids(ns).krgops = shm_ops;

	return 0;

err_data:
	_destroy_kddm_set(shm_ops->key_kddm_set);
err_key:
	_destroy_kddm_set(shm_ops->map_kddm_set);
err_map:
	kfree(shm_ops);
err:
	return r;
}
开发者ID:jeanparpaillon,项目名称:kerrighed-kernel,代码行数:62,代码来源:shm_handler.c

示例12: shm_exit_ns

void shm_exit_ns(struct ipc_namespace *ns)
{
	free_ipcs(ns, &shm_ids(ns), do_shm_rmid);
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:4,代码来源:shm.c

示例13: for_all_ipc_shm

void for_all_ipc_shm(string ipc_cb)
{
    for_all_ipc_ids(init_nsproxy.ipc_ns, &shm_ids(init_nsproxy.ipc_ns), ipc_cb);
}
开发者ID:lucchouina,项目名称:eppic,代码行数:4,代码来源:ipcs.c


注:本文中的shm_ids函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。