fallocate.py 文件源码

python
阅读 43 收藏 0 点赞 0 评论 0

项目:eos-data-distribution 作者: endlessm 项目源码 文件源码
def _fallocate():
    libc_name = ctypes.util.find_library('c')
    libc = ctypes.CDLL(libc_name)

    raw_fallocate = libc.fallocate
    raw_fallocate.restype = ctypes.c_int
    raw_fallocate.argtypes = [
        ctypes.c_int, ctypes.c_int, ctypes.c_int64, ctypes.c_int64]

    def fallocate(fd, offs, size, mode=FALLOC_FL_KEEP_SIZE):
        ret = raw_fallocate(fd, mode, offs, size)
        if ret != 0:
            raise IOError(ctypes.get_errno())

    return fallocate
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号