dragonfly.git
16 years agoMerge from vendor branch GCC:
Matthew Dillon [Sun, 20 Jun 2004 02:14:58 +0000 (02:14 +0000)]
Merge from vendor branch GCC:
Bring in a trimmed down gcc-3.4-20040618.

Submitted-by: Joerg Sonnenberger <joerg@crater.dragonflybsd.org>
16 years agoBring in a trimmed down gcc-3.4-20040618.
Matthew Dillon [Sun, 20 Jun 2004 02:14:58 +0000 (02:14 +0000)]
Bring in a trimmed down gcc-3.4-20040618.

Submitted-by: Joerg Sonnenberger <joerg@crater.dragonflybsd.org>
16 years agoAlways set the _CPUCFLAGS in bsd.cpu.gcc2.mk to some known, safe
Joerg Sonnenberger [Sun, 20 Jun 2004 00:43:28 +0000 (00:43 +0000)]
Always set the _CPUCFLAGS in bsd.cpu.gcc2.mk to some known, safe
value. For the !CPUTYPE || CPUTYPE==i386 case _CPUCFLAGS wasn't
reset which breaks a CCVER=gcc34 buildworld, because the default
flags for gcc34 (-mtune=pentiumpro) doesn't work for gcc2.

16 years agoUse our specs, not FreeBSD's.
Joerg Sonnenberger [Sun, 20 Jun 2004 00:20:28 +0000 (00:20 +0000)]
Use our specs, not FreeBSD's.

16 years agoManually recurse into ../cc_prepend for depend to workaround
Joerg Sonnenberger [Sun, 20 Jun 2004 00:19:51 +0000 (00:19 +0000)]
Manually recurse into ../cc_prepend for depend to workaround
buildworld issues.

16 years agoRedo the ProPolice patches, there were partly broken.
Joerg Sonnenberger [Sun, 20 Jun 2004 00:10:52 +0000 (00:10 +0000)]
Redo the ProPolice patches, there were partly broken.

16 years agoIEEE Std. 1003.1-2001 (SUSv3):
Hiten Pandya [Sat, 19 Jun 2004 22:03:08 +0000 (22:03 +0000)]
IEEE Std. 1003.1-2001 (SUSv3):

Add the tabs(1) utility.

Written by Tim J. Robbins of the FreeBSD Project.

16 years agoAdd the csplit(1) utility, which splits files based on context, as
Hiten Pandya [Sat, 19 Jun 2004 21:51:54 +0000 (21:51 +0000)]
Add the csplit(1) utility, which splits files based on context, as
specified by IEEE Std. 1003.1-2001 (SUSv3).

Written by Tim J. Robbins (tjr@) of the FreeBSD Project.

16 years agoFix GCC 3.4 build
Joerg Sonnenberger [Sat, 19 Jun 2004 20:38:22 +0000 (20:38 +0000)]
Fix GCC 3.4 build

16 years agoFix GCC 3.4 build.
Joerg Sonnenberger [Sat, 19 Jun 2004 20:36:04 +0000 (20:36 +0000)]
Fix GCC 3.4 build.

16 years agoFix compilation "Label at end of compound statement" and some missing
Joerg Sonnenberger [Sat, 19 Jun 2004 18:55:48 +0000 (18:55 +0000)]
Fix compilation "Label at end of compound statement" and some missing
prototyps / K&R style functions for GCC 3.4.

16 years agoFix a bogus type declaration to remove a compiler warning - `group'
Chris Pressey [Sat, 19 Jun 2004 17:28:28 +0000 (17:28 +0000)]
Fix a bogus type declaration to remove a compiler warning - `group'
in this case refers to a netgroup name, and should therefore be a
char * instead of a gid_t.

Requested-by: joerg
16 years agoFix GCC 3.4 build
Joerg Sonnenberger [Sat, 19 Jun 2004 17:19:50 +0000 (17:19 +0000)]
Fix GCC 3.4 build

16 years agoRemove the evil inline ==> rpcgen_inline CPP hack, rename the variable
Joerg Sonnenberger [Sat, 19 Jun 2004 16:40:36 +0000 (16:40 +0000)]
Remove the evil inline ==> rpcgen_inline CPP hack, rename the variable
properly. Use ISO C prototyps. Remove useless void casts. Do some other
style updates. Remove !defined(__DragonFly__) cases, one was checking for
__Dragonfly__, which broke buildworld with GCC 3.4. Add a break after
default: in switch statements, which is not portable and an error with
GCC 3.4 and later.

16 years agoFix an aggregious non-terminated buffer issue and also fix the retry code
Matthew Dillon [Sat, 19 Jun 2004 16:03:01 +0000 (16:03 +0000)]
Fix an aggregious non-terminated buffer issue and also fix the retry code
(the buffer was being wiped and needed to be regenerated for the retry).

Reported-by: Vincent Labrecque <vincent@psyfreaks.ca>
16 years agoFix prototype of usage().
Hiten Pandya [Sat, 19 Jun 2004 12:34:52 +0000 (12:34 +0000)]
Fix prototype of usage().

16 years agoFirst stage in cleaning the built-in pathes of gcc. Adapted patch from
Joerg Sonnenberger [Sat, 19 Jun 2004 11:13:30 +0000 (11:13 +0000)]
First stage in cleaning the built-in pathes of gcc. Adapted patch from
cc3/gcc.patch and fit directly into the patching system.

16 years agoInclude ProPolice suport for GCC 3.4.
Joerg Sonnenberger [Sat, 19 Jun 2004 10:34:17 +0000 (10:34 +0000)]
Include ProPolice suport for GCC 3.4.

Obtained-from: http://www.trl.ibm.com/projects/security/ssp

Additional files forgotten in first commit.

16 years agoInclude ProPolice suport for GCC 3.4.
Joerg Sonnenberger [Sat, 19 Jun 2004 10:30:08 +0000 (10:30 +0000)]
Include ProPolice suport for GCC 3.4.

Obtained-from: http://www.trl.ibm.com/projects/security/ssp

Adjust Makefile.langs to use the patched common.opts from cc_prep.

16 years agoCreate twed0 entries in /dev
David Rhodus [Fri, 18 Jun 2004 23:50:34 +0000 (23:50 +0000)]
Create twed0 entries in /dev

16 years agoFix installworld by making it aware of the rconfig examples.
David Rhodus [Fri, 18 Jun 2004 21:45:06 +0000 (21:45 +0000)]
Fix installworld by making it aware of the rconfig examples.

16 years agoAdd a helper utility, called asf(8): Add Symbol File.
Hiten Pandya [Fri, 18 Jun 2004 21:20:55 +0000 (21:20 +0000)]
Add a helper utility, called asf(8): Add Symbol File.

The purpose of this utility is to extract start addresses from kldstat(8)'s
output and prepare a .gdbinit style file (called .asf) with GDB commands to
load the KLD files at the right offset.

The file can then be given to the 'source' command of GDB so that it does
its magic.  This is how one can invoke the asf(8) command:

# asf -k -f -s -x /modules gdb.kldsyms.asf

Note, the '-k' output invokes kldstat(8) automatically, otherwise it
accepts kldstat(8) sytle output on stdin, which can be produced by a
gdb macro so that is is equally useful in post-crash analysis.

One needs to compile the module with debugging symbols, though.

Obtained-from: FreeBSD (CVS, MAIN branch)

16 years agoA sample rconfig script which completely wipes and reinstalls dragonfly
Matthew Dillon [Fri, 18 Jun 2004 18:36:06 +0000 (18:36 +0000)]
A sample rconfig script which completely wipes and reinstalls dragonfly
on a fresh HD.

16 years agochdir into WorkDir before running the downloaded script.
Matthew Dillon [Fri, 18 Jun 2004 04:26:53 +0000 (04:26 +0000)]
chdir into WorkDir before running the downloaded script.

Exit with an error if both -a and a list of hosts are specified on the
command line.

16 years agoWrite a remote configuration utility called 'rconfig'. This initial
Matthew Dillon [Fri, 18 Jun 2004 02:46:46 +0000 (02:46 +0000)]
Write a remote configuration utility called 'rconfig'.  This initial
implementation is very basic and designed to be convienient.  It allows a
CD user to scan the network for configuration servers, download a
configuration script based on a tag name, and execute that script all in
one simple command.  Running the rconfig server is just as easy... you
basically just run the server -a -s and put your scripts in
/usr/local/etc/rconfig/<tagname>.sh and you are done.

Of course the scripts themselves have to be written and can certainly become
quite complex.

In order to use rconfig from a CD Boot at least one network interface must
be properly configured.  The dhclient program is usually used to accomplish
this.

16 years agoThe insn-conditions.c generated by stock GCC does some bad premature
Joerg Sonnenberger [Thu, 17 Jun 2004 23:28:39 +0000 (23:28 +0000)]
The insn-conditions.c generated by stock GCC does some bad premature
optimizations which breaks e.g. genflags. Remove this until a better
solution is found.

