Commit Graph

40 Commits

Author SHA1 Message Date
Daniel Eischen
d201fe46e3 Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread
functions.  If the threads library is linked in, the real
pthread functions will pulled in.

Use the following convention for system calls wrapped by the
threads library:
	__sys_foo - actual system call
	_foo - weak definition to __sys_foo
	foo - weak definition to __sys_foo

Change all libc uses of system calls wrapped by the threads
library from foo to _foo.  In order to define the prototypes
for _foo(), we introduce namespace.h and un-namespace.h
(suggested by bde).  All files that need to reference these
system calls, should include namespace.h before any standard
includes, then include un-namespace.h after the standard
includes and before any local includes.  <db.h> is an exception
and shouldn't be included in between namespace.h and
un-namespace.h  namespace.h will define foo to _foo, and
un-namespace.h will undefine foo.

Try to eliminate some of the recursive calls to MT-safe
functions in libc/stdio in preparation for adding a mutex
to FILE.  We have recursive mutexes, but would like to avoid
using them if possible.

Remove uneeded includes of <errno.h> from a few files.

Add $FreeBSD$ to a few files in order to pass commitprep.

Approved by:	-arch
2001-01-24 13:01:12 +00:00
John Baldwin
9a51cfcde1 Prefix the register argument of indirect 'jmp's with a * to make gas 2.10.x
happy.
2000-11-28 22:59:14 +00:00
Peter Wemm
ea3d353444 Fix some rather interesting bugs that managed to not turn up in various
testing and real-life applications:
1) If you returned from the thread function, you got a segv instead of
  calling _exit() with your return code.
2) clean up some bogus stack management.  There was also an underflow
  on function return.
3) when making syscalls, the kernel is expecting to have to leave space
  for the function's return address.  We need to duplicate this.  It was
  an accident that the rfork syscall actually worked here. :-/
2000-07-29 11:34:01 +00:00
Peter Wemm
c932e5d18f rfork(2) wrapper for simple rfork-style threads. I have lost count of
the number of times I have given this to people and got asked: why isn't
it in libc?  It is impossible to do this without assembler glue to reset
the stack for the new child process.

int rfork_thread(flags, stack_addr, start_fnc, start_arg)
int flags;                 Flags to rfork system call.  See rfork(2).
void *stack_addr;          Top of stack for thread.
int (*start_fnc)(void *);  Address of thread function to call in child.
void *start_arg;           Argument to pass to the thread function in child.

This is deliberately not documented or prototyped in includes until the
corresponding alpha version is written.
2000-07-29 07:14:04 +00:00
Jason Evans
9976e59211 Use assembler directives rather than ALTENTRY() so that longjmp() and
siglongjmp() are weak symbols.  This is necessary to allow static linking
with the linuxthreads library port.
2000-05-04 04:36:26 +00:00
Jason Evans
bafd6b2f76 Remove unnecessary alternate entry points for *setjmp(). Make the main
entry point the standard name when not compiling libc_r (for example,
longjmp is the main entry point instead of __longjmp).

Suggested by:	bde
2000-01-20 21:58:27 +00:00
Jason Evans
1c12990b99 Make minor entry point changes to support libc_r. 2000-01-19 07:01:40 +00:00
Jason Evans
929273386f Add three-tier symbol naming in support of POSIX thread cancellation
points.  For library functions, the pattern is __sleep() <--
_libc_sleep() <-- sleep().  The arrows represent weak aliases.  For
system calls, the pattern is _read() <-- _libc_read() <-- read().
2000-01-12 09:23:48 +00:00
Jason Evans
0105d67807 Unbreak profiling. bde says this is not the cleanest way to fix the
problem, but that it works.

Submitted by:	bde
2000-01-04 00:02:21 +00:00
Jason Evans
ec9d5fa5f8 Creating weak symbols doesn't work correctly when building an aout libc.
Doing the "right thing" here is difficult, so create two ENTRY points for
each function (for example, __setjmp and setjmp are equivalent).  This
isn't pretty, but it works for both aout and ELF.

libc symbol naming needs an overhaul in order to properly support function
wrapping, specifically in the case of a real libpthread, and these
duplicate entry points should be fixed as part of that overhaul.

Pointed out by:	bde
1999-12-24 00:03:00 +00:00
Jason Evans
ea8271a8bb Make setjmp, longjmp, sigsetjmp, and siglongjmp weak aliases for
__setjmp, __longjmp, __sigsetjmp, and __siglongjmp, respectively.
This supports cancellation in the linuxthreads port.  In the long run,
a much more comprehensive solution will necessitate more dramatic changes
to libc symbol naming, and these aliases will probably need modification
at that time.
1999-12-14 20:17:52 +00:00
Marcel Moolenaar
23cd96d8ce \begin{quote}
setjmp() gets the jmp_buf pointer from the wrong place (the place
where the return address is) in the shlib case, and uses it (only)
to fetch the current signal mask to address (return_address + 28).
This address is normally read-only (I hope), so the sigprocmask()
call has no effect except to return an error code.
\end{quote}

Submitted by: bde
1999-10-10 08:38:33 +00:00
Marcel Moolenaar
3cf3c5d9dd sigset_t change (part 5 of 5)
-----------------------------

Most of the userland changes are in libc. For both the alpha
and the i386 setjmp has been changed to accomodate for the
new sigset_t. Internally, libc is mostly rewritten to use the
new syscalls. The exception is in compat-43/sigcompat.c

The POSIX thread library has also been rewritten to use the
new sigset_t. Except, that it currently only handles NSIG
signals instead of the maximum _SIG_MAXSIG. This should not
be a problem because current applications don't use any
signals higher than NSIG.

There are version bumps for the following libraries:
  libdialog
  libreadline
  libc
  libc_r
  libedit
  libftpio
  libss

These libraries either a) have one of the modified structures
visible in the interface, or b) use sigset_t internally and
may cause breakage if new binaries are used against libraries
that don't have the sigset_t change. This not an immediate
issue, but will be as soon as applications start using the
new range to its fullest.

NOTE: libncurses already had an version bump and has not been
      given one now.

NOTE: doscmd is a real casualty and has been disconnected for
      the moment. Reconnection will eventually happen after
      doscmd has been fixed. I'm aware that being the last one
      to touch it, I'm automaticly promoted to being maintainer.
      According to good taste this means that I will receive a
      badge which either will be glued or mechanically stapled,
      drilled or otherwise violently forced onto me :-)

NOTE: pcvt/vttest cannot be compiled with -traditional. The
      change cause sys/types to be included along the way which
      contains the const and volatile modifiers. I don't consider
      this a solution, but more a workaround.
1999-09-29 15:18:46 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
John Birrell
5178bcd1cf Stop renaming these in libc_r because wrappered versions don't make sense.
PR: i386/4826, bin/5953
1998-04-29 09:14:35 +00:00
Bruce Evans
b2fad8ae7a Moved `SRCS+= frexp.c' to the correct Makefile.inc.
Sorted SRCS.
1997-10-14 07:43:33 +00:00
Peter Wemm
65b3003d2d kill the undead 1997-07-13 14:26:00 +00:00
Bruce Evans
362c392f0b This commit was generated by cvs2svn to compensate for changes in r27180,
which included commits to RCS files with non-trunk default branches.
1997-07-03 03:28:27 +00:00
Bruce Evans
5500fdcd4f Import Lite2's src/lib, except for non-i386 machine-dependent directories,
libc/db, libc/gen/crypt.* and libtelnet.  All affected files except 3
unimportant ones have already left the vendor branch.
1997-07-03 03:28:27 +00:00
Peter Wemm
662909a780 Import CSRG 4.4BSD-Lite2 lib/libc onto vendor branch 1997-03-11 11:29:42 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Jordan K. Hubbard
51295a4d3e General -Wall warning cleanup, part I.
Submitted-By: Kent Vander Velden <graphix@iastate.edu>
1996-07-12 18:57:58 +00:00
John Polstra
cbdc4399d2 Fix a bug caused by the collision of a local assembler label with another
use of the same label in a recently-introduced PIC_PROLOGUE.  This
should solve the recent core dumps from pdksh.
1996-05-11 13:28:11 +00:00
Peter Wemm
f1703dfbaa Add support to enable libc to be compiled in ELF format. (#ifdef __ELF__)
In a nutshell, this macroizes the local/global symbol scoping rules
that are different in a.out and ELF.  It also makes the i386 assembler
stubs conform to i386 PIC calling conventions - the a.out ld.so didn't
object, but the ELF one needs it as it implements PIC jumps via PLT's as
well as calls.  The a.out rtld only worked because it was accidently
snooping the grandparent calling function's return address off the stack..

This also affects the libc_r code a little, because of cpp macro nesting.
1996-05-05 07:56:21 +00:00
Peter Wemm
13295c7f99 Put in missing '_' in call to wrapper _thread_sys_sigsetmask() function. 1996-02-17 12:25:21 +00:00
Julian Elischer
f70177e76e Reviewed by: julian and (hsu?)
Submitted by:	 John Birrel(L?)

changes for threadsafe operations
1996-01-22 00:02:33 +00:00
Peter Wemm
6065a0be11 This commit was generated by cvs2svn to compensate for changes in r13122,
which included commits to RCS files with non-trunk default branches.
1995-12-30 19:02:48 +00:00
Peter Wemm
a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Poul-Henning Kamp
fcce81cde3 remove GCC support functions from libc.
Should never have been here in the first place.
1995-10-05 10:24:57 +00:00
David Greenman
717d9cdd57 First round of changes to clean up the RCSID mess in libc:
1) Changed LIB_SCCS and SYSLIB_SCCS to LIB_RCS and SYSLIB_RCS.
2) Changed sccsid[] variables to rcsid[]
3) Moved all RCSID strings into .text
4) Converted all SCCSID's to RCS $Id$'s
5) Added missing $Id$'s after copyright.
1995-01-23 01:30:24 +00:00
Bruce Evans
75b6d64b84 fixunsdfsi.S:
Embalm.  Rewrite to do things much the same as gcc-2: use fistpq for speed
and elegance, and mishandle overflow consistently.  __fixunsdfsi() is no
longer called by gcc.
1994-12-27 13:37:38 +00:00
Bruce Evans
08747772a2 sigsetjmp.S:
Remove unnecessary .text statement.
1994-12-27 13:34:04 +00:00
Bruce Evans
1fe9751525 Remove unnecessary .align statement. 1994-12-27 13:33:03 +00:00
Bruce Evans
1a4206dd85 Reenable sigsetjmp.S. Preserve the FP state. Rearrange offsets
to match setjmp.S.
1994-10-25 14:08:13 +00:00
Jordan K. Hubbard
2494a00b49 This is weird. I *added this*, but it went away again! Ummm.. Mumble.
I'm confused..
Submitted by:	jkh
1994-08-22 09:19:50 +00:00
Jordan K. Hubbard
11841a6877 Put __infinity back here again until someone does the right thing and
repartitions libc into something human again.  I don't have that kind of
time right now myself, unfortunately.
Submitted by:	jkh
1994-08-20 20:16:57 +00:00
Garrett Wollman
2ceb2ce9ee First crack at making libc work with the new make macros. It compiles on
my machine, and a simple static (genassym) and shared (sysctl) executable
both work.  Still to be done: RPCand YP merge.
1994-08-05 01:19:12 +00:00
Rodney W. Grimes
8e101982f3 Pull in GNU2 fix for this from FreeBSD, allows ldexp.c to compile with
gcc2.x
1994-05-27 11:00:56 +00:00
Rodney W. Grimes
58f0484fa2 BSD 4.4 Lite Lib Sources 1994-05-27 05:00:24 +00:00