Sync usage with man page.
[netbsd-mini2440.git] / sys / compat / irix / irix_prctl.h
blobd330ba04bc57c717292dd508ee89f1c8b9ff0351
1 /* $NetBSD: irix_prctl.h,v 1.13 2007/12/06 14:53:36 ad Exp $ */
3 /*-
4 * Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
5 * All rights reserved.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Emmanuel Dreyfus.
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.
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.
32 #ifndef _IRIX_PRCTL_H_
33 #define _IRIX_PRCTL_H_
35 /* IRIX share group structure */
36 struct irix_share_group {
37 LIST_HEAD(isg_head, irix_emuldata) isg_head; /* list head */
38 krwlock_t isg_lock; /* list lock */
39 int isg_refcount;
43 * List of shared vs unshared regions in the VM space. We need to maintain
44 * this for all processes, not only processes belonging to a share group,
45 * because a process can request a private mapping (MAP_LOCAL option to
46 * mmap(2)) before becoming the member of a share group.
48 struct irix_shared_regions_rec {
49 vaddr_t isrr_start;
50 vsize_t isrr_len;
51 int isrr_shared; /* shared or not shared */
52 #define IRIX_ISRR_SHARED 1
53 #define IRIX_ISRR_PRIVATE 0
54 LIST_ENTRY(irix_shared_regions_rec) isrr_list;
57 int irix_prda_init(struct proc *);
58 void irix_vm_sync(struct proc *);
59 int irix_vm_fault(struct proc *, vaddr_t, vm_prot_t);
60 void irix_isrr_insert(vaddr_t, vsize_t, int, struct proc *);
62 /* macro used to wrap irix_vm_sync calls */
63 #define IRIX_VM_SYNC(q,cmd) \
64 if (((struct irix_emuldata *)((q)->p_emuldata))->ied_share_group == NULL || \
65 ((struct irix_emuldata *)((q)->p_emuldata))->ied_shareaddr == 0) { \
66 (cmd); \
67 } else { \
68 rw_enter(&((struct irix_emuldata *) \
69 ((q)->p_emuldata))->ied_share_group->isg_lock, RW_WRITER); \
70 (cmd); \
71 irix_vm_sync((q)); \
72 rw_exit(&((struct irix_emuldata *) \
73 ((q)->p_emuldata))->ied_share_group->isg_lock); \
76 /* From IRIX's <sys/prctl.h> */
78 #define IRIX_PR_MAXPROCS 1
79 #define IRIX_PR_ISBLOCKED 2
80 #define IRIX_PR_SETSTACKSIZE 3
81 #define IRIX_PR_GETSTACKSIZE 4
82 #define IRIX_PR_MAXPPROCS 5
83 #define IRIX_PR_UNBLKONEXEC 6
84 #define IRIX_PR_SETEXITSIG 8
85 #define IRIX_PR_RESIDENT 9
86 #define IRIX_PR_ATTACHADDR 10
87 #define IRIX_PR_DETACHADDR 11
88 #define IRIX_PR_TERMCHILD 12
89 #define IRIX_PR_GETSHMASK 13
90 #define IRIX_PR_GETNSHARE 14
91 #define IRIX_PR_COREPID 15
92 #define IRIX_PR_ATTACHADDRPERM 16
93 #define IRIX_PR_PTHREADEXIT 17
94 #define IRIX_PR_SETABORTSIG 18
95 #define IRIX_PR_INIT_THREADS 20
96 #define IRIX_PR_THREAD_CTL 21
97 #define IRIX_PR_LASTSHEXIT 22
99 /* sproc flags */
100 #define IRIX_PR_SPROC 0x00000001
101 #define IRIX_PR_SFDS 0x00000002
102 #define IRIX_PR_SDIR 0x00000004
103 #define IRIX_PR_SUMASK 0x00000008
104 #define IRIX_PR_SULIMIT 0x00000010
105 #define IRIX_PR_SID 0x00000020
106 #define IRIX_PR_SADDR 0x00000040
107 #define IRIX_PR_THREADS 0x00000080
108 #define IRIX_PR_BLOCK 0x01000000
109 #define IRIX_PR_NOLIBC 0x02000000
110 #define IRIX_PR_EVENT 0x04000000
112 /* blockproc constants */
113 #define IRIX_PR_MAXBLOCKCNT 10000
114 #define IRIX_PR_MINBLOCKCNT -10000
116 /* This is undocumented */
117 #define IRIX_PROCBLK_BLOCK 0
118 #define IRIX_PROCBLK_UNBLOCK 1
119 #define IRIX_PROCBLK_COUNT 2
120 #define IRIX_PROCBLK_BLOCKALL 3
121 #define IRIX_PROCBLK_UNBLOCKALL 4
122 #define IRIX_PROCBLK_COUNTALL 5
123 #define IRIX_PROCBLK_ONLYONE -3
125 /* From <sys/prctl.h> */
126 #define IRIX_PRDA ((struct prda *)0x00200000L)
127 struct irix_prda_sys {
128 irix_pid_t t_pid;
129 uint32_t t_hint;
130 uint32_t t_dlactseq;
131 uint32_t t_fpflags;
132 uint32_t t_prid;
133 uint32_t t_dlendseq;
134 uint64_t t_unused1[5];
135 irix_pid_t t_rpid;
136 int32_t t_resched;
137 int32_t t_syserror;
138 int32_t t_nid;
139 int32_t t_affinity_nid;
140 uint32_t t_unused2[5];
141 uint32_t t_cpu;
142 uint32_t t_flags;
143 irix_k_sigset_t t_hold;
145 struct irix_prda {
146 char unused[2048];
147 union {
148 char fill[512];
149 uint32_t rsvd[8];
150 } sys2_prda;
151 union {
152 char fill[512];
153 } lib2_prda;
154 union {
155 char fill[512];
156 } usr2rda;
157 union {
158 struct irix_prda_sys prda_sys;
159 char fill[128];
160 } sys_prda;
161 union {
162 char fill[256];
163 } lib_prda;
164 union {
165 char fill[128];
166 } usr_prda;
169 #endif /* _IRIX_PRCTL_H_ */