Subject: Fully prototyped kernel
To: None <tech-kern@NetBSD.ORG>
From: Christos Zoulas <christos@deshaw.com>
List: tech-kern
Date: 07/31/1995 05:45:08
I just wanted to report some progress in adding prototypes and making
the whole kernel pass gcc -Wall.
- Most of the filesystem code is done
- 70% of the networking code is done.
- All of kern, vm, ddb, is done.
- All the sys headers are done.
In doing this I have found and fixed approximately 10 bugs [incorrect
argument passing, incorrect variable use, uninitialized variables, some
of which will definitely drop you to the kernel debugger..., some in
miscfs/union some in netccitt etc...] What is the status of netiso and
netccitt? Is anybody using them? Do they actually work?
The biggest question is what to do with the protocol switch; unfortunately
there is no way to fully prototype in input and output functions...
Here's the current prototype that I am using. Does anybody have any
better ideas? It looks to me like the protocol switch was an afterthought,
and there are lots of places where it is violated.
My final problem is that the diffs are getting to be *very* large...
christos
struct protosw {
short pr_type; /* socket type used for */
struct domain *pr_domain; /* domain protocol a member of */
short pr_protocol; /* protocol number */
short pr_flags; /* see below */
/* protocol-protocol hooks */
void (*pr_input) /* input to protocol (from below) */
__P((struct mbuf *, ...));
int (*pr_output) /* output to protocol (from above) */
__P((struct mbuf *, ...));
void *(*pr_ctlinput) /* control input (from below) */
__P((int, struct sockaddr *, void *));
int (*pr_ctloutput) /* control output (from above) */
__P((int, struct socket *, int, int, struct mbuf **));
int (*pr_usrreq) /* user request: see list below */
__P((struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *));
/* utility hooks */
void (*pr_init) /* initialization hook */
__P((void));
void (*pr_fasttimo) /* fast timeout (200ms) */
__P((void));
void (*pr_slowtimo) /* slow timeout (500ms) */
__P((void));
void (*pr_drain) /* flush any excess space possible */
__P((void));
int (*pr_sysctl) /* sysctl for protocol */
__P((int *, u_int, void *, size_t *, void *, size_t));
};