size_test.c
1 #include <stdio.h>
2 #include <sys/types.h>
3 #include <sys/stat.h>
4 #include <fcntl.h>
5 #include <errno.h>
6 #include <string.h>
7 #include <unistd.h>
8 #include <stdlib.h>
9 #include <sys/mman.h>
10 #include <pthread.h>
11 #include <stdint.h>
12 #include <inttypes.h>
13 #include <pthread.h>
14 
15 #include "config.h"
16 #include "spew.h"
17 #include "assert.h"
18 #include "debug_lock.h"
19 #include "shm_arena.h"
20 #include "arena.h"
21 
22 int main(void)
23 {
24 
25  printf("The segment overhead without added rwlock is: %zu bytes\n",
26  CHUNKS(sizeof(struct seg_header)) +
27  CHUNKS(sizeof(struct seg_footer)));
28 
29  printf("The segment overhead with added rwlock is: %zu bytes\n",
30  CHUNKS(sizeof(struct seg_header)) +
31  CHUNKS(sizeof(pthread_rwlock_t)) +
32  CHUNKS(sizeof(struct seg_footer)));
33 
34  printf("sizeof(pthread_rwlock_t)=%zu CHUNKS(sizeof(pthread_rwlock_t))=%zu\n",
35  sizeof(pthread_rwlock_t), CHUNKS(sizeof(pthread_rwlock_t)) );
36 
37  printf("sizeof(struct seg_footer)=%zu\n",
38  sizeof(struct seg_footer));
39 
40 
41  printf("sizeof(struct seg_header)=%zu\n",
42  sizeof(struct seg_header));
43 
44  return 0;
45 }

Shared Memory Arena version RC-0.0.25