16 years agoDefault the MMX/XMM kernel optimizations to the on position. Also make a
David Rhodus [Thu, 17 Jun 2004 19:37:29 +0000 (19:37 +0000)]
Default the MMX/XMM kernel optimizations to the on position. Also make a
note in the loader man page that these optimizations can be turned off at
the loader by setting kern.mmxopt=1.

16 years agoDon't whine about malloc/realloc "poising" the code for YACC files.
Joerg Sonnenberger [Thu, 17 Jun 2004 18:05:17 +0000 (18:05 +0000)]
Don't whine about malloc/realloc "poising" the code for YACC files.

16 years agoDon't set prefetch mode on VIA chips, it causes problems on newer chips and
Matthew Dillon [Thu, 17 Jun 2004 16:51:56 +0000 (16:51 +0000)]
Don't set prefetch mode on VIA chips, it causes problems on newer chips and
ATAPI devices.

Notified-by: David Xu <davidxu@viatech.com.cn>
Taken-From: FreeBSD-5

16 years agoSpell 'written' properly.
Hiten Pandya [Thu, 17 Jun 2004 01:30:27 +0000 (01:30 +0000)]
Spell 'written' properly.

16 years agoFix spelling in comment.
Hiten Pandya [Wed, 16 Jun 2004 01:17:30 +0000 (01:17 +0000)]
Fix spelling in comment.

16 years agoMake sure gcc_local.c and any left over patch mess is cleaned up by make clean,
Matthew Dillon [Wed, 16 Jun 2004 01:14:10 +0000 (01:14 +0000)]
Make sure gcc_local.c and any left over patch mess is cleaned up by make clean,
and fix an improper setting of CLEANFILES for cpp and f77.

16 years agoClean up GCC3.3, rip out all the weird search paths it adds and fix a long
Matthew Dillon [Wed, 16 Jun 2004 01:06:45 +0000 (01:06 +0000)]
Clean up GCC3.3, rip out all the weird search paths it adds and fix a long
standing bug that was preventing it from finding the crtbegin*.o and
crtend*.o files in their new home.

In consultation with: Joerg Sonnenberger <joerg@britannica.bec.de>

16 years agoFix warning
Joerg Sonnenberger [Tue, 15 Jun 2004 13:43:20 +0000 (13:43 +0000)]
Fix warning

16 years agoReally use the host compiler in bsd.hostprog.mk
Joerg Sonnenberger [Tue, 15 Jun 2004 11:56:03 +0000 (11:56 +0000)]
Really use the host compiler in bsd.hostprog.mk

16 years agoNuke lib/csu/i386 (a.out support) and copy lib/csu/i386-elf there.
Joerg Sonnenberger [Tue, 15 Jun 2004 08:53:09 +0000 (08:53 +0000)]
Nuke lib/csu/i386 (a.out support) and copy lib/csu/i386-elf there.

16 years agoAdd CCVER=gcc34 support to bsd.cpu.mk. Also add the magic for AMD64 support
Joerg Sonnenberger [Tue, 15 Jun 2004 07:53:32 +0000 (07:53 +0000)]
Add CCVER=gcc34 support to bsd.cpu.mk. Also add the magic for AMD64 support
for GCC 3.4 and backwards compatiblity for the older compilers.

16 years agoAdd directory entries for GCC 3.4.
Joerg Sonnenberger [Tue, 15 Jun 2004 07:35:17 +0000 (07:35 +0000)]
Add directory entries for GCC 3.4.

16 years agoFix a race with the clearing of p->p_session->s_ttyvp. NULL the pointer
Matthew Dillon [Tue, 15 Jun 2004 00:30:55 +0000 (00:30 +0000)]
Fix a race with the clearing of p->p_session->s_ttyvp.  NULL the pointer
out before calling vrele() rather then after.

Fix a bug with v_opencount accounting on revoke().  The underlying device
was being closed properly but v_opencount was being decremented which causes
it to go negative when close() is called on the descriptor later on.  To
fix the bug we zero out v_opencount() when the underlying vnode's device
is disassociated and spec_close() now only decrements it when the device is
associated.

Reported-by: GeekGod
Testing-by: GeekGod, Hiten, David Rhodus.
16 years agoBuild infrastructure for GCC 3.4
Joerg Sonnenberger [Mon, 14 Jun 2004 22:27:56 +0000 (22:27 +0000)]
Build infrastructure for GCC 3.4

This is based both on the logical structure of GCC own Makefiles
and the build framework of GCC 3.3. For the moment, the generated
helper files are recreated for each directory using them to make
the dependencies simpler. libgcc_r is not included, because the
only difference is the normal version is an explicit call to
pthread_mutex_init instead of using the static init model, which
is serialized by a spinlock for all those locks.

