[5103] in Athena Bugs

home help back first fref pref prev next nref lref last post

/etc/biod

daemon@ATHENA.MIT.EDU (John Carr)
Thu Jun 7 01:14:57 1990

To: bugs@ATHENA.MIT.EDU
Date: Thu, 07 Jun 90 01:14:36 EDT
From: John Carr <jfc@ATHENA.MIT.EDU>


biod has been blamed on some swap space fragmentation.  This patch will
reduce size:

	% size biod /etc/biod
	text    data    bss     dec     hex
	4096    2048    0       6144    1800    biod
	18432   4096    0       22528   5800    /etc/biod

The interesting change is to remove "printf" and print "biod" instead of
argv[0] (given the normal usage of biod, I do not think this is a problem).
Also, <sys/errno.h> is included (since errno is referenced) and "biod 0" is
an error.

*** /source/bsd-4.3/common/etc/biod/biod.c	Fri Jun  5 16:31:52 1987
--- biod.c	Thu Jun  7 01:08:50 1990
***************
*** 2,10 ****
  static  char sccsid[] = "@(#)biod.c 1.1 85/05/30 Copyr 1983 Sun Micro";
  #endif
  
- #include <stdio.h>
  #include <sys/file.h>
  #include <sys/ioctl.h>
  
  /*
   * This is the NFS asynchronous block I/O daemon
--- 2,10 ----
  static char sccsid[] = "@(#)biod.c 1.1 85/05/30 Copyr 1983 Sun Micro";
  #endif
  
  #include <sys/file.h>
  #include <sys/ioctl.h>
+ #include <sys/errno.h>
  
  /*
   * This is the NFS asynchronous block I/O daemon
***************
*** 14,20 ****
  	int argc;
  	char *argv[];
  {
- 	extern int errno;
  	int pid;
  	int count;
  
--- 14,19 ----
***************
*** 24,30 ****
  
  	if (argc == 2) {
  		count = atoi(argv[1]);
! 		if (count < 0) {
  			usage(argv[0]);
  		}
  	} else {
--- 23,29 ----
  
  	if (argc == 2) {
  		count = atoi(argv[1]);
! 		if (count <= 0) {
  			usage(argv[0]);
  		}
  	} else {
***************
*** 41,53 ****
  		pid = fork();
  		if (pid == 0) {
  			async_daemon();		/* Should never return */
! 			fprintf(stderr, "%s: async_daemon ", argv[0]);
! 			perror("");
  			exit(1);
  		}
  		if (pid < 0) {
! 			fprintf(stderr, "%s: cannot fork", argv[0]);
! 			perror("");
  			exit(1);
  		}
  	}
--- 40,50 ----
  		pid = fork();
  		if (pid == 0) {
  			async_daemon();		/* Should never return */
! 			perror("biod: async_daemon");
  			exit(1);
  		}
  		if (pid < 0) {
! 			perror("biod: fork");
  			exit(1);
  		}
  	}
***************
*** 56,62 ****
  usage(name)
  	char	*name;
  {
! 
! 	fprintf(stderr, "usage: %s [<count>]\n", name);
  	exit(1);
  }
--- 53,58 ----
  usage(name)
  	char	*name;
  {
! 	write(2, "usage: biod [<count>]\n", 22); 
  	exit(1);
  }

home help back first fref pref prev next nref lref last post