~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/sem.h

Version: ~ [ linux-5.12-rc7 ] ~ [ linux-5.11.13 ] ~ [ linux-5.10.29 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.111 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.186 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.230 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.266 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.266 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef _LINUX_SEM_H
  2 #define _LINUX_SEM_H
  3 
  4 #include <linux/atomic.h>
  5 #include <linux/rcupdate.h>
  6 #include <linux/cache.h>
  7 #include <uapi/linux/sem.h>
  8 
  9 struct task_struct;
 10 
 11 /* One semaphore structure for each semaphore in the system. */
 12 struct sem {
 13         int     semval;         /* current value */
 14         /*
 15          * PID of the process that last modified the semaphore. For
 16          * Linux, specifically these are:
 17          *  - semop
 18          *  - semctl, via SETVAL and SETALL.
 19          *  - at task exit when performing undo adjustments (see exit_sem).
 20          */
 21         int     sempid;
 22         spinlock_t      lock;   /* spinlock for fine-grained semtimedop */
 23         struct list_head pending_alter; /* pending single-sop operations */
 24                                         /* that alter the semaphore */
 25         struct list_head pending_const; /* pending single-sop operations */
 26                                         /* that do not alter the semaphore*/
 27         time_t  sem_otime;      /* candidate for sem_otime */
 28 } ____cacheline_aligned_in_smp;
 29 
 30 /* One sem_array data structure for each set of semaphores in the system. */
 31 struct sem_array {
 32         struct kern_ipc_perm    sem_perm;       /* permissions .. see ipc.h */
 33         time_t                  sem_ctime;      /* create/last semctl() time */
 34         struct list_head        pending_alter;  /* pending operations */
 35                                                 /* that alter the array */
 36         struct list_head        pending_const;  /* pending complex operations */
 37                                                 /* that do not alter semvals */
 38         struct list_head        list_id;        /* undo requests on this array */
 39         int                     sem_nsems;      /* no. of semaphores in array */
 40         int                     complex_count;  /* pending complex operations */
 41         unsigned int            use_global_lock;/* >0: global lock required */
 42 
 43         struct sem              sems[];
 44 } __randomize_layout;
 45 
 46 #ifdef CONFIG_SYSVIPC
 47 
 48 struct sysv_sem {
 49         struct sem_undo_list *undo_list;
 50 };
 51 
 52 extern int copy_semundo(unsigned long clone_flags, struct task_struct *tsk);
 53 extern void exit_sem(struct task_struct *tsk);
 54 
 55 #else
 56 
 57 struct sysv_sem {
 58         /* empty */
 59 };
 60 
 61 static inline int copy_semundo(unsigned long clone_flags, struct task_struct *tsk)
 62 {
 63         return 0;
 64 }
 65 
 66 static inline void exit_sem(struct task_struct *tsk)
 67 {
 68         return;
 69 }
 70 #endif
 71 
 72 #endif /* _LINUX_SEM_H */
 73 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp