[Dovecot] test program #2: mmaping

Adam McDougall mcdouga9 at egr.msu.edu
Thu Jun 21 06:35:51 EEST 2007


On Thu, Jun 21, 2007 at 04:28:17AM +0300, Timo Sirainen wrote:

  Attached another test program. I don't expect it to print any errors
  with any OS, but I'd like to confirm it for non-Linux SMP kernels.
  
  (Except for OpenBSD, it doesn't work correctly in it anyway because it
  doesn't support mixing write()s and mmap())


On one computer I faltered on the first two tries because both my home directory
and /tmp contained a file or directory named foo :)  Perhaps the script should
check for existing file entries and abort to avoid unexpected results?  Applies
to multiple runs too.


--------------------------------------------  
FreeBSD 7.0 amd64 SMP (on core 2 duo), local UFS:

% gcc concurrency.c -o concurrency -Wall
% gcc -v
Using built-in specs.
Target: amd64-undermydesk-freebsd
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 4.2.0 20070514 [FreeBSD]
% ./concurrency 
writing, page size = 4096
0: reading, page size = 4096
4: reading, page size = 4096
3: reading, page size = 4096
2: reading, page size = 4096
1: reading, page size = 4096

(been waiting for 22 min, prompt does not return)

------------------------------------------------

FreeBSD 7.0 i386 UP (pentium 4), local UFS:

> gcc concurrency.c -o concurrency -Wall
concurrency.c: In function 'main':
concurrency.c:92: warning: format '%ld' expects type 'long int', but argument 2 has type 'size_t'
> gcc -v
Using built-in specs.
Target: i386-undermydesk-freebsd
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 4.2.0 20070514 [FreeBSD]
> ./concurrency 
0: reading, page size = 4096
open(): No such file or directory
writing, page size = 4096
4: reading, page size = 4096
3: reading, page size = 4096
2: reading, page size = 4096
1: reading, page size = 4096
> ps -xauww | grep concurr
mcdouga9  2262  0.0  0.1  3104   652  p0  R    10:57PM   0:00.23 ./concurrency
mcdouga9  2263  0.0  0.1  3112   648  p0  S    10:57PM   0:00.11 ./concurrency
mcdouga9  2264  0.0  0.1  3112   648  p0  S    10:57PM   0:00.08 ./concurrency
mcdouga9  2265  0.0  0.1  3112   648  p0  S    10:57PM   0:00.08 ./concurrency
mcdouga9  2266  0.0  0.1  3112   648  p0  S    10:57PM   0:00.09 ./concurrency
> 

(been waiting for 22 min, prompt returns right away with backgrounded processes)

--------------------------------------------------

Solaris 9 sparc:

> gcc concurrency.c -o concurrency -Wall
concurrency.c: In function `main':
concurrency.c:40: warning: implicit declaration of function `flock'
concurrency.c:40: error: `LOCK_EX' undeclared (first use in this function)
concurrency.c:40: error: (Each undeclared identifier is reported only once
concurrency.c:40: error: for each function it appears in.)
concurrency.c:50: error: `LOCK_UN' undeclared (first use in this function)
concurrency.c:92: warning: long int format, size_t arg (arg 2)
> gcc -v
Reading specs from /opt/lib/gcc-lib/sparc-sun-solaris2.8/3.3.1/specs
Configured with: /usr/local/src/gcc-3.3.1/configure --prefix=/opt --with-as=/usr/ccs/bin/as 
--with-ld=/usr/ccs/bin/ld --with-system-zlib
Thread model: posix
gcc version 3.3.1
> ls -l concurrency
ls: concurrency: No such file or directory

-----------------------------------------------------

FreeBSD 6.2 amd64 SMP on opteron

> gcc concurrency.c -o concurrency -Wall
> gcc -v
Using built-in specs.
Configured with: FreeBSD/amd64 system compiler
Thread model: posix
gcc version 3.4.6 [FreeBSD] 20060305
> ./concurrency
(has inconsistent behaviors, sometimes looks fine, sometimes has some open() failures
and backgrounded process(es?), may or may not vary if stored on NFS).

Not sure if the behavior here is expected or the test needs work, 
I didn't want to test exhaustively if the results would be inconclusive anyway

------------------------------------------------------

FreeBSD 6.2 i386 SMP on opteron, local UFS

% gcc concurrency.c -o concurrency -Wall
concurrency.c: In function `main':
concurrency.c:92: warning: long int format, size_t arg (arg 2)
% gcc -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.6 [FreeBSD] 20060305
% ~/concurrency
writing, page size = 4096
0: reading, page size = 4096
4: reading, page size = 4096
3: reading, page size = 4096
2: reading, page size = 4096
1: reading, page size = 4096

(seems consistent and fine)


More information about the dovecot mailing list