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


C++ sem_ids函数代码示例

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


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

示例1: 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

示例2: newary

static int newary(struct ipc_namespace *ns, struct ipc_params *params)
{
	int id;
	int retval;
	struct sem_array *sma;
	int size;
	key_t key = params->key;
	int nsems = params->u.nsems;
	int semflg = params->flg;
	int i;

	if (!nsems)
		return -EINVAL;
	if (ns->used_sems + nsems > ns->sc_semmns)
		return -ENOSPC;

	size = sizeof (*sma) + nsems * sizeof (struct sem);
	sma = ipc_rcu_alloc(size);
	if (!sma) {
		return -ENOMEM;
	}
	memset (sma, 0, size);

	sma->sem_perm.mode = (semflg & S_IRWXUGO);
	sma->sem_perm.key = key;

	sma->sem_perm.security = NULL;
	retval = security_sem_alloc(sma);
	if (retval) {
		ipc_rcu_putref(sma);
		return retval;
	}

	id = ipc_addid(&sem_ids(ns), &sma->sem_perm, ns->sc_semmni);
	if (id < 0) {
		security_sem_free(sma);
		ipc_rcu_putref(sma);
		return id;
	}
	ns->used_sems += nsems;

	sma->sem_base = (struct sem *) &sma[1];

	for (i = 0; i < nsems; i++) {
		INIT_LIST_HEAD(&sma->sem_base[i].sem_pending);
		spin_lock_init(&sma->sem_base[i].lock);
	}

	sma->complex_count = 0;
	INIT_LIST_HEAD(&sma->sem_pending);
	INIT_LIST_HEAD(&sma->list_id);
	sma->sem_nsems = nsems;
	sma->sem_ctime = get_seconds();
	sem_unlock(sma, -1);
	rcu_read_unlock();

	return sma->sem_perm.id;
}
开发者ID:u9621071,项目名称:kernel-uek-UEK3,代码行数:58,代码来源:sem.c

示例3: ipc_obtain_object

static inline struct sem_array *sem_obtain_object(struct ipc_namespace *ns, int id)
{
	struct kern_ipc_perm *ipcp = ipc_obtain_object(&sem_ids(ns), id);

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

	return container_of(ipcp, struct sem_array, sem_perm);
}
开发者ID:u9621071,项目名称:kernel-uek-UEK3,代码行数:9,代码来源:sem.c

示例4: SYSCALL_DEFINE3

SYSCALL_DEFINE3(semget, key_t, key, int, nsems, int, semflg)
{
	struct ipc_namespace *ns;
	struct ipc_ops sem_ops;
	struct ipc_params sem_params;

	ns = current->nsproxy->ipc_ns;

	if (nsems < 0 || nsems > ns->sc_semmsl)
		return -EINVAL;

	sem_ops.getnew = newary;
	sem_ops.associate = sem_security;
	sem_ops.more_checks = sem_more_checks;

	sem_params.key = key;
	sem_params.flg = semflg;
	sem_params.u.nsems = nsems;

	return ipcget(ns, &sem_ids(ns), &sem_ops, &sem_params);
}
开发者ID:u9621071,项目名称:kernel-uek-UEK3,代码行数:21,代码来源:sem.c

示例5: sem_exit_ns

void sem_exit_ns(struct ipc_namespace *ns)
{
    free_ipcs(ns, &sem_ids(ns), freeary);
}
开发者ID:liuyang201666,项目名称:linux-akae,代码行数:4,代码来源:sem.c

示例6: for_all_ipc_sem

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

示例7: ipc_lock

struct sem_array *sem_lock(struct ipc_namespace *ns, int id)
{
	struct kern_ipc_perm *ipcp = ipc_lock(&sem_ids(ns), id);

	return container_of(ipcp, struct sem_array, sem_perm);
}
开发者ID:lucchouina,项目名称:eppic,代码行数:6,代码来源:sem.c


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