AFS-Monitor

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

26
27
28
29
30
31
32
33
34
35
36
pod/xstat_cm_test.pod
pod/xstat_fs_test.pod
pod/afsmon_stats.pod
pod/Monitor.pod
src/Monitor.xs
src/Makefile.PL
src/ppport.h
src/t/Monitor.t
src/afsmon-labels.h
src/Monitor.pm
src/typemap

examples/cmdebug  view on Meta::CPAN

190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
      if ($centry->{states} & 8) {
        print ", mt pt valid";
      }
      if ($centry->{states} & 0x10) {
        print ", pending core";
      }
      if ($centry->{states} & 0x40) {
        print ", wait-for-store";
      }
      if ($centry->{states} & 0x80) {
        print ", mapped";
      }
      print "\n";
    }
  }
}
 
 
sub print_lock {
  my $lock = shift;

examples/xstat_cm_test  view on Meta::CPAN

364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
printf "\t%10d afs_gn_mknod\n", $data->{afs_gn_mknod};
printf "\t%10d afs_gn_remove\n", $data->{afs_gn_remove};
printf "\t%10d afs_gn_rename\n", $data->{afs_gn_rename};
printf "\t%10d afs_gn_rmdir\n", $data->{afs_gn_rmdir};
printf "\t%10d afs_gn_fid\n", $data->{afs_gn_fid};
printf "\t%10d afs_gn_lookup\n", $data->{afs_gn_lookup};
printf "\t%10d afs_gn_open\n", $data->{afs_gn_open};
printf "\t%10d afs_gn_create\n", $data->{afs_gn_create};
printf "\t%10d afs_gn_hold\n", $data->{afs_gn_hold};
printf "\t%10d afs_gn_rele\n", $data->{afs_gn_rele};
printf "\t%10d afs_gn_unmap\n", $data->{afs_gn_unmap};
printf "\t%10d afs_gn_access\n", $data->{afs_gn_access};
printf "\t%10d afs_gn_getattr\n", $data->{afs_gn_getattr};
printf "\t%10d afs_gn_setattr\n", $data->{afs_gn_setattr};
printf "\t%10d afs_gn_fclear\n", $data->{afs_gn_fclear};
printf "\t%10d afs_gn_fsync\n", $data->{afs_gn_fsync};
printf "\t%10d phash\n", $data->{pHash};
printf "\t%10d DInit\n", $data->{DInit};
printf "\t%10d DRead\n", $data->{DRead};
printf "\t%10d FixupBucket\n", $data->{FixupBucket};
printf "\t%10d afs_newslot\n", $data->{afs_newslot};

examples/xstat_cm_test  view on Meta::CPAN

476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
printf "\t%10d gop_lookupname\n", $data->{gop_lookupname};
printf "\t%10d afs_uniqtime\n", $data->{afs_uniqtime};
printf "\t%10d gfs_vattr_null\n", $data->{gfs_vattr_null};
printf "\t%10d afs_lock\n", $data->{afs_lock};
printf "\t%10d afs_unlock\n", $data->{afs_unlock};
printf "\t%10d afs_update\n", $data->{afs_update};
printf "\t%10d afs_gclose\n", $data->{afs_gclose};
printf "\t%10d afs_gopen\n", $data->{afs_gopen};
printf "\t%10d afs_greadlink\n", $data->{afs_greadlink};
printf "\t%10d afs_select\n", $data->{afs_select};
printf "\t%10d afs_gbmap\n", $data->{afs_gbmap};
printf "\t%10d afs_getfsdata\n", $data->{afs_getfsdata};
printf "\t%10d afs_gsymlink\n", $data->{afs_gsymlink};
printf "\t%10d afs_namei\n", $data->{afs_namei};
printf "\t%10d afs_gmount\n", $data->{afs_gmount};
printf "\t%10d afs_gget\n", $data->{afs_gget};
printf "\t%10d afs_glink\n", $data->{afs_glink};
printf "\t%10d afs_gmkdir\n", $data->{afs_gmkdir};
printf "\t%10d afs_unlink\n", $data->{afs_unlink};
printf "\t%10d afs_grmdir\n", $data->{afs_grmdir};
printf "\t%10d afs_makenode\n", $data->{afs_makenode};

examples/xstat_cm_test  view on Meta::CPAN

656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
printf "\t%10d afs_FinalizeReq\n", $data->{afs_FinalizeReq};
printf "\t%10d afs_GetVolCache\n", $data->{afs_GetVolCache};
printf "\t%10d afs_GetVolSlot\n", $data->{afs_GetVolSlot};
printf "\t%10d afs_UFSGetVolSlot\n", $data->{afs_UFSGetVolSlot};
printf "\t%10d afs_MemGetVolSlot\n", $data->{afs_MemGetVolSlot};
printf "\t%10d afs_WriteVolCache\n", $data->{afs_WriteVolCache};
printf "\t%10d haveCallbacksfrom\n", $data->{HaveCallBacksFrom};
printf "\t%10d afs_getpage\n", $data->{afs_getpage};
printf "\t%10d afs_putpage\n", $data->{afs_putpage};
printf "\t%10d afs_nfsrdwr\n", $data->{afs_nfsrdwr};
printf "\t%10d afs_map\n", $data->{afs_map};
printf "\t%10d afs_cmp\n", $data->{afs_cmp};
printf "\t%10d afs_PageLeft\n", $data->{afs_PageLeft};
printf "\t%10d afs_mount\n", $data->{afs_mount};
printf "\t%10d afs_unmount\n", $data->{afs_unmount};
printf "\t%10d afs_root\n", $data->{afs_root};
printf "\t%10d afs_statfs\n", $data->{afs_statfs};
printf "\t%10d afs_sync\n", $data->{afs_sync};
printf "\t%10d afs_vget\n", $data->{afs_vget};
printf "\t%10d afs_index\n", $data->{afs_index};
printf "\t%10d afs_setpag\n", $data->{afs_setpag};

examples/xstat_cm_test  view on Meta::CPAN

712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
printf "\t%10d afs_MemHandleLink\n", $data->{afs_MemHandleLink};
printf "\t%10d afs_UFSHandleLink\n", $data->{afs_UFSHandleLink};
printf "\t%10d HandleFlock\n", $data->{HandleFlock};
printf "\t%10d afs_readlink\n", $data->{afs_readlink};
printf "\t%10d afs_fsync\n", $data->{afs_fsync};
printf "\t%10d afs_inactive\n", $data->{afs_inactive};
printf "\t%10d afs_ustrategy\n", $data->{afs_ustrategy};
printf "\t%10d afs_strategy\n", $data->{afs_strategy};
printf "\t%10d afs_bread\n", $data->{afs_bread};
printf "\t%10d afs_brelse\n", $data->{afs_brelse};
printf "\t%10d afs_bmap\n", $data->{afs_bmap};
printf "\t%10d afs_fid\n", $data->{afs_fid};
printf "\t%10d afs_FakeOpen\n", $data->{afs_FakeOpen};
printf "\t%10d afs_FakeClose\n", $data->{afs_FakeClose};
printf "\t%10d afs_StoreOnLastReference\n", $data->{afs_StoreOnLastReference};
printf "\t%10d afs_AccessOK\n", $data->{afs_AccessOK};
printf "\t%10d afs_GetAccessBits\n", $data->{afs_GetAccessBits};
printf "\t%10d afsio_copy\n", $data->{afsio_copy};
printf "\t%10d afsio_trim\n", $data->{afsio_trim};
printf "\t%10d afsio_skip\n", $data->{afsio_skip};
printf "\t%10d afs_page_read\n", $data->{afs_page_read};

src/Makefile.PL  view on Meta::CPAN

203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
system("perl -p -i.bak -e $command Makefile");
 
# change the library name of the AFS system library "libsys"
$command = "\'s#-lsys#$AFSPath/lib/afs/libsys.a#\'";
system("perl -p -i.bak -e $command Makefile");
 
# change the library name of the AFS system library "libcmd"
$command = "\'s#-lcmd#$AFSPath/lib/afs/libcmd.a#\'";
system("perl -p -i.bak -e $command Makefile");
 
# make changes to the typemap file if Perl < 5.6.0
$command = "\'s#T_UV#T_IV#\'";
system("perl -p -i.bak -e $command typemap") unless $] >= 5.006;
 
 
 
sub version {
  my ($testver, $compver) = @_;
 
  $compver = $ENV{VERSION} unless defined $compver;
 
  # Remove possible package name from both strings.
  $testver =~ s/^([a-zA-Z][^-]*-)*//;

src/Monitor.xs  view on Meta::CPAN

841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
if ((strcasecmp(arg1, "fs") != 0) && (strcasecmp(arg1, "cm") != 0)) {
   sprintf(buffer,
           "Second argument of \"show\" directive should be \"fs\" or \"cm\"");
   return (-1);
}
 
/* Each entry can either be a variable name or a section/group name. Variable
 * names are listed in xx_varNames[] and section/group names in xx_categories[].
 * The section/group names in xx_categiries[] also give the starting/ending
 * indices of the variables belonging to that section/group. These indices
 * are stored in order in xx_Display_map[] and displayed to the screen in that
 * order. */
 
/* To handle duplicate "show" entries we keep track of what what we have
 * already marked to show in the xx_showFlags[] */
 
if (strcasecmp(arg1, "fs") == 0) {   /* its a File Server entry */
   /* mark that we have to show only what the user wants */
   *fs_showDefault = 0;
 
   /* if it is a section/group name, find it in the fs_categories[] array */

src/Monitor.xs  view on Meta::CPAN

873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
      }
   }
 
   if (!found) {  /* typo in section/group name */
      sprintf(buffer, "Could not find section/group name %s", arg2);
      return (-1);
   }
}
 
  /* if it is a group name, read its start/end indices and fill in the
   * fs_Display_map[]. */
 
if (strcasestr(arg2, "_group") != (char *)NULL) {
 
   if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_FS_STAT_ENTRIES ||
       toIdx > NUM_FS_STAT_ENTRIES)
      return (-2);
   for (j = fromIdx; j <= toIdx; j++) {
      fs_showFlags[j] = 1;
   }
}

src/Monitor.xs  view on Meta::CPAN

967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
   if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_CM_STAT_ENTRIES
       || toIdx > NUM_CM_STAT_ENTRIES)
      return (-10);
   for (j = fromIdx; j <= toIdx; j++) {
      cm_showFlags[j] = 1;
   }
}
 
/* if it is a section name, get the count of number of groups in it and
 * for each group fill in the start/end indices in the cm_Display_map[] */
 
else if (strcasestr(arg2, "_section") != (char *)NULL) {
   /* fromIdx is actually the number of groups in thi section */
   numGroups = fromIdx;
   /* for each group in section */
   while (idx < CM_NUM_DATA_CATEGORIES && numGroups) {
      sscanf(cm_categories[idx], "%s %d %d", catName, &fromIdx, &toIdx);
 
      if (strcasestr(catName, "_group") != (char *) NULL) {
         if (fromIdx < 0 || toIdx < 0 || fromIdx > NUM_CM_STAT_ENTRIES

src/Monitor.xs  view on Meta::CPAN

2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
/*
 * Copy in the socket info for the current server, resolve its
 * printable name if possible.
 */
 
memcpy(&(curr_conn->skt), a_socketArray + curr_srv,
       sizeof(struct sockaddr_in));
 
hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr);
if (hostNameFound == NULL) {
   warn("Can't map Internet address %lu to a string name",
        curr_conn->skt.sin_addr.s_addr);
   curr_conn->hostName[0] = '\0';
}
else {
   strcpy(curr_conn->hostName, hostNameFound);
}
 
/*
 * Make an Rx connection to the current server.
 */

src/Monitor.xs  view on Meta::CPAN

3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
/*
 * Copy in the socket info for the current server, resolve its
 * printable name if possible.
 */
 
memcpy(&(curr_conn->skt), a_socketArray + curr_srv,
       sizeof(struct sockaddr_in));
 
hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr);
if (hostNameFound == NULL) {
   warn("Can't map Internet address %lu to a string name",
        curr_conn->skt.sin_addr.s_addr);
   curr_conn->hostName[0] = '\0';
}
else {
   strcpy(curr_conn->hostName, hostNameFound);
}
 
/*
 * Make an Rx connection to the current server.
 */

src/Monitor.xs  view on Meta::CPAN

3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
            sprintf(data_name, "%s, backup", data_name);
        if (centry.states & 4)
            sprintf(data_name, "%s, read-only", data_name);
        if (centry.states & 8)
            sprintf(data_name, "%s, mt pt valid", data_name);
        if (centry.states & 0x10)
            sprintf(data_name, "%s, pending core", data_name);
        if (centry.states & 0x40)
            sprintf(data_name, "%s, wait-for-store", data_name);
        if (centry.states & 0x80)
            sprintf(data_name, "%s, mapped", data_name);
        hv_store(CENTRY, "states", 6, newSVpv(data_name, strlen(data_name)), 0);
 
        av_store(CACHE_ENTRIES, i, newRV_inc((SV *) CENTRY));
    }
    return 0;
}
 
 
/*
 * from src/venus/cmdebug.c

src/Monitor.xs  view on Meta::CPAN

4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
   fprintf(scout_debugfd, "[%s] IP addr 0x%lx, port %d\n", rn,
           (a_socketArray + curr_srv)->sin_addr.s_addr,
           (a_socketArray + curr_srv)->sin_port);
   fflush(scout_debugfd);
}
memcpy(&(curr_conn->skt), a_socketArray + curr_srv,
       sizeof(struct sockaddr_in));
 
hostNameFound = hostutil_GetNameByINet(curr_conn->skt.sin_addr.s_addr);
if (hostNameFound == (char *) NULL) {
   warn("Can't map Internet address %lu to a string name\n",
        curr_conn->skt.sin_addr.s_addr);
   curr_conn->hostName[0] = '\0';
}
else {
   strcpy(curr_conn->hostName, hostNameFound);
   if (scout_debugfd) {
      fprintf(scout_debugfd,
              "[%s] Host name for server index %d is %s\n", rn,
              curr_srv, curr_conn->hostName);
      fflush(scout_debugfd);

src/Monitor.xs  view on Meta::CPAN

5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
         newSViv(cmp->callInfo.C_afs_gn_open), 0);
data_name = "afs_gn_create";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_create), 0);
data_name = "afs_gn_hold";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_hold), 0);
data_name = "afs_gn_rele";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_rele), 0);
data_name = "afs_gn_unmap";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_unmap), 0);
data_name = "afs_gn_access";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_access), 0);
data_name = "afs_gn_getattr";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_getattr), 0);
data_name = "afs_gn_setattr";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gn_setattr), 0);
data_name = "afs_gn_fclear";

src/Monitor.xs  view on Meta::CPAN

5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
         newSViv(cmp->callInfo.C_afs_gclose), 0);
data_name = "afs_gopen";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gopen), 0);
data_name = "afs_greadlink";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_greadlink), 0);
data_name = "afs_select";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_select), 0);
data_name = "afs_gbmap";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gbmap), 0);
data_name = "afs_getfsdata";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_getfsdata), 0);
data_name = "afs_gsymlink";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_gsymlink), 0);
data_name = "afs_namei";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_namei), 0);
data_name = "afs_gmount";

src/Monitor.xs  view on Meta::CPAN

6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
         newSViv(cmp->callInfo.C_HaveCallBacksFrom), 0);
data_name = "afs_getpage";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_getpage), 0);
data_name = "afs_putpage";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_putpage), 0);
data_name = "afs_nfsrdwr";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_nfsrdwr), 0);
data_name = "afs_map";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_map), 0);
data_name = "afs_cmp";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_cmp), 0);
data_name = "afs_PageLeft";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_PageLeft), 0);
data_name = "afs_mount";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_mount), 0);
data_name = "afs_unmount";

src/Monitor.xs  view on Meta::CPAN

6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
         newSViv(cmp->callInfo.C_afs_ustrategy), 0);
data_name = "afs_strategy";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_strategy), 0);
data_name = "afs_bread";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_bread), 0);
data_name = "afs_brelse";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_brelse), 0);
data_name = "afs_bmap";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_bmap), 0);
data_name = "afs_fid";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_fid), 0);
data_name = "afs_FakeOpen";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_FakeOpen), 0);
data_name = "afs_FakeClose";
hv_store(DATA, data_name, strlen(data_name),
         newSViv(cmp->callInfo.C_afs_FakeClose), 0);
data_name = "afs_StoreOnLastReference";

src/ppport.h  view on Meta::CPAN

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* To verify whether ppport.h is needed for your module, and whether any
   special defines should be used, ppport.h can be run through Perl to check
   your source code. Simply say:
 
        perl -x ppport.h *.c *.h *.xs foo/*.c [etc]
 
   The result will be a list of patches suggesting changes that should at
   least be acceptable, if not necessarily the most efficient solution, or a
   fix for all possible problems. It won't catch where dTHR is needed, and
   doesn't attempt to account for global macro or function definitions,
   nested includes, typemaps, etc.
 
   In order to test for the need of dTHR, please try your module under a
   recent version of Perl that has threading compiled-in.
 
*/
 
 
/*
#!/usr/bin/perl
@ARGV = ("*.xs") if !@ARGV;
%badmacros = %funcs = %macros = (); $replace = 0;
foreach (<DATA>) {
        $funcs{$1} = 1 if /Provide:\s+(\S+)/;
        $macros{$1} = 1 if /^#\s*define\s+([a-zA-Z0-9_]+)/;
        $replace = $1 if /Replace:\s+(\d+)/;
        $badmacros{$2}=$1 if $replace and /^#\s*define\s+([a-zA-Z0-9_]+).*?\s+([a-zA-Z0-9_]+)/;
        $badmacros{$1}=$2 if /Replace (\S+) with (\S+)/;
}
foreach $filename (map(glob($_),@ARGV)) {
        unless (open(IN, "<$filename")) {
                warn "Unable to read from $file: $!\n";
                next;
        }
        print "Scanning $filename...\n";
        $c = ""; while (<IN>) { $c .= $_; } close(IN);
        $need_include = 0; %add_func = (); $changes = 0;
        $has_include = ($c =~ /#.*include.*ppport/m);
 
        foreach $func (keys %funcs) {

src/ppport.h  view on Meta::CPAN

105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
foreach $badmacro (keys %badmacros) {
        if ($c =~ /\b$badmacro\b/m) {
                $changes += ($c =~ s/\b$badmacro\b/$badmacros{$badmacro}/gm);
                print "Uses $badmacros{$badmacro} (instead of $badmacro)\n";
                $need_include = 1;
        }
}
 
if (scalar(keys %add_func) or $need_include != $has_include) {
        if (!$has_include) {
                $inc = join('',map("#define NEED_$_\n", sort keys %add_func)).
                       "#include \"ppport.h\"\n";
                $c = "$inc$c" unless $c =~ s/#.*include.*XSUB.*\n/$&$inc/m;
        } elsif (keys %add_func) {
                $inc = join('',map("#define NEED_$_\n", sort keys %add_func));
                $c = "$inc$c" unless $c =~ s/^.*#.*include.*ppport.*$/$inc$&/m;
        }
        if (!$need_include) {
                print "Doesn't seem to need ppport.h.\n";
                $c =~ s/^.*#.*include.*ppport.*\n//m;
        }
        $changes++;
}
 
if ($changes) {



( run in 0.398 second using v1.01-cache-2.11-cpan-0f795438458 )