summaryrefslogtreecommitdiff
path: root/contrib/ipc_check/ipc_check.pl
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>2001-02-27 15:37:39 +0000
committerMarc G. Fournier <scrappy@hub.org>2001-02-27 15:37:39 +0000
commitca22223e82d86a34a2cc1ec51a5d43f2523a4512 (patch)
tree2e5aec03757a85bca8e3302590f6948026798053 /contrib/ipc_check/ipc_check.pl
parentdf247b821d811abcfc0ac707e1a3af9dfce474c9 (diff)
downloadpostgresql-ca22223e82d86a34a2cc1ec51a5d43f2523a4512.tar.gz
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" ...
Diffstat (limited to 'contrib/ipc_check/ipc_check.pl')
-rw-r--r--contrib/ipc_check/ipc_check.pl51
1 files changed, 51 insertions, 0 deletions
diff --git a/contrib/ipc_check/ipc_check.pl b/contrib/ipc_check/ipc_check.pl
new file mode 100644
index 0000000000..cc65294718
--- /dev/null
+++ b/contrib/ipc_check/ipc_check.pl
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+
+# Notes ... -B 1 == 8k
+
+if(@ARGV > 1) {
+ if($ARGV[0] eq "-B") {
+ $buffers = $ARGV[1];
+ }
+}
+
+if($buffers > 0) {
+ $kb_memory_required = $buffers * 8;
+}
+
+$shm = `sysctl kern.ipc | grep shmall`;
+( $junk, $shm_amt ) = split(/ /, $shm);
+chomp($shm_amt);
+$sem = `sysctl kern.ipc | grep semmap`;
+
+print "\n\n";
+if(length($shm) > 0) {
+ printf "shared memory enabled: %d kB available\n", $shm_amt * 4;
+ if($buffers > 0) {
+ if($kb_memory_required / 4 > $shm_amt) {
+ print "\n";
+ print "to provide enough shared memory for a \"-B $buffers\" setting\n";
+ print "issue the following command\n\n";
+ printf "\tsysctl -w kern.ipc.shmall=%d\n", $kb_memory_required / 4;
+ print "\nand add the following to your /etc/sysctl.conf file:\n\n";
+ printf "\tkern.ipc.shmall=%d\n", $kb_memory_required / 4;
+ } else {
+ print "\n";
+ print "no changes to kernel required for a \"-B $buffers\" setting\n";
+ }
+ }
+} else {
+ print "no shared memory support available\n";
+ print "add the following option to your kernel config:\n\n";
+ print "\toptions SYSVSHM\n\n";
+}
+
+print "\n==========================\n\n";
+if(length($sem) > 0) {
+ print "semaphores enabled\n";
+} else {
+ print "no semaphore support available\n";
+ print "add the following option to your kernel config:\n\n";
+ print "\toptions SYSVSEM\n\n";
+}
+
+