[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    AW: [git commit] taskset: implement -a
From:       Walter Harms <wharms () bfs ! de>
Date:       2021-06-20 13:01:24
Message-ID: 5111897479e749228e09ef5dcad4fa10 () bfs ! de
[Download RAW message or body]


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@busybox.net> im Auftrag von Bernhard Reutner-Fischer \
                <rep.dot.nop@gmail.com>
Gesendet: Sonntag, 20. Juni 2021 10:18
An: busybox@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@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
> process_pid_str                                        -     854
> +854
> .rodata                                           103363  103378
> +15
> packed_usage                                       33654   33658
> +4
> taskset_main                                         936     190
> -746
> ------------------------------------------------------------------------------
> (add/remove: 1/0 grow/shrink: 2/1 up/down: 873/-746)          Total:
> 127 bytes

> +      if (opts & OPT_a) {
> +              char dn[sizeof("/proc/%s/task") + 3 * sizeof(int)];
> +              DIR *dir;
> +              struct dirent *ent;
> +
> +              sprintf(dn, "/proc/%s/task", pid_str);
> +              dir = opendir(dn);
> +              if (!dir) {
> +                      goto no_threads;
> +              }
> +              while ((ent = readdir(dir)) != NULL) {
> +                      if (isdigit(ent->d_name[0]))
> +                              process_pid_str(ent->d_name, opts, aff);
> +              }
> +              IF_FEATURE_CLEAN_UP(closedir(dir);)

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

> +      } else {
> + no_threads:
> +              process_pid_str(pid_str, opts, aff);
> +      }
> +      return EXIT_SUCCESS;
> }
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic