* /dev/fd driver for Ultrix DECstations
@ 1993-03-26 0:38 John Mackin
1993-03-29 19:21 ` Scott Schwartz
0 siblings, 1 reply; 3+ messages in thread
From: John Mackin @ 1993-03-26 0:38 UTC (permalink / raw)
To: The rc Mailing List
I thought this was posted to comp.sources.unix. In any case it was
certainly ok'd for public release; I would have given a reference
to comp.sources.unix for it but when I looked I couldn't work out
what was going on there -- maybe the archive site I looked at
was busted. Anyway. Since rc can use /dev/fd to advantage,
maybe this will interest people on this list. As the Subject: says,
this is a device driver implementing /dev/fd for DECstations
running Ultrix, version 4.2 (or later, it says; I have only
tried 4.2 myself). This is by Boyd Roberts. You need the
kernel objects that come with your Ultrix distribution to
re-build the kernel to include this driver. Follow the
build instructions in the README; they work :).
OK,
John.
# To unbundle, sh this file
echo README 1>&2
sed 's/.//' >README <<'//GO.SYSIN DD README'
-Installation instructions for a Ninth Edition style /dev/fd driver for
-4.2 (and later) ULTRIX systems.
-
- 1. cp devfd.c /usr/sys/fs/gfs
-
- 2. Edit /usr/sys/machine/common/conf.c and before `cdevsw' add :
-
-#if DEVFD > 0
-int devfdopen();
-#else
-#define devfdopen nodev
-#endif
-
- 3. Choose a free slot in the `cdevsw' (I used 90) and put:
-
- {devfdopen, nodev, nodev, nodev, /*90*/
- nodev, nodev, nodev, 0,
- nodev, nodev, 0, 0},
-
- 4. Edit /usr/sys/conf/mips/files.mips and add:
-
-fs/gfs/devfd.c optional devfd device-driver Notbinary
-
- 5. To enable this driver for your kernel, the following two lines
- must be added to /usr/sys/conf/mips/<machine>
-
-options DEVFD
-pseudo-device devfd
-
-
- 6. Re-configure your kernel and make it:
-
- cd /usr/sys/conf/mips/<machine>
- config <machine>
- cd /usr/sys/MIPS/<machine>
- make depend
- make
-
- 7. Boot the new `vmunix'.
-
- 8. Create the necessary special files with /usr/bin/sh5:
-
- cd /dev
- mkdir fd
- cd fd
- umask 0111
- i=0
- while test $i -lt 64
- do
- mknod $i c 90 $i # use major device (ie. 90) that
- i=`expr $i + 1` # concurs with your cdevsw entry
- done
- ln /dev/fd/0 /dev/stdin
- ln /dev/fd/1 /dev/stdout
- ln /dev/fd/2 /dev/stderr
-
- 9. You now have a /dev/fd driver, test it with:
-
- echo '/dev/fd ok?' | cat /dev/stdin
-
-Thanks to Norman Wilson for an essential piece of insight which allows /dev/fd
-to be implemented as a driver, rather than a foul hack in the kernel [c]open().
-
-
-Boyd Roberts <boyd@prl.dec.com>
-Member of Technical Staff
-Paris Research Laboratory
-Digital Equipment Corporation
//GO.SYSIN DD README
echo devfd.c 1>&2
sed 's/.//' >devfd.c <<'//GO.SYSIN DD devfd.c'
-/* Copyright 1991 Digital Equipment Corporation
- * All Rights Reserved
- *
- * Permission to use, copy, and modify this software and its documentation is
- * hereby granted only under the following terms and conditions. Both the
- * above copyright notice and this permission notice must appear in all copies
- * of the software, derivative works or modified versions, and any portions
- * thereof, and both notices must appear in supporting documentation.
- *
- * Users of this software agree to the terms and conditions set forth herein,
- * and hereby grant back to Digital a non-exclusive, unrestricted, royalty-free
- * right and license under any changes, enhancements or extensions made to the
- * core functions of the software, including but not limited to those affording
- * compatibility with other hardware or software environments, but excluding
- * applications which incorporate this software. Users further agree to use
- * their best efforts to return to Digital any such changes, enhancements or
- * extensions that they make and inform Digital of noteworthy uses of this
- * software. Correspondence should be provided to Digital at:
- *
- * Director of Licensing
- * Paris Research Laboratory
- * Digital Equipment Corporation
- * 85 Avenue Victor Hugo
- * 92500 Rueil Malmaison
- * France
- *
- * This software may be distributed (but not offered for sale or transferred
- * for compensation) to third parties, provided such third parties agree to
- * abide by the terms and conditions of this notice.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
- * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
- * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- * SOFTWARE.
- */
-
-/*
- * Ninth Edition style /dev/fd/... driver.
- *
- * Boyd Roberts <boyd@prl.dec.com>
- * Digital PRL
- * September '91
- */
-
-#include "../h/param.h"
-#include "../h/systm.h"
-#include "../h/dir.h"
-#include "../h/user.h"
-#include "../h/kernel.h"
-#include "../h/gnode.h"
-#include "../h/proc.h"
-#include "../h/conf.h"
-#include "../h/file.h"
-#include "../h/socket.h"
-#include "../h/socketvar.h"
-#include "../h/mount.h"
-#include "../h/stat.h"
-#include "../h/ioctl.h"
-#include "../h/flock.h"
-#include "../h/exec.h"
-
-#undef GETF
-#define GETF(fp, fd) if ((fp = getf(fd)) == NULL) return u.u_error
-
-int
-devfdopen(dev, flag)
-dev_t dev;
-int flag;
-{
- struct file *fp; /* file table entry for this open */
- struct file *dfp; /* file table entry for /dev/fd/`minor(dev)' */
- int fd; /* fd allocated for this open */
- int dfd; /* fd allocated for /dev/fd/`minor(dev)' */
-
- dfd = minor(dev);
- fd = u.u_r.r_val1; /* courtesy of ufalloc() */
-
-#ifdef DEBUG
- mprintf("/dev/fd/%d will be %d\n", dfd, fd);
-#endif DEBUG
-
- GETF(dfp, dfd);
- GETF(fp, fd);
-
- /* If both are the same then it's opening a closed /dev/fd/... */
- if (fp == dfp)
- return EBADF;
-
- /* fake dup() */
- smp_lock(&lk_file, LK_RETRY);
- U_OFILE_SET(fd, dfp);
- dfp->f_count++;
- U_POFILE_SET(fd, U_POFILE(dfd));
- smp_unlock(&lk_file);
-
- /* free my file table entry and return */
- return closef(fp);
-}
-
//GO.SYSIN DD devfd.c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: /dev/fd driver for Ultrix DECstations
1993-03-26 0:38 /dev/fd driver for Ultrix DECstations John Mackin
@ 1993-03-29 19:21 ` Scott Schwartz
1993-03-29 19:47 ` Jim Davis
0 siblings, 1 reply; 3+ messages in thread
From: Scott Schwartz @ 1993-03-29 19:21 UTC (permalink / raw)
To: The rc Mailing List
Does anyone have one for SunOS, by any chance?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: /dev/fd driver for Ultrix DECstations
1993-03-29 19:21 ` Scott Schwartz
@ 1993-03-29 19:47 ` Jim Davis
0 siblings, 0 replies; 3+ messages in thread
From: Jim Davis @ 1993-03-29 19:47 UTC (permalink / raw)
To: Scott Schwartz; +Cc: The rc Mailing List
On Mon, 29 Mar 1993, Scott Schwartz wrote:
> Does anyone have one for SunOS, by any chance?
Yes, for 4.1.1. Never tried it on 4.1.2 or 4.1.3, but I think it should
work. Anonymous ftp to gemini.tuc.noao.edu:/pub/devfd.shar.
(For all its warts, Solaris 2.1 has /dev/fd built in and it works well
with rc.)
--
Jim Davis | "So here I am, not being entertained."
jdavis@cs.arizona.edu | -- Calvin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1993-03-29 19:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-03-26 0:38 /dev/fd driver for Ultrix DECstations John Mackin
1993-03-29 19:21 ` Scott Schwartz
1993-03-29 19:47 ` Jim Davis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).