unix - C Code: To connect a pty terminal to current process to execute commands -


in unix process, planning write code access terminal. so, can login process , run few commands.

for example, can telnet 0:2000 terminal , there can dump commands dump process information.

on research, saw can use /dev/pts or /dev/tty access terminal process. user can login terminal these not clear on how works.

to create new pseudoterminal, tou need call following functions in order:

  • posix_openpt (to new master)

  • grantpt (to fix permissions new slave)

  • unlockpt (to unlock slave)

  • ptsname (to name of slave)

  • open (to open slave)

  • setsid (optional, enter new session , process group - typically after fork when running separate process on slave)


Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -