Commit ffa45579 by Celine Mercier

changed MAP_PRIVATE flags to MAP_SHARED when opening a column because it

seems a lot more efficient
parent 003cd113
......@@ -161,7 +161,14 @@ static char* build_column_file_name(const char* column_name, obiversion_t versio
// Build the file name
version_number_length = (version_number == 0 ? 1 : (int)(log10(version_number)+1));
file_name = (char*) malloc((strlen(column_name) + version_number_length + 6)*sizeof(char)); // TODO check the mallocs...
file_name = (char*) malloc((strlen(column_name) + version_number_length + 6)*sizeof(char));
if (file_name == NULL)
{
obi_set_errno(OBI_MALLOC_ERROR);
obidebug(1, "\nError allocating the memory for a column file name");
return NULL;
}
if (sprintf(file_name,"%s@%d.odc", column_name, version_number) < 0)
{
obi_set_errno(OBICOL_MEMORY_ERROR);
......@@ -179,6 +186,13 @@ static char* build_version_file_name(const char* column_name)
// Build the file name
file_name = (char*) malloc((strlen(column_name) + 5)*sizeof(char));
if (file_name == NULL)
{
obi_set_errno(OBI_MALLOC_ERROR);
obidebug(1, "\nError allocating the memory for a version file name");
return NULL;
}
if (sprintf(file_name,"%s.odv", column_name) < 0)
{
obi_set_errno(OBICOL_MEMORY_ERROR);
......@@ -809,7 +823,7 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms,
if (column_file_descriptor < 0)
{
obi_set_errno(OBICOL_UNKNOWN_ERROR);
//obidebug(1, "\nError opening column file");
obidebug(1, "\nError opening column file");
free(column_file_name);
return NULL;
}
......@@ -842,7 +856,7 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms,
column->header = mmap(NULL,
header_size,
PROT_READ,
MAP_PRIVATE,
MAP_SHARED,
column_file_descriptor,
0
);
......@@ -860,7 +874,7 @@ OBIDMS_column_p obi_open_column(OBIDMS_p dms,
column->data = mmap(NULL,
(column->header)->data_size,
PROT_READ,
MAP_PRIVATE,
MAP_SHARED,
column_file_descriptor,
header_size
);
......@@ -1329,12 +1343,12 @@ OBIDMS_column_header_p obi_column_get_header_from_name(OBIDMS_p dms, const char*
// Fill the header structure
header = mmap(NULL,
header_size,
PROT_READ,
MAP_SHARED,
column_file_descriptor,
0
);
header_size,
PROT_READ,
MAP_SHARED,
column_file_descriptor,
0
);
if (header == MAP_FAILED)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment