Skip to content
Snippets Groups Projects
Commit ef1dd479 authored by Fache Charles's avatar Fache Charles
Browse files

4.4 tests don't pass but kernel compiles, remains at least initializing the sleeplock

parent 93f98762
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,8 @@ fileinit(void)
initlock(&ftable.lock, "ftable");
}
// Allocate a file structure.
// Allocate a file structure, returns 0 if
// none was found free
struct file*
filealloc(void)
{
......
......@@ -486,7 +486,68 @@ sys_pipe(void)
uint64
sys_create_mutex(void)
{
return -1;
// char path[MAXPATH];
int fd; //, omode;
struct file *f;
// struct inode *ip;
// int n;
// if((n = argstr(0, path, MAXPATH)) < 0 || argint(1, &omode) < 0)
// return -1;
// begin_op(ROOTDEV);
// if(omode & O_CREATE){
// ip = create(path, T_FILE, 0, 0); //?
// if(ip == 0){
// end_op(ROOTDEV);
// return -1;
// }
// } else {
// if((ip = namei(path)) == 0){
// end_op(ROOTDEV);
// return -1;
// }
// ilock(ip);
// if(ip->type == T_DIR && omode != O_RDONLY){
// iunlockput(ip);
// end_op(ROOTDEV);
// return -1;
// }
// }
// if(ip->type == T_DEVICE && (ip->major < 0 || ip->major >= NDEV)){
// iunlockput(ip);
// end_op(ROOTDEV);
// return -1;
// }
if((f = filealloc()) == 0 || (fd = fdalloc(f)) < 0){
if(f)
fileclose(f);
// iunlockput(ip);
// end_op(ROOTDEV);
return -1;
}
// if(ip->type == T_DEVICE){
// f->type = FD_DEVICE;
// f->major = ip->major;
// f->minor = ip->minor;
// } else {
// f->type = FD_INODE;
// }
// f->ip = ip;
// f->off = 0;
// f->readable = !(omode & O_WRONLY);
// f->writable = (omode & O_WRONLY) || (omode & O_RDWR);
f->type = FD_MUTEX;
// iunlock(ip);
// end_op(ROOTDEV);
return fd;
}
uint64
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment