Skip to content
Snippets Groups Projects
Select Git revision
  • c48b07226bd41f4053aa2024c5e347183c04deb5
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

test-file-handle.c

Blame
    • Namhyung Kim's avatar
      49f550ea
      perf tools: Add file-handle feature test · 49f550ea
      Namhyung Kim authored
      
      The file handle (FHANDLE) support is configurable so some systems might not
      have it.  So add a config feature item to check it on build time so that we
      don't add the cgroup tracking feature based on that.
      
      Committer notes:
      
      Had to make the test use the same construct as its later use in
      synthetic-events.c, in the next patch in this series. i.e. make it be:
      
      	struct {
      		struct file_handle fh;
      		uint64_t cgroup_id;
      	} handle;
      
      To cope with:
      
          CC       /tmp/build/perf/util/cloexec.o
        util/synthetic-events.c:428:22: error: field 'fh' with   CC       /tmp/build/perf/util/call-path.o
        variable sized type 'struct file_handle' not at the end of a struct or class is a GNU
              extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
                        struct file_handle fh;
                                           ^
        1 error generated.
      
      Deal with this at some point, i.e. investigate if the right thing is to
      remove that -Wgnu-variable-sized-type-not-at-end from our CFLAGS, for
      now do the test the same way as it is used looks more sensible.
      
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200402015249.3800462-1-namhyung@kernel.org
      
      
      [ split from a larger patch, removed blank line at EOF ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      49f550ea
      History
      perf tools: Add file-handle feature test
      Namhyung Kim authored
      
      The file handle (FHANDLE) support is configurable so some systems might not
      have it.  So add a config feature item to check it on build time so that we
      don't add the cgroup tracking feature based on that.
      
      Committer notes:
      
      Had to make the test use the same construct as its later use in
      synthetic-events.c, in the next patch in this series. i.e. make it be:
      
      	struct {
      		struct file_handle fh;
      		uint64_t cgroup_id;
      	} handle;
      
      To cope with:
      
          CC       /tmp/build/perf/util/cloexec.o
        util/synthetic-events.c:428:22: error: field 'fh' with   CC       /tmp/build/perf/util/call-path.o
        variable sized type 'struct file_handle' not at the end of a struct or class is a GNU
              extension [-Werror,-Wgnu-variable-sized-type-not-at-end]
                        struct file_handle fh;
                                           ^
        1 error generated.
      
      Deal with this at some point, i.e. investigate if the right thing is to
      remove that -Wgnu-variable-sized-type-not-at-end from our CFLAGS, for
      now do the test the same way as it is used looks more sensible.
      
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200402015249.3800462-1-namhyung@kernel.org
      
      
      [ split from a larger patch, removed blank line at EOF ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
    test-file-handle.c 282 B
    #define _GNU_SOURCE
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <inttypes.h>
    
    int main(void)
    {
    	struct {
    		struct file_handle fh;
    		uint64_t cgroup_id;
    	} handle;
    	int mount_id;
    
    	name_to_handle_at(AT_FDCWD, "/", &handle.fh, &mount_id, 0);
    	return 0;
    }