Commit Graph

2525 Commits

Author SHA1 Message Date
jb
e4680d30d3 Implement compile time debug support instead of tracking file name and
line number every time a file descriptor is locked.

This looks like a big change but it isn't. It should reduce the size
of libc_r and make it run slightly faster.
1998-06-09 23:21:05 +00:00
jb
b4d098467a Add compile time debug instead of doing this all the time. Reduce the
time that a thread keeps the file descriptor table locked. In particular,
perform malloc/free calls outside the lock and handle the situation
where two threads can race to initialise the table entry for the same
file descriptor.
1998-06-09 23:16:53 +00:00
jb
e2de1c7ce7 Add support for compile time debug. This is enabled if libc_r is built
with -D_LOCK_DEBUG. This adds the file name and line number to each lock
call and these are stored in the spinlock structure. When using debug
mode, the lock function will check if the thread is trying to lock
something it has already locked. This is not supposed to happen because
the lock will be freed too early.

Without lock debug, libc_r should be smaller and slightly faster.
1998-06-09 23:13:10 +00:00
jb
824eb52ded POSIX says that pthread_exit() is not allowed to be called from a
cleanup destructor, so trap this case to prevent me from being being
burnt again by applications that try to do this. With this change, an
application (like one using a mis-configured ACE) will exit the process
after displaying a message quoting the POSIX section that the application
has violated.
1998-06-09 23:08:41 +00:00
jb
6bef44bba3 Add compile time thread lock debug support.
Add a thread specific flag to trap the case where pthread_exit() is
called from a destructor in violation of the Posix standard.
1998-06-09 23:02:43 +00:00
jb
149fd6eca0 Remove __NETBSD_SYSCALLS from CFLAGS now that it is set in sys.mk. 1998-06-09 22:59:16 +00:00
jb
2cefa1efbd Rename calls when building libc_r. 1998-06-09 22:57:34 +00:00
jb
41d132df3f Make this thread-safe in both libc as well as libc_r. 1998-06-09 22:56:24 +00:00
jb
09fd5b9594 Rename when building libc_r. 1998-06-09 22:45:39 +00:00
jb
b4d7deb8ae Add rename support for libc_r. 1998-06-09 22:43:34 +00:00
wpaul
c451360ac4 Fix potential resource leak: when call to des_crypt_1() fails, remember
to destroy the RPC CLIENT handle before returning.
1998-06-09 17:38:33 +00:00
jb
91f495a7b3 Implement compile time thread lock debug. 1998-06-09 08:37:35 +00:00
jb
eb856053d1 Rename fstat as _thread_sys_fstat if being built into libc_r. 1998-06-09 08:35:42 +00:00
jb
0f134e687a Implement thread support for libc_r. Make the lseek syscall directly
to avoid recursive locking.
1998-06-09 08:34:35 +00:00
jb
7c1557c6f9 Implement compile time debug mode for thread locks. 1998-06-09 08:32:23 +00:00
jb
1e3270b62a Add support for thread lock debug. No impact of the malloc code. 1998-06-09 08:30:32 +00:00
jb
3a95b6373e Implement compile time debug support for spinlocks.
Simplify the atomic lock prototype, removing the lock value.

Delete the unlock prototypes that are not required.
1998-06-09 08:28:49 +00:00
jb
c2f213c811 Delete the atomic unlock function since it is no longer required.
Simplify the atomic lock to just write a value of 1 to the lock instead
of taking the value passed by the caller (which just confused things).
1998-06-09 08:25:41 +00:00
jb
969445866b Atomic lock asm code for the alpha version of libc_r. 1998-06-09 08:21:55 +00:00
brian
62dadfb7e8 Don't call PunchFWHole() ifdef NO_FW_PUNCH
Pointed out by: "Steve Sims" <SimsS@IBM.Net>
1998-06-06 21:52:37 +00:00
steve
fbb89e4312 Fix this so that it compiles in the !__STDC__ case.
Also be consistent about usage of #if ...

