Skip to contentSkip to conversation

net: Return -1 when ctrl+c is pressed

PATCH Superseded Michal Simek 4 participants 5 messages Aug 13, 2015 – Aug 21, 2015 Networking

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: Return -1 when ctrl+c is pressed

Current behavior is that if CTRL+C is pressed command returns 0 that was successful which is not correct behavior.
The easiest test case is "tftpboot 80000 uImage && echo yes" and press CTRL+C. Then the second command is called which is incorrect.

Error log:
zynq-uboot> tftpb 80000 uImage && echo yes
Gem.e000b000:7 is connected to Gem.e000b000. Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete....... done Using Gem.e000b000 device
TFTP from server 192.168.0.102; our IP address is 192.168.0.101 Filename 'uImage'.
Load address: 0x80000
Loading: ################
Abort
yes
zynq-uboot>

This patch adds -1 return value when CTRL+C is pressed.

---

Not sure if -1 is the right error code but I have parsed the code and it looks like that -1 is standard behavior for CTRL+C. But I am happy to change this behavior.

---
 net/net.c | 1 +
 1 file changed, 1 insertion(+)
net/net.c +1 -0
index 67e0ad297cf5..738a0db8c2ba 100644
@@ -565,6 +565,7 @@ restart:
 			/* include a debug print as well incase the debug
 			   messages are directed to stderr */
 			debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
+			ret = -1;
 			goto done;
 		}
 
Signature · 1 line
2.3.5
#1 lore raw

PATCH 1/1 net: Return -1 when ctrl+c is pressed

Quoted 38 lines · Michal Simek

Current behavior is that if CTRL+C is pressed command returns 0 that was successful which is not correct behavior.
The easiest test case is "tftpboot 80000 uImage && echo yes" and press CTRL+C. Then the second command is called which is incorrect.

Error log:
zynq-uboot> tftpb 80000 uImage && echo yes
Gem.e000b000:7 is connected to Gem.e000b000. Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete....... done Using Gem.e000b000 device
TFTP from server 192.168.0.102; our IP address is 192.168.0.101 Filename 'uImage'.
Load address: 0x80000
Loading: ################
Abort
yes
zynq-uboot>

This patch adds -1 return value when CTRL+C is pressed.

---

Not sure if -1 is the right error code but I have parsed the code and it looks like that -1 is standard behavior for CTRL+C. But I am happy to change this behavior.

---
 net/net.c | 1 +
 1 file changed, 1 insertion(+)
net/net.c +0 -0
index 67e0ad297cf5..738a0db8c2ba 100644

net/net.c restart: · line 571

Quoted 7 lines
net/net.c +1 -0
@@ -565,6 +565,7 @@ restart:
 			/* include a debug print as well incase the debug
 			   messages are directed to stderr */
 			debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
+			ret = -1;
 			goto done;
 		}
 

Joe, Tom: Any update on this one?

Thanks,
Michal

Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150820/5ce9b83c/attachment.sig>
#2 lore raw

PATCH 1/1 net: Return -1 when ctrl+c is pressed

Hi Michal,

Quoted 33 lines · Michal Simek
Quoted 32 lines · Michal Simek

Current behavior is that if CTRL+C is pressed command returns 0 that was successful which is not correct behavior.
The easiest test case is "tftpboot 80000 uImage && echo yes" and press CTRL+C. Then the second command is called which is incorrect.

Error log:
zynq-uboot> tftpb 80000 uImage && echo yes
Gem.e000b000:7 is connected to Gem.e000b000. Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete....... done Using Gem.e000b000 device
TFTP from server 192.168.0.102; our IP address is 192.168.0.101 Filename 'uImage'.
Load address: 0x80000
Loading: ################
Abort
yes
zynq-uboot>

This patch adds -1 return value when CTRL+C is pressed.

---

Not sure if -1 is the right error code but I have parsed the code and it looks like that -1 is standard behavior for CTRL+C. But I am happy to change this behavior.

