1#ifndef __VSF_LINUX_PTY_H__
2#define __VSF_LINUX_PTY_H__
7#if VSF_LINUX_CFG_RELATIVE_PATH == ENABLED
19#if VSF_LINUX_CFG_WRAPPER == ENABLED
20#define openpty VSF_LINUX_WRAPPER(openpty)
21#define login_tty VSF_LINUX_WRAPPER(login_tty)
24#if VSF_LINUX_APPLET_USE_PTY == ENABLED
31# ifndef __VSF_APPLET__
36#if defined(__VSF_APPLET__) && (defined(__VSF_APPLET_LIB__) || defined(__VSF_APPLET_LINUX_PTY_LIB__))\
37 && VSF_APPLET_CFG_ABI_PATCH != ENABLED && VSF_LINUX_APPLET_USE_PTY == ENABLED
39#ifndef VSF_LINUX_APPLET_PTY_VPLT
40# if VSF_LINUX_USE_APPLET == ENABLED
41# define VSF_LINUX_APPLET_PTY_VPLT \
42 ((vsf_linux_pty_vplt_t *)(VSF_LINUX_APPLET_VPLT->pty_vplt))
44# define VSF_LINUX_APPLET_PTY_VPLT \
45 ((vsf_linux_pty_vplt_t *)vsf_vplt((void *)0))
49#define VSF_LINUX_APPLET_PTY_ENTRY(__NAME) \
50 VSF_APPLET_VPLT_ENTRY_FUNC_ENTRY(VSF_LINUX_APPLET_PTY_VPLT, __NAME)
51#define VSF_LINUX_APPLET_PTY_IMP(...) \
52 VSF_APPLET_VPLT_ENTRY_FUNC_IMP(VSF_LINUX_APPLET_PTY_VPLT, __VA_ARGS__)
54VSF_LINUX_APPLET_PTY_IMP(
openpty,
int,
int *amaster,
int *aslave,
char *name,
58 return VSF_LINUX_APPLET_PTY_ENTRY(
openpty)(amaster, aslave, name, termp, winp);
60VSF_LINUX_APPLET_PTY_IMP(
login_tty,
int,
int fd) {
62 return VSF_LINUX_APPLET_PTY_ENTRY(
login_tty)(fd);
67int openpty(
int *amaster,
int *aslave,
char *name,
74#define forkpty(__amaster, __name, __termp, __winp) ({ \
75 int VSF_MACRO_SAFE_NAME(master); \
76 int VSF_MACRO_SAFE_NAME(slave); \
77 int VSF_MACRO_SAFE_NAME(pid); \
78 int VSF_MACRO_SAFE_NAME(result) = -1; \
79 if (!openpty(&VSF_MACRO_SAFE_NAME(master), &VSF_MACRO_SAFE_NAME(slave), __name, __termp, __winp)) {\
80 VSF_MACRO_SAFE_NAME(pid) = vfork(); \
81 switch (VSF_MACRO_SAFE_NAME(pid)) { \
83 close(VSF_MACRO_SAFE_NAME(master)); \
84 close(VSF_MACRO_SAFE_NAME(slave)); \
87 close(VSF_MACRO_SAFE_NAME(master)); \
88 if (login_tty(VSF_MACRO_SAFE_NAME(slave))) { \
91 VSF_MACRO_SAFE_NAME(result) = 0; \
94 *(__amaster) = VSF_MACRO_SAFE_NAME(master); \
95 close(VSF_MACRO_SAFE_NAME(slave)); \
96 VSF_MACRO_SAFE_NAME(result) = VSF_MACRO_SAFE_NAME(pid); \
100 VSF_MACRO_SAFE_NAME(result); \
#define openpty
Definition pty.h:20
#define login_tty
Definition pty.h:21
__VSF_VPLT_DECORATOR__ vsf_linux_pty_vplt_t vsf_linux_pty_vplt
Definition vsf_linux.c:4940
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(openpty)
VSF_APPLET_VPLT_ENTRY_FUNC_DEF(login_tty)
vsf_vplt_info_t info
Definition pty.h:26
#define __VSF_VPLT_DECORATOR__
Definition vsf_cfg.h:93
#define VSF_APPLET_VPLT_ENTRY_FUNC_TRACE()
Definition vsf_cfg.h:165