Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Software for White Rabbit PTP Core
Manage
Activity
Members
Labels
Plan
Issues
35
Issue boards
Milestones
Wiki
Code
Merge requests
6
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Projects
Software for White Rabbit PTP Core
Commits
e6e7bc30
Commit
e6e7bc30
authored
8 years ago
by
Alessandro Rubini
Browse files
Options
Downloads
Patches
Plain Diff
host: exit on recv() error (likely not superuser)
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
e3967660
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
host/host.h
+1
-0
1 addition, 0 deletions
host/host.h
host/misc.c
+10
-2
10 additions, 2 deletions
host/misc.c
host/socket.c
+6
-1
6 additions, 1 deletion
host/socket.c
with
17 additions
and
3 deletions
host/host.h
0 → 100644
+
1
−
0
View file @
e6e7bc30
void
uart_exit
(
int
i
);
This diff is collapsed.
Click to expand it.
host/misc.c
+
10
−
2
View file @
e6e7bc30
...
...
@@ -12,6 +12,8 @@
#include
"pps_gen.h"
#include
"rxts_calibrator.h"
#include
"host.h"
uint32_t
_endram
;
int
wrc_stat_running
;
...
...
@@ -74,6 +76,13 @@ void uart_init_hw(void)
void
uart_init_sw
(
void
)
{
printf
(
"%s
\n
"
,
__func__
);
}
void
uart_exit
(
int
i
)
{
system
(
"stty sane"
);
exit
(
i
);
}
int
uart_read_byte
(
void
)
{
fd_set
set
;
...
...
@@ -86,8 +95,7 @@ int uart_read_byte(void)
ret
=
getchar
();
/* Use ctrl-C and ctrl-D specially (hack!) */
if
(
ret
==
3
||
ret
==
4
)
{
system
(
"stty sane"
);
exit
(
0
);
uart_exit
(
0
);
}
return
ret
;
}
...
...
This diff is collapsed.
Click to expand it.
host/socket.c
+
6
−
1
View file @
e6e7bc30
...
...
@@ -15,6 +15,8 @@
#include
"minic.h"
#include
"hw/pps_gen_regs.h"
#include
"host.h"
static
int
dumpstruct
(
FILE
*
dest
,
char
*
name
,
void
*
ptr
,
int
size
)
{
int
ret
,
i
;
...
...
@@ -134,7 +136,6 @@ void set_mac_addr(uint8_t dev_addr[])
printf
(
"%s: no implemented yet
\n
"
,
__func__
);
}
int
minic_rx_frame
(
struct
wr_ethhdr
*
hdr
,
uint8_t
*
payload
,
uint32_t
buf_size
,
struct
hw_timestamp
*
hwts
)
{
...
...
@@ -144,6 +145,10 @@ int minic_rx_frame(struct wr_ethhdr *hdr, uint8_t * payload, uint32_t buf_size,
ret
=
recv
(
sock
,
frame
,
sizeof
(
frame
),
MSG_DONTWAIT
);
if
(
ret
<
0
&&
errno
==
EAGAIN
)
return
0
;
if
(
ret
<
0
)
{
printf
(
"recv(): %s
\n
"
,
strerror
(
errno
));
uart_exit
(
1
);
}
memcpy
(
hdr
,
frame
,
14
);
dumpstruct
(
stdout
,
"rx header"
,
hdr
,
14
);
ret
-=
14
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment