Joker_vD
Joined 6 years ago
Joined 6 years ago
Oh, and did you know that the width of ptrdiff_t is not required to have any relation to the width of size_t? There is even an explicit provision in standard for the case when subtracting two pointers into the same very large array can't fit into ptrdiff_t:
When two pointers are subtracted, both shall point to elements of the same array object, or one past
the last element of the array object; the result is the difference of the subscripts of the two array
elements. The size of the result is implementation-defined, and its type (a signed integer type) is
ptrdiff_t defined in the <stddef.h> header. If the result is not representable in an object of that
type, the behavior is undefined.
So yeah; you should try to work strictly with indices only, they're guaranteed to be correctly addible to pointers no matter the sizes of your arrays. FOR var = start [DOWN] TO end BY step DO ... END
No custom increment expressions, and "step" even usually was only allowed to be a constant (in which case, the language usually didn't have DOWN specifier and used the step's sign instead). Then Dennis Ritchie invented C, and ditched the traditional "do"-loop (Fortran started that construct with DO, so it was called DO loop; Algol used FOR instead, but most people preferred the Fortran's nomenclature... until C came to dominate, but that wouldn't happen for yet another 20 years) in favour of his invention because he felt that easily iterating through linked lists or strings was a much more pressing concern: for(p=head; p; p=p->next) { ... }
for(s=str; *s; s++) { ... }
The downside, of course, is that now you can't straightforwardly write for size_t i = count - 1 downto 0 do
...
endTurns out, it affected the global politics tremendously.
Well, again, the process that calls setsid(2) ceases to receive the signals from its previous process group, so there is nothing for it to propagate. The only way this propagation can work is with cooperation from the parent process of the setsid-calling process: it will need to manually pass the group-wide signals to its setsid-calling child — which it can't reliably do for two obvious reasons.
> By limiting its usage to the period between fork and exec, so that the process calling setsid knows that the parent process is propagating signals to it.
Wait. Are you implying a scheme where the process A, that wants to do setsid(2), forks itself, and it's this child process B that does setsid(2) and all future actual work, while process A merely lives in a "while(1) { sig = sigwait(); signal(pidB, sig); }" loop forever? This almost works but doesn't survive SIGSTOP/SIGCONT/etc. and, of course, you can't propagate SIGKILL. And SIGKILL-propagation is arguably one of the main attraction of the process groups — you send SIGKILL to the process group (or a container, for that matter), and all of it dies with no further work on your part.
How?! After a process calls setsid(2), it becomes a leader of a new process group so it stops receiving signals from its former process group!
> But that would have been nice to actually have nestable job management.
Yes, it would be. Just imagine: a simple, straightforward way to group a bunch of processes (and their potential children, inescapably), signal them all at once, wait for them all at once, etc. Instead, we at best ended up with docker compose and k8s. And they kinda do solve that problem, no question about that but it's just so incredibly heavyweight...
There is always human trial — the whole history/timeline of people taking a particular medicine is effectively a decades-long human trial. That's actually the only way we learn about long-term side effects, see paracetamol for instance. All you're proposing is we remove a smaller, controlled pre-trial before releasing the medicine into the wilder population. Sorry, but that won't solve anything except for your feeling of moral indignation.
I, for one, welcome our Debian overlords, taking care of stupid users such as myself to protect them from both "arbitrary" applications and from non-obsolete versions of non-arbitrary applications.
And yes-yes, this curated walled-off garden is fine, unlike all others walled-off gardens, because its maintained by "the community" (of Debian maintainers, that is).