Re: [PATCH] user-cr: add --output-fd to write output to a specific fd

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Oct 25, 2009 at 06:13:21PM -0400, Oren Laadan wrote:
> This is useful if the user would like redirect the output to
> e.g, a socket or any other already open file descriptor when
> invoking 'checkpoint'.
> 
> Also useful if the user would like to append an existing file.
> 
> Signed-off-by: Oren Laadan <orenl@xxxxxxxxxxxxxxx>
> ---
>  checkpoint.c |   47 +++++++++++++++++++++++++++++++++++++++++------
>  1 files changed, 41 insertions(+), 6 deletions(-)
> 
> diff --git a/checkpoint.c b/checkpoint.c
> index c116daf..aef954b 100644
> --- a/checkpoint.c
> +++ b/checkpoint.c
> @@ -32,12 +32,14 @@ static char usage_str[] =
>  "\tOptions:\n"
>  "  -h,--help             print this help message\n"
>  "  -o,--output=FILE      write data to FILE instead of standard output\n"
> +"     --output-fd=FD     write data to file descriptor FD instead of stdout\n"
>  "  -c,--container        require the PID is a container-init\n"
>  "  -v,--verbose          verbose output\n"
>  "";
> 
>  struct args {
>  	char *output;
> +	int outputfd;
>  	int container;
>  	int verbose;
>  };
> @@ -53,17 +55,33 @@ static void usage(char *str)
>  	exit(1);
>  }
> 
> +/* negative retval means error */
> +static int str2num(char *str)
> +{
> +	char *nptr;
> +	int num;
> +
> +	num = strtol(str, &nptr, 10);
> +	if (nptr - str != strlen(str))
> +		num = -1;
> +	return num;
> +}

It'd be nice to see common functions in a shared .o  between
checkpoint and restart. 

Cheers,
	-Matt Helsley

_______________________________________________
Containers mailing list
Containers@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/containers

[Index of Archives]     [Cgroups]     [Netdev]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux