17 Commits

Author SHA1 Message Date
David Herrmann
dd481c2fa6 pty: add env_reset property
This property controls whether the environment should be reset before
spawning the child process. Defaults to "no" and affects whether "-p" is
passed as default argument to /bin/login.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-12 21:20:45 +01:00
David Herrmann
d50f80a72f pty: add "colorterm" property
The colorterm property is used (if set) as COLORTERM environment variable.
Note that this variable (despite the name) is not used with
terminfo/termcap. Instead, it's solely used to identify the running
terminal.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-12-12 20:12:21 +01:00
David Herrmann
593a4992b4 pty: set XDG_SEAT for childs
Recent systemd was updated to parse XDG_SEAT in PAM so we can assign
logins to the correct seat.
This patch allows pty users to specify what seat they run on so the PTY
can correctly set the seat variable. If no seat is specified, then
XDG_SEAT is not set so we still allow non-seated logins.
Note that if kmscon_pty is run with XDG_SEAT set, this will also be set
for the client PTY so unset it if you don't want the environment to be
copied to the client (like any environment variable).

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-10-07 17:24:52 +02:00
David Herrmann
89cb239fce pty: set argv via helper function
This makes the pty layer independent of kmscon global state. This allows
us to use it in other applications bundled with kmscon. There is still
some work to do to make it fully independent so we can integrate it into
TSM. But that's not really needed, yet.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 21:24:34 +02:00
David Herrmann
9c48153e30 pty: set "TERM" via helper function instead of kmscon_conf
Instead of accessing global state, we now set the TERM value via a helper
function. This is needed to make the pty layer independent of kmscon.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-26 19:25:35 +02:00
David Herrmann
b5aa89f4ac pty: remove public eloop dependency
We now create an eloop object internally to avoid requiring public eloop
headers. Functionality is still the same but now hidden in the library.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-09-18 19:22:09 +02:00
David Herrmann
3bcce95be3 pty: add kmscon_pty_signal()
Allow to send arbitrary signals to the foreground process group of the
pty. Linux supports the TIOCSIG ioctl so we actually do not need to
implement this on our own, yeah!

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-27 13:35:41 +02:00
David Herrmann
d98dba57d3 pty: fix log statements
Remove new-lines and add LOG_SUBSYSTEM.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-24 17:44:42 +01:00
David Herrmann
4790d9f7ab eloop: move prefix to "ev_" instead of "kmscon_"
The long "kmscon_" prefix is horrible so move everything to "ev_" now.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-03-20 19:08:29 +01:00
David Herrmann
885bdef87b pty: change callback parameters to "const xy"
There is no reason to allow the callbacks to modify our internal data so
make it constant.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-29 14:22:48 +01:00
David Herrmann
229b4bfde2 pty: buffer data between pty and child
If the child returns EWOULDBLOCK on write we need to save the input in a
buffer to avoid loosing data. We need to work in non-blocking mode to
avoid UI hangs so we simply use the new ring-buffer object to store
data.

This also changes the callback behavior. The pty is no longer closed
implicitely so the owner must call pty_close now even if the close
callback is called. This avoids circular callbacks.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 17:17:20 +01:00
David Herrmann
ecb7ddbc29 pty: merge input and close callbacks
There is no reason to keep two callbacks as the caller always registers
both. Hence, we can use a shared callback. Reading length 0 means closed
like reading from an fd.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 14:03:52 +01:00
David Herrmann
da0623c260 terminal, pty: pass eloop reference on obj creation
There is no reason to pass the eloop reference late at terminal/pty
open. If we pass it early on object creation we will always have a valid
reference and can remove several code paths.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:56:13 +01:00
David Herrmann
9b4c6c5542 pty: move output_cb to input_cb
The output_cb handles output from the pty but it actually makes more
sense to call it input_cb as we are handling input to our console here.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:45:06 +01:00
David Herrmann
cda62d3e60 pty: move pty_input to pty_write
pty_write actually makes more sense as we are writing to the other end
and not reading input.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:44:25 +01:00
David Herrmann
c3d2ea3eb2 pty: fix style issue
Fix small indentation style issue.

Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-28 13:43:09 +01:00
Ran Benita
c63a5f2b95 Add pseudo terminal support
This commit adds a new pty object.

The pty object takes care of all pseudo terminal handling, reading and
writing. It can be opened and closed, and notify through callbacks when
input arrives or the child process exits/dies. It can also receive input
and pass it along to the child process.

There is not yet any real VTE processing, so we display raw escape
codes and so on. However, this should provide immediate feedback for
any further vte development, as we start to act like a real terminal
emulator.

Signed-off-by: Ran Benita <ran234@gmail.com>
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
2012-01-23 14:02:43 +01:00