gpt 말로는 scanf() 같이 터미널에서 입력 받는 등, pipe 보다는 터미널의 영향을 받는 프로그램을 테스트 하기 좋다고.
forkpty는 fork + openpty 라는데 한번 둘러는 봐야겠다.
The openpty() function finds an available pseudoterminal and returns file descriptors for the master and slave in amaster and aslave. If name is not NULL, the filename of the slave is returned in name. If termp is not NULL, the terminal parameters of the slave will be set to the values in termp. If winp is not NULL, the window size of the slave will be set to the values in winp. The login_tty() function prepares for a login on the terminal fd (which may be a real terminal device, or the slave of a pseudoterminal as returned by openpty()) by creating a new session, making fd the controlling terminal for the calling process, setting fd to be the standard input, output, and error streams of the current process, and closing fd.
The forkpty() function combines openpty(), fork(2), and login_tty() to create a new process operating in a pseudoterminal. The file descriptor of the master side of the pseudoterminal is returned in amaster, and the filename of the slave in name if it is not NULL. The termp and winp arguments, if not NULL, will determine the terminal attributes and window size of the slave side of the pseudoterminal.
voidinput_event(structinput_dev* dev, unsigned int type, unsigned int code, int value) report new input event Parameters structinput_dev*devdevice that generated the eventunsignedinttypetype of the eventunsignedintcodeevent codeintvaluevalue of the event
Description This function should be used by drivers implementing various input devices to report input events. See alsoinput_inject_event(). NOTE input_event()may be safely used right after input device was allocated withinput_allocate_device(), even before it is registered withinput_register_device(), but the event will not reach any of the input handlers. Such early invocation ofinput_event()may be used to ‘seed’ initial state of a switch or initial position of absolute axis, etc.
LD_DEBUG=help cat Valid options for the LD_DEBUG environment variable are:
libs display library search paths reloc display relocation processing files display progress for input file symbols display symbol table processing bindings display information about symbol binding versions display version dependencies all all previous options combined statistics display relocation statistics unused determined unused DSOs help display this help message and exit
To direct the debugging output into a file instead of standard output a filename can be specified using the LD_DEBUG_OUTPUT environment variable.