[systemd-devel] [PATCH] do not ellipsize cgroup members in full status

Lennart Poettering lennart at poettering.net
Tue Sep 25 08:45:16 PDT 2012


On Tue, 25.09.12 15:36, Lukáš Nykrýn (lnykryn at redhat.com) wrote:

Heya,

> diff --git a/src/shared/logs-show.h b/src/shared/logs-show.h
> index 3e6b6e0..3b63a5d 100644
> --- a/src/shared/logs-show.h
> +++ b/src/shared/logs-show.h
> @@ -27,26 +27,6 @@
>  
>  #include "util.h"
>  
> -typedef enum OutputMode {
> -        OUTPUT_SHORT,
> -        OUTPUT_SHORT_MONOTONIC,
> -        OUTPUT_VERBOSE,
> -        OUTPUT_EXPORT,
> -        OUTPUT_JSON,
> -        OUTPUT_JSON_PRETTY,
> -        OUTPUT_CAT,
> -        _OUTPUT_MODE_MAX,
> -        _OUTPUT_MODE_INVALID = -1
> -} OutputMode;
> -
> -typedef enum OutputFlags {
> -        OUTPUT_SHOW_ALL       = 1 << 0,
> -        OUTPUT_FOLLOW         = 1 << 1,
> -        OUTPUT_WARN_CUTOFF    = 1 << 2,
> -        OUTPUT_FULL_WIDTH     = 1 << 3,
> -        OUTPUT_COLOR          = 1 << 4
> -} OutputFlags;
> -

Hmm, I don't think this should be part of util.[ch] really, it's far to
specific to be considered just a utility. Could you please move this to a new
file output.h or so?

> -int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line) {
> -        char *r, *k;
> +int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line, OutputFlags flags) {
> +        char *r = NULL, *k;
>          int c;
> -        bool space = false;
> -        size_t left;
>          FILE *f;

I don't think this flag really should be passed here, this call is too
low-level for that. Instead, max_length == 0 could be used as a good
indicator for "as big as needed" or so.

Otherwise looks pretty OK!

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list