rem: err = EBADF;
add: err = FS_EBADF;
context: sys_read(bool kernel, int fd, void *buf, size_t len){    ofile       *f;    int         err;    vnode       *vn;    size_t      sz;    f = get_fd(kernel, fd, FD_FILE);    if (!f) {        err = EBADF;        goto error1;    }    if ((f->omode & OMODE_MASK) == O_WRONLY) {        err = EBADF;        goto error2;    }    vn = f->vn;    sz = len;    err = (*vn->ns->fs->ops.read)(vn->ns->data, vn->data, f->cookie, f->pos,        buf, &sz);    if (err)        goto error2;    /*    the update of f->pos is not protected. does it matter?    simultaneous I/Os on the same file are unpredictable anyway.    */    f->pos += sz;    put_fd(f);    return sz;error2:    put_fd(f);  error1:    return err;}