xref: /minix3/sys/sys/pty.h (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: pty.h,v 1.11 2014/10/15 15:00:03 christos Exp $	*/
26c8f7fc3SBen Gras 
36c8f7fc3SBen Gras /*-
46c8f7fc3SBen Gras  * Copyright (c) 2004 The NetBSD Foundation, Inc.
56c8f7fc3SBen Gras  * All rights reserved.
66c8f7fc3SBen Gras  *
76c8f7fc3SBen Gras  * This code is derived from software contributed to The NetBSD Foundation
86c8f7fc3SBen Gras  * by Christos Zoulas.
96c8f7fc3SBen Gras  *
106c8f7fc3SBen Gras  * Redistribution and use in source and binary forms, with or without
116c8f7fc3SBen Gras  * modification, are permitted provided that the following conditions
126c8f7fc3SBen Gras  * are met:
136c8f7fc3SBen Gras  * 1. Redistributions of source code must retain the above copyright
146c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer.
156c8f7fc3SBen Gras  * 2. Redistributions in binary form must reproduce the above copyright
166c8f7fc3SBen Gras  *    notice, this list of conditions and the following disclaimer in the
176c8f7fc3SBen Gras  *    documentation and/or other materials provided with the distribution.
186c8f7fc3SBen Gras  *
196c8f7fc3SBen Gras  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
206c8f7fc3SBen Gras  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
216c8f7fc3SBen Gras  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
226c8f7fc3SBen Gras  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
236c8f7fc3SBen Gras  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
246c8f7fc3SBen Gras  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
256c8f7fc3SBen Gras  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
266c8f7fc3SBen Gras  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
276c8f7fc3SBen Gras  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
286c8f7fc3SBen Gras  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
296c8f7fc3SBen Gras  * POSSIBILITY OF SUCH DAMAGE.
306c8f7fc3SBen Gras  */
316c8f7fc3SBen Gras #ifndef _SYS_PTY_H_
326c8f7fc3SBen Gras #define _SYS_PTY_H_
336c8f7fc3SBen Gras 
346c8f7fc3SBen Gras int pty_isfree(int, int);
356c8f7fc3SBen Gras int pty_check(int);
366c8f7fc3SBen Gras 
376c8f7fc3SBen Gras #ifndef NO_DEV_PTM
386c8f7fc3SBen Gras void ptmattach(int);
39*0a6a1f1dSLionel Sambuc int pty_fill_ptmget(struct lwp *, dev_t, int, int, void *, struct mount *);
40*0a6a1f1dSLionel Sambuc int pty_grant_slave(struct lwp *, dev_t, struct mount *);
416c8f7fc3SBen Gras dev_t pty_makedev(char, int);
426c8f7fc3SBen Gras struct ptm_pty *pty_sethandler(struct ptm_pty *);
43*0a6a1f1dSLionel Sambuc int pty_getmp(struct lwp *, struct mount **);
446c8f7fc3SBen Gras 
45*0a6a1f1dSLionel Sambuc /*
46*0a6a1f1dSLionel Sambuc  * Ptm_pty is used for switch ptm{x} driver between BSDPTY, PTYFS.
47*0a6a1f1dSLionel Sambuc  * Functions' argument (struct mount *) is used only PTYFS,
48*0a6a1f1dSLionel Sambuc  * in the case BSDPTY can be NULL.
49*0a6a1f1dSLionel Sambuc  */
506c8f7fc3SBen Gras struct ptm_pty {
51*0a6a1f1dSLionel Sambuc 	int (*allocvp)(struct mount *, struct lwp *, struct vnode **, dev_t,
526c8f7fc3SBen Gras 	    char);
53*0a6a1f1dSLionel Sambuc 	int (*makename)(struct mount *, struct lwp *, char *, size_t, dev_t, char);
54*0a6a1f1dSLionel Sambuc 	void (*getvattr)(struct mount *, struct lwp *, struct vattr *);
55*0a6a1f1dSLionel Sambuc 	int (*getmp)(struct lwp *, struct mount **);
566c8f7fc3SBen Gras };
576c8f7fc3SBen Gras 
586c8f7fc3SBen Gras #ifdef COMPAT_BSDPTY
596c8f7fc3SBen Gras extern struct ptm_pty ptm_bsdpty;
606c8f7fc3SBen Gras #endif
616c8f7fc3SBen Gras 
62*0a6a1f1dSLionel Sambuc #endif /* NO_DEV_PTM */
63*0a6a1f1dSLionel Sambuc 
64*0a6a1f1dSLionel Sambuc extern int npty;
65*0a6a1f1dSLionel Sambuc 
666c8f7fc3SBen Gras #endif /* _SYS_PTY_H_ */
67