rem: err = EINVAL;
add: err = FS_EINVAL;
context: sys_lseek(bool kernel, int fd, fs_off_t pos, int whence){    ofile           *f;    int              err;    struct my_stat   st;    vnode           *vn;    op_rstat        *op;        f = get_fd(kernel, fd, FD_FILE);    if (!f) {        err = EBADF;        goto error1;    }    switch(whence) {    case SEEK_SET:        f->pos = pos;        break;    case SEEK_CUR:        if ((f->omode & O_APPEND) == 0)            f->pos += pos;        else {               /* we're in append mode so ask where the EOF is */            vn = f->vn;            op = vn->ns->fs->ops.rstat;            if (!op) {                err = EINVAL;                goto error2;            }            err = (*op)(vn->ns->data, vn->data, &st);            if (err)                goto error2;            pos += st.st_size;            f->pos = pos;            break;        }        break;    case SEEK_END:        vn = f->vn;        op = vn->ns->fs->ops.rstat;        if (!op) {            err = EINVAL;            goto error2;        }        err = (*op)(vn->ns->data, vn->data, &st);        if (err)            goto error2;        pos += st.st_size;        f->pos = pos;        break;    default:        put_fd(f);        return EINVAL;    }    if (f->pos < 0) {        f->pos = 0;        err = EINVAL;        goto error2;    }    pos = f->pos;    put_fd(f);    return pos;error2:    put_fd(f);error1:    return err;}