From owner-cvs-all Tue Nov 5 23:50:55 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CE4B537B401; Tue, 5 Nov 2002 23:50:53 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0383B43E3B; Tue, 5 Nov 2002 23:50:53 -0800 (PST) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id gA67of9d093097; Wed, 6 Nov 2002 08:50:42 +0100 (CET) (envelope-from phk@critter.freebsd.dk) eo: "Daniel O'Connor" Cc: Robert Watson , cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG Subject: Re: cvs commit: src/sys/conf majors In-Reply-To: Your message of "06 Nov 2002 18:11:22 +1030." <1036568487.55376.99.camel@chowder.localdomain> Date: Wed, 06 Nov 2002 08:50:41 +0100 Message-ID: <93096.1036569041@critter.freebsd.dk> From: Poul-Henning Kamp Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG In message <1036568487.55376.99.camel@chowder.localdomain>, "Daniel O'Connor" w rites: >On Wed, 2002-11-06 at 18:04, Poul-Henning Kamp wrote: >> That is still not a reason for cloning the driver. If you did it right >> with a linedisc, it would also work on sparc64 which uses a siemens >> chips, on multiport cards which use their own chips and on any future >> serial port worth its salt. >> >> If you continue to clone the sio driver, you will get a driver which >> conflicts with the sio driver, making life difficult for people who >> want to mix and match normal serial and RS485. >> >> Trust me on this, I've cleaned up more "I'll just make a copy and >> modify" code in the kernel than anybody else in this project. >> >> Please do it right, don't hack it. > >Could you perhaps suggest something helpful, like HOW I would write a >line discipline? >Where would I get information on it? Is there something similar I could >copy? Line disciplines sit between the filedescriptor and the tty drivers, and interpret read/write/ioctl system calls according to their own policies. Currently I belive we have three working line disciplines in the kernel, the default "tty" linediscipline, which we use on command lines and such, the slip and the ppp line disciplines. The "infrastructure" for linedisciplines are in sys/kern/tty_conf.c, this is mainly the functions to register/deregister them with the kernel. The default tty discipline is in sys/kern/tty.c The ppp discipline in sys/net/tty_ppp.c, the slip discipline in sys/net/if_sl.c The entire chapter 10 in the 4.4 "daemon" book is about terminals and line disciplines. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message