mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 13:16:34 +00:00
usr/fileio/fileio: Fix align_alloc()
User space code must not use PAGE_SIZE but must use sysconf(_SC_PAGESIZE) instead to obtain the page size. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8997 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+7
-1
@@ -28,6 +28,7 @@
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/user.h>
|
||||
#include <poll.h>
|
||||
@@ -199,8 +200,13 @@ out:
|
||||
|
||||
static void *align_alloc(size_t size)
|
||||
{
|
||||
static uint32_t page_size;
|
||||
|
||||
if (page_size == 0)
|
||||
page_size = sysconf(_SC_PAGESIZE);
|
||||
|
||||
TRACE_MEM("Request to alloc %zdKB", size / 1024);
|
||||
return memalign(PAGE_SIZE, size);
|
||||
return memalign(page_size, size);
|
||||
}
|
||||
|
||||
static void sigalrm_handler(int signo)
|
||||
|
||||
Reference in New Issue
Block a user