This is not yet hooked into the normal buildworld system.

16 years agoAdd the old CSU files to list of file to be deleted and keep the new ones.
Joerg Sonnenberger [Mon, 14 Jun 2004 20:08:02 +0000 (20:08 +0000)]
Add the old CSU files to list of file to be deleted and keep the new ones.

16 years agoSwitch from GCC-version specific crtbegin/crtend code to the version
Joerg Sonnenberger [Mon, 14 Jun 2004 19:35:36 +0000 (19:35 +0000)]
Switch from GCC-version specific crtbegin/crtend code to the version
independent code. This is binary compatible with old version. The old
object files are currently left in place.

16 years agoImport BSD-licensed crtbegin/crtend support.
Joerg Sonnenberger [Mon, 14 Jun 2004 18:56:12 +0000 (18:56 +0000)]
Import BSD-licensed crtbegin/crtend support.

Obtained-from: NetBSD

Note: crtend.c comes without license header. I send a mail to Jason Thorpe
and will update it according to the response. I'm assuming the normal
4-clause NetBSD license for now.

16 years agoMake the procfs_validfile() function static.
Hiten Pandya [Mon, 14 Jun 2004 15:26:56 +0000 (15:26 +0000)]
Make the procfs_validfile() function static.

16 years agoIf there was a cache hit, and the msf->m_flags was set to SFBA_ONFREEQ,
Hiten Pandya [Mon, 14 Jun 2004 01:35:36 +0000 (01:35 +0000)]
If there was a cache hit, and the msf->m_flags was set to SFBA_ONFREEQ,
make sure we dequeue it properly before jumping to the 'done' label.

Reported-by: Emiel Kollof <coolvibe@gamepoint.net>
Discussed-with: Matthew Dillon <dillon@backplane.com>

16 years agostart_forked_proc() should not be called when rfork() is called without
Matthew Dillon [Sat, 12 Jun 2004 03:09:41 +0000 (03:09 +0000)]
start_forked_proc() should not be called when rfork() is called without
RFPROC, since no new process is being created.

Reported-by: Hiten
Testing-by: Hiten
16 years agoANSIfy the remaining K&R functions. Remove two bzero-after-malloc's in
Matthew Dillon [Sat, 12 Jun 2004 03:07:36 +0000 (03:07 +0000)]
ANSIfy the remaining K&R functions.  Remove two bzero-after-malloc's in
favor of M_ZERO, replace all uses of the MALLOC() macro with malloc(), and
replace all uses of the FREE() macro with free().

This is a cleanup commit only.

16 years agoFix a bug in the reply port path related to aborts. Aborted messages are
Matthew Dillon [Sat, 12 Jun 2004 01:55:59 +0000 (01:55 +0000)]
Fix a bug in the reply port path related to aborts.  Aborted messages are
requeued to the target port.  If the target is processing the message and
replies to it, the replyport code is supposed to remove any requeued aborts
(since the target completed processing of that message).

However, this was only occuring for MSGF_ASYNC messages.  It must be done for
both originator synchronous and originator asynchronous messages (abort
processing has nothing to do with how the originator sent the message).

Reported-by: David Rhodus
Testing-by: David Rhodus
16 years agoDo not produce a warning if the sysctl does not exist. This happens when
Hiten Pandya [Fri, 11 Jun 2004 12:03:15 +0000 (12:03 +0000)]
Do not produce a warning if the sysctl does not exist.  This happens when
the kernel is compiled without the INET6 option.

16 years agoBoth 'ps' and the loadav calculations got broken by thread sleeps, which
Matthew Dillon [Thu, 10 Jun 2004 22:11:39 +0000 (22:11 +0000)]
Both 'ps' and the loadav calculations got broken by thread sleeps, which
occur without knowledge by the proc and so ps/loadav thought processes
sitting in e.g. accept() were in a 'R'un state when they were actually
sleeping.

Make ps and the loadav calculator thread-aware.

16 years agoAdd Makefile support for host programs (.nx) just like we support normal
Joerg Sonnenberger [Thu, 10 Jun 2004 10:31:29 +0000 (10:31 +0000)]
Add Makefile support for host programs (.nx) just like we support normal
programs with bsd.prog.mk. The difference is that bsd.hostprog.mk doesn't
support man pages, scripts and builds ${PROG}.nx.

