utilities.c revision 1.35 1 /* $NetBSD: utilities.c,v 1.35 2003/01/24 21:55:09 fvdl Exp $ */
2
3 /*
4 * Copyright (c) 1980, 1986, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement:
17 * This product includes software developed by the University of
18 * California, Berkeley and its contributors.
19 * 4. Neither the name of the University nor the names of its contributors
20 * may be used to endorse or promote products derived from this software
21 * without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36 #include <sys/cdefs.h>
37 #ifndef lint
38 #if 0
39 static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
40 #else
41 __RCSID("$NetBSD: utilities.c,v 1.35 2003/01/24 21:55:09 fvdl Exp $");
42 #endif
43 #endif /* not lint */
44
45 #include <sys/param.h>
46 #include <sys/time.h>
47
48 #include <ufs/ufs/dinode.h>
49 #include <ufs/ufs/dir.h>
50 #include <ufs/ffs/fs.h>
51 #include <ufs/ffs/ffs_extern.h>
52 #include <ufs/ufs/ufs_bswap.h>
53
54 #include <ctype.h>
55 #include <err.h>
56 #include <stdio.h>
57 #include <stdlib.h>
58 #include <string.h>
59 #include <unistd.h>
60
61 #include "fsutil.h"
62 #include "fsck.h"
63 #include "extern.h"
64
65 long diskreads, totalreads; /* Disk cache statistics */
66
67 static void rwerror __P((char *, daddr_t));
68
69 extern int returntosingle;
70
71 int
72 ftypeok(dp)
73 struct dinode *dp;
74 {
75 switch (iswap16(dp->di_mode) & IFMT) {
76
77 case IFDIR:
78 case IFREG:
79 case IFBLK:
80 case IFCHR:
81 case IFLNK:
82 case IFSOCK:
83 case IFIFO:
84 return (1);
85
86 default:
87 if (debug)
88 printf("bad file type 0%o\n", iswap16(dp->di_mode));
89 return (0);
90 }
91 }
92
93 int
94 reply(question)
95 char *question;
96 {
97 int persevere;
98 char c;
99
100 if (preen)
101 pfatal("INTERNAL ERROR: GOT TO reply()");
102 persevere = !strcmp(question, "CONTINUE");
103 printf("\n");
104 if (!persevere && (nflag || fswritefd < 0)) {
105 printf("%s? no\n\n", question);
106 resolved = 0;
107 return (0);
108 }
109 if (yflag || (persevere && nflag)) {
110 printf("%s? yes\n\n", question);
111 return (1);
112 }
113 do {
114 printf("%s? [yn] ", question);
115 (void) fflush(stdout);
116 c = getc(stdin);
117 while (c != '\n' && getc(stdin) != '\n') {
118 if (feof(stdin)) {
119 resolved = 0;
120 return (0);
121 }
122 }
123 } while (c != 'y' && c != 'Y' && c != 'n' && c != 'N');
124 printf("\n");
125 if (c == 'y' || c == 'Y')
126 return (1);
127 resolved = 0;
128 return (0);
129 }
130
131 /*
132 * Malloc buffers and set up cache.
133 */
134 void
135 bufinit()
136 {
137 struct bufarea *bp;
138 long bufcnt, i;
139 char *bufp;
140
141 pbp = pdirbp = (struct bufarea *)0;
142 bufp = malloc((unsigned int)sblock->fs_bsize);
143 if (bufp == 0)
144 errx(EEXIT, "cannot allocate buffer pool");
145 cgblk.b_un.b_buf = bufp;
146 initbarea(&cgblk);
147 bufp = malloc((unsigned int)APPLEUFS_LABEL_SIZE);
148 if (bufp == 0)
149 errx(EEXIT, "cannot allocate buffer pool");
150 appleufsblk.b_un.b_buf = bufp;
151 initbarea(&appleufsblk);
152 bufhead.b_next = bufhead.b_prev = &bufhead;
153 bufcnt = MAXBUFSPACE / sblock->fs_bsize;
154 if (bufcnt < MINBUFS)
155 bufcnt = MINBUFS;
156 for (i = 0; i < bufcnt; i++) {
157 bp = (struct bufarea *)malloc(sizeof(struct bufarea));
158 bufp = malloc((unsigned int)sblock->fs_bsize);
159 if (bp == NULL || bufp == NULL) {
160 if (i >= MINBUFS)
161 break;
162 errx(EEXIT, "cannot allocate buffer pool");
163 }
164 bp->b_un.b_buf = bufp;
165 bp->b_prev = &bufhead;
166 bp->b_next = bufhead.b_next;
167 bufhead.b_next->b_prev = bp;
168 bufhead.b_next = bp;
169 initbarea(bp);
170 }
171 bufhead.b_size = i; /* save number of buffers */
172 }
173
174 /*
175 * Manage a cache of directory blocks.
176 */
177 struct bufarea *
178 getdatablk(blkno, size)
179 daddr_t blkno;
180 long size;
181 {
182 struct bufarea *bp;
183
184 for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next)
185 if (bp->b_bno == fsbtodb(sblock, blkno))
186 goto foundit;
187 for (bp = bufhead.b_prev; bp != &bufhead; bp = bp->b_prev)
188 if ((bp->b_flags & B_INUSE) == 0)
189 break;
190 if (bp == &bufhead)
191 errx(EEXIT, "deadlocked buffer pool");
192 getblk(bp, blkno, size);
193 /* fall through */
194 foundit:
195 totalreads++;
196 bp->b_prev->b_next = bp->b_next;
197 bp->b_next->b_prev = bp->b_prev;
198 bp->b_prev = &bufhead;
199 bp->b_next = bufhead.b_next;
200 bufhead.b_next->b_prev = bp;
201 bufhead.b_next = bp;
202 bp->b_flags |= B_INUSE;
203 return (bp);
204 }
205
206 void
207 getblk(bp, blk, size)
208 struct bufarea *bp;
209 daddr_t blk;
210 long size;
211 {
212 daddr_t dblk;
213
214 dblk = fsbtodb(sblock, blk);
215 if (bp->b_bno != dblk) {
216 flush(fswritefd, bp);
217 diskreads++;
218 bp->b_errs = bread(fsreadfd, bp->b_un.b_buf, dblk, size);
219 bp->b_bno = dblk;
220 bp->b_size = size;
221 }
222 }
223
224 void
225 flush(fd, bp)
226 int fd;
227 struct bufarea *bp;
228 {
229 int i, j;
230 struct csum *ccsp;
231
232 if (!bp->b_dirty)
233 return;
234 if (bp->b_errs != 0)
235 pfatal("WRITING %sZERO'ED BLOCK %lld TO DISK\n",
236 (bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
237 (long long)bp->b_bno);
238 bp->b_dirty = 0;
239 bp->b_errs = 0;
240 bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size);
241 if (bp != &sblk)
242 return;
243 for (i = 0, j = 0; i < sblock->fs_cssize; i += sblock->fs_bsize, j++) {
244 int size = sblock->fs_cssize - i < sblock->fs_bsize ?
245 sblock->fs_cssize - i : sblock->fs_bsize;
246 ccsp = (struct csum *)((char *)sblock->fs_csp + i);
247 if (needswap)
248 ffs_csum_swap(ccsp, ccsp, size);
249 bwrite(fswritefd, (char *)ccsp,
250 fsbtodb(sblock, sblock->fs_csaddr + j * sblock->fs_frag),
251 size);
252 if (needswap)
253 ffs_csum_swap(ccsp, ccsp, size);
254 }
255 }
256
257 static void
258 rwerror(mesg, blk)
259 char *mesg;
260 daddr_t blk;
261 {
262
263 if (preen == 0)
264 printf("\n");
265 pfatal("CANNOT %s: BLK %lld", mesg, (long long)blk);
266 if (reply("CONTINUE") == 0)
267 exit(EEXIT);
268 }
269
270 void
271 ckfini()
272 {
273 struct bufarea *bp, *nbp;
274 int ofsmodified, cnt = 0;
275
276 if (fswritefd < 0) {
277 (void)close(fsreadfd);
278 return;
279 }
280 flush(fswritefd, &sblk);
281 if (havesb && sblk.b_bno != SBOFF / dev_bsize &&
282 !preen && reply("UPDATE STANDARD SUPERBLOCK")) {
283 sblk.b_bno = SBOFF / dev_bsize;
284 sbdirty();
285 flush(fswritefd, &sblk);
286 }
287 flush(fswritefd, &appleufsblk);
288 free(appleufsblk.b_un.b_buf);
289 flush(fswritefd, &cgblk);
290 free(cgblk.b_un.b_buf);
291 for (bp = bufhead.b_prev; bp && bp != &bufhead; bp = nbp) {
292 cnt++;
293 flush(fswritefd, bp);
294 nbp = bp->b_prev;
295 free(bp->b_un.b_buf);
296 free((char *)bp);
297 }
298 if (bufhead.b_size != cnt)
299 errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt);
300 pbp = pdirbp = (struct bufarea *)0;
301 if (markclean && (sblock->fs_clean & FS_ISCLEAN) == 0) {
302 /*
303 * Mark the file system as clean, and sync the superblock.
304 */
305 if (preen)
306 pwarn("MARKING FILE SYSTEM CLEAN\n");
307 else if (!reply("MARK FILE SYSTEM CLEAN"))
308 markclean = 0;
309 if (markclean) {
310 sblock->fs_clean = FS_ISCLEAN;
311 sbdirty();
312 ofsmodified = fsmodified;
313 flush(fswritefd, &sblk);
314 #if LITE2BORKEN
315 fsmodified = ofsmodified;
316 #endif
317 if (!preen)
318 printf(
319 "\n***** FILE SYSTEM MARKED CLEAN *****\n");
320 }
321 }
322 if (debug)
323 printf("cache missed %ld of %ld (%d%%)\n", diskreads,
324 totalreads, (int)(diskreads * 100 / totalreads));
325 (void)close(fsreadfd);
326 (void)close(fswritefd);
327 }
328
329 int
330 bread(fd, buf, blk, size)
331 int fd;
332 char *buf;
333 daddr_t blk;
334 long size;
335 {
336 char *cp;
337 int i, errs;
338 off_t offset;
339
340 offset = blk;
341 offset *= dev_bsize;
342 if (lseek(fd, offset, 0) < 0)
343 rwerror("SEEK", blk);
344 else if (read(fd, buf, (int)size) == size)
345 return (0);
346 rwerror("READ", blk);
347 if (lseek(fd, offset, 0) < 0)
348 rwerror("SEEK", blk);
349 errs = 0;
350 memset(buf, 0, (size_t)size);
351 printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:");
352 for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) {
353 if (read(fd, cp, (int)secsize) != secsize) {
354 (void)lseek(fd, offset + i + secsize, 0);
355 if (secsize != dev_bsize && dev_bsize != 1)
356 printf(" %lld (%lld),",
357 (long long)((blk*dev_bsize + i) / secsize),
358 (long long)(blk + i / dev_bsize));
359 else
360 printf(" %lld,",
361 (long long)(blk + i / dev_bsize));
362 errs++;
363 }
364 }
365 printf("\n");
366 return (errs);
367 }
368
369 void
370 bwrite(fd, buf, blk, size)
371 int fd;
372 char *buf;
373 daddr_t blk;
374 long size;
375 {
376 int i;
377 char *cp;
378 off_t offset;
379
380 if (fd < 0)
381 return;
382 offset = blk;
383 offset *= dev_bsize;
384 if (lseek(fd, offset, 0) < 0)
385 rwerror("SEEK", blk);
386 else if (write(fd, buf, (int)size) == size) {
387 fsmodified = 1;
388 return;
389 }
390 rwerror("WRITE", blk);
391 if (lseek(fd, offset, 0) < 0)
392 rwerror("SEEK", blk);
393 printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
394 for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
395 if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
396 (void)lseek(fd, offset + i + dev_bsize, 0);
397 printf(" %lld,", (long long)(blk + i / dev_bsize));
398 }
399 printf("\n");
400 return;
401 }
402
403 /*
404 * allocate a data block with the specified number of fragments
405 */
406 daddr_t
407 allocblk(frags)
408 long frags;
409 {
410 int i, j, k, cg, baseblk;
411 struct cg *cgp = cgrp;
412
413 if (frags <= 0 || frags > sblock->fs_frag)
414 return (0);
415 for (i = 0; i < maxfsblock - sblock->fs_frag; i += sblock->fs_frag) {
416 for (j = 0; j <= sblock->fs_frag - frags; j++) {
417 if (testbmap(i + j))
418 continue;
419 for (k = 1; k < frags; k++)
420 if (testbmap(i + j + k))
421 break;
422 if (k < frags) {
423 j += k;
424 continue;
425 }
426 cg = dtog(sblock, i + j);
427 getblk(&cgblk, cgtod(sblock, cg), sblock->fs_cgsize);
428 memcpy(cgp, cgblk.b_un.b_cg, sblock->fs_cgsize);
429 if ((doswap && !needswap) || (!doswap && needswap))
430 swap_cg(cgblk.b_un.b_cg, cgp);
431 if (!cg_chkmagic(cgp, 0))
432 pfatal("CG %d: ALLOCBLK: BAD MAGIC NUMBER\n",
433 cg);
434 baseblk = dtogd(sblock, i + j);
435 for (k = 0; k < frags; k++) {
436 setbmap(i + j + k);
437 clrbit(cg_blksfree(cgp, 0), baseblk + k);
438 }
439 n_blks += frags;
440 if (frags == sblock->fs_frag)
441 cgp->cg_cs.cs_nbfree--;
442 else
443 cgp->cg_cs.cs_nffree -= frags;
444 cgdirty();
445 return (i + j);
446 }
447 }
448 return (0);
449 }
450
451 /*
452 * Free a previously allocated block
453 */
454 void
455 freeblk(blkno, frags)
456 daddr_t blkno;
457 long frags;
458 {
459 struct inodesc idesc;
460
461 idesc.id_blkno = blkno;
462 idesc.id_numfrags = frags;
463 (void)pass4check(&idesc);
464 }
465
466 /*
467 * Find a pathname
468 */
469 void
470 getpathname(namebuf, curdir, ino)
471 char *namebuf;
472 ino_t curdir, ino;
473 {
474 int len;
475 char *cp;
476 struct inodesc idesc;
477 static int busy = 0;
478
479 if (curdir == ino && ino == ROOTINO) {
480 (void)strcpy(namebuf, "/");
481 return;
482 }
483 if (busy ||
484 (statemap[curdir] != DSTATE && statemap[curdir] != DFOUND)) {
485 (void)strcpy(namebuf, "?");
486 return;
487 }
488 busy = 1;
489 memset(&idesc, 0, sizeof(struct inodesc));
490 idesc.id_type = DATA;
491 idesc.id_fix = IGNORE;
492 cp = &namebuf[MAXPATHLEN - 1];
493 *cp = '\0';
494 if (curdir != ino) {
495 idesc.id_parent = curdir;
496 goto namelookup;
497 }
498 while (ino != ROOTINO) {
499 idesc.id_number = ino;
500 idesc.id_func = findino;
501 idesc.id_name = "..";
502 if ((ckinode(ginode(ino), &idesc) & FOUND) == 0)
503 break;
504 namelookup:
505 idesc.id_number = idesc.id_parent;
506 idesc.id_parent = ino;
507 idesc.id_func = findname;
508 idesc.id_name = namebuf;
509 if ((ckinode(ginode(idesc.id_number), &idesc)&FOUND) == 0)
510 break;
511 len = strlen(namebuf);
512 cp -= len;
513 memmove(cp, namebuf, (size_t)len);
514 *--cp = '/';
515 if (cp < &namebuf[MAXNAMLEN])
516 break;
517 ino = idesc.id_number;
518 }
519 busy = 0;
520 if (ino != ROOTINO)
521 *--cp = '?';
522 memmove(namebuf, cp, (size_t)(&namebuf[MAXPATHLEN] - cp));
523 }
524
525 void
526 catch(sig)
527 int sig;
528 {
529 if (!doinglevel2) {
530 markclean = 0;
531 ckfini();
532 }
533 exit(12);
534 }
535
536 /*
537 * When preening, allow a single quit to signal
538 * a special exit after filesystem checks complete
539 * so that reboot sequence may be interrupted.
540 */
541 void
542 catchquit(sig)
543 int sig;
544 {
545 printf("returning to single-user after file system check\n");
546 returntosingle = 1;
547 (void)signal(SIGQUIT, SIG_DFL);
548 }
549
550 /*
551 * Ignore a single quit signal; wait and flush just in case.
552 * Used by child processes in preen.
553 */
554 void
555 voidquit(sig)
556 int sig;
557 {
558
559 sleep(1);
560 (void)signal(SIGQUIT, SIG_IGN);
561 (void)signal(SIGQUIT, SIG_DFL);
562 }
563
564 /*
565 * determine whether an inode should be fixed.
566 */
567 int
568 dofix(idesc, msg)
569 struct inodesc *idesc;
570 char *msg;
571 {
572
573 switch (idesc->id_fix) {
574
575 case DONTKNOW:
576 if (idesc->id_type == DATA)
577 direrror(idesc->id_number, msg);
578 else
579 pwarn("%s", msg);
580 if (preen) {
581 printf(" (SALVAGED)\n");
582 idesc->id_fix = FIX;
583 return (ALTERED);
584 }
585 if (reply("SALVAGE") == 0) {
586 idesc->id_fix = NOFIX;
587 return (0);
588 }
589 idesc->id_fix = FIX;
590 return (ALTERED);
591
592 case FIX:
593 return (ALTERED);
594
595 case NOFIX:
596 case IGNORE:
597 return (0);
598
599 default:
600 errx(EEXIT, "UNKNOWN INODESC FIX MODE %d", idesc->id_fix);
601 }
602 /* NOTREACHED */
603 return (0);
604 }
605
606 void
607 copyback_cg(blk)
608 struct bufarea *blk;
609 {
610
611 memcpy(blk->b_un.b_cg, cgrp, sblock->fs_cgsize);
612 if (needswap)
613 swap_cg(cgrp, blk->b_un.b_cg);
614 }
615
616 void
617 swap_cg(o, n)
618 struct cg *o, *n;
619 {
620 int i;
621 u_int32_t *n32, *o32;
622 u_int16_t *n16, *o16;
623
624 n->cg_firstfield = bswap32(o->cg_firstfield);
625 n->cg_magic = bswap32(o->cg_magic);
626 n->cg_time = bswap32(o->cg_time);
627 n->cg_cgx = bswap32(o->cg_cgx);
628 n->cg_ncyl = bswap16(o->cg_ncyl);
629 n->cg_niblk = bswap16(o->cg_niblk);
630 n->cg_ndblk = bswap32(o->cg_ndblk);
631 n->cg_cs.cs_ndir = bswap32(o->cg_cs.cs_ndir);
632 n->cg_cs.cs_nbfree = bswap32(o->cg_cs.cs_nbfree);
633 n->cg_cs.cs_nifree = bswap32(o->cg_cs.cs_nifree);
634 n->cg_cs.cs_nffree = bswap32(o->cg_cs.cs_nffree);
635 n->cg_rotor = bswap32(o->cg_rotor);
636 n->cg_frotor = bswap32(o->cg_frotor);
637 n->cg_irotor = bswap32(o->cg_irotor);
638 n->cg_btotoff = bswap32(o->cg_btotoff);
639 n->cg_boff = bswap32(o->cg_boff);
640 n->cg_iusedoff = bswap32(o->cg_iusedoff);
641 n->cg_freeoff = bswap32(o->cg_freeoff);
642 n->cg_nextfreeoff = bswap32(o->cg_nextfreeoff);
643 n->cg_clustersumoff = bswap32(o->cg_clustersumoff);
644 n->cg_clusteroff = bswap32(o->cg_clusteroff);
645 n->cg_nclusterblks = bswap32(o->cg_nclusterblks);
646 for (i=0; i < MAXFRAG; i++)
647 n->cg_frsum[i] = bswap32(o->cg_frsum[i]);
648
649 if (sblock->fs_postblformat == FS_42POSTBLFMT) { /* old format */
650 struct ocg *on, *oo;
651 int j;
652 on = (struct ocg *)n;
653 oo = (struct ocg *)o;
654 for(i = 0; i < 8; i++) {
655 on->cg_frsum[i] = bswap32(oo->cg_frsum[i]);
656 }
657 for(i = 0; i < 32; i++) {
658 on->cg_btot[i] = bswap32(oo->cg_btot[i]);
659 for (j = 0; j < 8; j++)
660 on->cg_b[i][j] = bswap16(oo->cg_b[i][j]);
661 }
662 memmove(on->cg_iused, oo->cg_iused, 256);
663 on->cg_magic = bswap32(oo->cg_magic);
664 } else { /* new format */
665 if (n->cg_magic == CG_MAGIC) {
666 n32 = (u_int32_t*)((u_int8_t*)n + n->cg_btotoff);
667 o32 = (u_int32_t*)((u_int8_t*)o + n->cg_btotoff);
668 n16 = (u_int16_t*)((u_int8_t*)n + n->cg_boff);
669 o16 = (u_int16_t*)((u_int8_t*)o + n->cg_boff);
670 } else {
671 n32 = (u_int32_t*)((u_int8_t*)n + o->cg_btotoff);
672 o32 = (u_int32_t*)((u_int8_t*)o + o->cg_btotoff);
673 n16 = (u_int16_t*)((u_int8_t*)n + o->cg_boff);
674 o16 = (u_int16_t*)((u_int8_t*)o + o->cg_boff);
675 }
676 for (i=0; i < sblock->fs_cpg; i++)
677 n32[i] = bswap32(o32[i]);
678
679 for (i=0; i < sblock->fs_cpg * sblock->fs_nrpos; i++)
680 n16[i] = bswap16(o16[i]);
681
682 if (n->cg_magic == CG_MAGIC) {
683 n32 = (u_int32_t*)((u_int8_t*)n + n->cg_clustersumoff);
684 o32 = (u_int32_t*)((u_int8_t*)o + n->cg_clustersumoff);
685 } else {
686 n32 = (u_int32_t*)((u_int8_t*)n + o->cg_clustersumoff);
687 o32 = (u_int32_t*)((u_int8_t*)o + o->cg_clustersumoff);
688 }
689 for (i = 1; i < sblock->fs_contigsumsize + 1; i++)
690 n32[i] = bswap32(o32[i]);
691 }
692 }
693
694 void
695 infohandler(int sig)
696 {
697 got_siginfo = 1;
698 }
699
700