Rosen Penev
06cb0bbe9a
[clang-tidy] Add several references
...
Found with performance-unnecessary-value-param
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-12-26 21:55:53 -08:00
ridiculousfish
df0681d393
Remove process_generation_count_t
...
It was unused.
2019-12-26 13:33:14 -08:00
Mathieu Duponchelle
15c1b3ed4b
Place fish in its own process group when launched with -i
...
Fixes #5909
2019-12-23 10:32:37 +01:00
ridiculousfish
c0b3be9fb4
Stop storing block_io in job_t
...
Prior to this fix, a job would hold onto any IO redirections from its
parent. For example:
begin
echo a
end < file.txt
The "echo a" job would hold a reference to the I/O redirection.
The problem is that jobs then extend the life of pipes until the job is
cleaned up. This can prevent pipes from closing, leading to hangs.
Fix this by not storing the block IO; this ensures that jobs do not
prolong the life of pipes.
Fixes #6397
2019-12-11 16:34:20 -08:00
ridiculousfish
0b1af1ace4
Correct the use of the constructed pointer in job lineage
...
This was always being set to a different pointer. Ensure the root job
shares its constructed pointer with its children.
2019-12-10 18:32:56 -08:00
ridiculousfish
f136d634eb
Collapse a job's "parent stuff" into a new type job_lineage_t
...
Currently a job needs to know three things about its "parents:"
1. Any IO redirections for the block or function containing this job
2. The pgid for the parent job
3. Whether the parent job has been fully constructed (to defer self-disown)
These are all tracked in somewhat separate awkward ways. Collapse them
into a single new type job_lineage_t.
2019-12-08 15:03:07 -08:00
Rosen Penev
6f4a9d527c
[clang-tidy] Use C++ using instead of C typedef
...
Found with modernize-use-using
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-29 23:46:51 -08:00
Rosen Penev
1055ff321c
[clang-tidy] Replace NULL with nullptr
...
Found with modernize-use-nullptr
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:23:03 -08:00
Rosen Penev
0dfa7421f3
[clang-tidy] Convert C casts to C++ ones
...
Found with google-readability-casting
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-11-25 14:17:49 -08:00
ridiculousfish
cc1c973025
Remove job_flags as an enum, just use a struct
...
This removes an over-complicated flag implementation, replacing it with
just a plain struct.
2019-10-15 14:40:58 -07:00
ridiculousfish
82eca4bc86
Run clang-format on all files
...
The main change here is to reorder headers.
2019-10-13 15:50:48 -07:00
ridiculousfish
9fd9f70346
Restore terminal modes after sending SIGCONT
...
Fixes #2214
Thanks to @bruce-hill for the patch.
2019-09-01 17:24:23 -07:00
ridiculousfish
a33f0eb636
Clean up some logic around when process exit events are sent
2019-07-28 14:36:57 -07:00
ridiculousfish
8181883111
Minor refactoring of logic around when a job wants to claim the terminal
...
Introduce should_claim_terminal() which encapsulates an && exprsesion which
was previously repeated a lot.
2019-07-12 13:31:56 -07:00
ridiculousfish
09e4f8ff42
Refactor how the terminal is transferred to jobs
...
Centralize the logic around when a job acquires the terminal.
2019-06-29 15:58:36 -07:00
ridiculousfish
4a2c709fb1
Eliminate shell_is_interactive
...
We used to have a global notion of "is the shell interactive" but soon we
will want to have multiple independent execution threads, only some of
which may be interactive. Start tracking this data per-parser.
2019-06-29 11:28:26 -07:00
ridiculousfish
f7e2e7d26b
Don't generate exit events for jobs created from within event handlers
...
Add a new job property from_event_handler, and do not create exit events for
such jobs. This prevents easy accidental infinite recursion.
2019-06-26 17:30:51 -07:00
Fabian Homborg
caedf01c00
Revert "Latch signal handlers"
...
This reverts commit 7ed1022cf4
.
Fixes #5962 .
2019-06-25 11:25:09 +02:00
ridiculousfish
89fb408eb6
Migrate some job flags into const properties struct
...
This helps clarify which parts of a job are mutable, and which are constant.
2019-06-23 12:42:44 -07:00
ridiculousfish
1c66d56d3a
Add debug categories for reaping processes
2019-06-13 14:29:13 -07:00
ridiculousfish
fc99d6c7af
clang-format all files
2019-06-03 20:30:48 -07:00
ridiculousfish
ff55249447
Make events per-parser
...
This makes the following changes:
1. Events in background threads are executed in those threads, instead of
being silently dropped
2. Blocked events are now per-parser instead of global
3. Events are posted in builtin_set instead of within the environment stack
The last one means that we no longer support event handlers for implicit
sets like (example) argv. Instead only the `set` builtin (and also `cd`)
post variable-change events.
Events from universal variable changes are still not fully rationalized.
2019-06-03 02:48:35 -07:00
Fabian Homborg
87971e1f2e
Widen the rest of the FLOGs
...
Fixes #5900 .
2019-05-30 13:08:35 +02:00
Fabian Homborg
d73ee4d54b
More using FLOGF when formatting is needed
...
sed-patched, every time a "%" is used in a call to `FLOG`, we use
`FLOGF` instead.
2019-05-30 11:54:09 +02:00
ridiculousfish
f3ee6a99c3
Add some FLOG logging around internal processes
2019-05-29 12:34:11 -07:00
Fabian Homborg
66e238fad0
More wide IO for FLOG
...
This widens the remaining ones that don't take a char
anywhere.
The rest either use a char _variable_ or __FUNCTION__, which from my
reading is narrow and needs to be widened manually. I've been unable
to test it, though.
See #5900 .
2019-05-29 08:07:04 +02:00
ridiculousfish
ea9d1ad82f
Convert debug(0) calls to FLOG
2019-05-27 17:31:17 -07:00
ridiculousfish
46a9da83e8
Convert terminal ownership logging from debug to flog
2019-05-27 17:24:52 -07:00
ridiculousfish
8774860468
Convert job logging from debug to FLOG
2019-05-27 17:24:52 -07:00
ridiculousfish
7ed1022cf4
Latch signal handlers
...
Now that our interactive signal handlers are a strict superset of
non-interactive ones, there is no reason to "reset" signals or take action
when becoming non-interactive. Clean up how signal handlers get installed.
2019-05-26 18:04:03 -07:00
ridiculousfish
84febe8f2e
Make disowned pid reaping thread-safe
2019-05-22 17:10:33 -07:00
ridiculousfish
508c3a8005
Make is_event and other globals part of parser_t libdata
2019-05-18 19:03:45 -07:00
ridiculousfish
c44dae2d73
Migrate certain runtime flags to atomics hidden behind functions
2019-05-18 18:50:28 -07:00
ridiculousfish
4fcb9d1fed
Hide no_exec behind a function
2019-05-18 18:50:28 -07:00
ridiculousfish
be41407610
Make have_proc_stat an ordinary function
...
Removes a mutable global variable.
2019-05-18 18:50:28 -07:00
ridiculousfish
234c97e6d2
Remove some unused variables
2019-05-12 18:23:00 -07:00
ridiculousfish
1719d6f136
Make $status and $pipestatus per-parser
...
Another step towards allowing multiple parsers to execute in parallel.
2019-05-12 14:00:44 -07:00
ridiculousfish
8a8b2513b5
Eliminate the global jobs() function
...
All job lists are attached to a parser now.
2019-05-05 11:33:08 -07:00
Fabian Homborg
c2970f9618
Reformat all files
...
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.
If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
ridiculousfish
e10838d5d6
Make job_control_mode a static variable with accessors
2019-05-04 20:58:35 -07:00
ridiculousfish
9fb98baba6
Thread the parser into process_clean_after_marking
2019-05-04 20:58:35 -07:00
ridiculousfish
f66e010949
Turn a lot of common.h variables into getter functions
...
Improves thread safety.
2019-05-04 20:58:35 -07:00
ridiculousfish
55e3270ac4
Remove erase_list from process_clean_after_marking
...
We don't need to maintain an erase_list in this function any more.
Simply remove jobs that are completed.
2019-05-01 16:32:14 -07:00
ridiculousfish
3dfaa192da
Put back process and job exit events
...
These were removed in f8b2e818ed
under a
belief that they were unused. But they are documented and supported.
2019-05-01 16:32:14 -07:00
ridiculousfish
43d668bdc8
Continue to refactor internal loop of process_clean_after_marking
...
Factor our logic around when to print a message.
2019-05-01 16:32:14 -07:00
ridiculousfish
b5d3fadf44
Factor out the individual process handling in process_clean_after_marking
...
Helps break up this monolith.
2019-05-01 16:32:14 -07:00
ridiculousfish
b8170ec1ce
Clarify return value of job_reap and process_clean_after_marking
2019-05-01 16:32:14 -07:00
ridiculousfish
9700800ecf
Factor disowned job removal into its own function
...
This helps break up process_clean_after_marking.
2019-05-01 16:31:21 -07:00
ridiculousfish
c05e72749a
Rename PENDING_REMOVAL to DISOWN_REQUESTED
...
A commend implied that PENDING_REMOVAL was broader than it was. In practice
only disown() sets this flag. Rename the flag for clarity.
2019-05-01 15:37:53 -07:00
David Adam
665ae3787a
Switch to runtime check for /proc/self/stat
...
Removes a compile-time check that may have affected cross-compilation.
Work on #1067 .
2019-04-30 16:23:28 +08:00