16 years agoRevert the locking of feof(3) for now; there is possibility of ill
Hiten Pandya [Wed, 9 Jun 2004 23:35:45 +0000 (23:35 +0000)]
Revert the locking of feof(3) for now; there is possibility of ill
effects due to the current implementation of funlockfile().

Inspired by rev. 1.7 of lib/libc/stdio/fclose.c.

16 years agoAdd some whitespace for clarity. No operational changes.
Hiten Pandya [Wed, 9 Jun 2004 20:26:04 +0000 (20:26 +0000)]
Add some whitespace for clarity.  No operational changes.

16 years agoAdd a 'big fat comment' about the FUNLOCKFILE(fp) implementation and why
Hiten Pandya [Wed, 9 Jun 2004 19:40:59 +0000 (19:40 +0000)]
Add a 'big fat comment' about the FUNLOCKFILE(fp) implementation and why
it needs to be called before modification of the FILE flags.

Requested-by: Matthew Dillon <dillon at backplane.com>

16 years agoRevert previous commit about FUNLOCKFILE(fp), it causes ill (and weird)
Hiten Pandya [Wed, 9 Jun 2004 19:28:04 +0000 (19:28 +0000)]
Revert previous commit about FUNLOCKFILE(fp), it causes ill (and weird)
effects for ports like Mozilla and net/freeraidus.

16 years agoAdd implemenation of lrealpath. This works like realpath, but returns
Joerg Sonnenberger [Wed, 9 Jun 2004 12:32:07 +0000 (12:32 +0000)]
Add implemenation of lrealpath. This works like realpath, but returns
a dynamically allocated string or a copy of the original pathname, if
realpath(3) failed. This can return NULL, if malloc(3) failed.

16 years agoFix the warranty, this is not UCB code
Joerg Sonnenberger [Wed, 9 Jun 2004 12:19:21 +0000 (12:19 +0000)]
Fix the warranty, this is not UCB code

16 years agoBegin implementing a -liberty replacement for binutils and GCC under
Joerg Sonnenberger [Wed, 9 Jun 2004 10:42:32 +0000 (10:42 +0000)]
Begin implementing a -liberty replacement for binutils and GCC under
BSD license. Any commit for this has to be carefully evaluated not to
create derived work from the corresponding GPL/LGPL code.

This is intentionally not yet hooked into the build tree.

16 years agoMerge with FreeBSD (RELENG_4) src/usr.bin/script/script.c, revision
Chris Pressey [Wed, 9 Jun 2004 07:53:55 +0000 (07:53 +0000)]
Merge ... FreeBSD (RELENG_4) src/usr.bin/script/script.c, revision
1.11.2.2:

Let script(1)'s stdin/stdout be something besides a terminal,
allowing it to operate non-interactively.  (Addresses FreeBSD PR's
bin/56166, bin/57414, ports/57415, bin/59036, and ports/60534)

Approved-by: dillon
16 years agoAdd -u option to cpdup(1), which causes its -v[vv] logging output to
Chris Pressey [Wed, 9 Jun 2004 07:40:15 +0000 (07:40 +0000)]
Add -u option to cpdup(1), which causes its -v[vv] logging output to
stdout to be line-buffered instead of fully buffered.

Approved-by: dillon
16 years agoAdd the SysKonnect ethernet driver to the GENERIC kernel config.
David Rhodus [Tue, 8 Jun 2004 15:50:43 +0000 (15:50 +0000)]
Add the SysKonnect ethernet driver to the GENERIC kernel config.

16 years agoUpdate tcpslice to version 3.8.
Eirik Nygaard [Tue, 8 Jun 2004 13:20:56 +0000 (13:20 +0000)]
Update tcpslice to version 3.8.

Noticed by: David Rhodus <drhodus@machdep.com>

16 years agoTry the ELF image activator first.
Jeffrey Hsu [Tue, 8 Jun 2004 10:14:45 +0000 (10:14 +0000)]
Try the ELF image activator first.

16 years agoIf handed a bad file pointer that we can't write to, set the errno value
Hiten Pandya [Tue, 8 Jun 2004 04:04:11 +0000 (04:04 +0000)]
If handed a bad file pointer that we can't write to, set the errno value
to EBADF in order to get SUSv2 conformant behavior in higher level calls
like fputs() and puts().

Obtained-from:  FreeBSD (HEAD)

16 years agoIEEE Std. 1003.1-2001 wants feof(3) to behave as if it locked the FILE
Hiten Pandya [Tue, 8 Jun 2004 03:53:44 +0000 (03:53 +0000)]
IEEE Std. 1003.1-2001 wants feof(3) to behave as if it locked the FILE
stream for thread safety.

16 years agoIEEE Std. 1003.1-2001 dictates that fileno(3) behave as it locked the
Hiten Pandya [Tue, 8 Jun 2004 03:36:47 +0000 (03:36 +0000)]
IEEE Std. 1003.1-2001 dictates that fileno(3) behave as it locked the
stream.

16 years agoReplace the use of specially reserved pbufs in NFS's nfs_getpages() and
Hiten Pandya [Tue, 8 Jun 2004 02:58:52 +0000 (02:58 +0000)]
Replace the use of specially reserved pbufs in NFS's nfs_getpages() and
nfs_putpages() with MSF BUFs.  The pbufs were only used for providing a
KVA start address for the UIO and then released, thus being temporary.

This will not give a very huge boost in performance just yet because
not enough MSF_BUFs being reserved due to shortages of available KVA.
Until we convert the BUF and DEV subsystems to utilize the MSF_BUF+XIO
combo, we are pretty much limited.

In the worst case, the thrashing effect of MSF_BUFs will be no more then
the temporary pbuf+qenter; instead, the MSF_BUF will not be able to
cache the page-list mappings and end up doing a pmap_qenter() everytime.

Discussed-with:  Matthew Dillon <dillon@backplane.com>
                 (Earlier version of these changes were tested by him)

16 years agoRemove an accessory function called msf_buf_xio(); it is unnecessary for
Hiten Pandya [Tue, 8 Jun 2004 02:41:41 +0000 (02:41 +0000)]
Remove an accessory function called msf_buf_xio(); it is unnecessary for
now and was just additional bloat.

16 years agoConditionally include the essential header files, sys/queue.h and
Hiten Pandya [Tue, 8 Jun 2004 02:27:49 +0000 (02:27 +0000)]
Conditionally include the essential header files, sys/queue.h and
sys/xio.h.

16 years agoRe-order include, 'sys' includes first, 'vm' includes after.
Hiten Pandya [Tue, 8 Jun 2004 02:15:38 +0000 (02:15 +0000)]
Re-order include, 'sys' includes first, 'vm' includes after.

16 years agoC99 update: freopen(3) with NULL 'path' argument so that it opens the
Hiten Pandya [Tue, 8 Jun 2004 00:45:00 +0000 (00:45 +0000)]
C99 update: freopen(3) with NULL 'path' argument so that it opens the
same file with a different mode.

At the moment, we just recycle the old file descriptor instead of storing
it somewhere and using that to reopen the file, as the standard seems to
require.  Strictly conforming C99 applications would probably not be able
to tell the difference but POSIX ones can.

While I am there, update the manual page about the new functionality and
correct nearby mdoc(7) markup errors.

Original-work-by: Tim J. Robbins <tjr@freebsd.org>
Additional-work-by: Hiten Pandya <hmp@backplane.com>
16 years agomdoc(7) corrections; use .Dv instead of .Em etc, fix grammar.
Hiten Pandya [Tue, 8 Jun 2004 00:29:47 +0000 (00:29 +0000)]
mdoc(7) corrections; use .Dv instead of .Em etc, fix grammar.

16 years agoDocument security issues with gets(3) in a proper manner.
Hiten Pandya [Tue, 8 Jun 2004 00:29:03 +0000 (00:29 +0000)]
Document security issues with gets(3) in a proper manner.

16 years agoSet the return value properly for fgetpos(3).
Hiten Pandya [Mon, 7 Jun 2004 20:57:15 +0000 (20:57 +0000)]
Set the return value properly for fgetpos(3).

16 years agoFUNLOCKFILE(fp) *after* modifying the FILE pointer's fields.
Hiten Pandya [Mon, 7 Jun 2004 20:45:14 +0000 (20:45 +0000)]
FUNLOCKFILE(fp) *after* modifying the FILE pointer's fields.

16 years agoUse ANSI C prototypes and remove the !__STDC__ varargs compatibility
Hiten Pandya [Mon, 7 Jun 2004 20:35:41 +0000 (20:35 +0000)]
Use ANSI C prototypes and remove the !__STDC__ varargs compatibility
junk.

Add a missing '$DragonFly$' tag in stdio/setbuf.c file.

16 years agoAvoid a memory leak if vfprintf(3) by always calling va_end(3); this
Hiten Pandya [Mon, 7 Jun 2004 17:59:42 +0000 (17:59 +0000)]
Avoid a memory leak if vfprintf(3) by always calling va_end(3); this
happens if vfprintf(3) runs out of memory.

Move the va_start(3) closer to the vfprintf(3) call; free the buffer
when if there is a failure condition and don't bother to realloc the
buffer before returning it.

Work done by Bruce Evans and Tim J. Robbins of the FreeBSD Project.

16 years agoRemove useless __STDC__ junk.
Hiten Pandya [Mon, 7 Jun 2004 16:53:40 +0000 (16:53 +0000)]
Remove useless __STDC__ junk.

Correct a nearby comment, s/NULL/NUL/ (NUL char...)

16 years agoUse correct sentence structure.
Hiten Pandya [Mon, 7 Jun 2004 16:37:56 +0000 (16:37 +0000)]
Use correct sentence structure.

16 years agoDissolve use of the 'register' keyword.
Hiten Pandya [Mon, 7 Jun 2004 16:31:02 +0000 (16:31 +0000)]
Dissolve use of the 'register' keyword.

16 years agoFix improper vm_object ref counting in procfs that was introduced in the last
Matthew Dillon [Mon, 7 Jun 2004 16:26:51 +0000 (16:26 +0000)]
Fix improper vm_object ref counting in procfs that was introduced in the last
commit.  This resulted in a panic under certain circumstances (e.g. when
configure got to the 'checking for correct flags to ps...' stage).

Reported-by: "GeekGod" <GeekGod@GeekGod.com> and others
16 years agoulimit.h needed to be added to the include file list for installation.
Matthew Dillon [Mon, 7 Jun 2004 07:06:31 +0000 (07:06 +0000)]
ulimit.h needed to be added to the include file list for installation.

Reported-by: Francois Briere <f.briere@dopha.org>
16 years agoConvert netproto/ns to the pr_usrreqs structure. This is untested work
Matthew Dillon [Mon, 7 Jun 2004 07:04:33 +0000 (07:04 +0000)]
Convert netproto/ns to the pr_usrreqs structure.  This is untested work
but NS didn't work at all before so...

16 years agoAdditional listhead->pcblisthead and marker support for netinet6.
Matthew Dillon [Mon, 7 Jun 2004 07:02:42 +0000 (07:02 +0000)]
Additional listhead->pcblisthead and marker support for netinet6.

16 years agoRecent accept() changes started depending on the protosw->pr_mport field
Matthew Dillon [Mon, 7 Jun 2004 07:01:36 +0000 (07:01 +0000)]
Recent accept() changes started depending on the protosw->pr_mport field
being non-NULL, but unix domain sockets still used a NULL pr_mport field.
This was causing e.g. XFree86 to panic the system.

Unix domain socket calls must still be executed synchronously in the context
of the originating process in order to access the proc structure (for ucred
and other things).

Implement a special synchronous port (netisr_sync_port) and hook function
for the protosw called sync_soport() and hook it into the unix domain
socket protosw.  This port executes netmsg's synchronously and also supports
aborts for predicate messages (used by connect and accept).

The atm protosw also specified NULL which we change to the standard
cpu0_soport().

Remove previous workaround code for NULL mports, since we no longer have
any NULL mports.  Remove an assertion in connect2() that was designed to
detect mis-programmed use of the UNIX DOMAIN socket protosw structure.

Original-problem-reported-by: David Rhodus
16 years agoAdd in_pcbinfo_init() to encapsulate basic structural setup (right now just
Matthew Dillon [Mon, 7 Jun 2004 02:36:28 +0000 (02:36 +0000)]
Add in_pcbinfo_init() to encapsulate basic structural setup (right now just
the LIST_INIT).  Rename inpcbinfo->listhead to inpcbinfo->pcblisthead due
to changes in the API (addition of markers).

Add support for markers in the inpcbinfo->pcblisthead lists of INPCB
structures.  Use markers in sysctl output code to iterate through these lists
without losing its place or having to worry about structures being ripped out
from under it.  Scrap the original two-pass code.

Redo the sysctl INPCB output code for tcp, udp, and other protocols so we
always output the correct number of structures (as specified in xig_count).

Generate output for all cpus (for TCP).  This is accomplished by using
lwkt_setcpu_self() to migrate the kernel thread to each cpu, which allows us
to iterate the list(s) managed by that cpu without having to deal with mutexes
or other forms of locks.  Iterations always wind up on the same cpu they began
on.

Redo netstat to properly iterate across as many cpu chunks as the inpcb
sysctl's return, rather then just the first one.

Work-by: Hiten Pandya and Matthew Dillon
16 years agoRemove dtom() from comment.
Matthew Dillon [Mon, 7 Jun 2004 02:18:13 +0000 (02:18 +0000)]
Remove dtom() from comment.

16 years agoBack out the last change. Normal 'make' builds in the source tree are
Matthew Dillon [Sun, 6 Jun 2004 22:44:34 +0000 (22:44 +0000)]
Back out the last change.  Normal 'make' builds in the source tree are
expected to use the system installed includes, special-casing libc would
make libc operate differently from other libraries.  Note that a buildworld
always has and continues to use the include files from the source tree.

In-discussion-with: Hiten Pandya

16 years agoAdd the prototype for the recently added XIO API call xio_init().
Matthew Dillon [Sun, 6 Jun 2004 19:16:51 +0000 (19:16 +0000)]
Add the prototype for the recently added XIO API call xio_init().

16 years agoRemove the canwait argument to dup_sockaddr(). Callers of dup_sockaddr()
Matthew Dillon [Sun, 6 Jun 2004 19:16:17 +0000 (19:16 +0000)]
Remove the canwait argument to dup_sockaddr().  Callers of dup_sockaddr()
all assume that it just works, so it really has to work.  Since interrupts
are now threads we can use M_INTWAIT.  While it is possible that a memory
deadlock issue exists here (e.g. if swapping over NFS), it isn't likely in
this case.

16 years agoThe usbcom's device was being released too early in the close sequence.
Matthew Dillon [Sun, 6 Jun 2004 18:58:09 +0000 (18:58 +0000)]
The usbcom's device was being released too early in the close sequence.
Note that this fixes a null pointer panic but we still get the
following warning: 'ucom: Warning: cdevsw_remove() called while 1 device
refs still exist! (major 138)'

Submitted-by: YONETANI Tomokazu <qhwt+dragonfly-bugs@les.ath.cx>
16 years agoDeal with revoke()'d descriptors. The underlying vnode is vgone()'d, which
Matthew Dillon [Sun, 6 Jun 2004 18:47:51 +0000 (18:47 +0000)]
Deal with revoke()'d descriptors.  The underlying vnode is vgone()'d, which
means that it is forceably closed.  This clears v_rdev even though file
descriptors may still have references to the vnode, which leads to panics
(mainly on tty devices).

Check for v_rdev == NULL in most specfs fileops calls and return an error
code instead of panicing.   This isn't the cleanest solution but it's fine
for now.

Reported-by: Sascha Wildner <saw@online.de>
16 years agoANSI-fication. No operational changes.
Hiten Pandya [Sun, 6 Jun 2004 16:41:05 +0000 (16:41 +0000)]
ANSI-fication.  No operational changes.

16 years agoRegister keyword removal. No operational changes.
Hiten Pandya [Sun, 6 Jun 2004 15:05:55 +0000 (15:05 +0000)]
Register keyword removal.  No operational changes.

16 years agoAdd a reference to the ulimit(3) manual page.
Hiten Pandya [Sun, 6 Jun 2004 13:33:28 +0000 (13:33 +0000)]
Add a reference to the ulimit(3) manual page.

16 years agoImplement POSIX.1-2001 (XSI)'s ulimit(3) library call.
Hiten Pandya [Sun, 6 Jun 2004 13:32:27 +0000 (13:32 +0000)]
Implement POSIX.1-2001 (XSI)'s ulimit(3) library call.

Obtained-from:   FreeBSD (HEAD)

16 years agoDo not use the installed include files, instead, set the include path
Hiten Pandya [Sun, 6 Jun 2004 13:30:33 +0000 (13:30 +0000)]
Do not use the installed include files, instead, set the include path
to ${.CURDIR}/../../include; so that the right version is used.

16 years agoNow that we have clients that use m_getcl(9), set the default mcl_pool_max
Hiten Pandya [Sun, 6 Jun 2004 11:49:54 +0000 (11:49 +0000)]
Now that we have clients that use m_getcl(9), set the default mcl_pool_max
pool size for mbuf+clusters to '10' instead of '0', to improve performace.

Obtained-from:   FreeBSD, rev. 1.51.2.17 (RELENG_4)

16 years agoDiscard the first 1024 bytes of output as suggested by
Hiten Pandya [Sun, 6 Jun 2004 10:58:31 +0000 (10:58 +0000)]
Discard the first 1024 bytes of output as suggested by
http://citeseer.nj.nec.com/fluhrer01weaknesses.html and
http://citeseer.nj.nec.com/531224.html.

Obtained-from: FreeBSD rev. 1.7 src/lib/libc/gen/arc4random.c

16 years agoClose race condition in accept(2).
Jeffrey Hsu [Sun, 6 Jun 2004 05:59:44 +0000 (05:59 +0000)]
Close race condition in accept(2).