Commit graph

32 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 5cecdfcb3e <machine/mcontext.h>
Change-Id: I2ad64018f3f402e7ccc5c4dc037dd0a3fe56a929
2014-03-03 20:47:03 +01:00
Ben Gras 17587738d3 align <sys/ucontext.h> <sys/uio.h> <sys/un.h>
Change-Id: I70adf01fddf931a3a6931083adaa4bbe647ea6a3
2014-03-03 20:47:03 +01: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
David van Moolenbroek 2af99c141d libmthread: do not dump stack for free threads
Change-Id: Ic438a252f5bddaf1513f554c71173e6fffb0c674
2014-02-18 11:25:03 +01:00
Ben Gras c8f3b10909 fix a few more minix specific warnings
. also disable stack protection feature for gcc,
	  causes build errors for pkgsrc gcc on minix

Change-Id: I1c6e2bcb4d948098d642543d7b2711284ee55c72
2013-08-27 16:16:03 +00:00
Ben Gras 6e5a113837 a bit more -Werror compatability
for clang, fix warnings in drivers/, lib/, servers/, sys/, common/.
by turning off fatal warnings (takes effect if the default is on),
fixing warnings or reducing the warning level.

Change-Id: Ia1b4bc877c879ba783158081b59aa6ebb021a50f
2013-08-20 11:37:40 +02:00
Lionel Sambuc fbd82e76a4 Let the build system manage compilation flags
Do not hardcode warning and optimisation flags, otherwise the
main options (i.e. DBG, CPPFLAGS) will not work as expected.

You can still provide specific default by using DBG?=<value>.

Doing so leaves the opportunity to override the setting from the
commandline, while the default value from the build system is
then ignored for that particular package.

When crosscompiling, and using build.sh, adding -V DBG=<value> has
this same effect as make DBG=<value>.

Change-Id: Ic610e4d33b945acad64571e1431f1814291e2d84
2013-03-08 09:41:49 +01:00
Lionel Sambuc 8e4736f2df Removing obsolete _MINIX define
Change-Id: Id33ac7e973d1c0e249b690fe44a597474fac6076
2013-02-26 09:44:20 +00:00
Thomas Veerman 93103f497f libmthread: add possibility to randomize scheduler 2013-01-11 09:18:35 +00:00
Lionel Sambuc e415d48872 Libc update to simplify merge.
Bumping libc files for unsupported architectures, to simplify merging.
A bunch of small fixes:
 * in libutil update
 * the macro in endian.h
 * some undefined types due to clear separation from host.
 * Fix a warning for cdbr.c

Some modification which were required for the new build system:
 * inclusion path for const.h in sconst, still hacky
 * Removed default malloc.c which conflicts on some occasions.
2012-11-15 16:07:29 +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
Thomas Veerman 8ae9987dca libmthread: add stack traces 2012-04-13 12:54:02 +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
Raja Appuswamy f9d1614e6d libmthread: add mthread_event_fire_all 2011-12-01 14:53:20 +01:00
Raja Appuswamy 03a8d06668 adding rwlock and event support to mthread 2011-11-29 14:35:22 +01:00
Thomas Veerman 9b43de2cb3 Clean up mthread 2011-07-27 09:30:26 +00:00
Thomas Veerman b61266eb51 Fix compiler warnings and mutex deadlock 2011-07-08 13:59:07 +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