Exemple #1
0
int sp_mapunlink(spfile *f) {
#ifdef _MSC_VER
    if (f->map) {
        sp_mapcut(f);
        if (f->map)
            sp_unmap(f);
    }
#endif
    return sp_filerm(f->file);
}
Exemple #2
0
int sp_mapclose(spfile *f)
{
	int rc = sp_mapcut(f);
	if (spunlikely(rc == -1))
		return -1;
	if (f->map) {
		rc = sp_unmap(f);
		if (spunlikely(rc == -1))
			return -1;
	}
	return sp_fileclose(f);
}
Exemple #3
0
int sp_mapcomplete(spfile *f)
{
    if (f->creat == 0)
        return 0;
    /* sync and truncate file by used size */
    int rc = sp_mapcut(f);
    if (spunlikely(rc == -1))
        return -1;
    /* remove .incomplete part */
    rc = sp_filecomplete(f);
    if (spunlikely(rc == -1))
        return -1;
    return sp_map(f, PROT_READ);
}