From mboxrd@z Thu Jan 1 00:00:00 1970 From: zhaolei@cn.fujitsu.com (Zhaolei) Date: Tue, 21 Oct 2008 09:52:37 +0800 Subject: [ltt-dev] [PATCH v2] Remove ltt-armall/disarmall's unwanted errormessages References: <48F8065E.8080503@cn.fujitsu.com> <20081017040033.GA5067@Krystal> <9D7EECC5F2624736AA58083DFA169796@zhaoleiwin> <20081020155223.GC28562@Krystal> Message-ID: <71884B8733CE4A86A121CC6EB43C9EFB@zhaoleiwin> 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 > >