Commit graph

19 commits

Author SHA1 Message Date
Lionel Sambuc
d3d33afe9f Experimental pthread compatibility library
This patch adds pthread compatibility by using libmthread.

To use this with a program using pthreads, you have to replace
  #include <pthread>
with
  #define _MTHREADIFY_PTHREADS
  #include <minix/mthreads>

This also changes the initialization function to be a constructor, which
is implicitly called before the call to main. This allows for
conformance with pthreads, while not paying a high price by checking on
each mthread_* call whether the library has been initialized or not.

As mthread_init is now a constructor, it also has been set as static, and
relevent calls removed from programs using it.

Change-Id: I2aa375db557958d2bee9a70d285aabb990c88f00
2014-07-28 17:05:08 +02:00
Lionel Sambuc
84d9c625bf Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC)
- Fix for possible unset uid/gid in toproto
 - Fix for default mtree style
 - Update libelf
 - Importing libexecinfo
 - Resynchronize GCC, mpc, gmp, mpfr
 - build.sh: Replace params with show-params.
     This has been done as the make target has been renamed in the same
     way, while a new target named params has been added. This new
     target generates a file containing all the parameters, instead of
     printing it on the console.
 - Update test48 with new etc/services (Fix by Ben Gras <ben@minix3.org)
     get getservbyport() out of the inner loop

Change-Id: Ie6ad5226fa2621ff9f0dee8782ea48f9443d2091
2014-07-28 17:05:06 +02:00
Ben Gras
dda632a24f drop the minix_ prefixes for mmap and munmap
also cleanup of various minix-specific changes, cleanup of
mmap-related testing.

Change-Id: I289a4fc50cf8a13df4a6082038d860853a4bd024
2014-03-03 20:47:03 +01:00
Arun Thomas
fd43d93ce5 ARM support for system libraries 2012-08-28 13:49:27 -04:00
Arun Thomas
6723dcfab7 Replace MACHINE/CHIP macros with compiler macros 2012-08-06 17:49:22 +02:00
Ben Gras
c0ef4c4956 mthread: mmap returns MAP_FAILED on error 2012-05-31 00:54:11 +02:00
Thomas Veerman
76092ddf33 libmthread: don't always verify library initialization
This can be turned back on when the library is compiled with
-DMTHREAD_STRICT (which enables more sanity checks). However,
always performing this check shows up in system profiling results.
2012-05-01 09:55:06 +00:00
Ben Gras
7336a67dfe retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
Ben Gras
6a73e85ad1 retire _PROTOTYPE
. only good for obsolete K&R support
	. also remove a stray ansi.h and the proto cmd
2012-03-25 16:17:10 +02:00
Thomas Veerman
bba63ef665 libmthread: fix typo in comments 2012-02-13 13:50:32 +00:00
Thomas Veerman
accaae9b2c libmthread: add guard pages to stacks
Add guard pages to the top of the stack to catch overflow errors.
Moreover, fix a bug where libmthread would keep using a stack that was
just deallocated; a detached thread would deallocate its own stack after
it was finished running).
2012-02-13 13:50:31 +00:00
Thomas Veerman
0949f5b342 libmthread: don't free() user allocated stack space 2012-02-13 13:50:13 +00:00
Thomas Veerman
9b43de2cb3 Clean up mthread 2011-07-27 09:30:26 +00:00
David van Moolenbroek
020277a38f libmthread: support for thread-local storage (keys/specifics) 2011-04-14 11:54:43 +00:00
Thomas Veerman
b1a60476c0 Return errors directly instead of using errno 2011-04-13 14:01:13 +00:00
Thomas Veerman
c8d0edc06a - Refactor mthread structure fields to prevent name clashes
- Remove sanity checks for initialized mutexes and condition variables. This
  significantly boosts performance. The checks can be turned back on by
  compiling libmthread with MTHREAD_STRICT. According to POSIX operations on
  uninitialized variables are a MAY fail if, therefore allowing this
  optimization.
- Test59 has to be accommodated to the lack of sanity checks on uninitialized
  variables in the library. It specifically tests for them and will run into
  segfaults when the checks are absent in the library.
- Fix a few bugs related to the scheduler
- Do some general code cleanups
2011-03-18 10:29:54 +00:00
Erik van der Kouwe
591201c1a0 Fix warnings in libmthread 2010-10-04 20:19:40 +00:00
Thomas Veerman
a7072a5e1c Revamp the mthread library and update test59
Before, the 'main thread' of a process was never taken into account anywhere in
the library, causing mutexes not to work properly (and consequently, neither
did the condition variables). For example, if the 'main thread' (that is, the
thread which is started at the beginning of a process; not a spawned thread by
the library) would lock a mutex, it wasn't actually locked.
2010-09-30 13:44:13 +00:00
Thomas Veerman
12e167f672 Add libmthread and test59 to test the implementation 2010-09-21 12:22:38 +00:00