summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2006-10-21 02:18:01 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2006-10-21 02:18:01 +0000
commit2effa5f52e0f4f0c12cc30c9cc9b1b654f4a1553 (patch)
tree2092f943043e64ff00ed756a848f57f5deb7b5d9 /sys
parent35e93d666997c4a80c78d8a0545cefbaf5456d3c (diff)
tbert sent me a diff to change some 0 to NULL
i got carried away and deleted a whole bunch of useless casts this is C, not C++. ok md5
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_synch.c6
-rw-r--r--sys/kern/sched_bsd.c12
-rw-r--r--sys/kern/uipc_syscalls.c67
3 files changed, 39 insertions, 46 deletions
diff --git a/sys/kern/kern_synch.c b/sys/kern/kern_synch.c
index f9a70ca3dcb..83ddbe84d60 100644
--- a/sys/kern/kern_synch.c
+++ b/sys/kern/kern_synch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_synch.c,v 1.73 2005/12/30 04:02:17 tedu Exp $ */
+/* $OpenBSD: kern_synch.c,v 1.74 2006/10/21 02:18:00 tedu Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*
@@ -342,10 +342,10 @@ restart:
KASSERT(p->p_cpu != NULL);
need_resched(p->p_cpu);
#else
- need_resched(0);
+ need_resched(NULL);
#endif
} else {
- wakeup((caddr_t)&proc0);
+ wakeup(&proc0);
}
/* END INLINE EXPANSION */
diff --git a/sys/kern/sched_bsd.c b/sys/kern/sched_bsd.c
index be3eef98f7f..a08ffe13011 100644
--- a/sys/kern/sched_bsd.c
+++ b/sys/kern/sched_bsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched_bsd.c,v 1.6 2006/10/09 00:31:11 tedu Exp $ */
+/* $OpenBSD: sched_bsd.c,v 1.7 2006/10/21 02:18:00 tedu Exp $ */
/* $NetBSD: kern_synch.c,v 1.37 1996/04/22 01:38:37 christos Exp $ */
/*-
@@ -159,7 +159,7 @@ roundrobin(void *arg)
splx(s);
}
- need_resched(0);
+ need_resched(NULL);
timeout_add(to, hz / 10);
}
#endif
@@ -272,7 +272,7 @@ schedcpu(void *arg)
phz = stathz ? stathz : profhz;
KASSERT(phz);
- for (p = LIST_FIRST(&allproc); p != 0; p = LIST_NEXT(p, p_list)) {
+ for (p = LIST_FIRST(&allproc); p != NULL; p = LIST_NEXT(p, p_list)) {
/*
* Increment time in/out of memory and sleep time
* (if sleeping). We ignore overflow; with 16-bit int's
@@ -321,7 +321,7 @@ schedcpu(void *arg)
SCHED_UNLOCK(s);
}
uvm_meter();
- wakeup((caddr_t)&lbolt);
+ wakeup(&lbolt);
timeout_add(to, hz);
}
@@ -582,7 +582,7 @@ resched_proc(struct proc *p, u_char pri)
need_resched(ci);
#else
if (pri < curpriority)
- need_resched(0);
+ need_resched(NULL);
#endif
}
@@ -624,7 +624,7 @@ setrunnable(struct proc *p)
updatepri(p);
p->p_slptime = 0;
if ((p->p_flag & P_INMEM) == 0)
- wakeup((caddr_t)&proc0);
+ wakeup(&proc0);
else
resched_proc(p, p->p_priority);
}
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 214ac7b7461..bd8c22a50cb 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.64 2006/10/18 14:43:45 kurt Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.65 2006/10/21 02:18:00 tedu Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -112,7 +112,7 @@ sys_bind(struct proc *p, void *v, register_t *retval)
error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen),
MT_SONAME);
if (error == 0) {
- error = sobind((struct socket *)fp->f_data, nam);
+ error = sobind(fp->f_data, nam);
m_freem(nam);
}
FRELE(fp);
@@ -132,7 +132,7 @@ sys_listen(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error);
- error = solisten((struct socket *)fp->f_data, SCARG(uap, backlog));
+ error = solisten(fp->f_data, SCARG(uap, backlog));
FRELE(fp);
return (error);
}
@@ -159,7 +159,7 @@ sys_accept(struct proc *p, void *v, register_t *retval)
return (error);
headfp = fp;
s = splsoftnet();
- head = (struct socket *)fp->f_data;
+ head = fp->f_data;
if ((head->so_options & SO_ACCEPTCONN) == 0) {
error = EINVAL;
goto bad;
@@ -267,7 +267,7 @@ sys_connect(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error);
- so = (struct socket *)fp->f_data;
+ so = fp->f_data;
if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
FRELE(fp);
return (EALREADY);
@@ -516,8 +516,7 @@ sendit(struct proc *p, int s, struct msghdr *mp, int flags, register_t *retsize)
}
#endif
len = auio.uio_resid;
- error = sosend((struct socket *)fp->f_data, to, &auio,
- NULL, control, flags);
+ error = sosend(fp->f_data, to, &auio, NULL, control, flags);
if (error) {
if (auio.uio_resid != len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
@@ -664,8 +663,8 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
}
#endif
len = auio.uio_resid;
- error = soreceive((struct socket *)fp->f_data, &from, &auio,
- NULL, mp->msg_control ? &control : NULL,
+ error = soreceive(fp->f_data, &from, &auio, NULL,
+ mp->msg_control ? &control : NULL,
&mp->msg_flags);
if (error) {
if (auio.uio_resid != len && (error == ERESTART ||
@@ -699,8 +698,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
mtod(from, struct osockaddr *)->sa_family =
mtod(from, struct sockaddr *)->sa_family;
#endif
- error = copyout(mtod(from, caddr_t),
- mp->msg_name, alen);
+ error = copyout(mtod(from, caddr_t), mp->msg_name, alen);
if (error)
goto out;
}
@@ -741,7 +739,7 @@ recvit(struct proc *p, int s, struct msghdr *mp, caddr_t namelenp,
len = 0;
else {
struct mbuf *m = control;
- caddr_t p = (caddr_t)mp->msg_control;
+ caddr_t p = mp->msg_control;
do {
i = m->m_len;
@@ -788,7 +786,7 @@ sys_shutdown(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error);
- error = soshutdown((struct socket *)fp->f_data, SCARG(uap, how));
+ error = soshutdown(fp->f_data, SCARG(uap, how));
FRELE(fp);
return (error);
}
@@ -834,7 +832,7 @@ sys_setsockopt(struct proc *p, void *v, register_t *retval)
}
m->m_len = SCARG(uap, valsize);
}
- error = sosetopt((struct socket *)fp->f_data, SCARG(uap, level),
+ error = sosetopt(fp->f_data, SCARG(uap, level),
SCARG(uap, name), m);
m = NULL;
bad:
@@ -863,26 +861,26 @@ sys_getsockopt(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error);
if (SCARG(uap, val)) {
- error = copyin((caddr_t)SCARG(uap, avalsize),
- (caddr_t)&valsize, sizeof (valsize));
+ error = copyin(SCARG(uap, avalsize),
+ &valsize, sizeof (valsize));
if (error)
goto out;
} else
valsize = 0;
- if ((error = sogetopt((struct socket *)fp->f_data, SCARG(uap, level),
+ if ((error = sogetopt(fp->f_data, SCARG(uap, level),
SCARG(uap, name), &m)) == 0 && SCARG(uap, val) && valsize &&
m != NULL) {
if (valsize > m->m_len)
valsize = m->m_len;
error = copyout(mtod(m, caddr_t), SCARG(uap, val), valsize);
if (error == 0)
- error = copyout((caddr_t)&valsize,
- (caddr_t)SCARG(uap, avalsize), sizeof (valsize));
+ error = copyout(&valsize,
+ SCARG(uap, avalsize), sizeof (valsize));
}
out:
FRELE(fp);
if (m != NULL)
- (void) m_free(m);
+ (void)m_free(m);
return (error);
}
@@ -900,8 +898,7 @@ sys_pipe(struct proc *p, void *v, register_t *retval)
fds[0] = rval[0];
fds[1] = rval[1];
- error = copyout((caddr_t)fds, (caddr_t)SCARG(uap, fdp),
- 2 * sizeof (int));
+ error = copyout(fds, SCARG(uap, fdp), 2 * sizeof (int));
if (error) {
fdplock(p->p_fd);
fdrelease(p, fds[0]);
@@ -931,20 +928,19 @@ sys_getsockname(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
return (error);
- error = copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, sizeof (len));
+ error = copyin(SCARG(uap, alen), &len, sizeof (len));
if (error)
goto bad;
- so = (struct socket *)fp->f_data;
+ so = fp->f_data;
m = m_getclr(M_WAIT, MT_SONAME);
error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0);
if (error)
goto bad;
if (len > m->m_len)
len = m->m_len;
- error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), len);
+ error = copyout(mtod(m, caddr_t), SCARG(uap, asa), len);
if (error == 0)
- error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen),
- sizeof (len));
+ error = copyout(&len, SCARG(uap, alen), sizeof (len));
bad:
FRELE(fp);
if (m)
@@ -972,12 +968,12 @@ sys_getpeername(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
return (error);
- so = (struct socket *)fp->f_data;
+ so = fp->f_data;
if ((so->so_state & (SS_ISCONNECTED|SS_ISCONFIRMING)) == 0) {
FRELE(fp);
return (ENOTCONN);
}
- error = copyin((caddr_t)SCARG(uap, alen), (caddr_t)&len, sizeof (len));
+ error = copyin(SCARG(uap, alen), &len, sizeof (len));
if (error)
goto bad;
m = m_getclr(M_WAIT, MT_SONAME);
@@ -986,10 +982,9 @@ sys_getpeername(struct proc *p, void *v, register_t *retval)
goto bad;
if (len > m->m_len)
len = m->m_len;
- error = copyout(mtod(m, caddr_t), (caddr_t)SCARG(uap, asa), len);
+ error = copyout(mtod(m, caddr_t), SCARG(uap, asa), len);
if (error == 0)
- error = copyout((caddr_t)&len, (caddr_t)SCARG(uap, alen),
- sizeof (len));
+ error = copyout(&len, SCARG(uap, alen), sizeof (len));
bad:
FRELE(fp);
m_freem(m);
@@ -1016,7 +1011,7 @@ sys_getpeereid(struct proc *p, void *v, register_t *retval)
if ((error = getsock(p->p_fd, SCARG(uap, fdes), &fp)) != 0)
return (error);
- so = (struct socket *)fp->f_data;
+ so = fp->f_data;
if (so->so_proto != pffindtype(AF_LOCAL, SOCK_STREAM)) {
FRELE(fp);
return (EOPNOTSUPP);
@@ -1032,11 +1027,9 @@ sys_getpeereid(struct proc *p, void *v, register_t *retval)
if (error)
goto bad;
id = mtod(m, struct unpcbid *);
- error = copyout((caddr_t)&(id->unp_euid),
- (caddr_t)SCARG(uap, euid), sizeof(uid_t));
+ error = copyout(&(id->unp_euid), SCARG(uap, euid), sizeof(uid_t));
if (error == 0)
- error = copyout((caddr_t)&(id->unp_egid),
- (caddr_t)SCARG(uap, egid), sizeof(gid_t));
+ error = copyout(&(id->unp_egid), SCARG(uap, egid), sizeof(gid_t));
bad:
FRELE(fp);
m_freem(m);