freebsd-skq/sys/sys
David Xu 9b0f1823b5 Use umtx to implement process sharable semaphore, to make this work,
now type sema_t is a structure which can be put in a shared memory area,
and multiple processes can operate it concurrently.
User can either use mmap(MAP_SHARED) + sem_init(pshared=1) or use sem_open()
to initialize a shared semaphore.
Named semaphore uses file system and is located in /tmp directory, and its
file name is prefixed with 'SEMD', so now it is chroot or jail friendly.
In simplist cases, both for named and un-named semaphore, userland code
does not have to enter kernel to reduce/increase semaphore's count.
The semaphore is designed to be crash-safe, it means even if an application
is crashed in the middle of operating semaphore, the semaphore state is
still safely recovered by later use, there is no waiter counter maintained
by userland code.
The main semaphore code is in libc and libthr only has some necessary stubs,
this makes it possible that a non-threaded application can use semaphore
without linking to thread library.
Old semaphore implementation is kept libc to maintain binary compatibility.
The kernel ksem API is no longer used in the new implemenation.

Discussed on: threads@
2010-01-05 02:37:59 +00:00
..
_bus_dma.h
_iovec.h
_lock.h - Embed the recursion counter for any locking primitive directly in the 2008-05-15 20:10:06 +00:00
_lockmgr.h In current code, threads performing an interruptible sleep (on both 2009-12-12 21:31:07 +00:00
_mutex.h - Embed the recursion counter for any locking primitive directly in the 2008-05-15 20:10:06 +00:00
_null.h *sigh*, while the kernel built, userland C did not. Revert the previous 2009-05-11 21:13:00 +00:00
_pthreadtypes.h Fix the visibility of several prototypes. Also move pthread_kill() and 2009-03-14 20:10:14 +00:00
_rmlock.h Initial checkin for rmlock (read mostly lock) a multi reader single writer 2007-11-08 14:47:55 +00:00
_rwlock.h - Embed the recursion counter for any locking primitive directly in the 2008-05-15 20:10:06 +00:00
_semaphore.h Use umtx to implement process sharable semaphore, to make this work, 2010-01-05 02:37:59 +00:00
_sigset.h
_sockaddr_storage.h Move the duplicate definition of struct sockaddr_storage to its own 2009-09-08 10:39:38 +00:00
_stack.h Optimize lockmgr in order to get rid of the pool mutex interlock, of the 2008-04-06 20:08:51 +00:00
_sx.h - Embed the recursion counter for any locking primitive directly in the 2008-05-15 20:10:06 +00:00
_task.h revert changes accidentally included in last commit 2008-07-18 06:22:57 +00:00
_termios.h Decompose <sys/termios.h>. 2009-11-28 23:50:48 +00:00
_timespec.h
_timeval.h
_types.h Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessary 2008-10-28 13:44:11 +00:00
_umtx.h Add user-level semaphore synchronous type, this change allows multiple 2010-01-04 05:27:49 +00:00
aac_ioctl.h Add additional featuresState.fBits entries to simplify compiling and 2009-10-29 17:21:41 +00:00
acct.h Increase precision of time values in the process accounting 2007-05-22 06:51:38 +00:00
acl.h Cosmetic fixes. 2009-12-22 09:03:59 +00:00
agpio.h
aio.h Namespace: aio_waitcomplete() is a BSD extension. 2009-03-14 19:17:00 +00:00
alq.h
apm.h Add apple-boot and apple-ufs. 2009-12-14 22:47:09 +00:00
assym.h
ata.h Add BIO_DELETE support to ada(4): 2009-12-28 20:08:01 +00:00
bio.h only export bio_cmd and flags to userland (bio_cmd are 2009-12-11 10:35:58 +00:00
bitstring.h
blist.h add malloc flag to blist so that it can be used in ithread context 2008-05-05 19:48:54 +00:00
buf_ring.h - add drbr routines for accessing #qentries and conditionally dequeueing 2009-06-09 19:19:16 +00:00
buf.h nfs_write() can use the recently introduced vfs_bio_set_valid() instead of 2009-05-31 20:18:02 +00:00
bufobj.h Remove the struct thread unuseful argument from bufobj interface. 2008-10-10 21:23:50 +00:00
bus_dma.h When bouncing pages, allow a new option to preserve the intra-page 2009-02-08 22:54:58 +00:00
bus.h For some buses, devices may have active resources assigned even though they 2009-12-09 21:52:53 +00:00
callout.h add callout_schedule; besides being useful it also improves 2008-08-02 17:42:38 +00:00
cdefs.h Revert my change; reintroduce __gnu89_inline. 2009-06-08 18:23:43 +00:00
cdio.h
cdrio.h
cfictl.h Add support for frobbing Intel StrataFlash Protection Registers: 2009-02-05 18:12:07 +00:00
chio.h
clock.h Now that all platforms use genclock, shuffle things around slightly 2008-04-22 19:38:30 +00:00
condvar.h - Pass the priority argument from *sleep() into sleepq and down into 2008-03-12 06:31:06 +00:00
conf.h Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
cons.h Allow multiple console devices per driver without insane code duplication. 2009-08-24 10:53:30 +00:00
consio.h
copyright.h Welcome to 2010. 2010-01-02 01:12:10 +00:00
cpu.h Provide a new CPU device driver ivar to report the nominal speed of the 2009-05-31 08:59:15 +00:00
cpuctl.h - Add support to atomically set/clear individual bits of a MSR register 2009-06-30 12:35:47 +00:00
cpuset.h - Add a new cpuset macro, CPU_FILL(), for setting the set to all 1s. 2009-06-23 06:57:46 +00:00
ctype.h
dataacq.h
device_port.h
devicestat.h
digiio.h
dir.h
dirent.h
disk.h Add two disk ioctls, giving user-level tools information about disk/array 2009-12-24 11:05:23 +00:00
disklabel.h Initial storage functionality for U-Boot support library. 2008-11-19 17:34:28 +00:00
diskmbr.h
diskpc98.h Move the PC98_[MS]ID_* defines from g_part_pc98.c to diskpc98.h. 2009-03-11 13:15:42 +00:00
dkstat.h
domain.h Introduce and use a sysinit-based initialization scheme for virtual 2009-07-23 20:46:49 +00:00
dtrace_bsd.h Add DTrace probes to the NFS access and attribute caches. Access cache 2009-03-24 17:14:34 +00:00
dvdio.h
elf32.h
elf64.h style(9) 2009-01-01 02:08:56 +00:00
elf_common.h Implement rtld part of the support for -z nodlopen (see ld(1)). 2009-11-26 13:57:20 +00:00
elf_generic.h style(9) 2009-01-01 02:08:56 +00:00
elf.h Remove _SOLARIS_C_SOURCE compatibility definitions. Unfortunately the 2007-11-28 21:54:46 +00:00
endian.h
errno.h Add a new errno, ENOTCAPABLE, to be returned when a process requests an 2009-10-07 20:20:51 +00:00
eui64.h
event.h The devices that supported EVFILT_NETDEV kqueue filters were removed in 2009-12-31 20:29:58 +00:00
eventhandler.h rev bpf attach/detach event api to include the dlt 2009-05-25 16:34:35 +00:00
eventvar.h
exec.h
extattr.h Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessary 2008-10-28 13:44:11 +00:00
fail.h fail(9) support: 2009-05-27 16:36:54 +00:00
fbio.h Fix VESA color palette corruption: 2009-11-03 20:22:09 +00:00
fcntl.h Add two new fcntls to enable/disable read-ahead: 2009-09-28 16:59:47 +00:00
fdcio.h
file.h Use ANSI declarations instead of K&R. 2009-12-28 23:12:55 +00:00
filedesc.h - Implement a lockless file descriptor lookup algorithm in 2009-05-14 03:24:22 +00:00
filio.h Add FIONSPACE from NetBSD. FIONSPACE is provided so that programs may 2009-06-30 13:38:49 +00:00
firmware.h
fnv_hash.h
gmon.h
gpt.h Add more Apple partition types. 2009-12-14 20:04:28 +00:00
hash.h
iconv.h Split tolower/toupper code from usual xlat16 kiconv table, and make it 2009-06-22 17:09:46 +00:00
imgact_aout.h kern_execve.c hasn't been around in ages, so update the file(s) where 2009-09-09 06:49:49 +00:00
imgact_elf.h Make sure FreeBSD binaries without .note.ABI-tag section work 2009-08-30 14:38:17 +00:00
imgact.h Supply AT_EXECPATH auxinfo entry to the interpreter, both for native and 2009-03-17 12:53:28 +00:00
inflate.h
interrupt.h - Fix several off-by-one errors when using MAXCOMLEN. The p_comm[] and 2009-10-23 15:14:54 +00:00
ioccom.h Protect _IOC's 'len' and 'inout' parameters so that _IOC can be used in 2008-08-28 18:29:59 +00:00
ioctl_compat.h Perform cleanups to the TTY headers: 2009-09-06 09:39:40 +00:00
ioctl.h Clean up <sys/ioctl.h>. 2009-05-09 19:01:24 +00:00
ipc.h Change the ABI of some of the structures used by the SYSV IPC API: 2009-06-24 21:10:52 +00:00
ipmi.h
jail.h Throughout the network stack we have a few places of 2009-12-13 13:57:32 +00:00
joystick.h
kbio.h Make the keyboard layer Unicode aware. 2009-09-19 17:56:26 +00:00
kdb.h DTrace can enter the debugger from a probe. Add a WHY definition for this. 2008-05-23 04:00:44 +00:00
kenv.h
kernel.h Random number generator initialization cleanup: 2009-10-20 16:36:51 +00:00
kerneldump.h PowerPC, meet kernel core dumps. The support is based 2009-04-04 02:12:37 +00:00
kobj.h KOBJMETHOD: throw the switch on kobj method signature checking 2009-06-12 09:05:23 +00:00
ksem.h Rework the lifetime management of the kernel implementation of POSIX 2008-06-27 05:39:04 +00:00
ksyms.h Add the ksyms(4) pseudo driver. The ksyms driver allows a process to 2009-05-26 21:39:09 +00:00
kthread.h kthread_exit needs no stinkin argument. 2007-10-26 17:03:22 +00:00
ktr.h In non-debugging mode make this define (void)0 instead of nothing. This 2009-06-21 09:01:12 +00:00
ktrace.h Style fix. 2009-10-23 15:10:41 +00:00
libkern.h This commit fixes the issue with alias_sctp.c. No 2009-02-14 11:34:57 +00:00
limits.h
link_aout.h
link_elf.h style(9) 2009-01-01 02:11:01 +00:00
linker_set.h
linker.h Implement a facility for dynamic per-cpu variables. 2009-06-23 22:42:39 +00:00
lock_profile.h In non-debugging mode make this define (void)0 instead of nothing. This 2009-06-21 09:01:12 +00:00
lock.h Add the address of the lock to the KTR_LOCK trace. 2009-08-14 10:57:57 +00:00
lockf.h The advisory lock may be activated or activated and removed during the 2009-05-24 12:39:38 +00:00
lockmgr.h Introduce support for adaptive spinning in lockmgr. 2009-06-17 01:55:42 +00:00
lockstat.h Add the OpenSolaris dtrace lockstat provider. The lockstat provider 2009-05-26 20:28:22 +00:00
mac.h
malloc.h Garbage collect now-unused struct malloc_type fields, bump __FreeBSD_version 2009-04-19 11:20:57 +00:00
mbpool.h
mbuf.h Add m_mbuftouio() helper function to copy(out) an arbitrary 2009-06-22 22:20:38 +00:00
mchain.h
md4.h
md5.h
mdioctl.h
memrange.h Initial suspend/resume support for amd64. 2009-03-17 00:48:11 +00:00
mman.h Add MAP_ANONYMOUS. 2009-11-06 07:17:31 +00:00
module.h - Invoke MOD_QUIESCE on all modules in a linker file (kld) before 2008-12-05 13:40:25 +00:00
mount.h Implement NFSv4 ACL support for UFS. 2009-12-21 19:39:10 +00:00
mouse.h
mpt_ioctl.h Add a new personality to mpt(4) devices to allow userland applications to 2008-05-06 20:49:53 +00:00
mqueue.h
msg.h Change the ABI of some of the structures used by the SYSV IPC API: 2009-06-24 21:10:52 +00:00
msgbuf.h Make /dev/klog and kern.msgbuf* MPSAFE. 2009-11-03 21:06:19 +00:00
mtio.h
mutex.h In non-debugging mode make this define (void)0 instead of nothing. This 2009-06-21 09:01:12 +00:00
namei.h Extend the cn_flags field of the struct componentname to 64 bits to have 2009-07-09 18:49:26 +00:00
nlist_aout.h
osd.h Introduce the extensible jail framework, using the same "name=value" 2009-04-29 21:14:15 +00:00
param.h Bump __FreeBSD_version for scandir(3) and alphasort(3) prototype changes. 2010-01-04 15:41:16 +00:00
pciio.h - Add a new ioctl to /dev/pci to fetch details on an individual BAR of a 2009-02-02 22:04:40 +00:00
pcpu.h Put minimum alignment on the dpcpu and vnet section so that ld 2009-08-12 10:26:03 +00:00
pioctl.h
pipe.h - Make maxpipekva a signed long rather than an unsigned long as overflow 2009-03-10 21:28:43 +00:00
pmc.h Log process mappings for existing processes at PMC start time. 2009-12-26 13:58:52 +00:00
pmckern.h Support sparsely numbered CPUs. 2008-09-22 10:37:02 +00:00
pmclog.h - Add support for PMCs in Intel CPUs of Family 6, model 0xE (Core Solo 2008-11-27 09:00:47 +00:00
poll.h
posix4.h
power.h
priority.h
priv.h Revert revision 199201 for now as it has introduced a kernel vulnerability 2009-11-12 19:02:10 +00:00
proc.h Let access overriding to TTYs depend on the cdev_priv, not the vnode. 2009-12-19 18:42:12 +00:00
procfs.h Widen psaddr_t from uintptr_t to uint64_t. This results in an 2008-09-14 16:52:42 +00:00
protosw.h Introduce an infrastructure for dismantling vnet instances. 2009-06-08 17:15:40 +00:00
ptio.h
ptrace.h
queue.h Rename the queue macros I introduced last year. 2009-05-27 19:28:04 +00:00
random.h
reboot.h
refcount.h Remove debugging cruft. 2008-07-23 16:44:20 +00:00
regression.h
resource.h Implement global and per-uid accounting of the anonymous memory. Add 2009-06-23 20:45:22 +00:00
resourcevar.h Implement global and per-uid accounting of the anonymous memory. Add 2009-06-23 20:45:22 +00:00
rman.h
rmlock.h Make the rmlock(9) interface a bit more like the rwlock(9) interface: 2009-05-29 10:52:37 +00:00
rtprio.h
runq.h - Restore runq to manipulating threads directly by putting runq links and 2008-03-20 05:51:16 +00:00
rwlock.h When releasing a read/shared lock we need to use a write memory barrier 2009-09-30 13:26:31 +00:00
sbuf.h Add sbuf_new_auto as a shortcut for the very common case of creating a 2008-08-09 11:14:05 +00:00
sched.h - Use DPCPU for SCHED_STATS. This is somewhat awkward because the 2009-06-25 01:33:51 +00:00
sdt.h Add SDT_PROBE[1-5] in the same way we have SDT_PROBE_DEFINE[1-5] to 2009-11-28 16:47:42 +00:00
select.h
selinfo.h Refactor select to reduce contention and hide internal implementation 2007-12-16 06:21:20 +00:00
sem.h Change the ABI of some of the structures used by the SYSV IPC API: 2009-06-24 21:10:52 +00:00
sema.h
serial.h
sf_buf.h
sglist.h Change the 'resid' parameter to sglist_consume_uio() from an int to a 2009-08-20 19:23:58 +00:00
shm.h Change the ABI of some of the structures used by the SYSV IPC API: 2009-06-24 21:10:52 +00:00
sigio.h
signal.h Implement sighold, sigignore, sigpause, sigrelse, sigset functions 2009-11-26 13:49:37 +00:00
signalvar.h Implement sighold, sigignore, sigpause, sigrelse, sigset functions 2009-11-26 13:49:37 +00:00
sleepqueue.h In current code, threads performing an interruptible sleep (on both 2009-12-12 21:31:07 +00:00
smp.h Remove forward_roundrobin(), it is unused for quite some time. 2009-09-21 13:09:56 +00:00
snoop.h
sockbuf.h Rework socket upcalls to close some races with setup/teardown of upcalls. 2009-06-01 21:17:03 +00:00
socket.h Get rid of the _NO_NAMESPACE_POLLUTION kludge by creating an 2009-09-08 20:45:40 +00:00
socketvar.h Fix poll(2) and select(2) for named pipes to return "ready for read" 2009-07-07 09:43:44 +00:00
sockio.h Revert revision 199201 for now as it has introduced a kernel vulnerability 2009-11-12 19:02:10 +00:00
sockopt.h Factor sockbuf, sockopt, and sockstate out of socketvar.h in to separate headers. 2008-07-29 07:45:05 +00:00
sockstate.h Factor sockbuf, sockopt, and sockstate out of socketvar.h in to separate headers. 2008-07-29 07:45:05 +00:00
soundcard.h Move machine dependant AFMT_* definition from sound.h 2009-06-10 03:56:24 +00:00
stack.h Add stack_print_short() and stack_print_short_ddb() interfaces to 2009-06-24 12:06:15 +00:00
stat.h Various namespace cleanups, including exposing fchmod() and fchmodat() 2009-03-14 19:11:08 +00:00
statvfs.h
stddef.h
stdint.h
sun_disklabel.h
sx.h When releasing a read/shared lock we need to use a write memory barrier 2009-09-30 13:26:31 +00:00
syscall.h Regenerate 2009-10-27 11:01:40 +00:00
syscall.mk Regenerate 2009-10-27 11:01:40 +00:00
syscallsubr.h Current pselect(3) is implemented in usermode and thus vulnerable to 2009-10-27 10:55:34 +00:00
sysctl.h Make it possible to change the vnet sysctl variables on jails 2009-08-13 10:26:34 +00:00
sysent.h Add 'sy_flags', a currently unused per-syscall entry flags field that will 2009-06-01 16:13:06 +00:00
syslimits.h Rework the credential code to support larger values of NGROUPS and 2009-06-19 17:10:35 +00:00
syslog.h Namespace: vsyslog() is a BSD extension. 2009-03-14 19:07:25 +00:00
sysproto.h Revert 200606. 2009-12-16 21:53:56 +00:00
systm.h Add a new sysctl for reporting all of the supported page sizes. 2009-09-18 17:04:57 +00:00
taskqueue.h Remove unused taskqueue_find() function. 2009-08-18 13:55:48 +00:00
termios.h Decompose <sys/termios.h>. 2009-11-28 23:50:48 +00:00
thr.h Add thr_kill2 syscall which sends a signal to a thread in another process. 2007-08-16 05:26:42 +00:00
tiio.h
time.h HZ is now 1000 on most platforms, update a comment. 2009-10-29 09:27:09 +00:00
timeb.h
timepps.h
timers.h
times.h
timespec.h
timetc.h
timex.h
tree.h In sys/tree.h: 2009-03-01 04:57:23 +00:00
tty.h Make TIOCSTI work again. 2010-01-04 20:59:52 +00:00
ttycom.h Perform cleanups to the TTY headers: 2009-09-06 09:39:40 +00:00
ttydefaults.h Reduce the default baud rate of PTY's to 9600. 2008-11-08 20:40:39 +00:00
ttydevsw.h Update d_mmap() to accept vm_ooffset_t and vm_memattr_t. 2009-12-29 21:51:28 +00:00
ttydisc.h Add ttydisc_rint_simple(). 2009-08-23 08:04:40 +00:00
ttyhook.h Change ttyhook_register() second argument from thread to process pointer. 2008-12-13 21:17:46 +00:00
ttyqueue.h Properly set the low watermarks when reducing the baud rate. 2009-10-19 07:17:37 +00:00
turnstile.h Commit 3/14 of sched_lock decomposition. 2007-06-04 23:51:44 +00:00
types.h Extend the device pager to support different memory attributes on different 2009-08-28 14:06:55 +00:00
ucontext.h
ucred.h Remove the interim vimage containers, struct vimage and struct procg, 2009-07-17 14:48:21 +00:00
uio.h Change the type of uio_resid member of struct uio from int to ssize_t. 2009-06-25 18:46:30 +00:00
umtx.h Add user-level semaphore synchronous type, this change allows multiple 2010-01-04 05:27:49 +00:00
un.h Now that portalfs doesn't directly invoke uipc_connect2(), make it a 2008-10-06 18:43:11 +00:00
unistd.h Add NFSv4 ACL support to libc. 2009-06-25 12:46:59 +00:00
unpcb.h Remove explicit locking of struct file. 2007-12-30 01:42:15 +00:00
user.h Revert the changes to struct kinfo_proc in r194498. Instead, fill 2009-07-24 15:03:10 +00:00
utsname.h
uuid.h
vmmeter.h Correct the description of v_cache_count. Eliminate an unused function. 2008-07-19 22:35:13 +00:00
vnode.h VI_OBJDIRTY vnode flag mirrors the state of OBJ_MIGHTBEDIRTY vm object 2009-12-21 12:29:38 +00:00
vtoc.h Add __packed to the part sub-structure to compensate for 2008-12-14 23:12:36 +00:00
wait.h Implement WNOWAIT flag for wait4(2). It specifies that process whose status 2008-08-26 12:37:16 +00:00
watchdog.h