~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to contrib/ipc_check/ipc_check.pl

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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