2005-04-17 06:20:36 +08:00
|
|
|
#ifndef _LINUX_SEM_H
|
|
|
|
#define _LINUX_SEM_H
|
|
|
|
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2008-07-25 16:48:06 +08:00
|
|
|
#include <linux/rcupdate.h>
|
2010-05-27 05:43:42 +08:00
|
|
|
#include <linux/cache.h>
|
2012-10-13 17:46:48 +08:00
|
|
|
#include <uapi/linux/sem.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-11-07 16:59:43 +08:00
|
|
|
struct task_struct;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
/* One sem_array data structure for each set of semaphores in the system. */
|
|
|
|
struct sem_array {
|
2010-05-27 05:43:42 +08:00
|
|
|
struct kern_ipc_perm ____cacheline_aligned_in_smp
|
|
|
|
sem_perm; /* permissions .. see ipc.h */
|
2005-04-17 06:20:36 +08:00
|
|
|
time_t sem_ctime; /* last change time */
|
|
|
|
struct sem *sem_base; /* ptr to first semaphore in array */
|
2013-07-09 07:01:23 +08:00
|
|
|
struct list_head pending_alter; /* pending operations */
|
|
|
|
/* that alter the array */
|
|
|
|
struct list_head pending_const; /* pending complex operations */
|
|
|
|
/* that do not alter semvals */
|
2008-07-25 16:48:04 +08:00
|
|
|
struct list_head list_id; /* undo requests on this array */
|
2009-12-16 08:47:32 +08:00
|
|
|
int sem_nsems; /* no. of semaphores in array */
|
|
|
|
int complex_count; /* pending complex operations */
|
2005-04-17 06:20:36 +08:00
|
|
|
};
|
|
|
|
|
2011-11-03 04:38:56 +08:00
|
|
|
#ifdef CONFIG_SYSVIPC
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
struct sysv_sem {
|
|
|
|
struct sem_undo_list *undo_list;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
|
|
|
|
extern void exit_sem(struct task_struct *tsk);
|
|
|
|
|
|
|
|
#else
|
2011-11-03 04:38:56 +08:00
|
|
|
|
|
|
|
struct sysv_sem {
|
|
|
|
/* empty */
|
|
|
|
};
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void exit_sem(struct task_struct *tsk)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _LINUX_SEM_H */
|