Top | ![]() |
![]() |
![]() |
![]() |
#define | IDE_PTY_FD_INVALID |
#define | IDE_PTY_INTERCEPT_MAGIC |
typedef | IdePtyFd |
struct | IdePtyInterceptSide |
void (*IdePtyInterceptCallback) (const IdePtyIntercept *intercept
,const IdePtyInterceptSide *side
,const guint8 *data
,gsize len
,gpointer user_data
);
IdePtyFd
ide_pty_intercept_create_master (void
);
Creates a new PTY master using posix_openpt()
. Some fallbacks are
provided for non-Linux systems where O_CLOEXEC and O_NONBLOCK may
not be supported.
a FD that should be closed with close()
if successful.
Upon error, IDE_PTY_FD_INVALID
(-1) is returned.
Since: 3.32
IdePtyFd ide_pty_intercept_create_slave (IdePtyFd master_fd
,gboolean blocking
);
This creates a new slave to the PTY master master_fd
.
This uses grantpt()
, unlockpt()
, and ptsname()
to open a new
PTY slave.
a FD for the slave PTY that should be closed with close()
.
Upon error, IDE_PTY_FD_INVALID
(-1) is returned.
Since: 3.32
gboolean ide_pty_intercept_init (IdePtyIntercept *self
,IdePtyFd fd
,GMainContext *main_context
);
Creates a enw IdePtyIntercept using the PTY master fd fd
.
A new PTY slave is created that will communicate with fd
.
Additionally, a new PTY master is created that can communicate
with another side, and will pass that information to fd
after
extracting any necessary information.
self |
a location of memory to store a IdePtyIntercept |
|
fd |
the PTY master fd, possibly from a VtePty |
|
main_context |
a GMainContext or |
[nullable] |
Since: 3.32
IdePtyFd
ide_pty_intercept_get_fd (IdePtyIntercept *self
);
Gets a master PTY fd created by the IdePtyIntercept. This is suitable to use to create a slave fd which can be passed to a child process.
Since: 3.32
gboolean ide_pty_intercept_set_size (IdePtyIntercept *self
,guint rows
,guint columns
);
Proxies a winsize across to the inferior. If the PTY is the controlling PTY for the process, then SIGWINCH will be signaled in the inferior process.
Since we can't track SIGWINCH cleanly in here, we rely on the external consuming program to notify us of SIGWINCH so that we can copy the new size across.
Since: 3.32
void
ide_pty_intercept_clear (IdePtyIntercept *self
);
Cleans up a IdePtyIntercept previously initialized with
ide_pty_intercept_init()
.
This diconnects any GIOChannel that have been attached and releases any allocated memory.
It is invalid to use self
after calling this function.
Since: 3.32
void ide_pty_intercept_set_callback (IdePtyIntercept *self
,IdePtyInterceptSide *side
,IdePtyInterceptCallback callback
,gpointer user_data
);
This sets the callback to execute every time data is received from a particular side of the intercept.
You may only set one per side.
self |
a IdePtyIntercept |
|
side |
the side containing the data to watch |
|
callback |
the callback to execute when data is received. |
[scope notified] |
user_data |
closure data for |
Since: 3.32