aboutsummaryrefslogtreecommitdiff
path: root/slave.c (follow)
Commit message (Collapse)AuthorAgeLines
* slave: skip e310487dae99 if not supportedJan Beich2021-01-23-0/+2
| | | | | | slave.c:188:26: error: use of undeclared identifier 'IUTF8' flags.c_iflag |= IUTF8; ^
* log: include 'fmt' in __VA_ARGS__Daniel Eklöf2020-08-23-2/+3
| | | | | This ensures all calls have at least one __VA_ARGS__ argument, thus making them ISO C99 compliant.
* slave: set $COLORTERM environment variable to "truecolor"Craig Barnes2020-08-23-0/+1
| | | | | | | This is also done by libvte, alacritty, kitty and several other terminal emulators as a way to indicate support for 24-bit RGB colors. It generally also implies support for the xterm 256-color palette and basic ECMA-48 colors.
* Convert most dynamic allocations to use functions from xmalloc.hCraig Barnes2020-08-08-4/+5
|
* Replace non-portable "\e" escape in string literals with "\033"Craig Barnes2020-08-02-4/+4
|
* Revert "slave: use an event FD to communicate errors after fork before exec"Daniel Eklöf2020-08-01-17/+20
| | | | | | | | | | | | | | | | | This reverts commit 027a8de6f547115fd90b8ee612fc616b61d5000c. I was a bit quick on this one, and only tested error cases. Turns out, this causes foot to hang in a blocking read(3) on the event FD. This is because while the FD has FD_CLOEXEC, that flag is per file descriptor. I.e. the forked copy of the event fd is closed when we exec(), but since this isn't a pipe, nothing is signaled to the parent process, which thus remains blocking in read(3) since its copy of the event fd hasn't been closed. We _could_ write a dummy value on the event fd just before exec(), but then we wouldn't be able to catch errors from exec() self - only errors *before* exec().
* slave: use an event FD to communicate errors after fork before execDaniel Eklöf2020-08-01-20/+17
| | | | | | | | Replace the pipe we used to communicate errors after fork(), but before exec() to the parent process with an event FD. The overhead in the kernel is much lower to setup an event fd, compared to a pipe.
* slave: emit user-notifications before dup:ing stdin/stdout/stderrDaniel Eklöf2020-08-01-40/+43
| | | | | | | | | Since we need to restore the status flags anyway, there's nothing to gain from emitting the user notifications after dup:ing the pts file descriptor. On the other hand, emitting user notifications *before* dup:ing means we can still print error messages for e.g. write(3) errors.
* slave: user-notifications: skip the O_NONBLOCK dance when there aren't any notificationsDaniel Eklöf2020-07-31-1/+1
|
* slave: restore pts file status flags after emitting user-notificationsDaniel Eklöf2020-07-31-3/+5
| | | | | | | | | | | | | | | We (need to) set O_NONBLOCK on the pts file description before emitting the user-notifications, to ensure we don't block in write(3). However, since file status flags are per *file*, not per file *descriptor*, this ends up setting O_NONBLOCK on the dup:ed stdin/stdout/stderr file descriptors too. Not all clients want this, or can handle this. Thus we need to restore the original flags before exec:ing the client. This fixes "makepkg" build failures.
* slave: user-notifications: don't block in write(3)Daniel Eklöf2020-07-31-0/+18
| | | | | | | | | | | The main process is blocking and waiting for us to close the error pipe (in exec(3), via O_CLOEXEC). Thus, pts data will *not* be processed until we've exec:d the shell. Because of this we must not write too much and block in write(3). Do this by setting O_NONBLOCK on the pts fd (*after* dup:ing it to stdin/stderr/sdout) and watch for EAGAIN EWOULDBLOCK.
* slave: user-notifications: emit errors first, then warnings and last deprecationsDaniel Eklöf2020-07-31-2/+21
|
* user-notification: 'productify' the user-warning systemDaniel Eklöf2020-07-30-38/+48
| | | | | | | | * Rename user_warning to user_notification * Add warning and error types (in addition to the existing deprecated) * Simplify logic when emitting a user notification after forking; we don't need to copy the notification data since we're in a new process and have total control over that memory.
* slave: don't ignore write(3) errorsDaniel Eklöf2020-07-29-3/+14
|
* term: add capability to print warnings *inside* the terminalDaniel Eklöf2020-07-29-3/+31
| | | | | This is intended to be used to print e.g. deprecation warnings inside the terminal, *before* the shell is started.
* slave: set IUTF8Daniel Eklöf2020-05-26-0/+14
|
* slave: restore signal maskDaniel Eklöf2020-05-21-1/+4
|
* slave: configure pts to be the controlling terminal of the forked processDaniel Eklöf2020-05-13-0/+7
|
* slave: set $SHELL when command line is a shell listed in /etc/shellsDaniel Eklöf2020-03-02-0/+51
|
* slave: check return value of chdir()Daniel Eklöf2020-02-20-1/+6
|
* slave: prefix argv[0] with a '-' when spawning a login-shellDaniel Eklöf2020-02-20-5/+26
|
* term: term_init: add 'cwd' argumentDaniel Eklöf2019-12-21-1/+3
| | | | | | | | | | This is used when spawning the slave, to set its current working directory just before we exec() the client. In a regular foot instance, we set the cwd from getcwd(). In a foot server instance, each connecting client sends its cwd to the server, and we use that.
* term: term_spawn_new(): new function, spawns a new foot/footclient processDaniel Eklöf2019-12-21-0/+1
| | | | Bind ctrl+shift+return to it
* slave: restore signals before calling exec()Daniel Eklöf2019-11-03-1/+13
|
* slave: remove unneeded defineDaniel Eklöf2019-11-03-1/+0
|
* slave: turn on FD_CLOEXEC after slave has been spawnedDaniel Eklöf2019-11-03-0/+9
| | | | | This ensures that our ptmx FD isn't carried over to other terminals spawned later.
* slave: set TERM environment variable in slave processDaniel Eklöf2019-11-01-1/+4
|
* slave: log child's errno, not parentsDaniel Eklöf2019-10-30-2/+2
|
* slave: fix debug logging (no 'term' variable)Daniel Eklöf2019-10-30-2/+2
|
* term: move client startup to a new function, slave_spawn()Daniel Eklöf2019-10-30-2/+70
|
* slave: rename slave_spawn() -> slave_exec()Daniel Eklöf2019-10-30-1/+1
|
* main: allow user to override shell on the command lineDaniel Eklöf2019-07-17-8/+1
|
* slave: break out command line tokenizerDaniel Eklöf2019-07-17-79/+1
|
* slave: report exec() failure back to main processDaniel Eklöf2019-07-17-1/+2
|
* slave: exec shell from confDaniel Eklöf2019-07-17-2/+87
|
* logging: disable debug logging by defaultDaniel Eklöf2019-07-03-1/+1
|
* slave: remove initial debug codeDaniel Eklöf2019-06-29-16/+0
|
* wip: vt parsing: initial csi/osc dispatchingDaniel Eklöf2019-06-15-0/+5
|
* Initial handling of multi byte charactersDaniel Eklöf2019-06-13-1/+1
| | | | Use mblen() to calculate the byte count for each character.
* Render cursorDaniel Eklöf2019-06-13-0/+3
|
* Use frame callback to rate-limit surface updatesDaniel Eklöf2019-06-13-0/+3
|
* initial grid implementationDaniel Eklöf2019-06-13-1/+2
| | | | | This allows us to render *something*, even though it's inefficient, stupid and far far away from the real thing.
* Set up pseudo terminal and fork slaveDaniel Eklöf2019-06-13-0/+67