Your example is interesting. Postgres preserves it's arguments (chosen by it's father), it only tunes the command-line of it's sons.
There is no loss of information in the process, on the contrary. 2016-02-01 18:10 GMT+01:00 Mike Frysinger <[email protected]>: > On 01 Feb 2016 09:17, Nicolas CARRIER wrote: > > "init" is 4 chars long, "/bin/init" is 9 chars long, so when I "remove" > the > > while (*++argv) ... loop, there are 5 extra bytes between "init" and the > > content of argv[1]. > > In ps, the symptom is extra spaces inserted in the output, but the > argv[1]+ > > args are shown "correctly" > > In hexdump -C /proc/1/cmdline, 6 zeros instead of 1, are present between > > the last char of "init" and the first of argv[1]. > > OK, so you're talking about embedded NULs. that's entirely to be expected > and there's not really anything you can do about it unless you repack the > args yourself (as you noticed). > > > Personally, I prefer the first solution. I still don't get the point of > > modifying a program's argument, be it init or not... > > it makes a lot of sense when you fork children that have specific purposes. > rather than just seeing the program's name 4 times, it's more helpful for > them to be broken up. for example, postgres does: > 805 ? S 0:28 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > 807 ? Ss 2:49 postgres: checkpointer process > 808 ? Ss 1:05 postgres: writer process > 809 ? Ss 0:56 postgres: wal writer process > 810 ? Ss 0:22 postgres: autovacuum launcher process > 811 ? Ss 1:24 postgres: stats collector process > > surely you'd agree this is way better than if you saw: > 805 ? S 0:28 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > 807 ? Ss 2:49 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > 808 ? Ss 1:05 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > 809 ? Ss 0:56 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > 810 ? Ss 0:22 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > 811 ? Ss 1:24 /usr/lib/postgresql-9.4/bin/postgres -D /etc/postgresql-9.4 > --data-directory=/var/lib/postgresql/9.4/data > > especially if you're trying to debug why one of those processes is taking > up a ton of CPU or memory. > -mike >
_______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
