Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
4600cf98
Commit
4600cf98
authored
Jun 17, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify vtc_record()
parent
96e81ce2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
vtc_subr.c
bin/varnishtest/vtc_subr.c
+16
-22
No files found.
bin/varnishtest/vtc_subr.c
View file @
4600cf98
...
...
@@ -30,7 +30,7 @@
#include <sys/types.h>
#include <math.h>
#include <
poll
.h>
#include <
stdio
.h>
#include <string.h>
#include <stdint.h>
#include <unistd.h>
...
...
@@ -42,7 +42,6 @@
#include "vct.h"
#include "vnum.h"
#include "vre.h"
#include "vtcp.h"
struct
vsb
*
vtc_hex_to_bin
(
struct
vtclog
*
vl
,
const
char
*
arg
)
...
...
@@ -188,29 +187,24 @@ vtc_wait4(struct vtclog *vl, long pid,
void
*
vtc_record
(
struct
vtclog
*
vl
,
int
fd
,
struct
vsb
*
vsb
)
{
char
buf
[
65536
];
struct
pollfd
fds
[
1
];
char
buf
[
BUFSIZ
];
int
i
;
VTCP_nonblocking
(
fd
);
while
(
1
)
{
memset
(
fds
,
0
,
sizeof
fds
);
fds
->
fd
=
fd
;
fds
->
events
=
POLLIN
;
i
=
poll
(
fds
,
1
,
10000
);
if
(
i
==
0
)
continue
;
if
(
fds
->
revents
&
POLLIN
)
{
i
=
read
(
fd
,
buf
,
sizeof
buf
-
1
);
if
(
i
>
0
)
{
if
(
vsb
!=
NULL
)
VSB_bcat
(
vsb
,
buf
,
i
);
buf
[
i
]
=
'\0'
;
vtc_dump
(
vl
,
3
,
"debug"
,
buf
,
-
2
);
}
}
if
(
fds
->
revents
&
(
POLLERR
|
POLLHUP
))
{
vtc_log
(
vl
,
4
,
"STDOUT poll 0x%x"
,
fds
->
revents
);
errno
=
0
;
i
=
read
(
fd
,
buf
,
sizeof
buf
-
1
);
if
(
i
>
0
)
{
if
(
vsb
!=
NULL
)
VSB_bcat
(
vsb
,
buf
,
i
);
buf
[
i
]
=
'\0'
;
vtc_dump
(
vl
,
3
,
"debug"
,
buf
,
-
2
);
}
else
if
(
i
==
0
&&
errno
==
0
)
{
vtc_log
(
vl
,
4
,
"STDOUT EOF"
);
break
;
}
else
{
vtc_log
(
vl
,
4
,
"STDOUT read failed with %d - %s."
,
errno
,
strerror
(
errno
));
break
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment