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>
16 #include <sys/ioctl.h>
17 #include <sys/socket.h>
21 #include <netinet/in.h>
25 #include <afs/venus.h>
31 #include "afs/prs_fs.h"
32 #include <afs/afsint.h>
34 #include <afs/cellconfig.h>
40 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */
41 #define VMSGSIZE 128 /* size of msg buf in volume hdr */
43 static char space[MAXSIZE];
44 static char tspace[1024];
45 static struct ubik_client *uclient;
48 extern struct cmd_syndesc *cmd_CreateSyntax();
49 static char pn[] = "fs";
50 static int rxInitDone = 0;
53 struct cmd_syndesc *as; {
55 struct ViceIoctl blob;
60 ti=as->parms[0].items;
62 tmp = atoi (ti->data);
65 rxp.rx_initReceiveWindow = tmp;
66 ti=as->parms[1].items;
68 tmp = atoi (ti->data);
71 rxp.rx_maxReceiveWindow = tmp;
72 ti=as->parms[2].items;
74 tmp = atoi (ti->data);
77 rxp.rx_initSendWindow = tmp;
78 ti=as->parms[3].items;
80 tmp = atoi (ti->data);
83 rxp.rx_maxSendWindow = tmp;
84 ti=as->parms[4].items;
86 tmp = atoi (ti->data);
89 rxp.rxi_nSendFrags = tmp;
90 ti=as->parms[5].items;
92 tmp = atoi (ti->data);
95 rxp.rxi_nRecvFrags = tmp;
96 ti=as->parms[6].items;
98 tmp = atoi (ti->data);
101 rxp.rxi_OrphanFragSize = tmp;
102 ti=as->parms[7].items;
103 if (ti && ti->data) {
104 tmp = atoi (ti->data);
107 rxp.rx_maxReceiveSize = tmp;
108 ti=as->parms[8].items;
109 if (ti && ti->data) {
110 tmp = atoi (ti->data);
113 rxp.rx_MyMaxSendSize = tmp;
115 blob.in = (char *)&rxp;
116 blob.out = (char *)&rxp;
117 blob.in_size = sizeof(rxp);
118 blob.out_size = sizeof(rxp);
119 code = pioctl(0, VIOC_TWIDDLE, &blob, 1);
127 #include "AFS_component_version_number.c"
132 register afs_int32 code;
133 register struct cmd_syndesc *ts;
137 * The following signal action for AIX is necessary so that in case of a
138 * crash (i.e. core is generated) we can include the user's data section
139 * in the core dump. Unfortunately, by default, only a partial core is
140 * generated which, in many cases, isn't too useful.
142 struct sigaction nsa;
144 sigemptyset(&nsa.sa_mask);
145 nsa.sa_handler = SIG_DFL;
146 nsa.sa_flags = SA_FULLDUMP;
147 sigaction(SIGSEGV, &nsa, NULL);
149 /* try to find volume location information */
152 ts = cmd_CreateSyntax((char *)0, Twiddle, 0, "adjust rx parms");
153 cmd_AddParm(ts, "-initReceiveWindow ", CMD_SINGLE, CMD_OPTIONAL, "16");
154 cmd_AddParm(ts, "-maxReceiveWindow ", CMD_SINGLE, CMD_OPTIONAL, "16");
155 cmd_AddParm(ts, "-initSendWindow ", CMD_SINGLE, CMD_OPTIONAL, "8");
156 cmd_AddParm(ts, "-maxSendWindow ", CMD_SINGLE, CMD_OPTIONAL, "16");
157 cmd_AddParm(ts, "-nSendFrags ", CMD_SINGLE, CMD_OPTIONAL, "4");
158 cmd_AddParm(ts, "-nRecvFrags ", CMD_SINGLE, CMD_OPTIONAL, "4");
159 cmd_AddParm(ts, "-OrphanFragSize ", CMD_SINGLE, CMD_OPTIONAL, "512");
160 cmd_AddParm(ts, "-maxReceiveSize ", CMD_SINGLE, CMD_OPTIONAL, "");
161 cmd_AddParm(ts, "-MyMaxSendSize ", CMD_SINGLE, CMD_OPTIONAL, "");
163 code = cmd_Dispatch(argc, argv);
164 if (rxInitDone) rx_Finalize();
174 if (errno == EINVAL) {
176 fprintf(stderr,"%s: Invalid argument; it is possible that %s is not in AFS.\n", pn, filename);
177 else fprintf(stderr,"%s: Invalid argument.\n", pn);
179 else if (errno == ENOENT) {
180 if (filename) fprintf(stderr,"%s: File '%s' doesn't exist\n", pn, filename);
181 else fprintf(stderr,"%s: no such file returned\n", pn);
183 else if (errno == EROFS) fprintf(stderr,"%s: You can not change a backup or readonly volume\n", pn);
184 else if (errno == EACCES || errno == EPERM) {
185 if (filename) fprintf(stderr,"%s: You don't have the required access rights on '%s'\n", pn, filename);
186 else fprintf(stderr,"%s: You do not have the required rights to do this operation\n", pn);
189 if (filename) fprintf(stderr,"%s:'%s'", pn, filename);
190 else fprintf(stderr,"%s", pn);
191 fprintf(stderr,": %s\n", error_message(errno));