def open(s, cc):
    f = cc(s)

    # TODO: can we control path

    path = f.params[0]
    flags = f.params[1]
    mode = f.params[2]

    o = DummyOutputBuffer()
    o.append_string(String(s, path))
    path = o.string[:-1]

    s.log.function_call(f, 'open(path="{}", flags={}, mode={})', path, flags, mode)

    file_id = len(s.files) + 1

    s.files.append({
        'path':path,
        'mode':mode,
        'offset':0,
        'bytes':dict()
    })

    print ('stream id: {}'.format(file_id))

    return f.ret(value=file_id)


# unistd.h
dataset/ETHPy150Open c01db33f/concolica/library_emulation/unix.py/open/original