AW: [git commit] taskset: implement -a (original) (raw)

Walter Harms wharms at bfs.de
Sun Jun 20 13:01:24 UTC 2021


Would using xasprintf() an option here ? I did not try, but the dn[]+sprintf combo requires that both strings are always the same ...

jm2c, re, wh


Von: busybox <busybox-bounces at busybox.net> im Auftrag von Bernhard Reutner-Fischer <rep.dot.nop at gmail.com> Gesendet: Sonntag, 20. Juni 2021 10:18 An: busybox at busybox.net; Denys Vlasenko Cc: Bernhard Reutner-Fischer Betreff: Re: [git commit] taskset: implement -a

WARNUNG: Diese E-Mail kam von außerhalb der Organisation. Klicken Sie nicht auf Links oder öffnen Sie keine Anhänge, es sei denn, Sie kennen den/die Absender*in und wissen, dass der Inhalt sicher ist.

On 19 June 2021 17:42:35 CEST, Denys Vlasenko <vda.linux at googlemail.com> wrote:

commit: https://git.busybox.net/busybox/commit/?id=25128176c46b169cdec2c18b5730c36a940f6eb0 branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function old new delta processpidstr - 854 +854 .rodata 103363 103378 +15 packedusage 33654 33658 +4 tasksetmain 936 190 -746 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/1 up/down: 873/-746) Total: 127 bytes

+ if (opts & OPTa) { + char dn[sizeof("/proc/%s/task") + 3 * sizeof(int)]; + DIR *dir; + struct dirent *ent; + + sprintf(dn, "/proc/%s/task", pidstr); + dir = opendir(dn); + if (!dir) { + goto nothreads; + } + while ((ent = readdir(dir)) != NULL) { + if (isdigit(ent->dname[0])) + processpidstr(ent->dname, opts, aff); + } + IFFEATURECLEANUP(closedir(dir);)

Is this opencoded hunk smaller than a variant with recursive_action? thanks,

+ } else { + nothreads: + processpidstr(pidstr, opts, aff); + } + return EXITSUCCESS; }


busybox mailing list busybox at busybox.net http://lists.busybox.net/mailman/listinfo/busybox



More information about the busybox mailing list