Skip to contentSkip to conversation

what meaning of command function return val

DISCUSSION 张忠山 2 participants 2 messages Dec 4, 2012

lore
Share & tools
lore

张忠山

author
#0 lore raw

When write a command function do_xxx.

When all right it should return zero.

But when error, It should return a negtive value or a positive value? And what difference between neg-val and pos-val?

Signature · 9 lines
Best Regards,
zzs



_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 6 lines · 张忠山

When write a command function do_xxx.

When all right it should return zero.

But when error, It should return a negtive value or a positive value? And what difference between neg-val and pos-val?

Traditionally only positive error values were supported. This was changed recently so you can return negative error codes now. The difference is that with negative error values barebox will print a string representation of the error code. If that's suitable for your command I suggest to return negative codes.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox