Commit Graph

97 Commits

Author SHA1 Message Date
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
Alexander Langer
c20d2ab74b You need options USER_LDT in your kernel to use these functions.
PR:		18943
Submitted by:	Ben Smithurst <ben@scientia.demon.co.uk>
Reviewed by:	asmodai
2000-06-14 13:38:21 +00:00
Alexey Zelkin
03fc63031e Use `Er' variable to define first column width in ERRORS section. 2000-05-06 12:07:59 +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
Alexey Zelkin
25bb73e063 Introduce ".Lb" macro to libc manpages.
More libraries manpages updates following.
2000-04-21 09:42:15 +00:00
Jason Evans
b479399f73 Take care to avoid having "strong" and "weak" symbols of the same name in
libc_r.
2000-03-16 02:14:41 +00:00
Jason Evans
e9a89b2196 Undo the ill-conceived breakage of the previous commit and really fix:
For libc_r renamed syscalls, correct symbol naming from
_thread_sys_foo() <-- _foo() to _thread_sys_foo() <-- _foo() <-- foo().  This
is necessary for system calls which libc_r doesn't define foo().

Some weak symbols such as poll() are defined twice.  From what I understand,
depending on one weak symbol or the other to be used is a bad idea.  All
such weak symbols defined in the libc_r-specific code should therefore be
made strong (non-weak?).

Simplify PSEUDO() to not define any weak symbols, since they aren't ever
needed.

alpha/SYS.h:

Correct reversed usage of WEAK_ALIAS(), which has reversed arguments from
__weak_reference().  Also, fix reversal of symbols, so that syscall foo()
is a weak alias for _foo().

Add WEAK_ALIAS() call to PRSYSCALL(), which unlike the i386 version of
PRSYSCALL(), is not defined in terms of PSYSCALL().

Make PSEUDO() equivalent to the i386 version.
2000-01-29 12:50:47 +00:00
Jason Evans
cabdf9cef3 For syscalls that are renamed to _thread_sys_foo, create a weak alias
called _foo, not _thread_sys_foo.
2000-01-28 22:47:21 +00:00
Jason Evans
9233c4d942 Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo().  In the case of a libpthread that doesn't do
call conversion (such as linuxthreads and our upcoming libpthread), this
is adequate.  In the case of libc_r, we still need three names, which are
now _thread_sys_foo() <-- _foo() <-- foo().

Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(),
nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo().

Remove all internal libc usage of: creat(), pause(), sleep(), system(),
tcdrain(), wait(), and waitpid().

Make thread cancellation fully POSIX-compliant.

Suggested by:	deischen
2000-01-27 23:07:25 +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
ed25321907 Move ENTRY and ALTENTRY definitions to asm.h where they belong.
Unbreak profiling.  Again.

Submitted by:	bde
2000-01-20 03:15:01 +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
7023c66887 Remove osig* from NOASM. It bogus now. 1999-10-14 10:00:39 +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
0cec71466c Remove syscall wrappers. 1999-10-09 15:27:09 +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
Luoqi Chen
018949c4ac Use definitions provided in sysarch.h for args structures.
Reviewed by:	marcel
1999-09-02 21:03:32 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Dmitrij Tejblum
1b30ac5124 Add wrappers for pread and pwrite syscalls. 1999-04-04 21:46:24 +00:00
Alexander Langer
ee28fadec0 EACESS -> EACCES 1999-03-15 00:14:57 +00:00
Julian Elischer
6626c6045c Reviewed by: Luoqi Chen, Jordan Hubbard
Submitted by:	 "Richard Seaman, Jr." <lists@tar.com>
Obtained from:	linux :-)

Code to allow Linux Threads to run under FreeBSD.

By default not enabled
This code is dependent on the conditional
COMPAT_LINUX_THREADS (suggested by Garret)
This is not yet a 'real' option but will be within some number of hours.
1998-12-19 02:55:34 +00:00
Luoqi Chen
ae45749a50 Simplify implementation and eliminate a register preservation problem.
Reviewed by:	Bruce Evans <bde@zeta.org.au>
1998-09-18 05:50:52 +00:00
Luoqi Chen
02bc6ef2c8 Fix a cut 'n paste mistake. 1998-09-13 20:32:45 +00:00
Dmitrij Tejblum
deb9688ae1 In libc_r, rename vfork syscall to _thread_sys_vfork and make vfork an alias
to fork. It is difficult to do real vfork in libc_r, since almost every
operation with file descriptsor changes _thread_fd_table and friends.

popen(3) works much better with this change.
1998-09-12 22:03:20 +00:00
Bruce Evans
71101898e8 Fixed missing header in synopsis. 1998-08-03 16:29:31 +00:00
Bruce Evans
5b632b56e5 Fixed disordering in previous commit. 1998-07-29 13:43:06 +00:00
Jonathan Lemon
525187f914 u_int --> unsigned int, remove (now unneeded) <sys/types.h> 1998-07-28 15:22:51 +00:00
Jonathan Lemon
8d0517cffd oops, forgot to do ``cvs add'' first. 1998-07-28 03:39:04 +00:00
Jonathan Lemon
f88a03565a Add wrappers for i386_*_ioperm, i386_vm86 so userland code does
not have to call sysarch() directly.
Added man pages for above, as well as sysarch()
1998-07-28 03:33:27 +00:00
Steve Price
32c2131395 Fix a bunch of spelling errors.
PR:		6856
Submitted by:	Josh Gilliam <josh@quick.net>
1998-06-04 21:06:07 +00:00
John Birrell
b2dd537249 Use the thread-aware errno definition all the time. 1998-05-05 22:07:02 +00:00
John Birrell
75831c5b8f Build the syscalls (in libc, not libc_r) with weak symbols so that
libpthread can override them as required.
1998-05-05 22:06:16 +00:00
John Birrell
9b7c9bc4f8 Oops, backout the previous change having confused my underscores.
__thread_create is a syscall that uses the default asm. It is
_thread_create that contains specific asm code, but that lives in
libpthread.
1998-04-30 10:02:44 +00:00
John Birrell
3fece7a1aa Make cerror thread aware by calling __error() to get a pointer to the
thread-specific error variable. This change make libc use the same cerror
code that libc_r has been using.
1998-04-30 09:32:48 +00:00
John Birrell
68f87034f2 The syscall that creates a kernel thread is coming, but it doesn't use the
default syscall asm, so add it to NOASM. The other syscalls that manipulate
kernel threads use the default asm code, so they just get built
automatically.
1998-04-30 09:30:50 +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
John Birrell
0db2fac06a Nearly missed this one.
List non-default asm sources in MDASM so that they replace the defaults.

For funny or incomplete syscalls, list them in NOASM to stop them
from getting built as defaults.
1998-03-09 07:36:56 +00:00
Bruce Evans
7280dd1a3b Removed unused file. It just forces a return value of 0 on success
(no carry), but mount() in the kernel has returned 0 on success since
prehistoric times.
1997-10-18 13:59:48 +00:00
Bruce Evans
a461908da4 Handle machine-dependent (stdlib) sources more automatically.
This fixes bugs in the manual handling.  abs.[cS] was handled too
specially and the wrong (.c) variant for each of div.[cS], labs.[cS]
and ldiv.[cS] was added to SRCS.  This caused the .c variant to be
used if `depend' was made and the .S version to be used otherwise.
1997-10-16 14:58:30 +00:00
Bruce Evans
1cbbb1ba4b Removed bogus .PATH statement. 1997-10-16 14:41:25 +00:00
Bruce Evans
da16ae8684 Removed the subdirectory paths from the definitions of MAN[1-9]. They
were a workaround for limitations in bsd.man.mk that were fixed about
2 years ago.
1997-10-16 14:26:13 +00:00
Bruce Evans
ae80efa54f Handle machine-dependent (m-d) (string) sources more automatically.
The names of m-d variants are now added (manually) to MDSRCS instead
of to SRCS, and the names of all machine-independent (m-i) variants
that can reasonably be replaced by an m-d variant are now added
(manually) to MISRCS instead of to SRCS, so that a simple substitution
can be used to discard the unused m-i variants.  MISRCS is potentially
all m-i sources, but the substitution is too simple to be fast, so
MISRCS should be kept reasonably small.

libc/Makefile.inc:
Do the substitution.

libc/i386/string/Makefile.inc:
Add to MDSRCS instead of to SRCS.  Add the names of all sources in this
directory, but no others.

libc/string/Makefile.inc
Add to MISRCS instead of to SRCS.  Add the names of all sources in this
directory.  Don't use (broken) explicit rules for special cases.
1997-10-16 13:46:50 +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