Commit Graph

2448 Commits

Author SHA1 Message Date
peter
266cbb586a preserve errno across the readlink() calls. There is no value in trashing
errno during a successful malloc() call.
1998-06-18 09:13:16 +00:00
jb
250e479c13 Don't allow a SIGCHLD to wake up a thread if the process has the default
signal handler installed for SIGCHLD. The ACE MT_SOCK_Test was hanging
as the result of being interrupted when it didn't expect to be.
1998-06-17 22:29:12 +00:00
jb
bedf533cef If a thread is waiting on a child process to complete, the SIGCHLD
signal can arrive before the thread is woken from it's wait4. In this
case, don't return an EINTR, just set the thread state to running and
the wait4 wrapper will loop and get the exit status of the process.
1998-06-17 03:53:16 +00:00
peter
a57e59595f Don't compile in the use of poll() when building libc_r. This isn't
so much a "fix", rather a bandaid to buy time to fix it properly
within the thread engine.
1998-06-14 11:25:46 +00:00
jb
5e8b8f438e If a short write, only loop if no error. 1998-06-14 09:36:14 +00:00
bde
0db7adbed5 Document EINVAL return value. 1998-06-14 08:22:05 +00:00
peter
7dca0737c7 Understand elf library naming rules for libtermlib alias.
Don't do the libtermcap un-bump hack for anything but a.out
1998-06-12 15:57:59 +00:00
peter
4cb8d2287b Make nlist() understand elf unconditionally 1998-06-12 15:02:03 +00:00
jb
0d6b50b496 Add poll to the list of hidden syscalls so that it gets renamed. This
propagates a bug (that there is no poll wrapper in libc_r), but it
prevents GNU configure scripts from trying to use it in preference
to select. libc_r really needs to change it's wait interface to use
poll instead of select because poll is more a superset of select that
the other way around.

This should allow the Roxen web server to work out-of-the-box. It's
configuration intercae is kinda neat. The code isn't. Shiver. 8-)
1998-06-12 02:21:27 +00:00
jb
57477f9f5b Update the caller's descriptor masks even if there are none ready for
I/O for those applications that don't believe the return value of zero as
meaning that THERE ARE *NO* DESCRIPTORS READY.
1998-06-12 02:17:18 +00:00
peter
c81f48dae4 Sigh, mkdep doesn't know about all the CFLAGS to pass during depend
generation.
1998-06-11 10:39:32 +00:00
peter
09212697f1 Remove components that would duplicate those in libc now that the
includes and interfaces have been merged with the 8.1.2 update.

This essentially leaves the isc/* files that named and named-xfer use.
It might be best to just compile them with .PATH in both cases rather than
bothering with libbind.
1998-06-11 09:06:54 +00:00
peter
0e382d4b43 Update the resolver parts to bind-8.1.2 level. I have not touched the
getXXXXbyYYYY() interfaces yet.

Obtained from: diff relative to bind-8.1.2 sources
1998-06-11 09:03:02 +00:00
jb
f5dc6146f3 Check the access mode in the flags before waiting on a read or a write
that might never be possible if the file was not opened in the corrent
mode. This prevents a hang for bad programs. Why do people code like that?
1998-06-10 22:28:45 +00:00
jb
315029abcd Remove SA_RESTART from the signal dispatch in user-space since this
seems to be tripping up a lot of applications.
1998-06-10 22:25:18 +00:00
jb
fcb602cfeb When doing a F_SETFL, read the flags back so that the ones stored
in the file descriptor table are exactly what the kernel knows subject
to the O_NONBLOCK flag being requested by the user.
1998-06-10 22:24:12 +00:00
jdp
2e843ffbb7 Move ftok() from libcompat to libc, so that it can be closer to its
friend shmget().

PR:		closes misc/6763
1998-06-10 16:20:21 +00:00
danny
319f7224c4 Fix grammar, "null" -> "NUL" 1998-06-10 12:37:45 +00:00
phk
306618399a Spelling fixes.
PR:		6903
Reviewed by:	phk
Submitted by:	Josh Gilliam <josh@quick.net>
1998-06-10 12:34:27 +00:00
jdp
394535e352 This is a null commit to log the fact that I have done a repository
copy to bring these files into libc from libcompat.  I will enable
them and kill off the libcompat versions on the main branch soon.

PR:		step one toward closing misc/6763
1998-06-10 04:24:21 +00:00
brian
cc0e99f1ea Quieten gcc 2.8.1 1998-06-10 00:26:19 +00:00
brian
82817835b7 Cast pid_t to int for sprintf.
Pointed out by: Charlie Sorsby <crs@hgo.net>
1998-06-10 00:16:28 +00:00
jb
8a4a3034b4 Add a commented out CFLAGS entry that can be uncommented to compile thread
lock debug into libc_r. I don't know if this is the best place to document
this, but at least it is recorded somewhere. 8-)
1998-06-09 23:25:13 +00:00
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