Exemple #1
0
int io61_close(io61_file *f)
{
    io61_flush(f);
    int r = close(f->fd);
    // If mmap is flagged true
    if (f->cache->mmapp_bool)
    {
        // Sys call, delete mappings for specified address range. (address, length)
        munmap(f->cache->memory, f->size);
        // Free cache
        free(f->cache);
        // Free cache
        free(f);
    }
    else
    {
        // Free cache memory
        free(f->cache->memory);
        // Free cache
        free(f->cache);
        // Free file
        free(f);
    }
    return r;
}
Exemple #2
0
int io61_close(io61_file* f) {
    io61_flush(f);
    int r = fclose(f->f);
    free(f);
    return r;
}