1 /* Copyright (C) 1996 Transarc Corporation - All rights reserved */
3 * (C) COPYRIGHT IBM CORPORATION 1987
4 * LICENSED MATERIALS - PROPERTY OF IBM
15 #include <sys/ioctl.h>
16 #include <sys/socket.h>
18 #include <netinet/in.h>
21 #include <afs/venus.h>
22 #include "afs/prs_fs.h"
23 #include <afs/afsint.h>
25 #include <afs/cellconfig.h>
39 #include "AFS_component_version_number.c"
41 int WhatFidCmd_FileParm;
42 int WhatFidCmd_FollowLinkParm;
45 register struct cmd_syndesc *as;
47 register afs_int32 code;
48 struct ViceIoctl blob;
50 register struct cmd_item *ti;
51 struct VolumeStatus *status;
55 if (as->parms[1].items)
57 for(ti=as->parms[0].items; ti; ti=ti->next) {
59 blob.out_size = sizeof(struct VenusFid);
61 blob.out = (char*)&vFid;
62 code = pioctl(ti->data, VIOCGETFID, &blob, follow);
64 PioctlError(code, ti->data);
67 printf("%s: %x:%d.%d.%d\n", ti->data, vFid.Cell, vFid.Fid.Volume,
68 vFid.Fid.Vnode, vFid.Fid.Unique);
78 register afs_int32 code;
79 register struct cmd_syndesc *ts;
83 * The following signal action for AIX is necessary so that in case of a
84 * crash (i.e. core is generated) we can include the user's data section
85 * in the core dump. Unfortunately, by default, only a partial core is
86 * generated which, in many cases, isn't too useful.
90 sigemptyset(&nsa.sa_mask);
91 nsa.sa_handler = SIG_DFL;
92 nsa.sa_flags = SA_FULLDUMP;
93 sigaction(SIGSEGV, &nsa, NULL);
98 ts = cmd_CreateSyntax("initcmd", WhatFidCmd, 0, "list fid for file(s)");
99 WhatFidCmd_FileParm = cmd_AddParm(ts, "-path", CMD_LIST, 0, "pathnames");
100 WhatFidCmd_FollowLinkParm = cmd_AddParm(ts, "-link", CMD_FLAG, CMD_OPTIONAL,
101 "do not follow symlinks");
103 exit(cmd_Dispatch(argc, argv));
107 PioctlError(code, filename)
112 if (errno == EINVAL) {
114 fprintf(stderr,"%s: Invalid argument; it is possible that %s is not in AFS.\n", pn, filename);
115 else fprintf(stderr,"%s: Invalid argument.\n", pn);
117 else if (errno == ENOENT) {
118 if (filename) fprintf(stderr,"%s: File '%s' doesn't exist\n", pn, filename);
119 else fprintf(stderr,"%s: no such file returned\n", pn);
121 else if (errno == EROFS) fprintf(stderr,"%s: You can not change a backup or readonly volume\n", pn);
122 else if (errno == EACCES || errno == EPERM) {
123 if (filename) fprintf(stderr,"%s: You don't have the required access rights on '%s'\n", pn, filename);
124 else fprintf(stderr,"%s: You do not have the required rights to do this operation\n", pn);
127 if (filename) fprintf(stderr,"%s:'%s'", pn, filename);
128 else fprintf(stderr,"%s", pn);
129 fprintf(stderr,": %s\n", error_message(errno));