Compare commits
No commits in common. "d6793bf093b7a47f8337968e8208723faf50d442" and "6a4ad2779606f4ff426eb8975b31222353e424ad" have entirely different histories.
d6793bf093
...
6a4ad27796
61 changed files with 2001 additions and 1958 deletions
|
@ -18,7 +18,7 @@ AlignConsecutiveBitFields:
|
|||
AlignFunctionPointers: false
|
||||
PadOperators: false
|
||||
AlignConsecutiveDeclarations:
|
||||
Enabled: true
|
||||
Enabled: false
|
||||
AcrossEmptyLines: false
|
||||
AcrossComments: false
|
||||
AlignCompound: false
|
||||
|
@ -64,7 +64,7 @@ BitFieldColonSpacing: Both
|
|||
BraceWrapping:
|
||||
AfterCaseLabel: true
|
||||
AfterClass: true
|
||||
AfterControlStatement: false
|
||||
AfterControlStatement: Always
|
||||
AfterEnum: true
|
||||
AfterExternBlock: true
|
||||
AfterFunction: true
|
||||
|
@ -86,7 +86,7 @@ BreakAfterJavaFieldAnnotations: false
|
|||
BreakArrays: true
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeConceptDeclarations: Always
|
||||
BreakBeforeBraces: Linux
|
||||
BreakBeforeBraces: GNU
|
||||
BreakBeforeInlineASMColon: OnlyMultiline
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
|
@ -136,7 +136,7 @@ IndentRequiresClause: true
|
|||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
InsertBraces: false
|
||||
InsertNewlineAtEOF: true
|
||||
InsertNewlineAtEOF: false
|
||||
InsertTrailingCommas: None
|
||||
IntegerLiteralSeparator:
|
||||
Binary: 0
|
||||
|
@ -198,7 +198,7 @@ SpaceBeforeCpp11BracedList: false
|
|||
SpaceBeforeCtorInitializerColon: true
|
||||
SpaceBeforeInheritanceColon: true
|
||||
SpaceBeforeJsonColon: false
|
||||
SpaceBeforeParens: false
|
||||
SpaceBeforeParens: Never
|
||||
SpaceBeforeParensOptions:
|
||||
AfterControlStatements: false
|
||||
AfterForeachMacros: false
|
||||
|
@ -206,11 +206,11 @@ SpaceBeforeParensOptions:
|
|||
AfterFunctionDeclarationName: false
|
||||
AfterIfMacros: false
|
||||
AfterOverloadedOperator: false
|
||||
AfterPlacementOperator: false
|
||||
AfterPlacementOperator: true
|
||||
AfterRequiresInClause: false
|
||||
AfterRequiresInExpression: false
|
||||
BeforeNonEmptyParentheses: false
|
||||
SpaceBeforeRangeBasedForLoopColon: false
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpacesBeforeTrailingComments: 1
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
// * Only one process at a time can use a buffer,
|
||||
// so do not keep them longer than necessary.
|
||||
|
||||
|
||||
#include "types.h"
|
||||
#include "param.h"
|
||||
#include "spinlock.h"
|
||||
|
@ -136,17 +137,17 @@ brelse(struct buf *b)
|
|||
}
|
||||
|
||||
void
|
||||
bpin(struct buf *b)
|
||||
{
|
||||
bpin(struct buf *b) {
|
||||
acquire(&bcache.lock);
|
||||
b->refcnt++;
|
||||
release(&bcache.lock);
|
||||
}
|
||||
|
||||
void
|
||||
bunpin(struct buf *b)
|
||||
{
|
||||
bunpin(struct buf *b) {
|
||||
acquire(&bcache.lock);
|
||||
b->refcnt--;
|
||||
release(&bcache.lock);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -9,3 +9,4 @@ struct buf {
|
|||
struct buf *next;
|
||||
u8 data[BSIZE];
|
||||
};
|
||||
|
||||
|
|
|
@ -35,9 +35,7 @@ consputc(int c)
|
|||
{
|
||||
if(c == BACKSPACE){
|
||||
// if the user typed backspace, overwrite with a space.
|
||||
uartputc_sync('\b');
|
||||
uartputc_sync(' ');
|
||||
uartputc_sync('\b');
|
||||
uartputc_sync('\b'); uartputc_sync(' '); uartputc_sync('\b');
|
||||
} else {
|
||||
uartputc_sync(c);
|
||||
}
|
||||
|
@ -144,7 +142,8 @@ consoleintr(int c)
|
|||
procdump();
|
||||
break;
|
||||
case C('U'): // Kill line.
|
||||
while(cons.e != cons.w && cons.buf[(cons.e - 1) % INPUT_BUF_SIZE] != '\n') {
|
||||
while(cons.e != cons.w &&
|
||||
cons.buf[(cons.e-1) % INPUT_BUF_SIZE] != '\n'){
|
||||
cons.e--;
|
||||
consputc(BACKSPACE);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
|
||||
static int loadseg(pde_t *, u64, struct inode *, u32, u32);
|
||||
|
||||
int
|
||||
flags2perm(int flags)
|
||||
int flags2perm(int flags)
|
||||
{
|
||||
int perm = 0;
|
||||
if(flags & 0x1)
|
||||
|
|
|
@ -179,3 +179,4 @@ filewrite(struct file *f, u64 addr, int n)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ readsb(int dev, struct superblock *sb)
|
|||
|
||||
// Init fs
|
||||
void
|
||||
fsinit(int dev)
|
||||
{
|
||||
fsinit(int dev) {
|
||||
readsb(dev, &sb);
|
||||
if(sb.magic != FSMAGIC)
|
||||
panic("invalid file system");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// On-disk file system format.
|
||||
// Both the kernel and user programs use this header file.
|
||||
|
||||
|
||||
#define ROOTINO 1 // root i-number
|
||||
#define BSIZE 1024 // block size
|
||||
|
||||
|
@ -56,3 +57,4 @@ struct dirent {
|
|||
u16 inum;
|
||||
char name[DIRSIZ];
|
||||
};
|
||||
|
||||
|
|
|
@ -233,3 +233,4 @@ log_write(struct buf *b)
|
|||
}
|
||||
release(&log.lock);
|
||||
}
|
||||
|
||||
|
|
|
@ -187,14 +187,16 @@ proc_pagetable(struct proc *p)
|
|||
// at the highest user virtual address.
|
||||
// only the supervisor uses it, on the way
|
||||
// to/from user space, so not PTE_U.
|
||||
if(mappages(pagetable, TRAMPOLINE, PGSIZE, (u64)trampoline, PTE_R | PTE_X) < 0) {
|
||||
if(mappages(pagetable, TRAMPOLINE, PGSIZE,
|
||||
(u64)trampoline, PTE_R | PTE_X) < 0){
|
||||
uvmfree(pagetable, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// map the trapframe page just below the trampoline page, for
|
||||
// trampoline.S.
|
||||
if(mappages(pagetable, TRAPFRAME, PGSIZE, (u64)(p->trapframe), PTE_R | PTE_W) < 0) {
|
||||
if(mappages(pagetable, TRAPFRAME, PGSIZE,
|
||||
(u64)(p->trapframe), PTE_R | PTE_W) < 0){
|
||||
uvmunmap(pagetable, TRAMPOLINE, 1, 0);
|
||||
uvmfree(pagetable, 0);
|
||||
return 0;
|
||||
|
@ -216,10 +218,15 @@ proc_freepagetable(pagetable_t pagetable, u64 sz)
|
|||
// a user program that calls exec("/init")
|
||||
// assembled from ../user/initcode.S
|
||||
// od -t xC ../user/initcode
|
||||
u8 initcode[]
|
||||
= { 0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x02, 0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x35, 0x02, 0x93, 0x08,
|
||||
0x70, 0x00, 0x73, 0x00, 0x00, 0x00, 0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00, 0xef, 0xf0, 0x9f, 0xff,
|
||||
0x2f, 0x69, 0x6e, 0x69, 0x74, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
u8 initcode[] = {
|
||||
0x17, 0x05, 0x00, 0x00, 0x13, 0x05, 0x45, 0x02,
|
||||
0x97, 0x05, 0x00, 0x00, 0x93, 0x85, 0x35, 0x02,
|
||||
0x93, 0x08, 0x70, 0x00, 0x73, 0x00, 0x00, 0x00,
|
||||
0x93, 0x08, 0x20, 0x00, 0x73, 0x00, 0x00, 0x00,
|
||||
0xef, 0xf0, 0x9f, 0xff, 0x2f, 0x69, 0x6e, 0x69,
|
||||
0x74, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
// Set up first user process.
|
||||
void
|
||||
|
@ -401,7 +408,8 @@ wait(u64 addr)
|
|||
if(pp->state == ZOMBIE){
|
||||
// Found one.
|
||||
pid = pp->pid;
|
||||
if(addr != 0 && copyout(p->pagetable, addr, (char *)&pp->xstate, sizeof(pp->xstate)) < 0) {
|
||||
if(addr != 0 && copyout(p->pagetable, addr, (char *)&pp->xstate,
|
||||
sizeof(pp->xstate)) < 0) {
|
||||
release(&pp->lock);
|
||||
release(&wait_lock);
|
||||
return -1;
|
||||
|
@ -651,7 +659,12 @@ void
|
|||
procdump(void)
|
||||
{
|
||||
static char *states[] = {
|
||||
[UNUSED] "unused", [USED] "used", [SLEEPING] "sleep ", [RUNNABLE] "runble", [RUNNING] "run ", [ZOMBIE] "zombie"
|
||||
[UNUSED] "unused",
|
||||
[USED] "used",
|
||||
[SLEEPING] "sleep ",
|
||||
[RUNNABLE] "runble",
|
||||
[RUNNING] "run ",
|
||||
[ZOMBIE] "zombie"
|
||||
};
|
||||
struct proc *p;
|
||||
char *state;
|
||||
|
|
|
@ -50,3 +50,6 @@ holdingsleep(struct sleeplock *lk)
|
|||
release(&lk->lk);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@ struct sleeplock {
|
|||
char *name; // Name of lock.
|
||||
int pid; // Process holding lock
|
||||
};
|
||||
|
||||
|
|
|
@ -6,3 +6,4 @@ struct spinlock {
|
|||
char *name; // Name of lock.
|
||||
struct cpu *cpu; // The cpu holding the lock.
|
||||
};
|
||||
|
||||
|
|
|
@ -104,3 +104,4 @@ strlen(const char *s)
|
|||
;
|
||||
return n;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,11 +105,26 @@ extern u64 sys_close(void);
|
|||
// An array mapping syscall numbers from syscall.h
|
||||
// to the function that handles the system call.
|
||||
static u64 (*syscalls[])(void) = {
|
||||
[SYS_fork] sys_fork, [SYS_exit] sys_exit, [SYS_wait] sys_wait, [SYS_pipe] sys_pipe,
|
||||
[SYS_read] sys_read, [SYS_kill] sys_kill, [SYS_exec] sys_exec, [SYS_fstat] sys_fstat,
|
||||
[SYS_chdir] sys_chdir, [SYS_dup] sys_dup, [SYS_getpid] sys_getpid, [SYS_sbrk] sys_sbrk,
|
||||
[SYS_sleep] sys_sleep, [SYS_uptime] sys_uptime, [SYS_open] sys_open, [SYS_write] sys_write,
|
||||
[SYS_mknod] sys_mknod, [SYS_unlink] sys_unlink, [SYS_link] sys_link, [SYS_mkdir] sys_mkdir,
|
||||
[SYS_fork] sys_fork,
|
||||
[SYS_exit] sys_exit,
|
||||
[SYS_wait] sys_wait,
|
||||
[SYS_pipe] sys_pipe,
|
||||
[SYS_read] sys_read,
|
||||
[SYS_kill] sys_kill,
|
||||
[SYS_exec] sys_exec,
|
||||
[SYS_fstat] sys_fstat,
|
||||
[SYS_chdir] sys_chdir,
|
||||
[SYS_dup] sys_dup,
|
||||
[SYS_getpid] sys_getpid,
|
||||
[SYS_sbrk] sys_sbrk,
|
||||
[SYS_sleep] sys_sleep,
|
||||
[SYS_uptime] sys_uptime,
|
||||
[SYS_open] sys_open,
|
||||
[SYS_write] sys_write,
|
||||
[SYS_mknod] sys_mknod,
|
||||
[SYS_unlink] sys_unlink,
|
||||
[SYS_link] sys_link,
|
||||
[SYS_mkdir] sys_mkdir,
|
||||
[SYS_close] sys_close,
|
||||
};
|
||||
|
||||
|
@ -125,7 +140,8 @@ syscall(void)
|
|||
// and store its return value in p->trapframe->a0
|
||||
p->trapframe->a0 = syscalls[num]();
|
||||
} else {
|
||||
printf("%d %s: unknown sys call %d\n", p->pid, p->name, num);
|
||||
printf("%d %s: unknown sys call %d\n",
|
||||
p->pid, p->name, num);
|
||||
p->trapframe->a0 = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -396,7 +396,8 @@ sys_mknod(void)
|
|||
begin_op();
|
||||
argint(1, &major);
|
||||
argint(2, &minor);
|
||||
if((argstr(0, path, MAXPATH)) < 0 || (ip = create(path, T_DEVICE, major, minor)) == 0) {
|
||||
if((argstr(0, path, MAXPATH)) < 0 ||
|
||||
(ip = create(path, T_DEVICE, major, minor)) == 0){
|
||||
end_op();
|
||||
return -1;
|
||||
}
|
||||
|
@ -492,8 +493,8 @@ sys_pipe(void)
|
|||
fileclose(wf);
|
||||
return -1;
|
||||
}
|
||||
if(copyout(p->pagetable, fdarray, (char *)&fd0, sizeof(fd0)) < 0
|
||||
|| copyout(p->pagetable, fdarray + sizeof(fd0), (char *)&fd1, sizeof(fd1)) < 0) {
|
||||
if(copyout(p->pagetable, fdarray, (char*)&fd0, sizeof(fd0)) < 0 ||
|
||||
copyout(p->pagetable, fdarray+sizeof(fd0), (char *)&fd1, sizeof(fd1)) < 0){
|
||||
p->ofile[fd0] = 0;
|
||||
p->ofile[fd1] = 0;
|
||||
fileclose(rf);
|
||||
|
|
|
@ -179,7 +179,8 @@ devintr()
|
|||
{
|
||||
u64 scause = r_scause();
|
||||
|
||||
if((scause & 0x8000000000000000L) && (scause & 0xff) == 9) {
|
||||
if((scause & 0x8000000000000000L) &&
|
||||
(scause & 0xff) == 9){
|
||||
// this is a supervisor external interrupt, via PLIC.
|
||||
|
||||
// irq indicates which device interrupted.
|
||||
|
@ -217,3 +218,4 @@ devintr()
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,7 @@ uartputc(int c)
|
|||
release(&uart_tx_lock);
|
||||
}
|
||||
|
||||
|
||||
// alternate version of uartputc() that doesn't
|
||||
// use interrupts, for use by kernel printf() and
|
||||
// to echo characters. it spins waiting for the uart's
|
||||
|
|
|
@ -65,8 +65,10 @@ virtio_disk_init(void)
|
|||
|
||||
initlock(&disk.vdisk_lock, "virtio_disk");
|
||||
|
||||
if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 || *R(VIRTIO_MMIO_VERSION) != 2 || *R(VIRTIO_MMIO_DEVICE_ID) != 2
|
||||
|| *R(VIRTIO_MMIO_VENDOR_ID) != 0x554d4551) {
|
||||
if(*R(VIRTIO_MMIO_MAGIC_VALUE) != 0x74726976 ||
|
||||
*R(VIRTIO_MMIO_VERSION) != 2 ||
|
||||
*R(VIRTIO_MMIO_DEVICE_ID) != 2 ||
|
||||
*R(VIRTIO_MMIO_VENDOR_ID) != 0x554d4551){
|
||||
panic("could not find virtio disk");
|
||||
}
|
||||
|
||||
|
|
13
mkfs/mkfs.c
13
mkfs/mkfs.c
|
@ -12,12 +12,7 @@
|
|||
#include "kernel/param.h"
|
||||
|
||||
#ifndef static_assert
|
||||
#define static_assert(a, b) \
|
||||
do { \
|
||||
switch(0) \
|
||||
case 0: \
|
||||
case(a):; \
|
||||
} while(0)
|
||||
#define static_assert(a, b) do { switch (0) case 0: case (a): ; } while (0)
|
||||
#endif
|
||||
|
||||
#define NINODES 200
|
||||
|
@ -37,6 +32,7 @@ char zeroes[BSIZE];
|
|||
uint freeinode = 1;
|
||||
uint freeblock;
|
||||
|
||||
|
||||
void balloc(int);
|
||||
void wsect(uint, void*);
|
||||
void winode(uint, struct dinode*);
|
||||
|
@ -78,6 +74,7 @@ main(int argc, char *argv[])
|
|||
char buf[BSIZE];
|
||||
struct dinode din;
|
||||
|
||||
|
||||
static_assert(sizeof(int) == 4, "Integers must be 4 bytes!");
|
||||
|
||||
if(argc < 2){
|
||||
|
@ -105,8 +102,8 @@ main(int argc, char *argv[])
|
|||
sb.inodestart = xint(2+nlog);
|
||||
sb.bmapstart = xint(2+nlog+ninodeblocks);
|
||||
|
||||
printf("nmeta %d (boot, super, log blocks %u inode blocks %u, bitmap blocks %u) blocks %d total %d\n", nmeta, nlog,
|
||||
ninodeblocks, nbitmap, nblocks, FSSIZE);
|
||||
printf("nmeta %d (boot, super, log blocks %u inode blocks %u, bitmap blocks %u) blocks %d total %d\n",
|
||||
nmeta, nlog, ninodeblocks, nbitmap, nblocks, FSSIZE);
|
||||
|
||||
freeblock = nmeta; // the first free block that we can allocate
|
||||
|
||||
|
|
|
@ -81,8 +81,7 @@ match(char *re, char *text)
|
|||
}
|
||||
|
||||
// matchhere: search for re at beginning of text
|
||||
int
|
||||
matchhere(char *re, char *text)
|
||||
int matchhere(char *re, char *text)
|
||||
{
|
||||
if(re[0] == '\0')
|
||||
return 1;
|
||||
|
@ -96,8 +95,7 @@ matchhere(char *re, char *text)
|
|||
}
|
||||
|
||||
// matchstar: search for c*re at beginning of text
|
||||
int
|
||||
matchstar(int c, char *re, char *text)
|
||||
int matchstar(int c, char *re, char *text)
|
||||
{
|
||||
do{ // a * matches zero or more instances
|
||||
if(matchhere(re, text))
|
||||
|
@ -105,3 +103,4 @@ matchstar(int c, char *re, char *text)
|
|||
}while(*text!='\0' && (*text++==c || c=='.'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,7 @@ printint(int fd, int xx, int base, int sgn)
|
|||
}
|
||||
|
||||
static void
|
||||
printptr(int fd, u64 x)
|
||||
{
|
||||
printptr(int fd, u64 x) {
|
||||
int i;
|
||||
putc(fd, '0');
|
||||
putc(fd, 'x');
|
||||
|
|
|
@ -419,6 +419,7 @@ truncate3(char *s)
|
|||
exit(xstatus);
|
||||
}
|
||||
|
||||
|
||||
// does chdir() call iput(p->cwd) in a transaction?
|
||||
void
|
||||
iputtest(char *s)
|
||||
|
@ -615,7 +616,8 @@ writebig(char *s)
|
|||
exit(1);
|
||||
}
|
||||
if(((int*)buf)[0] != n){
|
||||
printf("%s: read content of block %d is %d\n", s, n, ((int *)buf)[0]);
|
||||
printf("%s: read content of block %d is %d\n", s,
|
||||
n, ((int*)buf)[0]);
|
||||
exit(1);
|
||||
}
|
||||
n++;
|
||||
|
@ -650,8 +652,7 @@ createtest(char *s)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
dirtest(char *s)
|
||||
void dirtest(char *s)
|
||||
{
|
||||
if(mkdir("dir0") < 0){
|
||||
printf("%s: mkdir failed\n", s);
|
||||
|
@ -726,6 +727,7 @@ exectest(char *s)
|
|||
printf("%s: wrong output\n", s);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// simple fork and pipe read/write
|
||||
|
@ -783,6 +785,7 @@ pipe1(char *s)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// test if child is killed (status = -1)
|
||||
void
|
||||
killstatus(char *s)
|
||||
|
@ -1460,7 +1463,8 @@ concreate(char *s)
|
|||
printf("%s: fork failed\n", s);
|
||||
exit(1);
|
||||
}
|
||||
if(((i % 3) == 0 && pid == 0) || ((i % 3) == 1 && pid != 0)) {
|
||||
if(((i % 3) == 0 && pid == 0) ||
|
||||
((i % 3) == 1 && pid != 0)){
|
||||
close(open(file, 0));
|
||||
close(open(file, 0));
|
||||
close(open(file, 0));
|
||||
|
@ -1514,6 +1518,7 @@ linkunlink(char *s)
|
|||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
subdir(char *s)
|
||||
{
|
||||
|
@ -1719,6 +1724,7 @@ bigwrite(char *s)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
bigfile(char *s)
|
||||
{
|
||||
|
@ -2182,8 +2188,7 @@ sbrkfail(char *s)
|
|||
sbrk(BIG - (u64)sbrk(0));
|
||||
write(fds[1], "x", 1);
|
||||
// sit around until killed
|
||||
for(;;)
|
||||
sleep(1000);
|
||||
for(;;) sleep(1000);
|
||||
}
|
||||
if(pids[i] != -1)
|
||||
read(fds[0], &scratch, 1);
|
||||
|
@ -2229,6 +2234,7 @@ sbrkfail(char *s)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
// test reads/writes from/to allocated memory
|
||||
void
|
||||
sbrkarg(char *s)
|
||||
|
@ -2302,9 +2308,7 @@ bigargtest(char *s)
|
|||
static char *args[MAXARG];
|
||||
int i;
|
||||
for(i = 0; i < MAXARG-1; i++)
|
||||
args[i] = "bigargs test: failed\n "
|
||||
" "
|
||||
" ";
|
||||
args[i] = "bigargs test: failed\n ";
|
||||
args[MAXARG-1] = 0;
|
||||
exec("echo", args);
|
||||
fd = open("bigarg-ok", O_CREATE);
|
||||
|
@ -2379,8 +2383,7 @@ fsfull()
|
|||
printf("fsfull test finished\n");
|
||||
}
|
||||
|
||||
void
|
||||
argptest(char *s)
|
||||
void argptest(char *s)
|
||||
{
|
||||
int fd;
|
||||
fd = open("init", O_RDONLY);
|
||||
|
@ -2540,6 +2543,7 @@ sbrklast(char *s)
|
|||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
// does sbrk handle signed int32 wrap-around with
|
||||
// negative arguments?
|
||||
void
|
||||
|
@ -2550,6 +2554,8 @@ sbrk8000(char *s)
|
|||
*(top-1) = *(top-1) + 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// regression test. test whether exec() leaks memory if one of the
|
||||
// arguments is invalid. the test passes if the kernel doesn't panic.
|
||||
void
|
||||
|
@ -2936,8 +2942,7 @@ struct test slowtests[] = {
|
|||
// run each test in its own process. run returns 1 if child's exit()
|
||||
// indicates success.
|
||||
int
|
||||
run(void f(char *), char *s)
|
||||
{
|
||||
run(void f(char *), char *s) {
|
||||
int pid;
|
||||
int xstatus;
|
||||
|
||||
|
@ -2960,8 +2965,7 @@ run(void f(char *), char *s)
|
|||
}
|
||||
|
||||
int
|
||||
runtests(struct test *tests, char *justone)
|
||||
{
|
||||
runtests(struct test *tests, char *justone) {
|
||||
for (struct test *t = tests; t->s != 0; t++) {
|
||||
if((justone == 0) || strcmp(t->s, justone) == 0) {
|
||||
if(!run(t->f, t->s)){
|
||||
|
@ -2973,6 +2977,7 @@ runtests(struct test *tests, char *justone)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// use sbrk() to count how many free physical memory pages there are.
|
||||
// touches the pages to force allocation.
|
||||
|
@ -3040,8 +3045,7 @@ countfree()
|
|||
}
|
||||
|
||||
int
|
||||
drivetests(int quick, int continuous, char *justone)
|
||||
{
|
||||
drivetests(int quick, int continuous, char *justone) {
|
||||
do {
|
||||
printf("usertests starting\n");
|
||||
int free0 = countfree();
|
||||
|
|
Loading…
Add table
Reference in a new issue