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/ioctl.h>
16 #include <sys/socket.h>
20 #include <netinet/in.h>
23 #include <afs/com_err.h>
25 #include <afs/venus.h>
31 #include "afs/prs_fs.h"
32 #include <afs/afsint.h>
34 #include <afs/cellconfig.h>
37 #include <afs/com_err.h>
38 #include <afs/afs_consts.h>
39 #include <afs/sys_prototypes.h>
41 #define MAXINSIZE 1300 /* pioctl complains if data is larger than this */
42 #define VMSGSIZE 128 /* size of msg buf in volume hdr */
44 static void Die(int code, char *filename);
46 static char pn[] = "fs";
47 static int rxInitDone = 0;
50 Twiddle(struct cmd_syndesc *as, void *arock)
53 struct ViceIoctl blob;
58 ti = as->parms[0].items;
63 rxp.rx_initReceiveWindow = tmp;
64 ti = as->parms[1].items;
69 rxp.rx_maxReceiveWindow = tmp;
70 ti = as->parms[2].items;
75 rxp.rx_initSendWindow = tmp;
76 ti = as->parms[3].items;
81 rxp.rx_maxSendWindow = tmp;
82 ti = as->parms[4].items;
87 rxp.rxi_nSendFrags = tmp;
88 ti = as->parms[5].items;
93 rxp.rxi_nRecvFrags = tmp;
94 ti = as->parms[6].items;
99 rxp.rxi_OrphanFragSize = tmp;
100 ti = as->parms[7].items;
101 if (ti && ti->data) {
102 tmp = atoi(ti->data);
105 rxp.rx_maxReceiveSize = tmp;
106 ti = as->parms[8].items;
107 if (ti && ti->data) {
108 tmp = atoi(ti->data);
111 rxp.rx_MyMaxSendSize = tmp;
113 blob.in = (char *)&rxp;
114 blob.out = (char *)&rxp;
115 blob.in_size = sizeof(rxp);
116 blob.out_size = sizeof(rxp);
117 code = pioctl(0, VIOC_TWIDDLE, &blob, 1);
125 #include "AFS_component_version_number.c"
128 main(int argc, char **argv)
131 struct cmd_syndesc *ts;
135 * The following signal action for AIX is necessary so that in case of a
136 * crash (i.e. core is generated) we can include the user's data section
137 * in the core dump. Unfortunately, by default, only a partial core is
138 * generated which, in many cases, isn't too useful.
140 struct sigaction nsa;
142 sigemptyset(&nsa.sa_mask);
143 nsa.sa_handler = SIG_DFL;
144 nsa.sa_flags = SA_FULLDUMP;
145 sigaction(SIGSEGV, &nsa, NULL);
147 /* try to find volume location information */
150 ts = cmd_CreateSyntax(NULL, Twiddle, NULL, "adjust rx parms");
151 cmd_AddParm(ts, "-initReceiveWindow ", CMD_SINGLE, CMD_OPTIONAL, "16");
152 cmd_AddParm(ts, "-maxReceiveWindow ", CMD_SINGLE, CMD_OPTIONAL, "16");
153 cmd_AddParm(ts, "-initSendWindow ", CMD_SINGLE, CMD_OPTIONAL, "8");
154 cmd_AddParm(ts, "-maxSendWindow ", CMD_SINGLE, CMD_OPTIONAL, "16");
155 cmd_AddParm(ts, "-nSendFrags ", CMD_SINGLE, CMD_OPTIONAL, "4");
156 cmd_AddParm(ts, "-nRecvFrags ", CMD_SINGLE, CMD_OPTIONAL, "4");
157 cmd_AddParm(ts, "-OrphanFragSize ", CMD_SINGLE, CMD_OPTIONAL, "512");
158 cmd_AddParm(ts, "-maxReceiveSize ", CMD_SINGLE, CMD_OPTIONAL, "");
159 cmd_AddParm(ts, "-MyMaxSendSize ", CMD_SINGLE, CMD_OPTIONAL, "");
161 code = cmd_Dispatch(argc, argv);
169 Die(int code, char *filename)
172 if (errno == EINVAL) {
175 "%s: Invalid argument; it is possible that %s is not in AFS.\n",
178 fprintf(stderr, "%s: Invalid argument.\n", pn);
179 } else if (errno == ENOENT) {
181 fprintf(stderr, "%s: File '%s' doesn't exist\n", pn, filename);
183 fprintf(stderr, "%s: no such file returned\n", pn);
184 } else if (errno == EROFS)
186 "%s: You can not change a backup or readonly volume\n", pn);
187 else if (errno == EACCES || errno == EPERM) {
190 "%s: You don't have the required access rights on '%s'\n",
194 "%s: You do not have the required rights to do this operation\n",
198 fprintf(stderr, "%s:'%s'", pn, filename);
200 fprintf(stderr, "%s", pn);
201 fprintf(stderr, ": %s\n", afs_error_message(errno));