No description
Find a file
Tom Cherry 013289364e logwrapper: open child_ptty in child process and remove ignore_int_quit
Opening child_ptty before fork() means that the parent process will
use child_ptty as the controlling terminal if it doesn't already have
one.  This is a problem, because when the parent_ptty closes, SIGHUP
will be sent to the parent process, since its controlling terminal has
closed.

It's better to have the child process start its own session and then
open child_ptty as its controlling terminal.  In this case, the child
process will get SIGHUP if the parent process exits, but the parent
process avoids the original issue.

There is a concern that the child_ptty will never be opened and
POLLHUP will never be generated, but there is a work-around in place
with a timeout to handle that extremely rare situation.

Secondly, remove the ignore_int_quit logic.  It is described to
totally ignore these signals, similar to `nohup` which should be
preferred.  However, it regressed shortly after being introduced in
2013 and serves essentially no purpose currently.

Thirdly, add a forward_signals option that does what we should have
done the whole time with signals: it forwards SIGHUP, SIGQUIT, and
SIGINT to the child process and let that process handle them.  This
only needs to be enabled in the `logwrapper` case itself.  Other
processes should not need to change any signals.  This fixes case 3)
below.

Lastly, add O_CLOEXEC where appropriate.

Test: launch process as `adb shell logwrapper yes`
      1) The both processes exit when given SIGINT
      2) The process prints when abbreviated is not enabled
      3) The process does print when abbreviated is enabled;
         this was previously broken
Test: launch process as `adb shell` then `logwrapper yes`
      4) The both processes exit when given SIGINT
      5) The process prints if abbreviated is enabled or not.
      6) Ctrl-c then Ctrl-c again rapidly and observe that the
         logwrapper process is terminated by the second Ctrl-c.
Test: simulate a failure in child() before opening child_tty and
      observe logwrapper and the child exiting appropriately.

Change-Id: Ia76cd17e16535500170d8f5e2183b3bbbf843df7
2019-09-25 12:59:52 -07:00
adb adb: fix adb remount -R 2019-09-18 09:40:50 -07:00
base <android-base/endian.h>: fix interoperability issue 2019-09-18 13:06:45 +08:00
bootstat Simply reboot if the boringssl self test fails 2019-09-19 14:59:07 -07:00
cpio Switch from dist-for-goals to dist in Android.bp 2018-11-19 23:06:12 -08:00
debuggerd Add TEMP_FAILURE_RETRY where appropriate. 2019-09-18 19:05:25 -07:00
deprecated-adf adf: rename. 2019-02-14 16:30:24 -08:00
diagnose_usb
fastboot fastboot: don't use sparse_file_import_auto() in load_buf_fd() 2019-09-17 13:43:56 -07:00
fs_mgr Merge "Construct the super_vbmeta image" 2019-09-19 10:21:53 +00:00
gatekeeperd Remove libhwbinder/libhidltransport deps 2019-09-05 14:17:42 -07:00
healthd Remove libhwbinder/libhidltransport deps 2019-09-05 14:17:42 -07:00
include
init Merge "init: create sockets before forking" 2019-09-20 14:59:58 +00:00
janitors Add the two best build system janitors. 2019-03-25 10:25:13 -07:00
libappfuse Close /dev/fuse FD before calling onClosed 2019-05-31 17:06:52 +01:00
libasyncio Revert "Mark libs as double_loadable" 2019-03-11 14:10:34 +00:00
libbacktrace libbacktrace: Fix clang-tidy warning 2019-09-09 18:39:08 +02:00
libbinderwrapper
libcrypto_utils Convert more modules to Android.bp 2018-10-31 21:53:37 -07:00
libcutils Merge "Allocate UID for fs-verity ownership in keystore" 2019-09-17 16:08:48 +00:00
libdiskconfig
libgrallocusage Merge "Build both static and shared lib." 2018-09-25 22:29:31 +00:00
libion ion-unit-tests: Add heap id verification test. 2019-09-10 04:50:24 -07:00
libkeyutils mini-keyctl: fix key id parsing by "0x" prefix 2019-04-15 15:19:08 -07:00
liblog liblog: run liblog#enoent only as root 2019-09-04 13:39:06 -07:00
libmeminfo Add support for scudo native allocator. 2019-09-18 16:41:25 -07:00
libmemtrack Remove libhwbinder/libhidltransport deps 2019-09-05 14:17:42 -07:00
libmemunreachable Merge "Add support for scudo native allocator." 2019-09-19 14:42:23 +00:00
libmetricslogger DO NOT MERGE - Merge pie-platform-release (PPRL.181205.001) into master 2018-12-11 14:46:12 -08:00
libmodprobe libmodprobe: add verbose mode 2019-08-07 10:44:32 -07:00
libnativebridge Update OWNERS for libnativebridge 2019-02-13 19:20:59 +09:00
libnativeloader Remove unused libnativeloader-dummy-headers 2019-09-12 15:22:18 +01:00
libnetutils Refactor OWNERS files for Android Core Networking 2019-02-12 13:25:13 +08:00
libpackagelistparser libpackageparser: C rules for bools. 2019-08-12 12:43:34 -07:00
libpixelflinger Mark gglMulx and gglMulAddx as always_inline 2019-02-14 11:59:48 -08:00
libprocessgroup Add surenb@ to libprocessgroup OWNERS 2019-09-17 08:50:04 -07:00
libprocinfo Add ReadMapFileAsyncSafe function. 2019-08-23 10:07:44 -07:00
libqtaguid
libsparse libsparse: replace legacy min() with std::min() 2019-08-15 14:07:51 +08:00
libstats Merge "libstats: remove _USING_LIBCXX." 2019-08-06 12:39:52 -07:00
libsuspend Remove libsuspend from VNDK. 2018-08-14 13:39:55 -07:00
libsync Enable native_bridge_support for libsync 2019-05-15 12:40:33 +02:00
libsystem Merge changes I8186718c,I8d6f33e9,I56fe5e11,Ie4004c98,I531d3d60, ... am: b26696e2dd 2019-05-21 02:24:56 -07:00
libsysutils Enable clang-tidy for libsysutils. 2019-04-24 00:35:58 +09:00
libunwindstack Fix LocalUpdatableMaps 2019-09-16 18:28:38 -07:00
libusbhost Revert "Mark libs as double_loadable" 2019-03-11 14:10:34 +00:00
libutils Use Android systemTime implementation for host linux. 2019-09-19 15:32:33 -07:00
libvndksupport Make android_load_sphal_library thread-safe 2019-07-15 13:58:51 -07:00
libziparchive Avoid using data descriptors in ZIP files when possible. 2019-07-23 06:58:53 +00:00
llkd llkd: do not call sync() 2019-01-10 12:52:35 -08:00
lmkd Merge "lmkd: Prevent non-main threads being registered or killed by lmkd" 2019-07-12 13:39:47 -07:00
logcat logcatd: fallocate and fadvise to logcat files 2019-09-04 22:45:48 +00:00
logd logd: Allow setDropped() to be called on already dropped messages 2019-08-23 14:58:14 -07:00
logwrapper logwrapper: open child_ptty in child process and remove ignore_int_quit 2019-09-25 12:59:52 -07:00
property_service init: ro.boottime.init.first_stage 2019-05-08 16:07:10 +00:00
qemu_pipe
reboot
rootdir Merge changes Iff879def,I79c72346 2019-09-20 14:59:42 +00:00
run-as run-as: improve diagnostics on failure. 2019-03-13 11:16:03 -07:00
sdcard Move layout_version to /data/misc/installd 2019-08-21 10:12:18 -07:00
shell_and_utilities Include ldd in /system/bin. 2019-07-25 12:47:34 -07:00
storaged Remove libhwbinder/libhidltransport deps 2019-09-05 14:17:42 -07:00
toolbox toolbox: add modprobe 2019-08-06 13:58:13 -07:00
trusty Merge "Provide VINTF for Trusty Keymaster" 2019-09-10 19:09:04 +00:00
usbd Remove libhwbinder/libhidltransport deps 2019-09-05 14:17:42 -07:00
watchdogd Move watchdogd out of init 2018-08-02 12:25:58 -07:00
.clang-format
.clang-format-2 Move clang-formats to build. 2019-01-18 14:26:33 -08:00
.clang-format-4 Move clang-formats to build. 2019-01-18 14:26:33 -08:00
.gitignore
Android.bp
CleanSpec.mk Rename product_services to system_ext 2019-07-09 08:56:53 +00:00
MODULE_LICENSE_APACHE2
NOTICE
OWNERS Move per-file OWNERS directives to their directories. 2018-06-06 11:49:40 +09:00
PREUPLOAD.cfg
TEST_MAPPING Add init_tests to CTS 2019-08-22 08:37:55 -07:00