2 * Copyright 2000, International Business Machines Corporation and others.
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
10 #include <afsconfig.h>
11 #include <afs/param.h>
15 #include <afs/afscbint.h>
17 #include <afs/com_err.h>
21 extern struct rx_securityClass
*rxnull_NewServerSecurityObject();
22 extern struct hostent
*hostutil_GetHostByName();
24 static PrintCacheEntries(struct rx_connection
*aconn
, int aint32
)
27 afs_int32 code
, addr
, inode
, flags
, time
;
30 for(i
=0;i
<100000;i
++) {
31 code
= RXAFSCB_GetDE(aconn
, i
, &addr
, &inode
, &flags
, &time
, &fileName
);
34 printf("cmdebug: failed to get cache entry %d (%s)\n", i
,
35 afs_error_message(code
));
39 /* otherwise print this entry */
40 printf("%d: ** dentry %d %08x %d %d %s\n",
41 i
, addr
, inode
, flags
, time
, fileName
);
45 printf("Returned %d entries.\n", i
);
50 CommandProc(struct cmd_syndesc
*as
, void *arock
)
52 struct rx_connection
*conn
;
56 struct rx_securityClass
*secobj
;
60 hostName
= as
->parms
[0].items
->data
;
61 if (as
->parms
[1].items
)
62 port
= atoi(as
->parms
[1].items
->data
);
65 thp
= hostutil_GetHostByName(hostName
);
67 printf("cmdebug: can't resolve address for host %s.\n", hostName
);
70 memcpy(&addr
, thp
->h_addr
, sizeof(afs_int32
));
71 secobj
= rxnull_NewServerSecurityObject();
72 conn
= rx_NewConnection(addr
, htons(port
), 1, secobj
, 0);
74 printf("cmdebug: failed to create connection for host %s\n", hostName
);
77 if (as
->parms
[2].items
) int32p
= 1;
79 PrintCacheEntries(conn
, int32p
);
83 #include "AFS_component_version_number.c"
88 struct cmd_syndesc
*ts
;
92 * The following signal action for AIX is necessary so that in case of a
93 * crash (i.e. core is generated) we can include the user's data section
94 * in the core dump. Unfortunately, by default, only a partial core is
95 * generated which, in many cases, isn't too useful.
99 sigemptyset(&nsa
.sa_mask
);
100 nsa
.sa_handler
= SIG_DFL
;
101 nsa
.sa_flags
= SA_FULLDUMP
;
102 sigaction(SIGSEGV
, &nsa
, NULL
);
106 ts
= cmd_CreateSyntax(NULL
, CommandProc
, NULL
, 0, "probe unik server");
107 cmd_AddParm(ts
, "-servers", CMD_SINGLE
, CMD_REQUIRED
, "server machine");
108 cmd_AddParm(ts
, "-port", CMD_SINGLE
, CMD_OPTIONAL
, "IP port");
109 cmd_AddParm(ts
, "-long", CMD_FLAG
, CMD_OPTIONAL
, "print all info");
111 cmd_Dispatch(argc
, argv
);