[ltt-dev] [PATCH v2] Remove ltt-armall/disarmall's unwanted errormessages

Zhaolei zhaolei at cn.fujitsu.com
Mon Oct 20 21:52:37 EDT 2008


Mathieu wrote:
>> > How about :
>> > 
>> > echo "connect $a default dynamic $CHANNEL" 2>&1 >/proc/ltt
>> > 
>> > and then use $?  as error value ?
>> > 
>> > (try issuing "echo $?" just after the failing command)
>> Actually, I considered about return value, but if other kind of error
>> happened, I think it is better to show errormsg to user.
>> If we judge on return value, user will see "Already connect" if other
>>  error happened.
>> 
>> Judge on "write error: File exists" maybe little iffy, but on worst case,
>> it will show whole errormessage to user(maybe the best choose).
>> 
> 
> Can you have a quick look at other debugfs, sysfs/procfs files to see
> how they handle this kind of situation ? I feel using the text returned
> as error value is not very standard.
> 
I tried following commands to see how other proc-based control doing:
  #echo AA >/proc/sys/kernel/printk
  -bash: echo: write error: Invalid argument
  # echo AA > /proc/sys/net/ipv4/ip_forward
  -bash: echo: write error: Invalid argument
They are same as lttng when user's input is wrong.
So I think lttng's /proc implement is ok.

But I think it may be difficult to get return value of sys_write in shell-script.
(We can only see $?=1 on any kind of error)
And I haven't find other shell-scripts who handle this kind of situation.

Sorry, but until now, I think we have following choice:
1: use errout string
2: write ltt-armall in C to check return value.

Thanks!
> Thanks,
> 
> Mathieu
> 
>> Thanks!
>> > 
>> > Maybe we could also get rid of the "echo: write error: File exists" by
>> > returning a more appropriate error value from the write system call ?
>> 
>> 
>> > 
>> > Mathieu
>> > 
>> 
> 
> -- 
> Mathieu Desnoyers
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
> 
>


More information about the lttng-dev mailing list