The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/compat/irix/irix_usema.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*      $NetBSD: irix_usema.h,v 1.14 2008/05/10 12:57:18 tnn Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
    5  * All rights reserved.
    6  *
    7  * This code is derived from software contributed to The NetBSD Foundation
    8  * by Emmanuel Dreyfus.
    9  *
   10  * Redistribution and use in source and binary forms, with or without
   11  * modification, are permitted provided that the following conditions
   12  * are met:
   13  * 1. Redistributions of source code must retain the above copyright
   14  *    notice, this list of conditions and the following disclaimer.
   15  * 2. Redistributions in binary form must reproduce the above copyright
   16  *    notice, this list of conditions and the following disclaimer in the
   17  *    documentation and/or other materials provided with the distribution.
   18  *
   19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   29  * POSSIBILITY OF SUCH DAMAGE.
   30  */
   31 
   32 #ifndef _IRIX_USEMA_H_
   33 #define _IRIX_USEMA_H_
   34 
   35 #include <sys/param.h>
   36 #include <sys/device.h>
   37 #include <sys/rwlock.h>
   38 #include <sys/queue.h>
   39 #include <sys/vnode.h>
   40 
   41 #include <compat/irix/irix_types.h>
   42 #include <compat/irix/irix_exec.h>
   43 
   44 extern struct vfsops irix_usema_dummy_vfsops;
   45 void irix_usema_dummy_vfs_init(void);
   46 extern const struct vnodeopv_desc * const irix_usema_vnodeopv_descs[];
   47 extern const struct vnodeopv_desc irix_usema_opv_desc;
   48 extern int (**irix_usema_vnodeop_p)(void *);
   49 extern const struct vnodeopv_entry_desc irix_usema_vnodeop_entries[];
   50 
   51 
   52 void    irix_usemaattach(struct device *, struct device *, void *);
   53 
   54 int     irix_usema_close(void *);
   55 int     irix_usema_access(void *);
   56 int     irix_usema_getattr(void *);
   57 int     irix_usema_setattr(void *);
   58 int     irix_usema_fcntl(void *);
   59 int     irix_usema_ioctl(void *);
   60 int     irix_usema_poll(void *);
   61 int     irix_usema_inactive(void *);
   62 
   63 void    irix_usema_exit_cleanup(struct proc *, struct proc *);
   64 #ifdef DEBUG_IRIX
   65 void    irix_usema_debug(void);
   66 #endif
   67 
   68 #define IRIX_USEMADEV_MINOR     1
   69 #define IRIX_USEMACLNDEV_MINOR  0
   70 
   71 /* Semaphore internal structure: undocumented in IRIX */
   72 struct irix_semaphore {
   73         int is_val;     /* Sempahore value */
   74         int is_uk1;     /* unknown, usually small integer < 3000  */
   75         int is_uk2;     /* metric, debug or history pointer ? */
   76         int is_uk3;     /* unknown, usually equal to 0 */
   77         int is_uk4;     /* unknown, usually equal to 0 */
   78         int is_shid;    /* unique ID for the shared arena ? */
   79         int is_oid;     /* owner id? usually equal to -1 */
   80         int is_uk7;     /* unknown, usually equal to -1 */
   81         int is_uk8;     /* unknown, usually equal to 0 */
   82         int is_uk9;     /* unknown, usually equal to 0 */
   83         int is_uk10;    /* semaphore page base address ? */
   84         int is_uk12;    /* unknown, usually equal to 0 */
   85         int is_uk13;    /* metric, debug or history pointer ? */
   86         int is_uk14;    /* padding? */
   87 };
   88 
   89 struct irix_usema_idaddr {
   90         int iui_uk1;    /* unknown, usually equal to 0 */
   91         int *iui_oidp;  /* pointer to is_oid field in struct irix_semaphore */
   92 };
   93 
   94 /* waiting processes list */
   95 struct irix_waiting_proc_rec {
   96         TAILQ_ENTRY(irix_waiting_proc_rec) iwpr_list;
   97         struct proc *iwpr_p;
   98 };
   99 
  100 /* semaphore list, their vnode counterparts, and waiting processes lists */
  101 struct irix_usema_rec {
  102         LIST_ENTRY(irix_usema_rec) iur_list;
  103         struct vnode *iur_vn;
  104         struct irix_semaphore *iur_sem;
  105         int iur_shid;
  106         struct proc *iur_p;
  107         struct selinfo iur_si;
  108         int iur_waiting_count;
  109         TAILQ_HEAD(iur_waiting_p, irix_waiting_proc_rec) iur_waiting_p;
  110         TAILQ_HEAD(iur_released_p, irix_waiting_proc_rec) iur_released_p;
  111         krwlock_t iur_lock;             /* lock for both lists */
  112 };
  113 
  114 /* From IRIX's <sys/usioctl.h> */
  115 #define IRIX_USEMADEV           "/dev/usema"
  116 #define IRIX_USEMACLNDEV        "/dev/usemaclone"
  117 
  118 #define IRIX_UIOC       ('u' << 16 | 's' << 8)
  119 #define IRIX_UIOC_MASK  0x00ffff00
  120 
  121 #define IRIX_UIOCATTACHSEMA     (IRIX_UIOC|2)
  122 #define IRIX_UIOCBLOCK          (IRIX_UIOC|3)
  123 #define IRIX_UIOCABLOCK         (IRIX_UIOC|4)
  124 #define IRIX_UIOCNOIBLOCK       (IRIX_UIOC|5)
  125 #define IRIX_UIOCUNBLOCK        (IRIX_UIOC|6)
  126 #define IRIX_UIOCAUNBLOCK       (IRIX_UIOC|7)
  127 #define IRIX_UIOCINIT           (IRIX_UIOC|8)
  128 #define IRIX_UIOCGETSEMASTATE   (IRIX_UIOC|9)
  129 #define IRIX_UIOCABLOCKPID      (IRIX_UIOC|10)
  130 #define IRIX_UIOCADDPID         (IRIX_UIOC|11)
  131 #define IRIX_UIOCABLOCKQ        (IRIX_UIOC|12)
  132 #define IRIX_UIOCAUNBLOCKQ      (IRIX_UIOC|13)
  133 #define IRIX_UIOCIDADDR         (IRIX_UIOC|14)
  134 #define IRIX_UIOCSETSEMASTATE   (IRIX_UIOC|15)
  135 #define IRIX_UIOCGETCOUNT       (IRIX_UIOC|16)
  136 
  137 struct irix_usattach_s {
  138         irix_dev_t      us_dev;
  139         void            *us_handle;
  140 };
  141 typedef struct irix_usattach_s irix_usattach_t;
  142 
  143 struct irix_irix5_usattach_s {
  144         __uint32_t      us_dev;
  145         __uint32_t      us_handle;
  146 };
  147 typedef struct irix_irix5_usattach_s irix_irix5_usattach_t;
  148 
  149 struct irix_ussemastate_s {
  150         int     ntid;
  151         int     nprepost;
  152         int     nfilled;
  153         int     nthread;
  154         struct irix_ussematidstate_s {
  155                 pid_t   pid;
  156                 int     tid;
  157                 int     count;
  158         } *tidinfo;
  159 };
  160 typedef struct irix_ussemastate_s irix_ussemastate_t;
  161 typedef struct irix_ussematidstate_s irix_ussematidstate_t;
  162 
  163 
  164 /* usync_fcntl() commands, undocumented in IRIX */
  165 #define IRIX_USYNC_BLOCK                1
  166 #define IRIX_USYNC_INTR_BLOCK           2
  167 #define IRIX_USYNC_UNBLOCK_ALL          3
  168 #define IRIX_USYNC_UNBLOCK              4
  169 #define IRIX_USYNC_NOTIFY_REGISTER      5
  170 #define IRIX_USYNC_NOTIFY               6
  171 #define IRIX_USYNC_NOTIFY_DELETE        7
  172 #define IRIX_USYNC_NOTIFY_CLEAR         8
  173 #define IRIX_USYNC_GET_STATE            11
  174 
  175 struct irix_usync_arg {
  176         int iua_uk0;    /* unknown, usually small integer around 1000 */
  177         int iua_uk1;    /* unknown, usually pointer to code in libc */
  178         int iua_uk2;    /* unknown, usually null */
  179         struct irix_semaphore *iua_sem; /* semaphore address */
  180 };
  181 
  182 #endif /* _IRIX_USEMA_H_ */

Cache object: 3cc76a7aea5aa2a30708675ce7f615ff


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.