Pointed out by:	bde
1998-06-06 18:52:43 +00:00
jb
80731b7e97 Add a warning message for a thread locking against itself. This is
not supposed to happen, but I have seen bogus g++ code that causes
it.
1998-06-06 07:27:06 +00:00
jb
d78d3f941a Simplify the handling of thread specific data. Only track if a key
is allocated or not, rather than keeping a count and attempting to
know it it is in-use. POSIX says that once a key is deleted, using the
key again results in undefined behaviour.
1998-06-06 07:24:24 +00:00
jb
00f9c743b6 Re-design the thread specific key structure. 1998-06-06 07:20:23 +00:00
jb
94110a7e9a I got the last commit back to front. 1998-06-06 07:02:27 +00:00
jkoshy
93bb25d88b Spelling corrections.
PR: 6868
Submitted by: Josh Gilliam <josh@quick.net>
1998-06-06 05:50:53 +00:00
jkoshy
005eba49d0 Spelling nits.
Pointed out by: Sue Blake <sue@welearn.com.au>
1998-06-06 04:56:13 +00:00
jb
e270b5b7ae Fix the signal behaviour for internal states which set the thread
state to running despite the SA_RESTART flag which is really just for
syscalls.
1998-06-05 23:31:55 +00:00
ache
a52f56a1c6 Fix handling more than 1 char with non-C locale
Misc. cleanup
PR: 6825
Submitted by: Sergey Gershtein <sg@mplik.ru>
1998-06-05 09:49:51 +00:00
jkoshy
6bae047a7d Mention that tftpd(8) also uses syslog(3). 1998-06-05 09:20:19 +00:00
ache
46b44ec42b Add missing uu_lock_txfr() prototype 1998-06-05 08:21:33 +00:00
steve
16359590c3 Fix a bunch of spelling errors.
PR:		6856
Submitted by:	Josh Gilliam <josh@quick.net>
1998-06-04 21:06:07 +00:00
jb
8cd2256c31 No longer need the architecture specific include from libc now that
NetBSD syscalls are defined in sys.mk if they are being used.
1998-06-03 08:55:20 +00:00
jb
686b0c5890 If using NetBSD syscalls the rtprio syscall doesn't exist, so just
don't try to use it to set special priorities.
1998-06-03 08:12:00 +00:00
jkoshy
80a6b12374 Correct wrong claim about `telldir()' cookie lifetimes.
PR: 4043
Submitted by: Joe Orthoefer <j_orthoefer@tia.net>
1998-06-03 06:54:24 +00:00
msmith
b43f59d0ec Add a trivial mechanism for returning a useful default value if one is
available and the kernel MIB setting is zero.

Return the result from getpagesize() if the p1003_1b.pagesize MIB
value is zero.

Suggested by:		Joerg Schilling <schilling@fokus.gmd.de>
1998-06-01 20:58:03 +00:00
amurai
e9e82fc544 Trim a domain part for wtmp as same as showed by "netstat -r".
Here is a some example for avoiding a confusion.

 It asssumes a logged host domain is "spec.co.jp". All
example is longer than UT_HOSTNAMELEN value.

   1) turbo.tama.spec.co.jp: 192.19.0.2  -> trubo.tama
   2) turbo.tama.foo.co.jp : 192.19.0.2  -> 192.19.0.2
   3) specgw.spec.co.jp    : 202.32.13.1 -> specgw

Submitted by:	Atsushi Murai <amurai@spec.co.jp>
1998-06-01 08:47:04 +00:00
jb
7ed9f54ed8 I shouldn't do things early in the morning.
I shouldn't do things early in the morning.
[...]
I shouldn't do things early in the morning.
1998-06-01 02:14:34 +00:00
jb
3471037447 send and recv are wrappered in libc, so they shouldn't appear here. 1998-06-01 02:12:15 +00:00
jb
d2ff0eca37 Remove some syscalls that should have been renamed (libc_r doesn't need
to wrapper them) and add a couple that should have been there.
1998-05-31 23:53:50 +00:00
jb
fd7b156bcf Add some missing syscall wrappers. 1998-05-31 23:48:30 +00:00
jb
6300fc7538 Remove some stale code.
Pointed out by: Amancio
1998-05-31 23:47:06 +00:00
jb
1108c05c3a Don't restart a syscall when a SIGCHLD is received by a thread waiting
on a child process.
1998-05-31 23:46:01 +00:00
steve
f37d064a38 Allow this to include from C++ programs.
PR:		2382
Submitted by:	Peter Jeremy <perer.jeremy@alcatel.com.au>
1998-05-31 20:12:06 +00:00
bde
9ee6c76c17 Fixed double slashes in pathnames. 1998-05-31 11:32:38 +00:00
steve
3866e59781 Several sources including Unix98 say that semctl's fourth
parameter is optional except where:
	cmd == {IPC_SET || IPC_STAT || GETALL || SETVAL || SETALL}

PR:		2448
Reviewed by:	bde
Submitted by:	Tim Singletary <tsingle@sunland.gsfc.nasa.gov>
Minor tweaks by: steve
1998-05-31 04:09:09 +00:00
steve
13b17853ed Remove references to getvfsbytype. Also remove getvfsbyname
as it has its own manpage.

Discussed with:	bde
1998-05-30 18:20:37 +00:00
brian
bfd6d855d8 Add uu_lock_txfr() to transfer ownership of a successful
uu_lock() to another process.
1998-05-28 23:17:09 +00:00
peter
5405db26a1 Turn on the rcsid storage so that it's easier to tell the difference
between libscrypt.a and libdescrypt.a
1998-05-28 12:52:03 +00:00
peter
19c10c45cb If building and installing libdescrypt, do it first so that the symlinks
point to it rather than libscrypt.

This was how it was done prior to libscrypt being added in.  This should
stop more people getting burnt with the /usr/lib -> /usr/lib/aout
transition, and the same when the ELF libs come online.
1998-05-27 18:42:36 +00:00
jkh
a1c6b2cb02 Don't use absolute path.
Submitted by:	jhay
1998-05-27 07:39:05 +00:00
jb
45b30f76bd Make a copy of the caller's iovec array, mallocing if necessary,
and modify that if the writev() syscall does not completely write
all bytes in a single call.
1998-05-27 00:44:58 +00:00
jb
d9806fda71 Remove error check from call to set the file descriptor to non-blocking
instead of explicitly ignoring some errors. This allows for the case
where a device is naturally non-blocking.
1998-05-27 00:41:22 +00:00
sos
d721e2b3d6 ELF preparation step 2:
Move a.out libraries to /usr/lib/aout to make space for ELF libs.
Make rtld usr /usr/lib/aout as default library path.
Make ldconfig reject /usr/lib as an a.out library path.
Fix various Makefiles for LIBDIR!=/usr/lib breakage.

This will after a make world & reboot give a system that no
longer uses /usr/lib/*, infact one could remove all the old
libraries there, they are not used anymore.

We are getting close to an ELF make world, but I'll let this
all settle for a week or two...
1998-05-26 20:12:56 +00:00
steve
6968fcaaa8 Remove a couple style bugs from the code snippet that
slipped in on the previous commit.

Submitted by:	bde
1998-05-26 02:53:06 +00:00
jb
04613bee72 When doing a blocking write, keep looping until all the bytes are
written without returning to the caller. This only occurs on pipes
where either the number of bytes written is greater than the pipe
buffer or if there is insufficient space in the pipe buffer because the
reader is reading slower than the writer is writing.
1998-05-25 21:45:52 +00:00
steve
5311308409 Update code example to reflect current practice. 1998-05-25 21:42:51 +00:00
steve
0e740135e1 Allow setting of idle or realtime processing priorities per
login class.

PR:		6636
Submitted by:	Jason Young <doogie@forbidden-donut.anet-stl.com>
1998-05-25 03:55:23 +00:00
amurai
b5e2f91569 Primary verison of NetBIOS over TCP/IP. Now you can connect Windows
DOMAIN as DOMAIN user through NAT function. See also RFC1002 for
futher detail of SMB structure.

Submitted by:	Atsushi Murai <amurai@spec.co.jp>
1998-05-24 03:03:10 +00:00
wpaul
e26eb161eb The incorrect select() timeout calculation that I fixed in svc_tcp.c
also exists here (the timeout can expire much sooner than it's supposed
to).
1998-05-21 15:22:39 +00:00
wpaul
5dfe53a812 Change the sanity test here. It's not correct to assume that the record
size we receive here should fit into the receive buffer. Unfortunately,
there's no 100% foolproof way to distinguish a ridiculously large record
size that a client actually meant to send us from a ridiculously large
record size that was sent as a spoof attempt.

The one value that we can positively identify as bogus is zero. A
zero-sized record makes absolutely no sense, and sending an endless
supply of zeroes will cause the server to loop forever trying to
fill its receive buffer.

Note that the changes made to readtcp() make it okay to revert this
sanity test since the deadlock case where a client can keep the server
occupied forever in the readtcp() select() loop can't happen anymore.
This solution is not ideal, but is relatively easy to implement. The
ideal solution would be to re-arrange the way dispatching is handled
so that the select() loop in readtcp() can be eliminated, but this is
difficult to implement. I do plan to implement the complete solution
eventually but in the meantime I don't want to leave the RPC library
totally vulnerable.

That you very much Sun, may I have another.
1998-05-20 15:56:11 +00:00
obrien
a8f52629d7 Add new NetBSD FFS with FDISK partition ID 0xa9
Obtained from:	Frank van der Linden <frank@wins.uva.nl>
1998-05-19 11:15:44 +00:00
wpaul
15ce081fdb Toss publickey.c in the attic and remove it from the Makefile.
If we have it in libc, we don't need it here.
1998-05-18 21:59:53 +00:00
wpaul
6fa6faf56c Replace the getpublickey() stub with the real thing. 1998-05-18 21:59:15 +00:00
wpaul
78a26f8013 Improve DoS avoidance in RPC stream oriented transports. The TCP transport
uses readtcp() to gather data from the network; readtcp() uses select(),
with a timeout of 35 seconds. The problem with this is that if you
connect to a TCP server, send two bytes of data, then just pause, the
server will remain blocked in readtcp() for up to 35 seconds, which is
sort of a long time. If you keep doing this every 35 seconds, you can
keep the server occupied indefinitely.

To fix this, I modified readtcp() (and its cousin, readunix() in svc_unix.c)
to monitor all service transport handles instead of just the current socket.
This allows the server to keep handling new connections that arrive while
readtcp() is running. This prevents one client from potentially monopolizing
a server.

Also, while I was here, I fixed a bug in the timeout calculations. Someone
attempted to adjust the timeout so that if select() returned EINTR and the
loop was restarted, the timeout would be reduced so that rather than waiting
for another 35 seconds, you could never wait for more than 35 seconds total.
Unfortunately, the calculation was wrong, and the timeout could expire much
sooner than 35 seconds.
1998-05-18 16:12:13 +00:00
jkoshy
4bccc04365 Add warning about interaction of S/Key and login(1) for users without S/Key
passwords attempting to invoke login(1) on a pty.

PR: 3289
1998-05-18 09:36:31 +00:00
jb
2154da8d10 This library builds from libc source, so it also needs to know what
syscall style libc is using otherwise the library can contain calls
(like issetugid) that you don't find out until you build X programs.
1998-05-18 04:41:07 +00:00
jkoshy
713f5b7ac1 kill.1: Remove reference to obsolete sigvec(2) man page. Removed
self reference in sigaction(2) man page.

Submitted by: Josh Gilliam <josh@quick.net>
PR: 6617
1998-05-18 03:33:11 +00:00
wpaul
19405518ab Patch RPC library to avoid possible denial of service attacks as described
recently in BUGTRAQ. The set_input_fragment() routine in the XDR record
marking code blindly trusts that the first two bytes it sees will in fact
be an actual record header and that the specified size will be sane. In
fact, if you just telnet to a listening port of an RPC service and send a
few carriage returns, set_input_fragment() will obtain a ridiculously large
record size and sit there for a long time trying to read from the network.

A sanity test is required: if the record size is larger than the receive
buffer, punt.
1998-05-15 22:57:31 +00:00
wpaul
c243b66c64 Patch RPC library to avoid possible denial of service attacks as described
recently in BUGTRAQ. If a stream oriented transport fails to properly decode
an RPC message header structure where there should be one, it should mark
the stream as dead so that the connection will be dropped.
1998-05-15 22:53:47 +00:00
ache
3c5d4e304d Low level use of 'vidattr()' can cause a NULL pointer to be
dereferenced.  This is because 'SP' is only initialized via 'newterm()'
(which is not required if you are going to interact with the 'terminfo'
database without using 'ncurses').

PR: 6648
Submitted by: Max Euston <meuston@jmrodgers.com>
1998-05-15 21:35:53 +00:00
obrien
a5ecfdf0d2 Change an arbitarly hardcoded `10' to MAX_NO_DISKS, which is currently "20".
Otherwise can't see sd10 (obtained using wired down sd unit numbers),
reguardless of the number of actual disks you have.
1998-05-15 21:17:01 +00:00
jb
f1a3ae93df Remove a big hack after adding a small one to libc/gen/getcwd.c to
handle the lack of __getcwd syscall in NetBSD.
1998-05-15 12:01:06 +00:00
jb
227e7026b9 NetBSD doesn't have a __getcwd syscall, so set have__getcwd to `no'
when building libc with NetBSD syscalls.
1998-05-15 11:59:00 +00:00
jb
b80cd2a2e6 int -> long changes that reduce the diffs with the NetBSD version to
work in a 64-bit environment.
1998-05-14 21:45:18 +00:00
ache
a54b575696 Remove reference to signanosleep 1998-05-14 14:39:58 +00:00
peter
2415830018 Nuke signanosleep() 1998-05-14 11:36:16 +00:00
jb
4e19f72bd5 libtcl now builds (with lots of pointer to int cast warnings) on alpha. 1998-05-13 22:54:03 +00:00
jb
4db10719a2 Make -Werror i386 specific because gcc with -nostdinc on alpha belches
warnings about static inline functions that cause the build to fail.

And for some reason, alpha needs MD5. Find that out later!
1998-05-11 09:15:03 +00:00
jb
81f1277422 Cast a pointer to a long, not an int and make the arg passed to the function
a long too (it does have a proper prototype).
1998-05-11 09:10:38 +00:00
jb
e3b9898f3f Remove a 'const' because it was getting thrown away anyway. 1998-05-10 23:48:18 +00:00
jb
febd4cf311 There is no alpha asm code like on i386, so all the functions that
the i386 builds with a __generic prefix need to have that stripped.
1998-05-10 23:46:01 +00:00
jb
be21c03655 Cast a pointer to a long, not an int before masking it. 1998-05-10 21:22:47 +00:00
jb
f49610cadf Remove 'of type long' from a sentence talking about four 4-byte values
because that is wrong on alpha.
1998-05-10 21:21:01 +00:00
bde
e27017f09d Fixed the usual missing dependencies on headers generated by rpcgen. 1998-05-10 15:54:22 +00:00
bde
4c940db692 Fixed the usual missing dependencies on headers generated by rpcgen.
Use rpcgen's -C option, although using it for non-headers breaks K&R
support.  A local copy of yp.h is built to avoid adding
-I/usr/include/rpcsvc to CFLAGS.  This version of yp.h differed from
<rpcsvc/yp.h> only in not declaring prototypes.

Fixed style bugs.
1998-05-09 15:10:53 +00:00
brian
0f3c94a21f Add a BUGS section and describe a problem I've been having for
a few weeks now.
1998-05-09 14:45:06 +00:00
bde
151aaf93dd Simplified by using new yacc rules. 1998-05-08 06:43:07 +00:00
jb
0963eb5597 This is a hack to workaround source that is coded to use long variables
but also assumes that they are 32-bits. This is one place where I don't
think it is appropriate to change 'long' to 'int'. I don't see why the
code couldn't be fixed so that using natural long variables does the
right thing. It's spaggetti code so it'll take some effort. Obviously
NetBSD thought so too because they change 'long' to 'int32_t' etc
and left it at that. As a temporary measure FreeBSD/Alpha can use the
NetBSD code and put this on the list of things to fix.
1998-05-08 05:41:57 +00:00
jb
185a79fd64 Remote the NetBSD kludge for vfprintf.c 1998-05-08 05:17:11 +00:00
jb
2bfdc76a9f Don't assign the va_list variable 'ap' directly to the argtable because
va_list is not a pointer on alpha. Instead, use the va_arg() macro
to return the address that is stored in the argtable.
1998-05-08 05:10:32 +00:00
jb
e51e3f6a89 Use the thread-aware errno definition all the time. 1998-05-05 22:07:02 +00:00
jb
d6ec07b4f4 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
jb
7e146968d9 Remove extern int errno and #include <errno.h> to get the proper definition. 1998-05-05 22:04:13 +00:00
jb
59f991b3e7 Remove leading underscores from the FILE lock functions that POSIX
specifies.
1998-05-05 22:02:29 +00:00
jb
abb1e4e78f Remove leading underscores for the functions (weak symbols here) that
POSIX defines.
1998-05-05 21:56:42 +00:00
jb
9d8bc2de84 The __set_ospeed() function is coded against the speed_t type declared
in termios.h, but it's prototype in termcap.h and the main file use
the underlying definition (which is now an int, not a long for
compatibility with NetBSD). Really termcap.h should use speed_t too,
but I guess that this might break sources that don't include termios.h
first.
1998-05-05 21:54:26 +00:00
jb
7a3940c104 Treat the lock value as volatile. 1998-05-05 21:47:58 +00:00
jb
deeed33999 In a threaded library, expect the lock field to be declared volatile,
so provide function prototypes that respect that, avoiding a gcc
warning that `volatile' is being thrown away.
1998-05-05 21:46:30 +00:00
rnordier
8eaf407618 Fix a few nits in quoted code fragments and elsewhere. 1998-05-04 23:16:50 +00:00
jb
9cd9104a87 Force BOOTSTRAP mode all the time while the headers are broken on alpha
as the result of i386 changes.
1998-05-04 02:06:09 +00:00
jraynard
ed117dff86 Typo fixes 1998-05-03 22:59:47 +00:00
jraynard
1656507891 Typo fix. 1998-05-03 22:50:14 +00:00
jraynard
9211c4d512 Pedantry (NULL -> NUL). 1998-05-03 22:42:45 +00:00
jraynard
c7cff2d20c Don't imply sigset_t == int. 1998-05-03 22:27:29 +00:00
peter
5bb1ec446d Add libbind 1998-05-03 05:06:13 +00:00
peter
459fe62b97 Build libbind for named and friends (not installed in /usr/lib) 1998-05-03 05:04:21 +00:00
peter
fedfb91291 Resolve some unexpected differences when comparing with the 2.2 version.
One bug was relatively harmless (select's timeout had an uninitialized
tv_usec), the other I'm not so sure.. (neglected to catch select returns
less than zero).  Both of these were irrelevant on kernels with poll().
1998-05-02 15:51:54 +00:00
peter
2e115675f8 Update libc dns code to 4.9.7-T1B level. This involved chopping out large
chunks of res_comp.c and replacing it with chunks of bind-8.1.1's resolver
code.  (There are no interface changes though)
The other parts are better bounds checking related.
1998-05-02 13:11:02 +00:00
jb
badd156592 Cleanup in the child, not the parent.
Submitted by: Tor Egge <Tor.Egge@idi.ntnu.no>
1998-05-02 03:42:20 +00:00
brian
7c4b920246 Go back to version 1.16 - it was correct the way it was.
Pointed out by:	bde
1998-05-01 19:41:12 +00:00
bde
7c748f97a7 Fixed disordering and other style bugs in rev.1.50. 1998-05-01 15:46:06 +00:00
brian
7187f6a9c3 connect() returns -1 on error - not 0. 1998-05-01 01:16:39 +00:00
jb
0d33dcfa10 Fix the incremental priority increment.
PR: bin/6467 Marino Ladavac <lada@pc8811.gud.siemens.at>
1998-04-30 21:50:29 +00:00
ache
4dfc17e28f Add reference to setlocale(3) 1998-04-30 16:11:50 +00:00
ache
eb0bd19233 Add reference to catopen(3) 1998-04-30 16:07:54 +00:00
ache
17b2dd915a Return -1 for invalid descriptor in catclose 1998-04-30 13:15:31 +00:00
ache
f1053fff57 If passed catgets descriptor is NULL or -1, return default string immediately 1998-04-30 12:25:05 +00:00
ache
49e36af497 Force loadType to 0 1998-04-30 11:39:08 +00:00
ache
218d8dfdad Implement NL_CAT_LOCALE
Manpages cleanup
1998-04-30 11:06:12 +00:00
ache
58873d7886 Prototypes/typedefs cleanup
Fix error return codes
1998-04-30 10:14:55 +00:00
jb
96a1d834ad 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
jb
0969c323e8 Change the description of errno to match the thread-aware implementation
from 3.0 on. With 3.0 being a major release, now is a good time to do
this.
1998-04-30 09:49:59 +00:00
jb
4460aad9b5 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
jb
8d4e711fea 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
jb
9c1691d11b Build __error.c into libc, but not libc_r. The weak symbol in the
file works with libpthread, but when built into libc_r which has a non-weak
symbol of the same name, the linker behaves unpredicatably and sometimes
links the wrong symbol. The linker behaviour is a byproduct of what
the program calls from object to object so it is like winning a lottery
if the program actually works. The odds are quite good - 95:1, I think.
We need a sure thing, though, so weak symbols can't be used instead
of renaming things.
1998-04-30 09:13:48 +00:00
jb
fe3e52614e Change the name of this source file so that libc_r builds it instead
of the one in libc that contains the weak symbol for __error. FreeBSD's
make accumulates paths to the point that it can find *anything*, possibly
including the car keys.
1998-04-30 09:04:10 +00:00
jmz
fad1137798 Resurrect exit.c
PR:		misc/6433
1998-04-29 22:43:18 +00:00
ache
dd508b2f30 Basic support for LC_MESSAGES 1998-04-29 22:39:56 +00:00
jb
49642f714d Add spinlock. 1998-04-29 11:03:34 +00:00
jb
e9b0f7892b Change signal model to match POSIX (i.e. one set of signal handlers
for the process, not a separate set for each thread). By default, the
process now only has signal handlers installed for SIGVTALRM, SIGINFO
and SIGCHLD. The thread kernel signal handler is installed for other
signals on demand. This means that SIG_IGN and SIG_DFL processing is now
left to the kernel, not the thread kernel.

Change the signal dispatch to no longer use a signal thread, and
call the signal handler using the stack of the thread that has the
signal pending.

Change the atomic lock method to use test-and-set asm code with
a yield if blocked. This introduces separate locks for each type
of object instead of blocking signals to prevent a context
switch. It was this blocking of signals that caused the performance
degradation the people have noted.

This is a *big* change!
1998-04-29 09:59:34 +00:00
jb
a3285d96fe Don't need wrappers for longjmp/setjmp anymore. 1998-04-29 09:40:51 +00:00
jb
c809fdbdc5 Remove empty files that were renamed some time ago. 1998-04-29 09:39:34 +00:00
jb
acbe1e4c91 Atomic lock source. 1998-04-29 09:36:03 +00:00
jb
5fe3d9fd50 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
jb
bed8d98d58 Replace the threaded locking with spinlock calls for both threaded
and non-threaded programs. This makes malloc thread safe for linking
with libpthread and kernel threads.

Reviewed by: phk
1998-04-29 09:10:58 +00:00
jb
68be02f38b Reference an external variable in threaded programs so that the
autoinitialiser gets linked in and therefore called before main().
1998-04-29 09:08:43 +00:00
jb
57aa8c90ed Use signal() in both the threaded and non-threaded cases. 1998-04-29 09:06:13 +00:00
jb
f887444fbd Stubs are required in libc so that it can be used with libpthread
(and kernel threads), but weak symbols and non-weak symbols of the
same name built into libc_r result in unpredictable linking.
1998-04-29 09:02:16 +00:00
dg
68b590047b Oops, revert part of a diff that wasn't supposed to have been committed. 1998-04-28 07:02:33 +00:00
dg
b258916809 Cache the results of the ps_strings sysctl so that it doesn't have to be
redone for every call of setproctitle().
1998-04-28 06:59:14 +00:00
phk
911ff3ed6a sigprocmask()' man page references sigmask()' in synopsis.
Note odd `sigmask()' line in synopsis.  `sigsetops(3)' is better suited
for `sigprocmask' and is already referenced from the manual page.
(`sigmask()' is useful for the older (& deprecated) `sigsetmask()' API).
PR:		6395
Reviewed by:	phk
Submitted by:	Joseph Koshy <koshy@india.hp.com>
1998-04-26 06:19:24 +00:00
ache
66cf8f60c0 Make asctime_r static if !_THREAD_SAFE to prevent namespace pollution and
prototype mismatch
1998-04-25 00:00:57 +00:00
pst
65990389dd Back out last change 1998-04-23 04:44:08 +00:00
rnordier
bc35794ff4 Improve description.
Submitted by: Arne Henrik Juul <arnej@imf.unit.no>
1998-04-22 19:59:55 +00:00
pst
381f7dfd83 Fix cabs and cabsf definitions to be prototypes. 1998-04-22 06:26:18 +00:00
dima
08ce66f63e indent 1998-04-20 22:13:50 +00:00
phk
b5e163289c Add a #ifdef _THREAD_SAFE around ctime_r 1998-04-20 10:09:37 +00:00
ache
00eafd89ad Describe timegm() 1998-04-20 00:52:32 +00:00
des
457c64741a Backed out lseek changes. 1998-04-19 22:20:32 +00:00
brian
e9b3c2546e o Support a compile-time -DNO_FW_PUNCH for portability
(and those of us that don't want the functionality).
o Don't assume sizeof(long) == 4.
Ok'd by: Charles Mott <cmott@srv.net>
1998-04-19 21:42:07 +00:00
phk
07df2a86ef ctime_r and asctime_r are not implemented.
prototypes in time.h do not match POSIX.

PR:		6345
Reviewed by:	phk
Submitted by:	Dmitry Khrustalev <dima@xyzzy.machaon.ru>
1998-04-19 06:47:25 +00:00
des
5d282768df Return EINVAL and do not changefile pointer if resulting offset is negative.
PR:		kern/6184
1998-04-18 19:24:22 +00:00
jb
e5351f3445 Allow a thread dump to report the thread's sigmask when in the
PS_SIGWAIT state.
1998-04-17 09:39:37 +00:00
jb
5359f916be When in PS_SIGWAIT state, still call signal handlers and set errno
to EINTR.
1998-04-17 09:37:41 +00:00
phk
a854d5b78c Backup out the last commit, it was already there.
Noticed by:	bde
1998-04-17 08:31:07 +00:00
phk
4940092d18 Manpages not installed
PR:		6327
Reviewed by:	phk
Submitted by:	Chia-liang Kao <clkao@cirx.org>
1998-04-17 07:26:51 +00:00
brian
82da744fab Typo police 1998-04-17 00:59:15 +00:00
ache
6528be86fc Add some easy to implement XSI macros including attr_get 1998-04-15 23:13:36 +00:00
peter
f0447f56aa Fix a nasty flaw as a result of using the arc4random() pre-seeding of
leading XXX's.  It could wrap an uppercase character through chars
like:  [ \ ] ^ _ `  in between Z and a.  The backslash and back tick
might be particularly nasty in a shell script context.  Also, since
we've been using upper-case generated values for a while now, go with
the flow and use them in the pathname search rotation.
1998-04-14 07:25:05 +00:00
jb
26590b3f93 Change the FILE locking to be by FILE, not by the underlying fd as
it was. Add a FILE_WAIT state and queue threads waiting for a FILE
lock. Start using the sys/queue.h macros instead of the way that MIT
pthreads did it.

Add a thread name to the private thread structure and a non-POSIX
function to set this. This helps (me at least) when sending a SIGINFO
to a threaded process to get a /tmp/uthread.dump to see what the
<expletive deleted> threads are doing this time. It is nice to be
able to recognise (yes, I spell that with an 's' too) which threads
are which.
1998-04-11 07:47:22 +00:00
jb
d14ddff45d Add FILE locking stubs for libc.
Change the FILE locking to support kernel threads when linked with
libpthread (which you haven't see yet). This requires that libc become
thread-safe and thread-aware, testing __isthreaded before attempting
to do lock/unlock calls. The impact on non-threaded programs is minor.
This change works with libc_r, so it's the best compromise.
1998-04-11 07:40:47 +00:00
phk
87b9646c33 Remove a nolonger implented "BUGS" description.
PR:		6240
Reviewed by:	phk
Submitted by:	Niall Smart rotel@indigo.ie
1998-04-11 07:37:44 +00:00
phk
8a9d073182 Correctly figure out that the remove cannot do passive mode.
PR:		6259
Reviewed & slightly modified by:	phk
Submitted by:	Archie Cobbs <archie@whistle.com>
1998-04-11 07:28:53 +00:00
jb
7aebd7bc3e Add a global variable called __isthreaded that can be tested throughout
libc to determine if locking is required. This is needed in libc
for use with kernel threads, but until a thread is created, we don't
really want to bother locking things. The variable was added here
because the crt code calls exit(main()) so all programs will get the
variable.
1998-04-11 07:02:58 +00:00
jb
e79ac2afbf Add a private header file for libc/libc_r/libpthread to contain
definitions for things like locking etc.
1998-04-11 06:57:33 +00:00
jb
db2ac10139 Enable static initialisation of mutexes and condition variables. 1998-04-04 11:33:01 +00:00
jb
43712df52a Change in name of the static initializer define. 1998-04-04 11:03:07 +00:00
jb
e7d127f8d1 Rename static initializer defines for opaque structures so that the
POSIX specified names can be declared in pthread.h.
1998-04-04 10:58:12 +00:00
jb
ec16037110 Move the magic field initialisation to a place when it is more magic. 1998-04-04 07:27:29 +00:00
jb
a8e4a3f0a9 Add a magic field to the pthread structure to help recognize valid
threads from invalid ones. The pthread structure is opaque to the user
so this change does not cause any incompatibilities.

Hopefully this change will help code that was written for draft 4
fail gracefully if the programmer ignores the compiler warning about
the change in the level of indirection for the argument passed to
pthread_detach(). I got burnt, so I fixed then (expletive deleted)
thing.

These functions comply with the revised standard. That should shut
Terry up!
1998-04-03 09:31:15 +00:00
jb
a4935aa96b This function compiles with the standard, so say so. 1998-04-03 09:12:19 +00:00
jb
f11c4bb2b1 This function compiles with the standard, so say so.
Add a note about not touching errno and warn about previous drafts
of the standard which changed the level of indirection to the thread
argument. POSIX had a bit of trouble deciding what to do. So anyone
coding to both draft 4 and draft 10 (the final draft) will get burnt
by this function. I did. Grrr.
1998-04-03 09:11:15 +00:00
jb
d4832d6ad2 Temporary fix for problems that occur if CFLAGS=-g is added to
/etc/make.conf. The tools can't handle generating debug code where
we fiddle with the ELF segments.
1998-04-01 03:24:19 +00:00
dufault
2c8366e69b Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work.  Changes:

Change all "posix4" to "p1003_1b".  Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.
1998-03-28 11:51:01 +00:00
phk
463e43d900 Split the padding out into a separate function.
Synchronize the kernel and libmd versions of md5c.c

PR:		misc/6127
Reviewed by:	phk
Submitted by:	Ari Suutari <ari@suutari.iki.fi>
1998-03-27 10:23:00 +00:00
jb
44bc78c765 For 1.3, NetBSD replaced the swapon() syscall with swapctl() and moved
the only call to compat_12 which isn't there by default. Provide
a wrapper.
1998-03-23 21:04:06 +00:00
bde
3c7ce625cf Fixed function types in synopsis.
Commented out docmentation of nonexistent authenticate() and
auth_timesok().  authenticate() seems to be obsolete and
auth_timesok() never existed in FreeBSD.
1998-03-23 13:29:49 +00:00
bde
0a9ff45390 Fixed bitrot in synopsis. 1998-03-23 13:23:22 +00:00
bde
e592d4d436 Regenerate (install tclAppInit.c in the installhdrs step). 1998-03-23 13:21:35 +00:00
bde
54d85d6ca0 Fixed a function arg type in the synopsis. 1998-03-23 13:07:17 +00:00
bde
f1e4d55e85 (Ab)use .Vt instead of .Fd for a variable declaration. 1998-03-23 13:05:07 +00:00
bde
13f5cecc75 Fixed bitrot in synopsis. Didn't fix bitrot elsewhere. 1998-03-23 13:02:37 +00:00
bde
95c23641e9 FixedSpellingErrorInAFunctionname. 1998-03-23 12:28:31 +00:00
charnier
1bf317d31f .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq. 1998-03-23 07:48:45 +00:00
jb
d27197558c For 1.3, NetBSD walloped the msync syscall and replaced it with
__msync13. The old one got moved to compat_12. Wrap __msync13 up
to look like FreeBSD's msync and be careful to respect the fact that
MS_SYNC is 0x0000 on FreeBSD, but 0x0004 on NetBSD.
1998-03-23 06:58:06 +00:00
jkh
accb36828d Add Compaq & SCO partition types.
PR:		6092
Submitted by:	Drew Derbyshire <ahd@kew.com>
1998-03-22 07:41:23 +00:00
jb
3f73ea7712 Fix a problem of indirection unblocking signals that would have caused
signals to be unblocked even if they were already blocked when entering
the function.

Pointed out by: bde
1998-03-22 04:13:23 +00:00
markm
1dfd1e0396 Build both libscrypt and libdescrypt. There is no point in letting
libscrypt stagnate, even if it is superceded by libdescrypt. It is
a tiny library anyway, and building it is inexpensive.
1998-03-21 08:18:57 +00:00
jkh
f645e98460 MF22: teach about LS-120 devices. 1998-03-20 23:43:04 +00:00
bde
acd80aa7bd Renamed the generated include file keys.tries to keys.tries.h so
that it can be put in SRCS for dependency generation to work
properly.  Don't use beforedepend, as usual.
1998-03-20 16:50:08 +00:00
bde
cc7c84e1aa Build the libraries in a correct order. Reorganized the ifdefs so
that the order is easy to see.
1998-03-19 16:56:58 +00:00
bde
570fccf1a3 Don't use the beforedepend target. It was a no-op here except for
helping bsd.dep.mk break `make -jN depend'.
1998-03-19 15:27:08 +00:00
charnier
46f7bb5b5b .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq 1998-03-19 07:34:22 +00:00
eivind
017dc9c8cf <sys/errno.h> -> <errno.h> 1998-03-16 18:00:18 +00:00
ache
2157ecc86d Add more AIX/DOS/Win95 partition types 1998-03-14 21:14:31 +00:00
bde
27410dd89f Changed speed_t from long to unsigned long. POSIX.1 requires an
unsigned integral type.  Changing it doesn't seem to cause any
sign extension bugs in /usr/src.  In the kernel, this is partly
because `struct speedtab' and its lookup function are too bogus
to use speed_t's for speeds - they use ints.

Reminded by:	PR 5786
1998-03-12 14:09:55 +00:00
bde
d7f1442cde Fixed disordering and inconsistent style in previous commit. 1998-03-12 12:05:14 +00:00
bde
16cac37c9c Separated header creation from header installation in libss. Create
the libss headers before installing them in `make world'.
1998-03-12 10:08:50 +00:00
jb
683c073d4b Bring these back from the dead. 1998-03-11 20:48:57 +00:00