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>
23 #include <sys/ioctl.h>
24 #include <sys/socket.h>
26 #include <netinet/in.h>
29 #include <afs/venus.h>
30 #include "afs/prs_fs.h"
31 #include <afs/afsint.h>
33 #include <afs/cellconfig.h>
47 #include "AFS_component_version_number.c"
49 int WhatFidCmd_FileParm;
50 int WhatFidCmd_FollowLinkParm;
53 register struct cmd_syndesc *as;
55 register afs_int32 code;
56 struct ViceIoctl blob;
58 register struct cmd_item *ti;
59 struct VolumeStatus *status;
63 if (as->parms[1].items)
65 for(ti=as->parms[0].items; ti; ti=ti->next) {
67 blob.out_size = sizeof(struct VenusFid);
69 blob.out = (char*)&vFid;
70 code = pioctl(ti->data, VIOCGETFID, &blob, follow);
72 PioctlError(code, ti->data);
75 printf("%s: %x:%d.%d.%d\n", ti->data, vFid.Cell, vFid.Fid.Volume,
76 vFid.Fid.Vnode, vFid.Fid.Unique);
86 register afs_int32 code;
87 register struct cmd_syndesc *ts;
91 * The following signal action for AIX is necessary so that in case of a
92 * crash (i.e. core is generated) we can include the user's data section
93 * in the core dump. Unfortunately, by default, only a partial core is
94 * generated which, in many cases, isn't too useful.
98 sigemptyset(&nsa.sa_mask);
99 nsa.sa_handler = SIG_DFL;
100 nsa.sa_flags = SA_FULLDUMP;
101 sigaction(SIGSEGV, &nsa, NULL);
106 ts = cmd_CreateSyntax("initcmd", WhatFidCmd, 0, "list fid for file(s)");
107 WhatFidCmd_FileParm = cmd_AddParm(ts, "-path", CMD_LIST, 0, "pathnames");
108 WhatFidCmd_FollowLinkParm = 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) {
122 fprintf(stderr,"%s: Invalid argument; it is possible that %s is not in AFS.\n", pn, filename);
123 else fprintf(stderr,"%s: Invalid argument.\n", pn);
125 else if (errno == ENOENT) {
126 if (filename) fprintf(stderr,"%s: File '%s' doesn't exist\n", pn, filename);
127 else fprintf(stderr,"%s: no such file returned\n", pn);
129 else if (errno == EROFS) fprintf(stderr,"%s: You can not change a backup or readonly volume\n", pn);
130 else if (errno == EACCES || errno == EPERM) {
131 if (filename) fprintf(stderr,"%s: You don't have the required access rights on '%s'\n", pn, filename);
132 else fprintf(stderr,"%s: You do not have the required rights to do this operation\n", pn);
135 if (filename) fprintf(stderr,"%s:'%s'", pn, filename);
136 else fprintf(stderr,"%s", pn);
137 fprintf(stderr,": %s\n", error_message(errno));