ivanallen / Titans

Learning Linux Program

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

current->flip[i]

zkangHUST opened this issue · comments

int open(const char* filename, int flags, int mode) {
    struce file* f = (struct file*)malloc(sizeof(struct file));
    // 为 f 填充字段
    // ...
    // 取到当前进程 PCB
    PCB* current = get_current();
    for (int i = 0; i < 256; ++i) {
        if (filp[i] == NULL) {
            filp[i] = f;
            return i;
        }
    }
    return -1;
}

task4这段代码中使用flip是不是写漏了current, 应该是current->flip[i]?

commented

是的,我去改一下