blob: 509dc4e8553b291fb4dc3ad858092259cd0a3b88 [file]
/****************************************************************************
* include/pty.h
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __INCLUDE_PTY_H
#define __INCLUDE_PTY_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <termios.h>
#include <sys/ioctl.h>
#ifdef CONFIG_PSEUDOTERM
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#if defined(__cplusplus)
extern "C"
{
#endif
/****************************************************************************
* Create pseudo tty pair with name and set terminal attributes according
* to term and win and return handles for both ends in master and slave.
****************************************************************************/
int openpty(FAR int *master, FAR int *slave, FAR char *name,
FAR const struct termios *term, FAR const struct winsize *win);
/****************************************************************************
* Open a pseudo tty pair as openpty() does and fork. The child has the
* slave as its controlling terminal and its standard streams; the parent
* gets the master.
****************************************************************************/
#ifdef CONFIG_ARCH_HAVE_FORK
pid_t forkpty(FAR int *master, FAR char *name,
FAR const struct termios *term, FAR const struct winsize *win);
#endif
#if defined(__cplusplus)
}
#endif
#endif /* CONFIG_PSEUDOTERM */
#endif /* __INCLUDE_PTY_H */