summary |
tags |
clone url |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1bb676c)
SCCS-vsn: sys/kern/kern_ktrace.c 7.6
SCCS-vsn: sys/kern/kern_sysctl.c 7.10
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)kern_ktrace.c 7.5 (Berkeley) %G%
+ * @(#)kern_ktrace.c 7.6 (Berkeley) %G%
*/
#ifdef KTRACE
#include "param.h"
*/
#ifdef KTRACE
#include "param.h"
#include "proc.h"
#include "file.h"
#include "vnode.h"
#include "proc.h"
#include "file.h"
#include "vnode.h"
-ktrsyscall(vp, code, narg)
+ktrsyscall(vp, code, narg, args)
+ int code, narg, args[];
{
struct ktr_header *kth = ktrgetheader(KTR_SYSCALL);
struct ktr_syscall *ktp;
{
struct ktr_header *kth = ktrgetheader(KTR_SYSCALL);
struct ktr_syscall *ktp;
ktp->ktr_narg = narg;
argp = (int *)((char *)ktp + sizeof(struct ktr_syscall));
for (i = 0; i < narg; i++)
ktp->ktr_narg = narg;
argp = (int *)((char *)ktp + sizeof(struct ktr_syscall));
for (i = 0; i < narg; i++)
kth->ktr_buf = (caddr_t)ktp;
kth->ktr_len = len;
ktrwrite(vp, kth);
kth->ktr_buf = (caddr_t)ktp;
kth->ktr_len = len;
ktrwrite(vp, kth);
+ktrsysret(vp, code, error, retval)
+ int code, error, retval;
{
struct ktr_header *kth = ktrgetheader(KTR_SYSRET);
struct ktr_sysret ktp;
{
struct ktr_header *kth = ktrgetheader(KTR_SYSRET);
struct ktr_sysret ktp;
if (kth == NULL)
return;
ktp.ktr_code = code;
if (kth == NULL)
return;
ktp.ktr_code = code;
- ktp.ktr_error = u.u_error;
- ktp.ktr_retval = u.u_r.r_val1; /* what about val2 ? */
+ ktp.ktr_error = error;
+ ktp.ktr_retval = retval; /* what about val2 ? */
kth->ktr_buf = (caddr_t)&ktp;
kth->ktr_len = sizeof(struct ktr_sysret);
kth->ktr_buf = (caddr_t)&ktp;
kth->ktr_len = sizeof(struct ktr_sysret);
-ktrgenio(vp, fd, rw, iov, len)
+ktrgenio(vp, fd, rw, iov, len, error)
enum uio_rw rw;
register struct iovec *iov;
{
enum uio_rw rw;
register struct iovec *iov;
{
register caddr_t cp;
register int resid = len, cnt;
register caddr_t cp;
register int resid = len, cnt;
- if (kth == NULL || u.u_error)
+ if (kth == NULL || error)
return;
MALLOC(ktp, struct ktr_genio *, sizeof(struct ktr_genio) + len,
M_TEMP, M_WAITOK);
return;
MALLOC(ktp, struct ktr_genio *, sizeof(struct ktr_genio) + len,
M_TEMP, M_WAITOK);
/*
* ktrace system call
*/
/*
* ktrace system call
*/
-ktrace()
-{
- register struct a {
+/* ARGSUSED */
+ktrace(curp, uap, retval)
+ struct proc *curp;
+ register struct args {
char *fname;
int ops;
int facs;
int pid;
char *fname;
int ops;
int facs;
int pid;
- } *uap = (struct a *)u.u_ap;
+ } *uap;
+ int *retval;
+{
register struct vnode *vp = NULL;
register struct nameidata *ndp = &u.u_nd;
register struct proc *p;
register struct vnode *vp = NULL;
register struct nameidata *ndp = &u.u_nd;
register struct proc *p;
struct pgrp *pg;
register int facs = uap->facs;
register int ret = 0;
struct pgrp *pg;
register int facs = uap->facs;
register int ret = 0;
/*
* Until security implications are thought through,
* limit tracing to root (unless ktrace_nocheck is set).
*/
/*
* Until security implications are thought through,
* limit tracing to root (unless ktrace_nocheck is set).
*/
- if (!ktrace_nocheck && (u.u_error = suser(u.u_cred, &u.u_acflag)))
- return;
+ if (!ktrace_nocheck && (error = suser(u.u_cred, &u.u_acflag)))
+ RETURN (error);
if (ops != KTROP_CLEAR) {
/*
* an operation which requires a file argument.
*/
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = uap->fname;
if (ops != KTROP_CLEAR) {
/*
* an operation which requires a file argument.
*/
ndp->ni_segflg = UIO_USERSPACE;
ndp->ni_dirp = uap->fname;
- if (u.u_error = vn_open(ndp, FREAD|FWRITE, 0))
- return;
+ if (error = vn_open(ndp, FREAD|FWRITE, 0))
+ RETURN (error);
vp = ndp->ni_vp;
if (vp->v_type != VREG) {
vp = ndp->ni_vp;
if (vp->v_type != VREG) {
* need something to (un)trace
*/
if (!facs) {
* need something to (un)trace
*/
if (!facs) {
if (uap->pid < 0) {
pg = pgfind(-uap->pid);
if (pg == NULL) {
if (uap->pid < 0) {
pg = pgfind(-uap->pid);
if (pg == NULL) {
goto done;
}
for (p = pg->pg_mem; p != NULL; p = p->p_pgrpnxt)
goto done;
}
for (p = pg->pg_mem; p != NULL; p = p->p_pgrpnxt)
} else {
p = pfind(uap->pid);
if (p == NULL) {
} else {
p = pfind(uap->pid);
if (p == NULL) {
goto done;
}
if (ops&KTRFLAG_DESCEND)
goto done;
}
if (ops&KTRFLAG_DESCEND)
ret |= ktrops(p, ops, facs, vp);
}
if (!ret)
ret |= ktrops(p, ops, facs, vp);
}
if (!ret)
done:
if (vp != NULL)
vrele(vp);
done:
if (vp != NULL)
vrele(vp);
}
ktrops(p, ops, facs, vp)
}
ktrops(p, ops, facs, vp)
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * @(#)kern_sysctl.c 7.9 (Berkeley) %G%
+ * @(#)kern_sysctl.c 7.10 (Berkeley) %G%
extern int kinfo_doproc(), kinfo_rtable(), kinfo_vnode();
struct kinfo_lock kinfo_lock;
extern int kinfo_doproc(), kinfo_rtable(), kinfo_vnode();
struct kinfo_lock kinfo_lock;
-getkerninfo()
-{
- register struct a {
+/* ARGSUSED */
+getkerninfo(p, uap, retval)
+ struct proc *p;
+ register struct args {
int op;
char *where;
int *size;
int arg;
int op;
char *where;
int *size;
int arg;
- } *uap = (struct a *)u.u_ap;
+ } *uap;
+ int *retval;
+{
int bufsize, /* max size of users buffer */
needed, locked, (*server)(), error = 0;
int bufsize, /* max size of users buffer */
needed, locked, (*server)(), error = 0;
if (kinfo_lock.kl_want)
wakeup(&kinfo_lock);
done:
if (kinfo_lock.kl_want)
wakeup(&kinfo_lock);
done:
- if (error)
- u.u_error = error;
- else
- u.u_r.r_val1 = needed;
+ if (!error)
+ *retval = needed;
+ return (error);