Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!husc6!necntc!ncoast!allbery From: arnold@emory.UUCP (Arnold D. Robbins {EUCC}) Newsgroups: comp.sources.misc Subject: /dev/full device for 4.3 BSD Message-ID: <2847@ncoast.UUCP> Date: Fri, 10-Jul-87 22:09:51 EDT Article-I.D.: ncoast.2847 Posted: Fri Jul 10 22:09:51 1987 Date-Received: Sun, 12-Jul-87 15:47:22 EDT Sender: allbery@ncoast.UUCP Organization: Math & Computer Science, Emory University, Atlanta Lines: 83 Approved: allbery@ncoast.UUCP X-Archive: comp.sources.misc/8707/43 A while back in comp.unix.wizards, elsie!ado (Arthur David Olsen) suggested the idea of /dev/full, a data source. He speculated it would be useful for testing tape drives, e.g. $ dd if=/dev/full of=/dev/rmt8 bs=20k to see how fast you can make it go. There may be other uses as well. I liked the idea, so I went ahead and did it. It's only 7 more lines of code in /sys/vax/mem.c in 4.3 BSD. As always, your line numbers may vary, but patch should be able to handle it. Enjoy, Arnold Robbins ------------------------------------- #! /bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #! /bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # mem.c.patch # full.4 # This archive created: Fri Jul 10 12:47:39 1987 export PATH; PATH=/bin:$PATH echo shar: extracting "'mem.c.patch'" '(516 characters)' if test -f 'mem.c.patch' then echo shar: will not over-write existing file "'mem.c.patch'" else cat << \SHAR_EOF > 'mem.c.patch' rcsdiff -c -r1.1 mem.c RCS file: RCS/mem.c,v retrieving revision 1.1 diff -c -r1.1 mem.c *** /tmp/,RCSt1015020 Fri Jul 10 12:46:39 1987 --- mem.c Wed May 27 15:24:33 1987 *************** *** 119,124 **** --- 122,134 ---- goto fault; error = UNIcpy((caddr_t)uio->uio_offset, iov->iov_base, (int)c, rw); + break; + + /* minor device 4 is /dev/full -- success on read, 0 on write */ + case 4: + if (rw == UIO_WRITE) + return (0); + c = iov->iov_len; break; } if (error) SHAR_EOF fi # end of overwriting check echo shar: extracting "'full.4'" '(277 characters)' if test -f 'full.4' then echo shar: will not over-write existing file "'full.4'" else cat << \SHAR_EOF > 'full.4' .TH FULL 4 local .SH NAME full \- data source .SH SYNOPSIS Data read from the full special device always returns the number of bytes requested. .PP The number of bytes that can be written to the full special device is always zero. .SH FILES /dev/full .SH SEE ALSO .IR null (4) SHAR_EOF fi # end of overwriting check # End of shell archive exit 0 -- Arnold Robbins ARPA, CSNET: arnold@emory.ARPA BITNET: arnold@emory UUCP: { decvax, gatech, sun!sunatl }!emory!arnold ONE-OF-THESE-DAYS: arnold@emory.mathcs.emory.edu