Permalink
Browse files

FreeBSD 4.2-RELEASE

  • Loading branch information...
itojun
itojun committed Jan 19, 2001
1 parent cd80629 commit 54ffc96f1300394c26678e2a6ffdbd003b1c65c9
Showing with 1,760 additions and 736 deletions.
  1. +5 −3 freebsd4/sys/kern/init_main.c
  2. +258 −256 freebsd4/sys/kern/init_sysent.c
  3. +1 −2 freebsd4/sys/kern/kern_acl.c
  4. +3 −7 freebsd4/sys/kern/kern_clock.c
  5. +9 −2 freebsd4/sys/kern/kern_descrip.c
  6. +2 −2 freebsd4/sys/kern/kern_environment.c
  7. +27 −19 freebsd4/sys/kern/kern_event.c
  8. +2 −2 freebsd4/sys/kern/kern_exec.c
  9. +3 −2 freebsd4/sys/kern/kern_exit.c
  10. +7 −6 freebsd4/sys/kern/kern_fork.c
  11. +14 −2 freebsd4/sys/kern/kern_jail.c
  12. +3 −3 freebsd4/sys/kern/kern_lock.c
  13. +4 −1 freebsd4/sys/kern/kern_malloc.c
  14. +3 −3 freebsd4/sys/kern/kern_mib.c
  15. +2 −2 freebsd4/sys/kern/kern_ntptime.c
  16. +1 −2 freebsd4/sys/kern/kern_physio.c
  17. +13 −93 freebsd4/sys/kern/kern_proc.c
  18. +68 −25 freebsd4/sys/kern/kern_prot.c
  19. +143 −1 freebsd4/sys/kern/kern_resource.c
  20. +14 −10 freebsd4/sys/kern/kern_shutdown.c
  21. +2 −2 freebsd4/sys/kern/kern_synch.c
  22. +274 −19 freebsd4/sys/kern/kern_sysctl.c
  23. +2 −2 freebsd4/sys/kern/makedevops.pl
  24. +35 −26 freebsd4/sys/kern/makesyscalls.sh
  25. +44 −11 freebsd4/sys/kern/subr_bus.c
  26. +2 −2 freebsd4/sys/kern/subr_devstat.c
  27. +1 −1 freebsd4/sys/kern/subr_diskslice.c
  28. +2 −2 freebsd4/sys/kern/subr_prof.c
  29. +9 −6 freebsd4/sys/kern/sys_generic.c
  30. +2 −2 freebsd4/sys/kern/sys_pipe.c
  31. +2 −2 freebsd4/sys/kern/sys_process.c
  32. +14 −1 freebsd4/sys/kern/sys_socket.c
  33. +2 −2 freebsd4/sys/kern/syscalls.c
  34. +8 −8 freebsd4/sys/kern/syscalls.master
  35. +111 −37 freebsd4/sys/kern/sysv_msg.c
  36. +143 −15 freebsd4/sys/kern/sysv_sem.c
  37. +30 −3 freebsd4/sys/kern/sysv_shm.c
  38. +2 −2 freebsd4/sys/kern/tty.c
  39. +2 −2 freebsd4/sys/kern/tty_cons.c
  40. +151 −0 freebsd4/sys/kern/uipc_accf.c
  41. +7 −1 freebsd4/sys/kern/uipc_mbuf.c
  42. +129 −6 freebsd4/sys/kern/uipc_socket.c
  43. +17 −11 freebsd4/sys/kern/uipc_socket2.c
  44. +6 −5 freebsd4/sys/kern/uipc_syscalls.c
  45. +13 −9 freebsd4/sys/kern/uipc_usrreq.c
  46. +46 −31 freebsd4/sys/kern/vfs_aio.c
  47. +35 −20 freebsd4/sys/kern/vfs_bio.c
  48. +39 −30 freebsd4/sys/kern/vfs_cache.c
  49. +18 −6 freebsd4/sys/kern/vfs_lookup.c
  50. +5 −5 freebsd4/sys/kern/vfs_subr.c
  51. +21 −20 freebsd4/sys/kern/vfs_syscalls.c
  52. +2 −2 freebsd4/sys/kern/vfs_vnops.c
  53. +2 −2 freebsd4/sys/kern/vnode_if.src
@@ -39,7 +39,7 @@
* SUCH DAMAGE.
*
* @(#)init_main.c 8.9 (Berkeley) 1/21/94
* $FreeBSD: src/sys/kern/init_main.c,v 1.134 2000/02/25 11:43:08 jkh Exp $
* $FreeBSD: src/sys/kern/init_main.c,v 1.134.2.3 2000/09/07 19:13:36 truckman Exp $
*/
#include "opt_init_path.h"
@@ -191,7 +191,7 @@ mi_startup(framep)
for (xipp = sipp + 1; *xipp; xipp++) {
if ((*sipp)->subsystem < (*xipp)->subsystem ||
((*sipp)->subsystem == (*xipp)->subsystem &&
(*sipp)->order < (*xipp)->order))
(*sipp)->order <= (*xipp)->order))
continue; /* skip*/
save = *sipp;
*sipp = *xipp;
@@ -324,9 +324,11 @@ proc0_init(dummy)
/* Create credentials. */
cred0.p_refcnt = 1;
cred0.p_uidinfo = uifind(0);
p->p_cred = &cred0;
p->p_ucred = crget();
p->p_ucred->cr_ngroups = 1; /* group 0 */
p->p_ucred->cr_uidinfo = uifind(0);
/* Don't jail it */
p->p_prison = 0;
@@ -387,7 +389,7 @@ proc0_init(dummy)
/*
* Charge root for one process.
*/
(void)chgproccnt(0, 1);
(void)chgproccnt(cred0.p_uidinfo, 1, 0);
/*
* Initialize the current process pointer (curproc) before

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_acl.c,v 1.2 2000/01/19 06:07:27 rwatson Exp $
* $FreeBSD: src/sys/kern/kern_acl.c,v 1.2.2.1 2000/07/28 18:48:16 rwatson Exp $
*/
/*
@@ -45,7 +45,6 @@
#include <sys/errno.h>
#include <sys/stat.h>
#include <sys/acl.h>
#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_ACL, "acl", "access control list");
@@ -37,7 +37,7 @@
* SUCH DAMAGE.
*
* @(#)kern_clock.c 8.5 (Berkeley) 1/21/94
* $FreeBSD: src/sys/kern/kern_clock.c,v 1.105.2.1 2000/05/16 06:58:11 dillon Exp $
* $FreeBSD: src/sys/kern/kern_clock.c,v 1.105.2.3 2000/09/22 08:01:00 des Exp $
*/
#include "opt_ntp.h"
@@ -86,11 +86,7 @@ static void tco_setscales __P((struct timecounter *tc));
static __inline unsigned tco_delta __P((struct timecounter *tc));
/* Some of these don't belong here, but it's easiest to concentrate them. */
#if defined(SMP) && defined(BETTER_CLOCK)
long cp_time[CPUSTATES];
#else
static long cp_time[CPUSTATES];
#endif
long tk_cancc;
long tk_nin;
@@ -465,7 +461,7 @@ statclock(frame)
* Return information about system clocks.
*/
static int
sysctl_kern_clockrate SYSCTL_HANDLER_ARGS
sysctl_kern_clockrate(SYSCTL_HANDLER_ARGS)
{
struct clockinfo clkinfo;
/*
@@ -823,7 +819,7 @@ SYSCTL_INT(_kern_timecounter, OID_AUTO, method, CTLFLAG_RW, &tco_method, 0,
);
static int
sysctl_kern_timecounter_hardware SYSCTL_HANDLER_ARGS
sysctl_kern_timecounter_hardware(SYSCTL_HANDLER_ARGS)
{
char newname[32];
struct timecounter *newtc, *tc;
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.2 2000/06/27 23:14:07 alfred Exp $
* $FreeBSD: src/sys/kern/kern_descrip.c,v 1.81.2.5 2000/10/31 23:11:23 alc Exp $
*/
#include "opt_compat.h"
@@ -1001,6 +1001,8 @@ setugidsafety(p)
if (*fpp != NULL && is_unsafe(*fpp)) {
if ((*fdfp & UF_MAPPED) != 0)
(void) munmapfd(p, i);
if (i < fdp->fd_knlistsize)
knote_fdclose(p, i);
(void) closef(*fpp, p);
*fpp = NULL;
*fdfp = 0;
@@ -1034,6 +1036,8 @@ fdcloseexec(p)
if (*fpp != NULL && (*fdfp & UF_EXCLOSE)) {
if (*fdfp & UF_MAPPED)
(void) munmapfd(p, i);
if (i < fdp->fd_knlistsize)
knote_fdclose(p, i);
(void) closef(*fpp, p);
*fpp = NULL;
*fdfp = 0;
@@ -1269,7 +1273,7 @@ dupfdopen(fdp, indx, dfd, mode, error)
* Get file structures.
*/
static int
sysctl_kern_file SYSCTL_HANDLER_ARGS
sysctl_kern_file(SYSCTL_HANDLER_ARGS)
{
int error;
struct file *fp;
@@ -1306,6 +1310,9 @@ SYSCTL_INT(_kern, KERN_MAXFILESPERPROC, maxfilesperproc, CTLFLAG_RW,
SYSCTL_INT(_kern, KERN_MAXFILES, maxfiles, CTLFLAG_RW,
&maxfiles, 0, "Maximum number of files");
SYSCTL_INT(_kern, OID_AUTO, openfiles, CTLFLAG_RD,
&nfiles, 0, "System-wide number of open files");
static void
fildesc_drvinit(void *unused)
{
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_environment.c,v 1.10 1999/11/24 01:03:00 archie Exp $
* $FreeBSD: src/sys/kern/kern_environment.c,v 1.10.2.1 2000/08/03 00:09:32 ps Exp $
*/
/*
@@ -102,7 +102,7 @@ getenv_quad(char *name, quad_t *data)
}
static int
sysctl_kernenv SYSCTL_HANDLER_ARGS
sysctl_kernenv(SYSCTL_HANDLER_ARGS)
{
int *name = (int *)arg1;
u_int namelen = arg2;
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.2 2000/07/18 21:49:12 jlemon Exp $
* $FreeBSD: src/sys/kern/kern_event.c,v 1.2.2.4 2000/08/23 02:41:41 jhb Exp $
*/
#include <sys/param.h>
@@ -58,7 +58,7 @@ static void filt_procdetach(struct knote *kn);
static int filt_proc(struct knote *kn, long hint);
static int kqueue_scan(struct file *fp, int maxevents,
struct kevent *ulistp, struct timespec *timeout,
struct kevent *ulistp, const struct timespec *timeout,
struct proc *p);
static int kqueue_read(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct proc *p);
@@ -320,11 +320,11 @@ kqueue(struct proc *p, struct kqueue_args *uap)
#ifndef _SYS_SYSPROTO_H_
struct kevent_args {
int fd;
struct kevent *changelist;
const struct kevent *changelist;
int nchanges;
struct kevent *eventlist;
int nevents;
struct timespec *timeout;
const struct timespec *timeout;
};
#endif
int
@@ -413,10 +413,10 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p)
}
if (fops->f_isfd) {
/* validate descriptor; ignore invalid descriptors */
/* validate descriptor */
if ((u_int)kev->ident >= fdp->fd_nfiles ||
(fp = fdp->fd_ofiles[kev->ident]) == NULL)
return (0);
return (EBADF);
if (kev->ident < fdp->fd_knlistsize) {
SLIST_FOREACH(kn, &fdp->fd_knlist[kev->ident], kn_link)
@@ -439,7 +439,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p)
}
if (kn == NULL && ((kev->flags & EV_ADD) == 0))
goto done;
return (ENOENT);
/*
* kn now contains the matching knote, or NULL if no match
@@ -511,7 +511,7 @@ kqueue_register(struct kqueue *kq, struct kevent *kev, struct proc *p)
static int
kqueue_scan(struct file *fp, int maxevents, struct kevent *ulistp,
struct timespec *tsp, struct proc *p)
const struct timespec *tsp, struct proc *p)
{
struct kqueue *kq = (struct kqueue *)fp->f_data;
struct kevent *kevp;
@@ -523,24 +523,28 @@ kqueue_scan(struct file *fp, int maxevents, struct kevent *ulistp,
if (count == 0)
goto done;
if (tsp != NULL) {
if (tsp != NULL) {
TIMESPEC_TO_TIMEVAL(&atv, tsp);
if (itimerfix(&atv)) {
if (itimerfix(&atv)) {
error = EINVAL;
goto done;
}
timeout = atv.tv_sec > 24 * 60 * 60 ?
24 * 60 * 60 * hz : tvtohz(&atv);
getmicrouptime(&rtv);
timevaladd(&atv, &rtv);
} else {
atv.tv_sec = 0;
if (tsp->tv_sec == 0 && tsp->tv_nsec == 0)
timeout = -1;
else
timeout = atv.tv_sec > 24 * 60 * 60 ?
24 * 60 * 60 * hz : tvtohz(&atv);
getmicrouptime(&rtv);
timevaladd(&atv, &rtv);
} else {
atv.tv_sec = 0;
atv.tv_usec = 0;
timeout = 0;
}
goto start;
retry:
if (atv.tv_sec) {
if (atv.tv_sec || atv.tv_usec) {
getmicrouptime(&rtv);
if (timevalcmp(&rtv, &atv, >=))
goto done;
@@ -554,8 +558,12 @@ kqueue_scan(struct file *fp, int maxevents, struct kevent *ulistp,
kevp = kq->kq_kev;
s = splhigh();
if (kq->kq_count == 0) {
kq->kq_state |= KQ_SLEEP;
error = tsleep(kq, PSOCK | PCATCH, "kqread", timeout);
if (timeout < 0) {
error = EWOULDBLOCK;
} else {
kq->kq_state |= KQ_SLEEP;
error = tsleep(kq, PSOCK | PCATCH, "kqread", timeout);
}
splx(s);
if (error == 0)
goto retry;
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.3 2000/07/19 06:23:56 kbyanc Exp $
* $FreeBSD: src/sys/kern/kern_exec.c,v 1.107.2.5 2000/09/21 09:06:43 truckman Exp $
*/
#include <sys/param.h>
@@ -294,7 +294,7 @@ execve(p, uap)
*/
p->p_ucred = crcopy(p->p_ucred);
if (attr.va_mode & VSUID)
p->p_ucred->cr_uid = attr.va_uid;
change_euid(p, attr.va_uid);
if (attr.va_mode & VSGID)
p->p_ucred->cr_gid = attr.va_gid;
setsugid(p);
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_exit.c 8.7 (Berkeley) 2/12/94
* $FreeBSD: src/sys/kern/kern_exit.c,v 1.92.2.1 2000/05/05 03:49:54 jlemon Exp $
* $FreeBSD: src/sys/kern/kern_exit.c,v 1.92.2.3 2000/09/07 19:13:36 truckman Exp $
*/
#include "opt_compat.h"
@@ -472,7 +472,7 @@ wait1(q, uap, compat)
/*
* Decrement the count of procs running with this uid.
*/
(void)chgproccnt(p->p_cred->p_ruid, -1);
(void)chgproccnt(p->p_cred->p_uidinfo, -1, 0);
/*
* Release reference to text vnode
@@ -485,6 +485,7 @@ wait1(q, uap, compat)
*/
if (--p->p_cred->p_refcnt == 0) {
crfree(p->p_ucred);
uifree(p->p_cred->p_uidinfo);
FREE(p->p_cred, M_SUBPROC);
p->p_cred = NULL;
}
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_fork.c 8.6 (Berkeley) 4/8/94
* $FreeBSD: src/sys/kern/kern_fork.c,v 1.72.2.1 2000/05/05 03:49:54 jlemon Exp $
* $FreeBSD: src/sys/kern/kern_fork.c,v 1.72.2.5 2000/09/14 23:21:18 truckman Exp $
*/
#include "opt_ktrace.h"
@@ -153,7 +153,7 @@ static int nextpid = 0;
static int randompid = 0;
static int
sysctl_kern_randompid SYSCTL_HANDLER_ARGS
sysctl_kern_randompid(SYSCTL_HANDLER_ARGS)
{
int error, pid;
@@ -183,7 +183,7 @@ fork1(p1, flags, procp)
struct proc *p2, *pptr;
uid_t uid;
struct proc *newproc;
int count;
int ok;
static int pidchecked = 0;
struct forklist *ep;
@@ -245,9 +245,9 @@ fork1(p1, flags, procp)
* Increment the count of procs running with this uid. Don't allow
* a nonprivileged user to exceed their current limit.
*/
count = chgproccnt(uid, 1);
if (uid != 0 && count > p1->p_rlimit[RLIMIT_NPROC].rlim_cur) {
(void)chgproccnt(uid, -1);
ok = chgproccnt(p1->p_cred->p_uidinfo, 1,
(uid != 0) ? p1->p_rlimit[RLIMIT_NPROC].rlim_cur : 0);
if (!ok) {
/*
* Back out the process count
*/
@@ -359,6 +359,7 @@ fork1(p1, flags, procp)
bcopy(p1->p_cred, p2->p_cred, sizeof(*p2->p_cred));
p2->p_cred->p_refcnt = 1;
crhold(p1->p_ucred);
uihold(p1->p_cred->p_uidinfo);
if (p2->p_prison) {
p2->p_prison->pr_ref++;
Oops, something went wrong.

0 comments on commit 54ffc96

Please sign in to comment.