Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdfp-pipe
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvdfp-pipe
Commits
3a3ae9bb
Unverified
Commit
3a3ae9bb
authored
Jan 25, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapt to filter api changes
parent
dacf9c4d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
vdfp_pipe.c
src/vdfp_pipe.c
+19
-20
No files found.
src/vdfp_pipe.c
View file @
3a3ae9bb
...
...
@@ -169,7 +169,7 @@ mk_dup(int oldfd, int newfd)
}
static
int
v_matchproto_
(
vdp_init_f
)
vdp_init
(
struct
vdp_ctx
*
ctx
,
void
**
priv
,
struct
objcore
*
objcore
)
vdp_init
(
VRT_CTX
,
struct
vdp_ctx
*
vc
,
void
**
priv
,
struct
objcore
*
objcore
)
{
struct
req
*
req
;
struct
vdp_state
*
state
;
...
...
@@ -177,21 +177,20 @@ vdp_init(struct vdp_ctx *ctx, void **priv, struct objcore *objcore)
struct
vdp_map
map_entry
,
*
map
;
struct
VPFX
(
pipe_vdp
)
*
obj
;
int
in
[
2
],
out
[
2
],
err
[
2
];
struct
vrt_ctx
fake_ctx
[
1
];
struct
vmod_priv
*
task_priv
;
struct
task_cfg
*
task
;
struct
setenv_head
*
setenv_head
;
char
**
argv
;
CHECK_OBJ_NOTNULL
(
ctx
,
VDP_CTX_MAGIC
);
req
=
ctx
->
req
;
CHECK_OBJ_NOTNULL
(
vc
,
VDP_CTX_MAGIC
);
req
=
vc
->
req
;
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
AN
(
req
->
vcl
);
AN
(
priv
);
AZ
(
*
priv
);
CHECK_OBJ_ORNULL
(
objcore
,
OBJCORE_MAGIC
);
vdpe
=
VTAILQ_LAST
(
&
ctx
->
vdp
,
vdp_entry_s
);
vdpe
=
VTAILQ_LAST
(
&
vc
->
vdp
,
vdp_entry_s
);
CHECK_OBJ_NOTNULL
(
vdpe
,
VDP_ENTRY_MAGIC
);
AN
(
vdpe
->
vdp
);
map_entry
.
vdp
=
vdpe
->
vdp
;
...
...
@@ -205,13 +204,13 @@ vdp_init(struct vdp_ctx *ctx, void **priv, struct objcore *objcore)
errno
=
0
;
ALLOC_OBJ
(
state
,
PIPE_VDP_STATE_MAGIC
);
if
(
state
==
NULL
)
{
VSLb
(
ctx
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot allocate "
VSLb
(
vc
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot allocate "
"state: %s"
,
obj
->
name
,
VAS_errtxt
(
errno
));
return
(
-
1
);
}
state
->
buf
=
malloc
(
obj
->
bufsz
);
if
(
state
->
buf
==
NULL
)
{
VSLb
(
ctx
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot allocate "
VSLb
(
vc
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: cannot allocate "
"buffer size %zd: %s"
,
obj
->
name
,
obj
->
bufsz
,
VAS_errtxt
(
errno
));
return
(
-
1
);
...
...
@@ -226,14 +225,10 @@ vdp_init(struct vdp_ctx *ctx, void **priv, struct objcore *objcore)
argv
=
obj
->
argv
;
setenv_head
=
obj
->
setenv_head
;
/* Hackishly using non-API knowledge of VRT_priv_task() */
INIT_OBJ
(
fake_ctx
,
VRT_CTX_MAGIC
);
fake_ctx
->
req
=
req
;
fake_ctx
->
ws
=
req
->
ws
;
task_priv
=
VRT_priv_task
(
fake_ctx
,
obj
);
task_priv
=
VRT_priv_task
(
ctx
,
obj
);
AN
(
priv
);
if
(
task_priv
->
priv
!=
NULL
)
{
AN
(
WS_Allocated
(
fake_
ctx
->
ws
,
task_priv
->
priv
,
sizeof
(
*
task
)));
AN
(
WS_Allocated
(
ctx
->
ws
,
task_priv
->
priv
,
sizeof
(
*
task
)));
CAST_OBJ_NOTNULL
(
task
,
task_priv
->
priv
,
PIPE_TASK_MAGIC
);
if
(
task
->
argv
!=
NULL
)
argv
=
task
->
argv
;
...
...
@@ -241,17 +236,17 @@ vdp_init(struct vdp_ctx *ctx, void **priv, struct objcore *objcore)
setenv_head
=
task
->
setenv_head
;
}
if
(
mk_pipe
(
in
,
obj
->
name
,
ctx
->
vsl
)
!=
0
)
if
(
mk_pipe
(
in
,
obj
->
name
,
vc
->
vsl
)
!=
0
)
return
(
-
1
);
if
(
mk_pipe
(
out
,
obj
->
name
,
ctx
->
vsl
)
!=
0
)
if
(
mk_pipe
(
out
,
obj
->
name
,
vc
->
vsl
)
!=
0
)
return
(
-
1
);
if
(
mk_pipe
(
err
,
obj
->
name
,
ctx
->
vsl
)
!=
0
)
if
(
mk_pipe
(
err
,
obj
->
name
,
vc
->
vsl
)
!=
0
)
return
(
-
1
);
errno
=
0
;
state
->
chldpid
=
fork
();
if
(
state
->
chldpid
<
0
)
{
VSLb
(
ctx
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: fork failed for "
VSLb
(
vc
->
vsl
,
SLT_Error
,
"vdfp_pipe: vdp %s: fork failed for "
"%s: %s"
,
obj
->
name
,
obj
->
path
,
VAS_errtxt
(
errno
));
closefd
(
&
in
[
0
]);
closefd
(
&
in
[
1
]);
...
...
@@ -299,7 +294,7 @@ vdp_init(struct vdp_ctx *ctx, void **priv, struct objcore *objcore)
}
}
VSLb
(
ctx
->
vsl
,
SLT_Notice
,
"vdfp_pipe: vdp %s: exec'd %s as pid %jd"
,
VSLb
(
vc
->
vsl
,
SLT_Notice
,
"vdfp_pipe: vdp %s: exec'd %s as pid %jd"
,
obj
->
name
,
obj
->
path
,
(
intmax_t
)
state
->
chldpid
);
closefd
(
&
in
[
0
]);
closefd
(
&
out
[
1
]);
...
...
@@ -660,7 +655,11 @@ vmod_vdp__init(VRT_CTX, struct VPFX(pipe_vdp) **vdpp, const char *obj_name,
vdp
->
init
=
vdp_init
;
vdp
->
bytes
=
vdp_bytes
;
vdp
->
fini
=
vdp_fini
;
VRT_AddVDP
(
ctx
,
vdp
);
// XXX free mem etc
if
(
VRT_AddFilter
(
ctx
,
NULL
,
vdp
))
{
return
;
}
vdp_obj
->
vdp
=
vdp
;
errno
=
0
;
...
...
@@ -689,7 +688,7 @@ vmod_vdp__init(VRT_CTX, struct VPFX(pipe_vdp) **vdpp, const char *obj_name,
return
;
}
/* Event function calls VRT_Remove
VDP()
, since it needs a VRT_CTX. */
/* Event function calls VRT_Remove
Filter
, since it needs a VRT_CTX. */
VCL_VOID
vmod_vdp__fini
(
struct
VPFX
(
pipe_vdp
)
**
vdpp
)
...
...
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