#include "spinlock.h"
struct spinlock console_lock;
-int paniced = 0;
+int panicked = 0;
int use_console_lock = 0;
/*
unsigned short *crt = (unsigned short *) 0xB8000; // base of CGA memory
int ind;
- if(paniced){
+ if(panicked){
cli();
- while(1)
+ for(;;)
;
}
cprintf("panic: ");
cprintf(s, 0);
cprintf("\n", 0);
- paniced = 1; // freeze other CPU
- while(1)
+ panicked = 1; // freeze other CPU
+ for(;;)
;
}
int pipe_read(struct pipe *p, char *addr, int n);
// fd.c
-int fd_ualloc();
-struct fd * fd_alloc();
+int fd_ualloc(void);
+struct fd * fd_alloc(void);
void fd_close(struct fd *);
int fd_read(struct fd *fd, char *addr, int n);
int fd_write(struct fd *fd, char *addr, int n);
* allocate a file descriptor number for curproc.
*/
int
-fd_ualloc()
+fd_ualloc(void)
{
int fd;
struct proc *p = curproc[cpu()];
* allocate a file descriptor structure
*/
struct fd *
-fd_alloc()
+fd_alloc(void)
{
int i;
};
struct run *freelist;
-void ktest();
+void ktest(void);
/*
* initialize free list of physical pages. this code
void
-lapic_timerinit()
+lapic_timerinit(void)
{
cprintf("%d: init timer\n", cpu());
lapic_write(LAPIC_TDCR, LAPIC_X1);
}
void
-lapic_timerintr()
+lapic_timerintr(void)
{
cprintf("%d: timer interrupt!\n", cpu());
lapic_write (LAPIC_EOI, 0);
}
void
-mp_init()
+mp_init(void)
{
int r;
uint8_t *p, *e;
extern void mpmain(void);
void
-mp_startthem()
+mp_startthem(void)
{
extern uint8_t _binary_bootother_start[], _binary_bootother_size[];
extern int main();
// Exited processes remain in the zombie state
// until their parent calls wait() to find out they exited.
void
-proc_exit()
+proc_exit(void)
{
struct proc *p;
struct proc *cp = curproc[cpu()];
struct Gatedesc idt[256];
extern unsigned vectors[]; /* vectors.S, array of 256 entry point addresses */
-extern void trapenter();
-extern void trapenter1();
+extern void trapenter(void);
+extern void trapenter1(void);
void
-tvinit()
+tvinit(void)
{
int i;
}
void
-idtinit()
+idtinit(void)
{
lidt(idt, sizeof idt);
}
char buf[32];
int
-main()
+main(void)
{
int pid, fds[2], n;
char buf[1024];
int
-main()
+main(void)
{
puts("userfs running\n");
block();
// simple fork and pipe read/write
void
-pipe1()
+pipe1(void)
{
int fds[2], pid;
int seq = 0, i, n, cc, total;
close(fds[1]);
total = 0;
cc = 1;
- while(1){
- n = read(fds[0], buf, cc);
- if(n < 1)
- break;
+ while((n = read(fds[0], buf, cc)) > 0){
for(i = 0; i < n; i++){
if((buf[i] & 0xff) != (seq++ & 0xff)){
panic("pipe1 oops 2\n");
// meant to be run w/ at most two CPUs
void
-preempt()
+preempt(void)
{
int pid1, pid2, pid3;
int pfds[2];
pid1 = fork();
if(pid1 == 0)
- while(1)
+ for(;;)
;
pid2 = fork();
if(pid2 == 0)
- while(1)
+ for(;;)
;
pipe(pfds);
if(write(pfds[1], "x", 1) != 1)
panic("preempt write error");
close(pfds[1]);
- while(1)
+ for(;;)
;
}
// try to find any races between exit and wait
void
-exitwait()
+exitwait(void)
{
int i, pid;
}
int
-main()
+main(void)
{
puts("usertests starting\n");