~ubuntu-branches/ubuntu/warty/openafs/warty

« back to all changes in this revision

Viewing changes to src/libadmin/samples/rxdebug_supported_stats.c

  • Committer: Bazaar Package Importer
  • Author(s): Sam Hartman
  • Date: 2004-01-10 16:37:33 UTC
  • Revision ID: james.westby@ubuntu.com-20040110163733-jvr0n1uahshlb1uu
Tags: upstream-1.2.11
ImportĀ upstreamĀ versionĀ 1.2.11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2000, International Business Machines Corporation and others.
 
3
 * All Rights Reserved.
 
4
 * 
 
5
 * This software has been released under the terms of the IBM Public
 
6
 * License.  For details, see the LICENSE file in the top-level source
 
7
 * directory or online at http://www.openafs.org/dl/license10.html
 
8
 *
 
9
 * Portions Copyright (c) 2003 Apple Computer, Inc.
 
10
 */
 
11
 
 
12
/*
 
13
 * This file contains sample code for the rxstats interface 
 
14
 */
 
15
 
 
16
#include <afsconfig.h>
 
17
#include <afs/param.h>
 
18
 
 
19
RCSID("$Header: /afs/sipb.mit.edu/project/openafs/debian/cvs/openafs/src/libadmin/samples/rxdebug_supported_stats.c,v 1.1.1.5 2004/01/10 20:56:46 hartmans Exp $");
 
20
 
 
21
#ifdef AFS_NT40_ENV
 
22
#include <winsock2.h>
 
23
#include <pthread.h>
 
24
#endif
 
25
#include <afs/afs_Admin.h>
 
26
#include <afs/afs_clientAdmin.h>
 
27
#include <afs/afs_utilAdmin.h>
 
28
 
 
29
#ifdef AFS_DARWIN_ENV
 
30
pthread_mutex_t des_init_mutex = PTHREAD_MUTEX_INITIALIZER;
 
31
pthread_mutex_t des_random_mutex = PTHREAD_MUTEX_INITIALIZER;
 
32
pthread_mutex_t rxkad_random_mutex = PTHREAD_MUTEX_INITIALIZER;
 
33
#endif /* AFS_DARWIN_ENV */
 
34
 
 
35
void Usage()
 
36
{
 
37
    fprintf(stderr,
 
38
            "Usage: rxdebug_supported_stats <host> <port>\n");
 
39
    exit(1);
 
40
}
 
41
 
 
42
void ParseArgs(
 
43
    int argc,
 
44
    char *argv[],
 
45
    char **srvrName,
 
46
    long *srvrPort)
 
47
{
 
48
    char **argp = argv;
 
49
 
 
50
    if (!*(++argp))
 
51
        Usage();
 
52
    *srvrName = *(argp++);
 
53
    if (!*(argp))
 
54
        Usage();
 
55
    *srvrPort = strtol(*(argp++), NULL, 0);
 
56
    if (*srvrPort <= 0 || *srvrPort >= 65536)
 
57
        Usage();
 
58
    if (*(argp))
 
59
        Usage();
 
60
}
 
61
 
 
62
int main(int argc, char *argv[])
 
63
{
 
64
    int rc;
 
65
    afs_status_t st = 0;
 
66
    rxdebugHandle_p handle;
 
67
    char *srvrName;
 
68
    long srvrPort;
 
69
    afs_uint32 supported;
 
70
 
 
71
    ParseArgs(argc, argv, &srvrName, &srvrPort);
 
72
 
 
73
    rc = afsclient_Init(&st);
 
74
    if (!rc) {
 
75
        fprintf(stderr, "afsclient_Init, status %d\n", st);
 
76
        exit(1);
 
77
    }
 
78
 
 
79
    rc = afsclient_RXDebugOpenPort(srvrName, srvrPort, &handle, &st);
 
80
    if (!rc) {
 
81
        fprintf(stderr, "afsclient_RXDebugOpenPort, status %d\n", st);
 
82
        exit(1);
 
83
    }
 
84
 
 
85
    rc = util_RXDebugSupportedStats(handle, &supported, &st);
 
86
    if (!rc) {
 
87
        fprintf(stderr, "util_RXDebugSupportedStats, status %d\n", st);
 
88
        exit(1);
 
89
    }
 
90
 
 
91
    rc = afsclient_RXDebugClose(handle, &st);
 
92
    if (!rc) {
 
93
        fprintf(stderr, "afsclient_RXDebugClose, status %d\n", st);
 
94
        exit(1);
 
95
    }
 
96
 
 
97
    printf("\n");
 
98
    printf("security stats: %s supported\n",
 
99
           (supported & RX_SERVER_DEBUG_SEC_STATS) ? "" : " not");
 
100
    printf("all connections:%s supported\n",
 
101
           (supported & RX_SERVER_DEBUG_ALL_CONN) ? "" : " not");
 
102
    printf("rx stats:       %s supported\n",
 
103
           (supported & RX_SERVER_DEBUG_RX_STATS) ? "" : " not");
 
104
    printf("waiter count:   %s supported\n",
 
105
           (supported & RX_SERVER_DEBUG_WAITER_CNT) ? "" : " not");
 
106
    printf("idle threads:   %s supported\n",
 
107
           (supported & RX_SERVER_DEBUG_IDLE_THREADS) ? "" : " not");
 
108
    printf("all peers:      %s supported\n",
 
109
           (supported & RX_SERVER_DEBUG_ALL_PEER) ? "" : " not");
 
110
    printf("\n");
 
111
 
 
112
    exit(0);
 
113
}