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

Oren Laadan orenl at librato.com
Mon Oct 26 12:39:19 PDT 2009


yeah .. I was lazy .. will add another patch.

Oren.

Matt Helsley wrote:
> 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 at cs.columbia.edu>
>> ---
>>  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 at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list