pty.c (181905) | pty.c (182069) |
---|---|
1/*- 2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Portions of this software were developed under sponsorship from Snow 6 * B.V., the Netherlands. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Portions of this software were developed under sponsorship from Snow 6 * B.V., the Netherlands. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 14 unchanged lines hidden (view full) --- 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 181905 2008-08-20 08:31:58Z ed $"); | 31__FBSDID("$FreeBSD: head/sys/kern/tty_pty.c 182069 2008-08-23 16:03:00Z ed $"); |
32 33#include <sys/param.h> 34#include <sys/conf.h> 35#include <sys/eventhandler.h> 36#include <sys/fcntl.h> 37#include <sys/kernel.h> 38#include <sys/proc.h> | 32 33#include <sys/param.h> 34#include <sys/conf.h> 35#include <sys/eventhandler.h> 36#include <sys/fcntl.h> 37#include <sys/kernel.h> 38#include <sys/proc.h> |
39#include <sys/sysctl.h> |
|
39#include <sys/systm.h> 40#include <sys/tty.h> 41 42/* 43 * This driver implements a BSD-style compatibility naming scheme for 44 * the pts(4) driver. We just call into pts(4) to create the actual PTY. 45 * To make sure we don't use the same PTY multiple times, we abuse 46 * si_drv1 inside the cdev to mark whether the PTY is in use. 47 */ 48 | 40#include <sys/systm.h> 41#include <sys/tty.h> 42 43/* 44 * This driver implements a BSD-style compatibility naming scheme for 45 * the pts(4) driver. We just call into pts(4) to create the actual PTY. 46 * To make sure we don't use the same PTY multiple times, we abuse 47 * si_drv1 inside the cdev to mark whether the PTY is in use. 48 */ 49 |
49static int pty_warningcnt = 10; | 50static unsigned int pty_warningcnt = 10; 51SYSCTL_UINT(_kern, OID_AUTO, tty_pty_warningcnt, CTLFLAG_RW, 52 &pty_warningcnt, 0, 53 "Warnings that will be triggered upon PTY allocation"); |
50 51static int 52ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) 53{ 54 int u, error; 55 char name[] = "ttyXX"; 56 57 if (!atomic_cmpset_ptr((uintptr_t *)&dev->si_drv1, 0, 1)) --- 68 unchanged lines hidden --- | 54 55static int 56ptydev_fdopen(struct cdev *dev, int fflags, struct thread *td, struct file *fp) 57{ 58 int u, error; 59 char name[] = "ttyXX"; 60 61 if (!atomic_cmpset_ptr((uintptr_t *)&dev->si_drv1, 0, 1)) --- 68 unchanged lines hidden --- |