home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1611 < prev    next >
Internet Message Format  |  1990-12-28  |  4KB

  1. From: lmjm@doc.ic.ac.uk (Lee McLoughlin)
  2. Newsgroups: alt.sources
  3. Subject: Buffer: patches for system 5
  4. Message-ID: <2119@gould.doc.ic.ac.uk>
  5. Date: 22 Jul 90 18:03:01 GMT
  6.  
  7. Here are the patches to buffer to allow it to compile under system 5 unix.
  8. (There is also a missing rcs log comment in there.)
  9.  
  10. I've tested these out under HP-UX 7.0 and Gould UTX 2.1A System 5 emulation.
  11.  
  12. diff -cr buffer.old/README buffer/README
  13. *** buffer.old/README    Sun Jul 22 18:41:40 1990
  14. --- buffer/README    Sun Jul 22 19:01:01 1990
  15. ***************
  16. *** 1,5 ****
  17.   This is a program designed to speed up writing tapes on remote tape
  18. ! drives.  It runs on SunOS so long as you have shared memory and locks. 
  19.   
  20.   The program splits itself into two processes.  The first process reads
  21.   (and reblocks) from stdin into a shared memory buffer.  The second
  22. --- 1,8 ----
  23.   This is a program designed to speed up writing tapes on remote tape
  24. ! drives.  Requirements are shared memory and locks.
  25. ! Buffer has been tested under SunOS 4.0, HP-UX 7.0 and
  26. ! Gould UTX 2.1A (sv universe).
  27.   
  28.   The program splits itself into two processes.  The first process reads
  29.   (and reblocks) from stdin into a shared memory buffer.  The second
  30. diff -cr buffer.old/buffer.c buffer/buffer.c
  31. *** buffer.old/buffer.c    Sun Jul 22 18:41:42 1990
  32. --- buffer/buffer.c    Sun Jul 22 18:46:39 1990
  33. ***************
  34. *** 9,14 ****
  35. --- 9,21 ----
  36.    * L.McLoughlin, Imperial College, 1990
  37.    *
  38.    * $Log:    buffer.c,v $
  39. +  * Revision 1.5  90/07/22  18:46:38  lmjm
  40. +  * Added system 5 support.
  41. +  * 
  42. +  * Revision 1.4  90/07/22  18:29:48  lmjm
  43. +  * Updated arg handling to be more consistent.
  44. +  * Make sofar printing size an option.
  45. +  * 
  46.    * Revision 1.3  90/05/15  23:27:46  lmjm
  47.    * Added -S option (show how much has been writen).
  48.    * Added -m option to specify how much shared memory to grab.
  49. ***************
  50. *** 27,32 ****
  51. --- 34,40 ----
  52.    * 
  53.    */
  54.   #include <stdio.h>
  55. + #include <signal.h>
  56.   #include <sys/types.h>
  57.   #include <sys/stat.h>
  58.   #include <sys/ipc.h>
  59. ***************
  60. *** 34,40 ****
  61.   #include <sys/sem.h>
  62.   
  63.   #ifndef lint
  64. ! static char *rcsid = "$Header: /home/gould/staff/csg/lmjm/src/buffer/RCS/buffer.c,v 1.3 90/05/15 23:27:46 lmjm Exp Locker: lmjm $";
  65.   #endif
  66.   
  67.   extern char *shmat();
  68. --- 42,48 ----
  69.   #include <sys/sem.h>
  70.   
  71.   #ifndef lint
  72. ! static char *rcsid = "$Header: /home/gould/staff/csg/lmjm/src/buffer/RCS/buffer.c,v 1.5 90/07/22 18:46:38 lmjm Exp Locker: lmjm $";
  73.   #endif
  74.   
  75.   extern char *shmat();
  76. ***************
  77. *** 235,241 ****
  78. --- 243,253 ----
  79.           fprintf( stderr, "pbuffer is 0x%08x, buffer_size is %d [%d x %d]\n",
  80.               (char *)pbuffer, buffer_size, blocks, blocksize );
  81.   
  82. + #ifdef SYS5
  83. +     memset( (char *)pbuffer, '\0', buffer_size );
  84. + #else
  85.       bzero( (char *)pbuffer, buffer_size );
  86. + #endif
  87.       pbuffer->blocks_used_lock = -1;
  88.       pbuffer->blocks_free_lock = -1;
  89.   
  90. diff -cr buffer.old/makefile buffer/makefile
  91. *** buffer.old/makefile    Sun Jul 22 18:41:41 1990
  92. --- buffer/makefile    Sun Jul 22 18:49:54 1990
  93. ***************
  94. *** 6,11 ****
  95. --- 6,13 ----
  96.   INSTMAN=/usr/man/manl
  97.   # The manual page section (normally l or 1)
  98.   S=l
  99. + # Add -DSYS5 for A System 5 (USG) version of unix.
  100. + CFLAGS=
  101.   
  102.   buffer: buffer.o sem.o
  103.       $(CC) -o buffer $(CFLAGS) buffer.o sem.o
  104. diff -cr buffer.old/sem.c buffer/sem.c
  105. *** buffer.old/sem.c    Sun Jul 22 18:41:42 1990
  106. --- buffer/sem.c    Sun Jul 22 18:20:51 1990
  107. ***************
  108. *** 5,10 ****
  109. --- 5,18 ----
  110.   #include <sys/ipc.h>
  111.   #include <sys/sem.h>
  112.   
  113. + #ifdef SYS5
  114. + union semun {
  115. +     int val;
  116. +     struct semid_ds *buf;
  117. +     ushort *array;
  118. + };
  119. + #endif
  120.   /* Set a semaphore to a particular value - meant to be used before
  121.    * first lock/unlock */
  122.   void
  123.