• Jiri Olsa's avatar
    perf daemon: Add client socket support · 90b0aad8
    Jiri Olsa authored
    Add support for client socket side that will be used to send commands to
    the daemon server socket.
    
    This patch adds only the core support, all commands using this
    functionality are coming in the following patches.
    
    Committer notes:
    
    Hat to patch patch it to deal with this in some systems:
    
      cc1: warnings being treated as errors
      builtin-daemon.c: In function 'send_cmd':  MKDIR    /tmp/build/perf/bench/
    
      builtin-daemon.c:1368: error: ignoring return value of 'fwrite', declared with attribute warn_unused_result
        MKDIR    /tmp/build/perf/tests/
      make[3]: *** [/tmp/build/perf/builtin-daemon.o] Error 1
    
    And also to not leak the 'line' buffer allocated by getline(), since you
    initialized line to NULL and len to zero, man page says:
    
      If *lineptr is set to NULL and *n is set 0 before the call,
      then getline() will allocate a buffer for storing the line.
      This buffer should be freed by the user program even if
      getline() failed.
    Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
    Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
    Cc: Alexei Budankov <abudankov@huawei.com>
    Cc: Ian Rogers <irogers@google.com>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: Mark Rutland <mark.rutland@arm.com>
    Cc: Michael Petlan <mpetlan@redhat.com>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Link: https://lore.kernel.org/r/20210208200908.1019149-6-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    90b0aad8
builtin-daemon.c 7.52 KB