---
 net/net.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 9 lines

net/net.c restart: · line 568

Quoted 9 lines
net/net.c +1 -0
index 67e0ad297cf5..738a0db8c2ba 100644
@@ -565,6 +565,7 @@ restart:
                      /* include a debug print as well incase the debug
                         messages are directed to stderr */
                      debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
+                     ret = -1;

Please replace this with -EINTR.

Quoted 6 lines

net/net.c restart: · line 571

Quoted 4 lines
net/net.c +0 -0
                      goto done;
              }
 

Joe, Tom: Any update on this one?

Slipped through... thanks for the reminder.

#3 lore raw

PATCH 1/1 net: Return -1 when ctrl+c is pressed

Quoted 48 lines · Joe Hershberger

Hi Michal,

Quoted 33 lines · Michal Simek
Quoted 32 lines · Michal Simek

Current behavior is that if CTRL+C is pressed command returns 0 that was successful which is not correct behavior.
The easiest test case is "tftpboot 80000 uImage && echo yes" and press CTRL+C. Then the second command is called which is incorrect.

Error log:
zynq-uboot> tftpb 80000 uImage && echo yes
Gem.e000b000:7 is connected to Gem.e000b000. Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete....... done Using Gem.e000b000 device
TFTP from server 192.168.0.102; our IP address is 192.168.0.101 Filename 'uImage'.
Load address: 0x80000
Loading: ################
Abort
yes
zynq-uboot>

This patch adds -1 return value when CTRL+C is pressed.

---

Not sure if -1 is the right error code but I have parsed the code and it looks like that -1 is standard behavior for CTRL+C. But I am happy to change this behavior.

---
 net/net.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 9 lines

net/net.c restart: · line 568

Quoted 9 lines
net/net.c +1 -0
index 67e0ad297cf5..738a0db8c2ba 100644
@@ -565,6 +565,7 @@ restart:
                      /* include a debug print as well incase the debug
                         messages are directed to stderr */
                      debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
+                     ret = -1;

Please replace this with -EINTR.

Quoted 8 lines
Quoted 6 lines

net/net.c restart: · line 571

Quoted 4 lines
net/net.c +0 -0
                      goto done;
              }
 

Joe, Tom: Any update on this one?

Slipped through... thanks for the reminder.

v2 sent.

Thanks,
Michal

#4 lore raw

PATCH 1/1 net: Return -1 when ctrl+c is pressed

In reply to Michal Simek
Quoted 33 lines · Michal Simek
Quoted 32 lines · Michal Simek

Current behavior is that if CTRL+C is pressed command returns 0 that was successful which is not correct behavior.
The easiest test case is "tftpboot 80000 uImage && echo yes" and press CTRL+C. Then the second command is called which is incorrect.

Error log:
zynq-uboot> tftpb 80000 uImage && echo yes
Gem.e000b000:7 is connected to Gem.e000b000. Reconnecting to Gem.e000b000
Gem.e000b000 Waiting for PHY auto negotiation to complete....... done Using Gem.e000b000 device
TFTP from server 192.168.0.102; our IP address is 192.168.0.101 Filename 'uImage'.
Load address: 0x80000
Loading: ################
Abort
yes
zynq-uboot>

This patch adds -1 return value when CTRL+C is pressed.

---

Not sure if -1 is the right error code but I have parsed the code and it looks like that -1 is standard behavior for CTRL+C. But I am happy to change this behavior.

---
 net/net.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines

net/net.c restart: · line 571

Quoted 13 lines
net/net.c +1 -0
index 67e0ad297cf5..738a0db8c2ba 100644
@@ -565,6 +565,7 @@ restart:
 			/* include a debug print as well incase the debug
 			   messages are directed to stderr */
 			debug_cond(DEBUG_INT_STATE, "--- net_loop Abort!\n");
+			ret = -1;
 			goto done;
 		}
 

Joe, Tom: Any update on this one?

Joe, do you want to pick this up? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150820/72087a8e/attachment.sig>