Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 1996 12:10:05 -0800 (PST)
From:      Tony Sterrett <tony@nlanr.net>
To:        hackers@FreeBSD.ORG
Subject:   (no subject given)
Message-ID:  <199612102010.MAA28642@nlanr.net>

next in thread | raw e-mail | index | archive | help
Hello everybody I am trying to install a test driver I wrote. 
The driver is simple it just returns a 0 when opened. My test
code only openeds the driver. I performed all the steps in
the FreeBSD tutorial on installing driver and my kernel recompiles
clean. However when I run I get a strange error:

 fd = -1
 tst: Unknown error: -266382256


Details follow:

The Test code:
main()
{

	int fd;
	fd = open("/dev/tst", O_RDONLY);
	if (fd < 0)
		{
		printf ("fd = %d \n",fd);
		perror("tst");
		}
}

and the driver code is :


tstopen(dev_t dev, int flag, int type, struct proc *p)
{
	return (1);

}

and here is a log of my install steps:

in /usr/src/sys/i386/conf/files.i386 -
/local/src/tst.c                optional        tst     device-driver

in usr/src/sys/i386/i386/conf.c

#include "tst.h"
#if NTST > 0 
d_open_t        tstopen;
d_close_t       tstclose;
d_rdwr_t        tstread;
d_ioctl_t       tstioctl;
#else
#define tstopen         nxopen
#define tstclose        nxclose
#define tstread         nxread
#define tstioctl        nxioctl
#endif

and

     { tstopen,      tstclose,       tstread,        nowrite,     /*76*/
       tstioctl,     nostop,         nullreset,      nodevtotty,/*test */   
	noselect,      nommap,         NULL},
								      
 for the struct cdevsw   cdevsw[] value.


 in GENERIC the config file
 pseudo-device      tst


 and I 
 mknod c 76 0

 76 is the cdevsw element

Any ideas. Thanks in advance.
Tony




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612102010.MAA28642>