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 <sys/types.h>
16 #include <netinet/in.h>
17 #include <sys/socket.h>
23 #include <afs/afscbint.h>
25 #include <afs/com_err.h>
29 extern struct rx_securityClass *rxnull_NewServerSecurityObject();
30 extern struct hostent *hostutil_GetHostByName();
32 static PrintCacheEntries(struct rx_connection *aconn, int aint32)
35 afs_int32 code, addr, inode, flags, time;
38 for(i=0;i<100000;i++) {
39 code = RXAFSCB_GetDE(aconn, i, &addr, &inode, &flags, &time, &fileName);
42 printf("cmdebug: failed to get cache entry %d (%s)\n", i,
43 afs_error_message(code));
47 /* otherwise print this entry */
48 printf("%d: ** dentry %d %08x %d %d %s\n",
49 i, addr, inode, flags, time, fileName);
53 printf("Returned %d entries.\n", i);
58 CommandProc(struct cmd_syndesc *as, void *arock)
60 struct rx_connection *conn;
64 struct rx_securityClass *secobj;
68 hostName = as->parms[0].items->data;
69 if (as->parms[1].items)
70 port = atoi(as->parms[1].items->data);
73 thp = hostutil_GetHostByName(hostName);
75 printf("cmdebug: can't resolve address for host %s.\n", hostName);
78 memcpy(&addr, thp->h_addr, sizeof(afs_int32));
79 secobj = rxnull_NewServerSecurityObject();
80 conn = rx_NewConnection(addr, htons(port), 1, secobj, 0);
82 printf("cmdebug: failed to create connection for host %s\n", hostName);
85 if (as->parms[2].items) int32p = 1;
87 PrintCacheEntries(conn, int32p);
91 #include "AFS_component_version_number.c"
96 struct cmd_syndesc *ts;
100 * The following signal action for AIX is necessary so that in case of a
101 * crash (i.e. core is generated) we can include the user's data section
102 * in the core dump. Unfortunately, by default, only a partial core is
103 * generated which, in many cases, isn't too useful.
105 struct sigaction nsa;
107 sigemptyset(&nsa.sa_mask);
108 nsa.sa_handler = SIG_DFL;
109 nsa.sa_flags = SA_FULLDUMP;
110 sigaction(SIGSEGV, &nsa, NULL);
114 ts = cmd_CreateSyntax(NULL, CommandProc, NULL, "probe unik server");
115 cmd_AddParm(ts, "-servers", CMD_SINGLE, CMD_REQUIRED, "server machine");
116 cmd_AddParm(ts, "-port", CMD_SINGLE, CMD_OPTIONAL, "IP port");
117 cmd_AddParm(ts, "-long", CMD_FLAG, CMD_OPTIONAL, "print all info");
119 cmd_Dispatch(argc, argv);