3 In order to avoid duplicating OpenSolaris-specifc headers, most extensions
4 define any constants/structs in accompanying private/"P" headers. For
5 example, zone_* is implemented in zone.c and constants/structs are defined in
8 auxiliary vector (auxv_t):
10 Proper OpenSolaris does not support statically-linked executables (i.e. via
11 gcc -static). However, glibc does, but with certain restrictions. The kernel
12 only builds the auxv_t if the elf file is not of type ET_EXEC or if the
13 PT_INTERP program header exists. This means that dynamically-linked
14 executables and libaries get an auxv_t while statically-linked executables
15 don't. This means that statically-linked executables won't see PT_TLS, which
16 is needed for __thread support. We can test for the SHARED macro for libc
17 library code, but in general, __thread will not work.
19 In order to fix this, it should be a matter of changing the kernel to
20 unconditionally supply the auxv_t.
24 The OpenSolaris kernel allows for loadable schedule classes. A scheduling
25 class has an id (pc_cid), associated name (pc_clname), and class-specific
26 scheduling information. As new schedulers are loaded, they are incrementally
29 Since id's are assigned dynamically, there is no way to statically associate
30 a class id with a posix scheduler (i.e. SCHED_*). The only exception is
31 SCHED_SYS, which is guaranteed to have cid == 0.
35 Each process has a set of privileges, represented by a prpriv_t. This struct
36 contains a header, followed by a number of priv_chunk_t blocks (the priv
37 sets), and finally followed by a number of priv_info_t blocks (per process
42 The sun libpthread/libthread implementation assumes a 1:1 mapping between
43 pthread_t/thread_t and lwpid_t, while NPTL maps thread descriptors to
44 pthread_t. This behaviour was added to NPTL and maybe enabled by defining
49 Recursive locks are represented by an 8-byte counter defined by the
50 mutex_rcount macro. The maximum number of recursive waiters is
53 Various fields are defined in a 64-bit field. 32 of the bits are used to
54 hold the owner pid. 8-bits each are used for holding the lock byte, the
55 number of waiters, and the number of spinners. Solaris defines some macros
56 for accessing these (architecture dependent of course):
58 mutex_lockword (32-bits): This is used if only the lock bit needs to
61 mutex_lockword64 (64-bits): This is used if you need to atomically swap
62 both the lock bytes and the owner pid. Note that where the pid portion
63 is located is dependent on byte ordering.
65 mutex_lockbyte (8-bits): This is the actual lock byte. It is set to 1 when
66 the lock is locked, and 0 when unlocked.
68 mutex_waiters (8-bits): This is set to 1 when there is another thread
69 waiting and 0 when there are no other waiters.
71 mutex_spinners (8-bits): This byte is apparently unused.
73 mutex_ownerpid (32-bits): Set to the mutex owner's process pid when the
76 The data field (aka mutex_owner) is used by sun libc to store a pointer to
77 the thread-descriptor of the owning thread. We split this 64-bit field into
80 mutex_owner (32-bits): The lwpid of the owning thread.
82 mutex_cond (32-bits): An in-use counter that is incremented when waiting on
83 a condition and decremented when we return (or are cancelled).
85 The kernel only touches the data field when it is cleared during cleanup for
88 The kernel does not handle recursive or error-checking mutexes.
90 The kernel does not set mutex_lockbyte for mutexes with the
91 LOCK_PRIO_INHERIT bit set.
97 The cond_waiters_kernel byte is set to 1 if there are waiters on the
98 condition variable and 0 otherwise. The cond_waiters_user byte is not
101 The only clock types supported by sun libc are CLOCK_REALTIME and
104 The data field is not used by the kernel.
108 The kernel only supports shared/process reader-writer locks; the private
109 rwlock implementation must be completely implemented in libc. For the shared
110 case, readercv and writercv are used to track the owner (thread and process).
111 The sun docs also state that the sun implementation favours writers over
114 There is no apparent advantage in using the rwlock syscalls since any
115 private implementation that used the embedded mutex and cv's would also work
116 correctly in the shared case.
118 Our implementation adds three additional fields are included for tracking
119 the owner (thread and process) of a reader-writer lock.
121 [0] http://docs.sun.com/app/docs/doc/819-2243/rwlock-init-3c?a=view
127 This is used to search a database given a key. Examples that use nss_search
128 include gethostbyname_r and _getauthattr.
135 These are used when for iterating over a database. nss_getent, nss_sent,
136 and nss_endent are used in gethostent, sethostent, and endhostent,
137 respectively. nss_delete is used to free resources used by the interation;
138 it usually directly follows a call to nss_endent.
142 This function is used to parse a file directly, rather than going through
143 nsswitch.conf and its databases.
147 Many of the _SC_ sysconf values are obtained via the systemconf syscall. The
148 following is a table of mappings from _SC_ to _CONFIG_ values. The third
149 column lists the value returned by sysdeps/posix/sysconf.c.
151 _SC_CHILD_MAX _CONFIG_CHILD_MAX _get_child_max
152 _SC_CLK_TCK _CONFIG_CLK_TCK _getclktck
153 _SC_NGROUPS_MAX _CONFIG_NGROUPS NGROUPS_MAX
154 _SC_OPEN_MAX _CONFIG_OPEN_FILES __getdtablesize
155 _SC_PAGESIZE _CONFIG_PAGESIZE __getpagesize
156 _SC_XOPEN_VERSION _CONFIG_XOPEN_VER _XOPEN_VERSION
157 _SC_STREAM_MAX _CONFIG_OPEN_FILES STREAM_MAX
158 _SC_NPROCESSORS_CONF _CONFIG_NPROC_CONF __get_nprocs_conf
159 _SC_NPROCESSORS_ONLN _CONFIG_NPROC_ONLN __get_nprocs
160 _SC_NPROCESSORS_MAX _CONFIG_NPROC_MAX
161 _SC_STACK_PROT _CONFIG_STACK_PROT
162 _SC_AIO_LISTIO_MAX _CONFIG_AIO_LISTIO_MAX AIO_LISTIO_MAX
163 _SC_AIO_MAX _CONFIG_AIO_MAX AIO_MAX
164 _SC_AIO_PRIO_DELTA_MAX _CONFIG_AIO_PRIO_DELTA_MAX AIO_PRIO_DELTA_MAX
165 _SC_DELAYTIMER_MAX _CONFIG_DELAYTIMER_MAX DELAYTIMER_MAX
166 _SC_MQ_OPEN_MAX _CONFIG_MQ_OPEN_MAX MQ_OPEN_MAX
167 _SC_MQ_PRIO_MAX _CONFIG_MQ_PRIO_MAX MQ_PRIO_MAX
168 _SC_RTSIG_MAX _CONFIG_RTSIG_MAX RTSIG_MAX
169 _SC_SEM_NSEMS_MAX _CONFIG_SEM_NSEMS_MAX SEM_NSEMS_MAX
170 _SC_SEM_VALUE_MAX _CONFIG_SEM_VALUE_MAX SEM_VALUE_MAX
171 _SC_SIGQUEUE_MAX _CONFIG_SIGQUEUE_MAX SIGQUEUE_MAX
172 _SC_SIGRT_MAX _CONFIG_SIGRT_MAX
173 _SC_SIGRT_MIN _CONFIG_SIGRT_MIN
174 _SC_TIMER_MAX _CONFIG_TIMER_MAX TIMER_MAX
175 _SC_PHYS_PAGES _CONFIG_PHYS_PAGES __get_phys_pages
176 _SC_AVPHYS_PAGES _CONFIG_AVPHYS_PAGES __get_avphys_pages
177 _SC_COHER_BLKSZ _CONFIG_COHERENCY
178 _SC_SPLIT_CACHE _CONFIG_SPLIT_CACHE
179 _SC_ICACHE_SZ _CONFIG_ICACHESZ
180 _SC_DCACHE_SZ _CONFIG_DCACHESZ
181 _SC_ICACHE_LINESZ _CONFIG_ICACHELINESZ
182 _SC_DCACHE_LINESZ _CONFIG_DCACHELINESZ
183 _SC_ICACHE_BLKSZ _CONFIG_ICACHEBLKSZ
184 _SC_DCACHE_BLKSZ _CONFIG_DCACHEBLKSZ
185 _SC_DCACHE_TBLKSZ _CONFIG_DCACHETBLKSZ
186 _SC_ICACHE_ASSOC _CONFIG_ICACHE_ASSOC
187 _SC_DCACHE_ASSOC _CONFIG_DCACHE_ASSOC
188 _SC_MAXPID _CONFIG_MAXPID
189 _SC_CPUID_MAX _CONFIG_CPUID_MAX
190 _SC_EPHID_MAX _CONFIG_EPHID_MAX
191 _SC_SYMLOOP_MAX _CONFIG_SYMLOOP_MAX SYMLOOP_MAX