libera/#devuan/ Sunday, 2024-08-04

joergprocesses may change their own... whateveritis that's shown in `ps`02:55
joergtheir own commandline?02:55
rrqyes04:38
rrqjoerg: (eg in C) memcpy( argv[0], "another commandlline", 22 ); // provided the given commandline is 21 bytes long05:08
joerg:-)05:08
rrq(and maybe the space should be replaced by a NUL, to make a command with 1 argument)05:10
joerg:-D05:11
joergyou're sure? what's about argv[1] ?05:11
joerggiven it exists05:12
joergnot sure if for n>argc, any argv[n] is defined05:13
rrqthe commandline is a contiguous string with NUL separators; I'm not sure one can point argv[0] elsewhere, so it's all within the one string with NUL separation05:13
rrqand limited in total size by the original commandline05:14
joergplausible, but I'd not bet on it05:14
joergI *think* ps (or at least some similar tools, like kde system monitor) distinguish between argv[0] and parameters05:15
joergthen, you certainly could rewrite argc as well05:16
rrqmmm changing argv[0] pointer doesn't change what ps sees05:20
rrqbut argv[1] points into the commandline data starting at argv[0]05:21
rrqso the data size is limited by original commandline, but one can divide it willy-nilly with NUL05:22
rrq(and the have to change argv[1] etc)05:22
joerginteresting05:23
rrqsee also the -z arg for init05:24
joerg       argc  The number of arguments to tclsh or wish.05:29
joerg       argv  Tcl list of arguments to tclsh or wish.05:29
joerg       argv0 The script that tclsh or wish started executing (if it was specified) or otherwise the name by which tclsh or wish was invoked.05:29
joergseems there's a difference between argv[n] and argv005:30
rrqyes. there is a similar comment for ps (the "c" output modifier)05:32
joergexecve...05:41
data41201<13:18

Generated by irclog2html.py 2.17.0 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!