File tree Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+
2
+ This simple perl script was designed under FreeBSD, and, right now, is
3
+ limited to it. It provides a simple way of determining and directing
4
+ administrators in what has to be done to get IPC working, and configured.
5
+
6
+ Usage:
7
+
8
+ ipc_check.pl
9
+
10
+ - simply checks for semaphores and shared memory being enabled
11
+ - if one or other is not enabled, appropriate "options" are provided
12
+ to get it compiled into the kernel
13
+
14
+ ipc_check.pl -B <# of buffers>
15
+
16
+ - checks to see if there are sufficient shared memory buffers to
17
+ run the postmaster with a -B option as provided
18
+ - if insufficient buffers are provided, appropriate 'sysctl' commands,
19
+ and instructions, are provided to the administrator to increase
20
+ them
21
+
22
+
Original file line number Diff line number Diff line change
1
+ # !/usr/bin/perl
2
+
3
+ # Notes ... -B 1 == 8k
4
+
5
+ if (@ARGV > 1) {
6
+ if ($ARGV [0] eq " -B" ) {
7
+ $buffers = $ARGV [1];
8
+ }
9
+ }
10
+
11
+ if ($buffers > 0) {
12
+ $kb_memory_required = $buffers * 8;
13
+ }
14
+
15
+ $shm = ` sysctl kern.ipc | grep shmall` ;
16
+ ( $junk , $shm_amt ) = split (/ / , $shm );
17
+ chomp ($shm_amt );
18
+ $sem = ` sysctl kern.ipc | grep semmap` ;
19
+
20
+ print " \n\n " ;
21
+ if (length ($shm ) > 0) {
22
+ printf " shared memory enabled: %d kB available\n " , $shm_amt * 4;
23
+ if ($buffers > 0) {
24
+ if ($kb_memory_required / 4 > $shm_amt ) {
25
+ print " \n " ;
26
+ print " to provide enough shared memory for a \" -B $buffers \" setting\n " ;
27
+ print " issue the following command\n\n " ;
28
+ printf " \t sysctl -w kern.ipc.shmall=%d \n " , $kb_memory_required / 4;
29
+ print " \n and add the following to your /etc/sysctl.conf file:\n\n " ;
30
+ printf " \t kern.ipc.shmall=%d \n " , $kb_memory_required / 4;
31
+ } else {
32
+ print " \n " ;
33
+ print " no changes to kernel required for a \" -B $buffers \" setting\n " ;
34
+ }
35
+ }
36
+ } else {
37
+ print " no shared memory support available\n " ;
38
+ print " add the following option to your kernel config:\n\n " ;
39
+ print " \t options SYSVSHM\n\n " ;
40
+ }
41
+
42
+ print " \n ==========================\n\n " ;
43
+ if (length ($sem ) > 0) {
44
+ print " semaphores enabled\n " ;
45
+ } else {
46
+ print " no semaphore support available\n " ;
47
+ print " add the following option to your kernel config:\n\n " ;
48
+ print " \t options SYSVSEM\n\n " ;
49
+ }
50
+
51
+
You can’t perform that action at this time.
0 commit comments