From: Frank Mori Hess Date: Mon, 28 Jan 2008 20:35:14 +0000 (+0000) Subject: Fixed another problem with mmap test on subdevice using lsampl_t. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=242aa6405f2b2621fbfd3fbb8344ea0ce1bcae29;p=comedilib.git Fixed another problem with mmap test on subdevice using lsampl_t. --- diff --git a/testing/mmap.c b/testing/mmap.c index 15f9e6c..96e047b 100644 --- a/testing/mmap.c +++ b/testing/mmap.c @@ -22,8 +22,6 @@ #define N_SAMPLES 10000 -#define MAPLEN 20480 - sigjmp_buf jump_env; void segv_handler(int num) @@ -67,6 +65,7 @@ int test_mmap(void) unsigned int flags; int i; unsigned sample_size; + unsigned map_len; flags = comedi_get_subdevice_flags(device,subdevice); @@ -76,6 +75,7 @@ int test_mmap(void) } if(flags & SDF_LSAMPL) sample_size = sizeof(lsampl_t); else sample_size = sizeof(sampl_t); + map_len = sample_size * N_SAMPLES; if(comedi_get_cmd_generic_timed(device, subdevice, &cmd, 1, 1)<0){ printf("E: comedi_get_cmd_generic_timed failed\n"); @@ -84,14 +84,14 @@ int test_mmap(void) buf=malloc(sample_size * N_SAMPLES); - map=mmap(NULL,MAPLEN,PROT_READ,MAP_SHARED,comedi_fileno(device),0); + map = mmap(NULL, map_len,PROT_READ, MAP_SHARED, comedi_fileno(device),0); if(!map){ printf("E: mmap() failed\n"); return 0; } /* test readability */ - for(adr=map;adr