Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit ca22223

Browse files
committed
start of an admin tool for FreeBSD to help configure shared memory for that machine I kept the name as generic as possible though, as other OS should have similar methods, so this can be extended "as appropriate" ...
1 parent df247b8 commit ca22223

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed

contrib/ipc_check/README

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+

contrib/ipc_check/ipc_check.pl

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 "\tsysctl -w kern.ipc.shmall=%d\n", $kb_memory_required / 4;
29+
print "\nand add the following to your /etc/sysctl.conf file:\n\n";
30+
printf "\tkern.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 "\toptions 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 "\toptions SYSVSEM\n\n";
49+
}
50+
51+

0 commit comments

Comments
 (0)