Commit Graph

503 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav a135bdb9a0 Use the correct type for uid and gid in struct passwd. Document it. 1999-01-18 02:14:20 +00:00
Dag-Erling Smørgrav eec1dbe6ce Make the implementation and documentation agree. Specifically:
- document that sysctl() and sysctlbyname() return 0 on success

 - if the provided buffer is too small, set errno to ENOMEM and return -1
   instead of returning ENOMEM.
1999-01-06 18:11:53 +00:00
Bruce Evans 2e4513990b Ignore the fs_spec entry for "/" in /etc/fstab if the device which
is actually mounted on "/" can be determined using statfs() and is
in /dev.  This fixes fsck operating on the wrong device when the
fs_spec entry is only an alias.  The aliased case became more
dangerous when the ROOTSLICE_HUNT hack was committed in mount(8).
ROOTSLICE_HUNT may be unnecessary now.
1999-01-01 14:14:44 +00:00
Eivind Eklund 630dc76f4e Restore old semantics (broken in rev 1.47's buffer overflow fix). 1998-12-17 16:31:02 +00:00
Bruce Evans d529713846 Adjust for kern.ps_strings and PS_STRINGS not being a pointer. This is
an unimprovement here.  I thought it would be an improvement, as in libkvm,
but here we can access the strings directly.

Use sysctlbyname() instead of sysctl() and trust it to give a nonzero
address if it succeeds.
1998-12-16 17:34:05 +00:00
Warner Losh 81e4e6a2d6 Add reminder to return memory allocated by this call.
Obtained from: OpenBSD
1998-12-16 04:39:23 +00:00
Matthew Dillon 9a0d08d599 PR: docs/9050
Add reference to required include file #include <stdlib.h> for
    getloadavg(3) function call.
1998-12-13 02:34:56 +00:00
Bruce Evans 0fe8d9f3dd Removed unused include of <kvm.h>. It was alarming for libc to apparently
depend on libkvm.

Removed obsolete `#define _NEW_VFSCONF'.
1998-12-07 11:26:28 +00:00
Joseph Koshy bee0365a4a Fix a .Nm -> .Fn fix that was missed in the previous commit.
Pointed-out-by:	Bruce Evans
1998-11-09 06:52:46 +00:00
Joseph Koshy 41a3e3b022 Update manual page to reflect changes in rev 1.12 of
"src/lib/libc/gen/popen.c" --- popen() in the child
now closes any copies of popen()'ed descriptors in the parent.
1998-11-06 07:09:22 +00:00
Peter Wemm 86854f0360 A feeble attempt at kld compatability. The mount_* programs assume that
they cannot mount a filesystem that they cannot see in getvfsbyname().
Part 1 of this is a hack, make vfsisloadable() always return true - the
ultimate decider of whether it's loadable or not is kldload() or mount().
Part 2 of this is to have vfsload() call kldload(2) and return success if
it works.  This means that we will use a viable kld module in preference
to an LKM!
Ultimately, the thing to do is remove the hacks to do a vfsload in all the
mount_* commands and let the kernel do it by itself in mount(2).
1998-11-03 15:02:29 +00:00
Mike Smith ebed2088fe Prevent buffer overflow in getpwnam()
PR:		bin/8176
Submitted by:	Archie Cobbs <archie@whistle.com>
1998-10-29 23:16:24 +00:00
Robert Nordier 30af884929 Clarify processing of the string argument by psignal(). 1998-10-29 22:17:46 +00:00
Robert Nordier d223b5868e The man page implies that the string argument to psignal() may be
NULL, in line with perror(3).  However, the code presently checks only
for a zero-length string.  Check for both.
1998-10-29 11:39:39 +00:00
John Polstra 76a2643efb Handle ELF symbols better. This fixes "vmstat -i" for the case
where "/var/db/kvm_kernel.db" doesn't exist.
1998-10-28 06:37:49 +00:00
Bill Fenner 551677729e (`'): and (`'); -> (`:') and (`;') 1998-10-26 19:36:38 +00:00
David E. O'Brien 2100aed918 Slight style police.
Add some content from objformat(1).
1998-10-25 13:29:57 +00:00
Dag-Erling Smørgrav af806462dc Fix style issues in execl(), and make execle() vfork()-safe.
Reviewed by:	bde
Approved by:	jkh
1998-10-15 17:14:15 +00:00
Mike Smith 26c51fb453 Conform to POSIX and close any copies of popen() descriptors inherited by a
popen()ed child.

PR:		misc/7810
Submitted by:	Wayne Scott <wscott@ichips.intel.com>
1998-10-15 01:47:40 +00:00
Dag-Erling Smørgrav 7ea577e550 Correct braino in previous commit. I get the pointy hat again. 1998-10-14 20:23:40 +00:00
Dag-Erling Smørgrav dea625c872 Make execl() vfork()-safe. This should fix potential bugs in rcp,
telnet and tip, and probably a few other apps.

Reviewed by:	bde
Approved by:	jkh
1998-10-14 18:53:36 +00:00
Peter Wemm 0c372549f6 Avoid the need for calling functions that malloc after a vfork(). 1998-10-11 14:11:51 +00:00
Bruce Evans 0890dc6f44 vfork -> fork. The child calls execl() which calls malloc(), so
vfork() can't be used.  We could use alloca() in execl() so that
it can be called between vfork() and execve(), but a "portable"
popen() shouldn't depend on this.  Calling execle() instead of
execl() should be fairly safe, since execle() is supposed to be
callable from signal handlers and signal handlers can't call
malloc().  However, execle() is broken.
1998-10-10 19:30:45 +00:00
Julian Elischer 29595ffd90 Fix a memory leak
PR: 7923
Submitted by: Archie Cobbs <archie@whistle.com>

        The scandir() function returns -1 if it fails.
	In many cases when this happens, it does not free
	the memory that it allocated, resulting in a memory
	leak, or close the directory opened with opendir().
	BAD DOG, BAD!
1998-10-07 01:30:02 +00:00
Joseph Koshy 7669e9013b `kern.maxproc' is not changeable from sysctl(8).
Reminded by:	Bruce Evans <bde@zeta.org.au>
1998-09-29 05:16:45 +00:00
Doug Rabson f0a3692000 Don't cast int pointers to long pointers when reading labels from
/etc/disktab.
1998-09-26 14:44:06 +00:00
Joseph Koshy 0a843f2afb Sort table and descriptions.
Pointed out by: bde
1998-09-16 07:25:34 +00:00
Warner Losh e8420087b0 Replace memory leaking instances of realloc with non-leaking reallocf.
In some cases replace if (a == null) a = malloc(x); else a =
realloc(a, x); with simple reallocf(a, x).  Per ANSI-C, this is
guaranteed to be the same thing.

I've been running these on my system here w/o ill effects for some
time.  However, the CTM-express is at part 6 of 34 for the CAM
changes, so I've not been able to do a build world with the CAM in the
tree with these changes.  Shouldn't impact anything, but...
1998-09-16 04:17:47 +00:00
Dmitrij Tejblum b5acd0014e Don't initialize NIS until it is really necessary. Now, in case of network
or NIS server problems, local user can login without a pause.

Also, -Wsomething cleanup.
1998-09-15 16:22:30 +00:00
Joseph Koshy 61a4defd54 Turn off replies to ICMP echo requests for broadcast and multicast
addresses by default.

Add a knob "icmp_bmcastecho" to "rc.network" to allow this
behaviour to be controlled from "rc.conf".

Document the controlling sysctl variable "net.inet.icmp.bmcastecho"
in sysctl(3).

Reviewed by: dg, jkh
Reminded on -hackers by: Steinar Haug <sthaug@nethelp.no>
1998-09-15 10:49:03 +00:00
Garrett Wollman 75a21a3859 Replace accidentally-deleted `x' which caused warnx() to misbehave. 1998-09-15 01:49:32 +00:00
Joseph Koshy 6e2affc98f Correct a typo that I noticed. 1998-09-15 00:24:19 +00:00
Garrett Wollman b4b4fb871e A small last-minute iitem for 3.0:
- Fix some style errors I made back in 1995.

- Add a new flavor of the err(3) family, which takes an explicit
  errno argument rather than implicitly examining errno.  This
  will make it easier to use these functions in conjunction with
  modern library interfaces that return an errno value explicitly.
1998-09-12 21:02:22 +00:00
Guy Helmer b697833cb3 Document a number of VM sysctl variables with help from old emails
written by John Dyson.
1998-09-09 18:36:14 +00:00
John Polstra cfa4d73988 Add a new library function getobjformat(). It checks all the
standard places ("/etc/objformat", ${OBJFORMAT}, argv) for an
indication of the user's preferred object file format.  This
consolidates some code that was starting to be duplicated in more
and more places.

Use the new function in ldconfig.

Note: I don't think that gcc should use getobjformat(), even though
it could.  The compiler should limit itself to functions that are
widespread, to ease porting and cross-compilation.
1998-09-09 01:21:25 +00:00
Andrey A. Chernov 7f41a65ede restore rev 1.23 to give clear SIGALRM handling example, 68 years
are too long to affect real code
1998-09-08 09:44:46 +00:00
Matthew Dillon 49d6409ac7 Reviewed by: Andrey A. Chernov <ache@nagual.pp.ru>, Doug Rabson <dfr@nlsystems.com>
Rewrote sleep() to remove int/long typing assumptions between the argument
    to the function and the timespec structure.
1998-09-06 09:11:06 +00:00
John Birrell ae59c2591e Use INT_MAX instead of LONG_MAX since the variable being compared
is an int, not a long.
1998-09-05 08:01:26 +00:00
Wolfram Schneider acd8019083 Sort cross references. 1998-08-31 16:41:09 +00:00
Doug Rabson 744857bc1c Update to use the new elf headers. 1998-08-17 08:47:19 +00:00
Bruce Evans 8023e3dd93 isnetworktty -> isnettty. ttyent.h has already gone through 3
revisions to match the confusing spelling in getttyent.c (1 to
break it to match the man page and 1 in each of 2 branches to fix
it).  This function seems to be orphaned and unused.
1998-08-03 15:35:41 +00:00
Bruce Evans 92f896a9cc Fixed printf format errors. 1998-08-02 14:41:34 +00:00
Dmitrij Tejblum 9b003a4c74 Add lockf(). 1998-07-08 15:42:57 +00:00
Dmitrij Tejblum abe2fe8a8b Make this look more FreeBSDish. 1998-07-08 15:38:06 +00:00
Dmitrij Tejblum f1f57565d4 This commit was generated by cvs2svn to compensate for changes in r37510,
which included commits to RCS files with non-trunk default branches.
1998-07-08 15:28:56 +00:00
Dmitrij Tejblum 6975deff55 An implementation of lockf() function call.
Obtained from:	NetBSD (author: Klaus Klein)
1998-07-08 15:28:56 +00:00
Poul-Henning Kamp 8a507b98ab fts_close calls free(sp), the ISSET(FTS_NOCHDIR) which is a macro that
references sp. The free needs to follow ISSET

PR:		7148
Reviewed by:	phk
Submitted by:	Ken Mayer <kmayer@freegate.com>
1998-07-03 08:21:05 +00:00
Eivind Eklund 38cf631922 Cross-reference to sysconf(3). 1998-06-30 22:56:39 +00:00
Bruce Evans a7f8e53079 Fixed printf format errors. 1998-06-30 17:30:22 +00:00
Peter Wemm f3f4b57ac9 Make nlist() understand elf unconditionally 1998-06-12 15:02:03 +00:00