From: Enrico Scholz Date: Sun, 4 Feb 2007 17:17:02 +0000 (+0000) Subject: - reworked the large pagesize patch; it seems to be always PAGESIZE*2+1 X-Git-Tag: release-0.30.214~121 X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a3cd29c62ceea9fb131e509229572c452f4c294;p=util-vserver.git - reworked the large pagesize patch; it seems to be always PAGESIZE*2+1 bytes required to trigger a SIGBUS. Since PAGESIZE is not available directly, use sysconf(3) to get this value and memset(3) to initialize buffer - removed byte crap git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@2484 94cd875c-1c1d-0410-91d2-eb244daf1a30 --- diff --git a/lib_internal/testsuite/sigbus.c b/lib_internal/testsuite/sigbus.c index 5193522..1abf55c 100644 --- a/lib_internal/testsuite/sigbus.c +++ b/lib_internal/testsuite/sigbus.c @@ -33,7 +33,8 @@ int wrapper_exit_code = 1; -#define TEST_BLOCKSIZE 0x20000 +#define TEST_BLOCKSIZE (sysconf(_SC_PAGESIZE)*2 + 0x10000) + static bool is_gremlin = false; static int sync_p[2]; @@ -81,13 +82,12 @@ int main() char f_name1[] = "/tmp/sigbus.XXXXXX"; int fd_src = mkstemp(f_name0); int fd_dst = mkstemp(f_name1); - char buf[TEST_BLOCKSIZE] = { [0] = '\0' }; + char buf[TEST_BLOCKSIZE]; struct stat st; bool res; - - fd_src = - - write(fd_src, buf, sizeof(buf)); + + memset(buf, 0, TEST_BLOCKSIZE); + write(fd_src, buf, TEST_BLOCKSIZE); close(fd_src); close(fd_dst);