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
13 #include <afsconfig.h>
14 #include <afs/param.h>
22 #include <sys/ioctl.h>
23 #include <sys/socket.h>
25 #include <netinet/in.h>
27 #include <afs/com_err.h>
29 #include <afs/venus.h>
30 #include "afs/prs_fs.h"
31 #include <afs/afsint.h>
32 #include <afs/cellconfig.h>
46 #include "AFS_component_version_number.c"
48 int WhatFidCmd_FileParm;
49 int WhatFidCmd_FollowLinkParm;
51 WhatFidCmd(register struct cmd_syndesc *as, void *arock)
53 register afs_int32 code;
54 struct ViceIoctl blob;
56 register struct cmd_item *ti;
57 struct VolumeStatus *status;
61 if (as->parms[1].items)
63 for (ti = as->parms[0].items; ti; ti = ti->next) {
65 blob.out_size = sizeof(struct VenusFid);
67 blob.out = (char *)&vFid;
68 code = pioctl(ti->data, VIOCGETFID, &blob, follow);
70 PioctlError(code, ti->data);
73 printf("%s: %x:%d.%d.%d\n", ti->data, vFid.Cell, vFid.Fid.Volume,
74 vFid.Fid.Vnode, vFid.Fid.Unique);
85 register afs_int32 code;
86 register struct cmd_syndesc *ts;
90 * The following signal action for AIX is necessary so that in case of a
91 * crash (i.e. core is generated) we can include the user's data section
92 * in the core dump. Unfortunately, by default, only a partial core is
93 * generated which, in many cases, isn't too useful.
97 sigemptyset(&nsa.sa_mask);
98 nsa.sa_handler = SIG_DFL;
99 nsa.sa_flags = SA_FULLDUMP;
100 sigaction(SIGSEGV, &nsa, NULL);
105 ts = cmd_CreateSyntax("initcmd", WhatFidCmd, NULL, "list fid for file(s)");
106 WhatFidCmd_FileParm = cmd_AddParm(ts, "-path", CMD_LIST, 0, "pathnames");
107 WhatFidCmd_FollowLinkParm =
108 cmd_AddParm(ts, "-link", CMD_FLAG, CMD_OPTIONAL,
109 "do not follow symlinks");
111 exit(cmd_Dispatch(argc, argv));
115 PioctlError(code, filename)
120 if (errno == EINVAL) {
123 "%s: Invalid argument; it is possible that %s is not in AFS.\n",
126 fprintf(stderr, "%s: Invalid argument.\n", pn);
127 } else if (errno == ENOENT) {
129 fprintf(stderr, "%s: File '%s' doesn't exist\n", pn, filename);
131 fprintf(stderr, "%s: no such file returned\n", pn);
132 } else if (errno == EROFS)
134 "%s: You can not change a backup or readonly volume\n", pn);
135 else if (errno == EACCES || errno == EPERM) {
138 "%s: You don't have the required access rights on '%s'\n",
142 "%s: You do not have the required rights to do this operation\n",
146 fprintf(stderr, "%s:'%s'", pn, filename);
148 fprintf(stderr, "%s", pn);
149 fprintf(stderr, ": %s\n", afs_error_message(errno));