Commit Graph

7863 Commits

Author SHA1 Message Date
Alexander Kabaev
48b9d042a8 The caller is expected to set up PIC register corectly before
jumping to .cerror. This means .cerror has to be present in the
same module with its consumers, or bad things will happen.
2003-09-05 18:08:19 +00:00
Peter Pentchev
8f4b894fbc Clarify that the second argument to accept() may be a null pointer if
no peer address information is desired.

PR:		56044
Submitted by:	Felix Opatz <felix@zotteljedi.de> and
		Bernd Luevelsmeyer <bdluevel@heitec.net>
MFC after:	1 month
2003-09-05 15:41:52 +00:00
Tim J. Robbins
4ae3aa59ef Remove an unused and incorrect prototype for _none_init(). 2003-09-05 09:01:31 +00:00
Simon L. B. Nielsen
4bbf46d65c Move a sentence about the terminating \0 from the RETURN VALUES section
(where it didn't really belong), to the DESCRIPTION section.

English advice:	ceri
Requested by:	das
MFC after:	4 weeks
2003-09-04 20:36:54 +00:00
David Xu
2ab83179b5 Add code to support barrier synchronous object and implement
pthread_mutex_timedlock().

Reviewed by: deischen
2003-09-04 14:06:43 +00:00
David Xu
cfd2782976 Remove repeated macro THR_IN_CONDQ. 2003-09-04 07:46:26 +00:00
David Xu
0318c367fc Allow hooks registered by atexit() to run with current thread pointer set,
without this change, my atexit test dumps core.
2003-09-04 05:24:53 +00:00
Peter Wemm
eda60a1613 Sigh. I can't win anything. Use addq rather than addl with %rsp. 2003-09-04 00:31:45 +00:00
Peter Wemm
294b146f2a Apply same basic fix for getcontext(2) as for i386. Store the return
value for getcontext() in a preserved register rather than on the stack.
The second time around, the stack value would likely have changed so we
can't depend on it for the return value.
2003-09-04 00:29:12 +00:00
Peter Wemm
c95f58c2f1 Fix some minor whitespace botches 2003-09-04 00:26:40 +00:00
Peter Wemm
6046bc37e8 Make getcontext(2) work on i386. It needs a small wrapper in libc
otherwise the return from the syscall stub for getcontext will pop off
the return value for the caller to the getcontext stub and it will appear
as though the setcontext() syscall returned instead of the getcontext().
The same bug exists on amd64, a fix is coming there too.

The bug can be demonstrated with this test code fragment:
main()
{
        ucontext_t top;

        if (getcontext(&top) == 0) {
                write(2, "PING!\n", 6);
                /* Cause a return value of 1 from getcontext this time */
                top.uc_mcontext.mc_eax = 1;
                setcontext(&top);
                err(1, "setcontext() returned");
        }
        write(2, "PONG!\n", 6);
        _exit(0);
}
2003-09-04 00:20:40 +00:00
Daniel Eischen
850108c0b4 Don't assume sizeof(long) = sizeof(int) on x86; use int
instead of long types for low-level locks.

Add prototypes for some internal libc functions that are
wrapped by the library as cancellation points.

Add memory barriers to alpha atomic swap functions (submitted
by davidxu).

Requested by:	bde
2003-09-03 17:56:26 +00:00
David Xu
29c668fc50 Move kse_wakeup_multi call to just before KSE_SCHED_UNLOCK.
Tested on: SMP
2003-09-03 00:21:10 +00:00
Alexander Kabaev
523be360f1 Rethink the way thr_libc.So is generated. Relying on GCC to extract
only needed symbols from libc_pic is not working on sparc64.

Requested by: jake
2003-09-02 19:37:11 +00:00
Diomidis Spinellis
bd2f86fe4e Fix/add errno return values to match the NFS client implementation and
better represent failures of special files accessed over NFS.

Approved by:	schweikh (mentor)
Reviewed by:	bde (as a description)
MFC after:	6 weeks
2003-09-02 16:50:17 +00:00
Eivind Eklund
62d6317d5a Update the kern.osreldate documentation to document the present format
used, and refer to <osreldate.h> to get userland date.

Submitted by:	ru
2003-09-01 14:26:33 +00:00
Robert Watson
7ea02dcd89 Return (-1) not (ENOENT) for mac_prepare_type(), and set errno to
ENOENT instead.

Reported by:	"Kenneth D. Merry" <ken@kdm.org>
Submitted by:	Bryan Liesner <bleez@comcast.net>
2003-08-30 14:51:01 +00:00
Ruslan Ermilov
b3a71bf3fd Unbreak the NOINSTALLLIB install.
PR:		50945
Submitted by:	Rene de Vries <rene@tunix.nl>
Reminded by:	jmallett
2003-08-30 13:57:31 +00:00
Daniel Eischen
9cd8ed99ee Allow the concurrency level to be reduced.
Reviewed by:	davidxu
2003-08-30 12:09:16 +00:00
Diomidis Spinellis
66eb91c1e0 Document that read(2) can also return EPERM
See e.g. nfsclient/nfs_vnops.c

static int
nfs_read(struct vop_read_args *ap)
{
        struct vnode *vp = ap->a_vp;

        if (vp->v_type != VREG)
                return (EPERM);
        return (nfs_bioread(vp, ap->a_uio, ap->a_ioflag, ap->a_cred));
}

Approved by:	schweikh (mentor)
MFC after:	6 weeks
2003-08-30 07:59:05 +00:00
Sean Chittenden
cc3ad99f0f Add a reference to bn(3) for those looking for functional multiprecision
integer arithmetic.
2003-08-30 05:35:46 +00:00
Dag-Erling Smørgrav
fd8f6d2269 Don't close a FILE * which we know is bogus. 2003-08-29 15:54:12 +00:00
Poul-Henning Kamp
3bc2f9a897 Introduce more knobs to slim down FreeBSD userland
NO_TOOLCHAIN	skips Compilers and Binutils
NO_USB		skips USB stuff
NO_VINUM	skips Vinum stuff
NO_ACPI		skips ACPI stuff
2003-08-29 10:35:01 +00:00
David E. O'Brien
e6f1abaa68 Ignore ccd(4)'s. This is not the best solution, but it at least removes
the "BARF 360" ccd(4) user's experience.

Submitted by:	rwatson
2003-08-28 17:39:09 +00:00
Poul-Henning Kamp
5e1847b4d1 Make build of libatm depend on existing NOATM conditional. 2003-08-27 20:00:48 +00:00
Eivind Eklund
09a759d347 Clarify text 2003-08-26 15:52:47 +00:00
Robert Watson
09a7f4484d Add HISTORY sections to the remaining MAC library man pages.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 18:01:03 +00:00
Robert Watson
bec8c3f9c3 Update the mac_prepare(3) man page to reflect changes to the
mac_prepare() APIs.

Add a HISTORY section.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:58:38 +00:00
Robert Watson
930d4ffa56 Make the elements argument to mac_prepare() be const.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:49:59 +00:00
Robert Watson
738824ad6c As new objects begin to support new labels, start to generalize
the default label support in /etc/mac.conf.  Rather than maintain
each default label type in an explicit global variable in mac.c,
keep a list of defaults loaded from the configuration file.
Generalize the parsing so that we support both the older:

        default_file_labels foo
        default_ifnet_labels foo
        default_process_labels foo

And also a new:

        default_labels file foo
        default_labels ifnet foo
        default_labels process foo

We now accept arbitrary object classes in the first argument.  If
the same object is specified more than once, we discard the
earlier definition in favor of the later one.

Add a new API, mac_prepare_type(), which accepts a mac_t to
prepare, as well as an object name in the second argument, which
will pull a default label set for the object out of the
configuration loaded by mac_init_internal().  This permits the libc
to adapt to new objects known about by applications but not by libc
at compile-time.

Also liberalize the error handling a bit: if we're using implicit
initialization (i.e., the application didn't explicitly initialize
the MAC code), ignore syntax errors and only use valid lines.  In
the future, we may want to add explicit warnings and do this a
bit more consistently.

While here, add support for a MAC_CONFFILE environmental variable,
which may be used to specify an alternative mac.conf configuration
file if the application isn't running with modified privilege
(issetugid()).

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, Network Associates Laboratories
2003-08-22 17:36:23 +00:00
David Xu
cd4f17872d Repost masked signal to kernel for scope system thread, it hardly happens
in real world.

Reviewed by: deischen
2003-08-21 22:02:18 +00:00
David Xu
2d81cd746b _thr_sig_check_pending is also called by scope system thread when it leaves
critical region, we wrap some syscalls for thread cancellation point, and
when syscalls returns, we call _thr_leave_cancellation_point, at the time
if a signal comes in, it would be buffered, and when the thread leaves
_thr_leave_cancellation_point, buffered signals will be processed, to avoid
messing up normal syscall errno, we should save and restore errno around
signal handling code.
2003-08-20 13:43:35 +00:00
Daniel Eischen
83e3877521 Add back a loop for up to PTHREAD_DESTRUCTOR_ITERATIONS to
destroy thread-specific data.  Display a warning when thread
specific data remains after PTHREAD_DESTRUCTOR_ITERATIONS.

Reviewed by:	davidxu
2003-08-20 02:34:14 +00:00
Garrett Wollman
89a26fd1fc Add a kluge suggested by Marcel to paper over the difference between
gethostname()'s old and new signatures without requiring a library
bump.  Note that programs which called gethostname() with a negative
argument were already broken, since the same type conversion was done
by the old implementation.  Add a note in the Makefile so that whoever
next bumps the libc revision will delete the kluge at the same time
(as it will no longer be necessary).  This is only operative on 64-bit
platforms.

Submitted by:	marcel
2003-08-19 23:01:46 +00:00
Garrett Wollman
effcb5eca3 Change gethostname() to set errno to ENAMETOOLONG instead of ENOMEM
when the buffer is not long enough to hold the current host name.
POSIX does not standardize error returns for gethostname(), so it
doesn't matter which one we use, but ENAMETOOLONG is at least a little
more intuitive, and mi suggests the existence of prior art.  I've been
running with this change for a while on my home machine with no
effect.  At the same time, I've updated the prototype for
gethostname() to use the correct standard type (size_t) for the
namelen argument.

All of the in-tree callers fall into one of the following categories:
1) Call perror() or equivalent when gethostname() fails.
2) Ignore gethostname()'s return value entirely, potentially resulting
in data corruption if the buffer is too small.
3) Fall back to a (possibly sensible) default value if gethostname()
fails.

Many of the callers I examined shows signs of confusion about the
correct sizing of the host name buffer.  gethostname(3) now has more
information about this, as well as updated standards information.

PR:		48114
Submitted by:	mi (in part)
2003-08-19 20:38:44 +00:00
Dag-Erling Smørgrav
39082bb4a5 Some servers respond to RETR in active mode with 125 (connection already
open) rather than 150 (opening connection).  There's no reason why we
shouldn't accept that.

PR:		misc/42172
MFC in:		3 days
2003-08-19 11:43:11 +00:00
David Xu
9fbc7f7255 Support printing 64 bits pointer and long integer.
Reviewed by: deischen
2003-08-19 08:29:33 +00:00
David Xu
6705464db0 Save and restore errno around sigprocmask. 2003-08-19 03:33:51 +00:00
David E. O'Brien
4f4a104ee8 style.Makefile(5) 2003-08-18 15:25:39 +00:00
David Xu
962eaaf9d6 Direct call exit if thread was never created. This makes it safe to call
pthread_exit in main() without creating any thread.

Tessted by: deischen
2003-08-18 04:03:08 +00:00
David Xu
e81bbed597 Treat initial thread as scope system thread when KSE mode is not activated
yet, so we can protect some locking code from being interrupted by signal
handling. When KSE mode is turned on, reset the thread flag to scope process
except we are running in 1:1 mode which we needn't turn it off.
Also remove some unused member variables in structure kse.

