1
0
mirror of https://github.com/adtools/clib2.git synced 2026-05-06 05:04:57 +00:00

- I/O buffers allocated are now aligned according to the CPU cache line size,

if the operating system can supply that detailed information.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15200 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2008-09-04 12:07:58 +00:00
parent b9ad1fda3f
commit 8a1347e61d
6 changed files with 44 additions and 25 deletions

View File

@@ -1,5 +1,5 @@
/*
* $Id: stdio_openiob.c,v 1.14 2006-01-08 12:04:24 obarthel Exp $
* $Id: stdio_openiob.c,v 1.15 2008-09-04 12:07:58 obarthel Exp $
*
* :ts=4
*
@@ -133,7 +133,7 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
SHOWMSG("allocating file buffer");
/* Allocate a little more memory than necessary. */
buffer = malloc(BUFSIZ + (CACHE_LINE_SIZE-1));
buffer = malloc(BUFSIZ + (__cache_line_size-1));
if(buffer == NULL)
{
SHOWMSG("that didn't work");
@@ -143,7 +143,7 @@ __open_iob(const char *filename, const char *mode, int file_descriptor, int slot
}
/* Align the buffer start address to a cache line boundary. */
aligned_buffer = (char *)((ULONG)(buffer + (CACHE_LINE_SIZE-1)) & ~(CACHE_LINE_SIZE-1));
aligned_buffer = (char *)((ULONG)(buffer + (__cache_line_size-1)) & ~(__cache_line_size-1));
if(file_descriptor < 0)
{