mbox series

[0/4] rt-tests: rt-utils: Close trace fds

Message ID 20201107095843.11909-1-kurt@linutronix.de
Headers show
Series rt-tests: rt-utils: Close trace fds | expand

Message

Kurt Kanzenbach Nov. 7, 2020, 9:58 a.m. UTC
Hi John,

while using cyclictest with tracing (-b, --tracemark), I've noticed some minor
issues...

Thanks,
Kurt

Kurt Kanzenbach (4):
  rt-tests: rt-utils: Mark internal functions static
  rt-tests: rt-utils: Add function to close trace fds
  rt-tests: cyclictest: Close correct trace fds
  rt-tests: oslat: Close trace fds

 src/cyclictest/cyclictest.c |  8 +-------
 src/include/rt-utils.h      |  1 +
 src/lib/rt-utils.c          | 20 +++++++++++++++++---
 src/oslat/oslat.c           |  2 ++
 4 files changed, 21 insertions(+), 10 deletions(-)

Comments

John Kacur Nov. 11, 2020, 2:29 a.m. UTC | #1
On Sat, 7 Nov 2020, Kurt Kanzenbach wrote:

> There are some helper functions which shouldn't be exported. Mark them static.

> 

> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

> ---

>  src/lib/rt-utils.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)

> 

> diff --git a/src/lib/rt-utils.c b/src/lib/rt-utils.c

> index 54a201661786..85d41b9542a2 100644

> --- a/src/lib/rt-utils.c

> +++ b/src/lib/rt-utils.c

> @@ -362,7 +362,7 @@ int parse_time_string(char *val)

>  	return t;

>  }

>  

> -void open_tracemark_fd(void)

> +static void open_tracemark_fd(void)

>  {

>  	char path[MAX_PATH];

>  

> @@ -390,7 +390,7 @@ void open_tracemark_fd(void)

>  	}

>  }

>  

> -int trace_file_exists(char *name)

> +static int trace_file_exists(char *name)

>  {

>  	struct stat sbuf;

>  	char *tracing_prefix = get_debugfileprefix();

> @@ -399,7 +399,7 @@ int trace_file_exists(char *name)

>  	return stat(path, &sbuf) ? 0 : 1;

>  }

>  

> -void debugfs_prepare(void)

> +static void debugfs_prepare(void)

>  {

>  	if (mount_debugfs(NULL))

>  		fatal("could not mount debugfs");

> -- 

> 2.26.2

> 

> 

Signed-off-by: John Kacur <jkacur@redhat.com>
John Kacur Nov. 11, 2020, 2:32 a.m. UTC | #2
On Sat, 7 Nov 2020, Kurt Kanzenbach wrote:

> Remove the last lefotovers from migrating cyclictest to rt-utils.

> 

> The rt-utils module is reponsible for handling the tracing code.

> 

> Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>

> ---

>  src/cyclictest/cyclictest.c | 8 +-------

>  1 file changed, 1 insertion(+), 7 deletions(-)

> 

> diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c

> index 34aa9be583f8..0ec0b235dba3 100644

> --- a/src/cyclictest/cyclictest.c

> +++ b/src/cyclictest/cyclictest.c

> @@ -283,9 +283,6 @@ enum {

>  	ERROR_NOTFOUND	= -2,

>  };

>  

> -static int trace_fd     = -1;

> -static int tracemark_fd = -1;

> -

>  /*

>   * Raise the soft priority limit up to prio, if that is less than or equal

>   * to the hard limit

> @@ -2272,10 +2269,7 @@ int main(int argc, char **argv)

>  	}

>   out:

>  	/* close any tracer file descriptors */

> -	if (tracemark_fd >= 0)

> -		close(tracemark_fd);

> -	if (trace_fd >= 0)

> -		close(trace_fd);

> +	disable_trace_mark();

>  

>  	/* unlock everything */

>  	if (lockall)

> -- 

> 2.26.2

> 

> 

Signed-off-by: John Kacur <jkacur@redhat.com>