Tested by: deischen
2003-08-18 03:58:29 +00:00
Poul-Henning Kamp
d2d0b14453 It is not an error to have no devices. 2003-08-17 12:06:44 +00:00
Gordon Tetlow
41d8423f71 Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.
2003-08-17 08:28:46 +00:00
David E. O'Brien
f29db4e7ef Imply NOLIBC_R for PowerPC. 2003-08-16 21:21:07 +00:00
Marcel Moolenaar
d4c89eb0a1 Fix wrong identifier on .end directive. The SYSCALL macro does name
mangling and creates an .ent directive with the mangled name.
2003-08-16 18:59:08 +00:00
David Xu
4e7370ed1f If threaded mode is not turned on yet, direct call __sys_sched_yield. 2003-08-16 13:02:45 +00:00
David Xu
1d29b48683 Replace some syscalls with libc version, this makes abort work better with
libkse. Tested under libc_r, libkse, libthr.

Reviewed by: deischen
2003-08-16 11:43:57 +00:00
David Xu
56b39ee1c2 Keep initial kse and kse group just like we keep initial thread,
Don't free them, so some code can still reference them.

Reviewed by: deischen
2003-08-16 05:22:20 +00:00
David Xu
61cc495a29 Access user provided pointer out of lock, and also check the case when
a key is less than 0.
2003-08-16 05:19:00 +00:00
Marcel Moolenaar
0662d65037 Don't run verify directly as that would require the perl script to
have execute permissions. Run "perl verify" instead. Replace all
occurences of the hardcoding of ./verify with $(VERIFY) to allow
it to be overridden as well.
2003-08-13 03:59:18 +00:00