sem.h 1.2 KB
Newer Older
L
Linus Torvalds 已提交
1 2 3
#ifndef _LINUX_SEM_H
#define _LINUX_SEM_H

A
Arun Sharma 已提交
4
#include <linux/atomic.h>
5
#include <linux/rcupdate.h>
6
#include <linux/cache.h>
7
#include <uapi/linux/sem.h>
L
Linus Torvalds 已提交
8

9 10
struct task_struct;

L
Linus Torvalds 已提交
11 12
/* One sem_array data structure for each set of semaphores in the system. */
struct sem_array {
13 14
	struct kern_ipc_perm	____cacheline_aligned_in_smp
				sem_perm;	/* permissions .. see ipc.h */
L
Linus Torvalds 已提交
15 16 17
	time_t			sem_otime;	/* last semop time */
	time_t			sem_ctime;	/* last change time */
	struct sem		*sem_base;	/* ptr to first semaphore in array */
18
	struct list_head	sem_pending;	/* pending operations to be processed */
19
	struct list_head	list_id;	/* undo requests on this array */
20 21
	int			sem_nsems;	/* no. of semaphores in array */
	int			complex_count;	/* pending complex operations */
L
Linus Torvalds 已提交
22 23
};

24 25
#ifdef CONFIG_SYSVIPC

L
Linus Torvalds 已提交
26 27 28 29 30 31 32 33
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
34 35 36 37 38

struct sysv_sem {
	/* empty */
};

L
Linus Torvalds 已提交
39 40 41 42 43 44 45 46 47 48 49 50
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 */