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
97c3fe27
Commit
97c3fe27
authored
Feb 10, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various cleanup
parent
b4d08660
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
56 additions
and
75 deletions
+56
-75
mgt.h
bin/varnishd/mgt/mgt.h
+1
-1
mgt_cli.c
bin/varnishd/mgt/mgt_cli.c
+5
-5
mgt_cli.h
bin/varnishd/mgt/mgt_cli.h
+5
-5
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+1
-1
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+44
-63
No files found.
bin/varnishd/mgt/mgt.h
View file @
97c3fe27
...
...
@@ -118,7 +118,7 @@ void STV_Config_Transient(void);
/* mgt_vcc.c */
void
mgt_vcc_init
(
void
);
unsigned
mgt_vcc_default
(
const
char
*
bflag
,
c
onst
char
*
f_arg
,
c
har
*
vcl
,
int
Cflag
);
unsigned
mgt_vcc_default
(
const
char
*
bflag
,
char
*
vcl
,
int
Cflag
);
int
mgt_push_vcls_and_start
(
unsigned
*
status
,
char
**
p
);
int
mgt_has_vcl
(
void
);
extern
char
*
mgt_cc_cmd
;
...
...
bin/varnishd/mgt/mgt_cli.c
View file @
97c3fe27
...
...
@@ -94,11 +94,11 @@ static struct cli_proto cli_proto[] = {
{
CLI_SERVER_STATUS
,
""
,
mcf_server_status
,
NULL
},
{
CLI_SERVER_START
,
""
,
mcf_server_startstop
,
NULL
},
{
CLI_SERVER_STOP
,
""
,
mcf_server_startstop
,
cli_proto
},
{
CLI_VCL_LOAD
,
""
,
mcf_
config
_load
,
NULL
},
{
CLI_VCL_INLINE
,
""
,
mcf_
config
_inline
,
NULL
},
{
CLI_VCL_USE
,
""
,
mcf_
config
_use
,
NULL
},
{
CLI_VCL_DISCARD
,
""
,
mcf_
config
_discard
,
NULL
},
{
CLI_VCL_LIST
,
""
,
mcf_
config
_list
,
NULL
},
{
CLI_VCL_LOAD
,
""
,
mcf_
vcl
_load
,
NULL
},
{
CLI_VCL_INLINE
,
""
,
mcf_
vcl
_inline
,
NULL
},
{
CLI_VCL_USE
,
""
,
mcf_
vcl
_use
,
NULL
},
{
CLI_VCL_DISCARD
,
""
,
mcf_
vcl
_discard
,
NULL
},
{
CLI_VCL_LIST
,
""
,
mcf_
vcl
_list
,
NULL
},
{
CLI_PARAM_SHOW
,
""
,
mcf_param_show
,
NULL
},
{
CLI_PARAM_SET
,
""
,
mcf_param_set
,
NULL
},
{
CLI_PANIC_SHOW
,
""
,
mcf_panic_show
,
NULL
},
...
...
bin/varnishd/mgt/mgt_cli.h
View file @
97c3fe27
...
...
@@ -39,11 +39,11 @@ cli_func_t mcf_param_show;
cli_func_t
mcf_param_set
;
/* mgt_vcc.c */
cli_func_t
mcf_
config
_load
;
cli_func_t
mcf_
config
_inline
;
cli_func_t
mcf_
config
_use
;
cli_func_t
mcf_
config
_discard
;
cli_func_t
mcf_
config
_list
;
cli_func_t
mcf_
vcl
_load
;
cli_func_t
mcf_
vcl
_inline
;
cli_func_t
mcf_
vcl
_use
;
cli_func_t
mcf_
vcl
_discard
;
cli_func_t
mcf_
vcl
_list
;
/* stevedore.c */
extern
struct
cli_proto
cli_stv
[];
bin/varnishd/mgt/mgt_main.c
View file @
97c3fe27
...
...
@@ -656,7 +656,7 @@ main(int argc, char * const *argv)
P_arg
,
strerror
(
errno
));
if
(
b_arg
!=
NULL
||
f_arg
!=
NULL
)
if
((
o
=
mgt_vcc_default
(
b_arg
,
f_arg
,
vcl
,
C_flag
))
!=
0
)
if
((
o
=
mgt_vcc_default
(
b_arg
,
vcl
,
C_flag
))
!=
0
)
exit
(
o
);
if
(
C_flag
)
...
...
bin/varnishd/mgt/mgt_vcc.c
View file @
97c3fe27
...
...
@@ -135,47 +135,11 @@ mgt_vcc_delbyname(const char *name)
return
(
1
);
}
/*--------------------------------------------------------------------
* Prepare the compiler command line
*/
static
struct
vsb
*
mgt_make_cc_cmd
(
const
struct
vcc_priv
*
vp
)
int
mgt_has_vcl
(
void
)
{
struct
vsb
*
sb
;
int
pct
;
char
*
p
;
CHECK_OBJ_NOTNULL
(
vp
,
VCC_PRIV_MAGIC
);
sb
=
VSB_new_auto
();
XXXAN
(
sb
);
for
(
p
=
mgt_cc_cmd
,
pct
=
0
;
*
p
;
++
p
)
{
if
(
pct
)
{
switch
(
*
p
)
{
case
's'
:
VSB_cat
(
sb
,
vp
->
srcfile
);
break
;
case
'o'
:
VSB_cat
(
sb
,
vp
->
libfile
);
break
;
case
'%'
:
VSB_putc
(
sb
,
'%'
);
break
;
default:
VSB_putc
(
sb
,
'%'
);
VSB_putc
(
sb
,
*
p
);
break
;
}
pct
=
0
;
}
else
if
(
*
p
==
'%'
)
{
pct
=
1
;
}
else
{
VSB_putc
(
sb
,
*
p
);
}
}
if
(
pct
)
VSB_putc
(
sb
,
'%'
);
AZ
(
VSB_finish
(
sb
));
return
(
sb
);
return
(
!
VTAILQ_EMPTY
(
&
vclhead
));
}
/*--------------------------------------------------------------------
...
...
@@ -231,16 +195,46 @@ static void
run_cc
(
void
*
priv
)
{
struct
vcc_priv
*
vp
;
struct
vsb
*
cmdsb
;
struct
vsb
*
sb
;
int
pct
;
char
*
p
;
mgt_sandbox
(
SANDBOX_CC
);
CAST_OBJ_NOTNULL
(
vp
,
priv
,
VCC_PRIV_MAGIC
);
/* Build the C-compiler command line */
cmdsb
=
mgt_make_cc_cmd
(
vp
);
sb
=
VSB_new_auto
();
AN
(
sb
);
for
(
p
=
mgt_cc_cmd
,
pct
=
0
;
*
p
;
++
p
)
{
if
(
pct
)
{
switch
(
*
p
)
{
case
's'
:
VSB_cat
(
sb
,
vp
->
srcfile
);
break
;
case
'o'
:
VSB_cat
(
sb
,
vp
->
libfile
);
break
;
case
'%'
:
VSB_putc
(
sb
,
'%'
);
break
;
default:
VSB_putc
(
sb
,
'%'
);
VSB_putc
(
sb
,
*
p
);
break
;
}
pct
=
0
;
}
else
if
(
*
p
==
'%'
)
{
pct
=
1
;
}
else
{
VSB_putc
(
sb
,
*
p
);
}
}
if
(
pct
)
VSB_putc
(
sb
,
'%'
);
AZ
(
VSB_finish
(
sb
));
(
void
)
umask
(
0177
);
(
void
)
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
VSB_data
(
cmdsb
),
(
char
*
)
0
);
(
void
)
execl
(
"/bin/sh"
,
"/bin/sh"
,
"-c"
,
VSB_data
(
sb
),
(
char
*
)
0
);
VSB_delete
(
sb
);
// For flexelint
}
/*--------------------------------------------------------------------
...
...
@@ -385,7 +379,7 @@ mgt_VccCompile(struct vsb **sb, const char *vclname, const char *vclsrc,
/*--------------------------------------------------------------------*/
unsigned
mgt_vcc_default
(
const
char
*
b_arg
,
c
onst
char
*
f_arg
,
c
har
*
vcl
,
int
C_flag
)
mgt_vcc_default
(
const
char
*
b_arg
,
char
*
vcl
,
int
C_flag
)
{
char
*
vf
;
struct
vsb
*
sb
;
...
...
@@ -393,9 +387,6 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, char *vcl, int C_flag)
char
buf
[
BUFSIZ
];
unsigned
status
=
0
;
/* XXX: annotate vcl with -b/-f arg so people know where it came from */
(
void
)
f_arg
;
if
(
b_arg
!=
NULL
)
{
AZ
(
vcl
);
/*
...
...
@@ -435,15 +426,6 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, char *vcl, int C_flag)
/*--------------------------------------------------------------------*/
int
mgt_has_vcl
(
void
)
{
return
(
!
VTAILQ_EMPTY
(
&
vclhead
));
}
/*--------------------------------------------------------------------*/
int
mgt_push_vcls_and_start
(
unsigned
*
status
,
char
**
p
)
{
...
...
@@ -470,8 +452,7 @@ mgt_push_vcls_and_start(unsigned *status, char **p)
/*--------------------------------------------------------------------*/
static
void
static
void
mgt_vcc_atexit
(
void
)
{
struct
vclprog
*
vp
;
...
...
@@ -500,7 +481,7 @@ mgt_vcc_init(void)
/*--------------------------------------------------------------------*/
void
mcf_
config
_inline
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
mcf_
vcl
_inline
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
char
*
vf
,
*
p
=
NULL
;
struct
vsb
*
sb
;
...
...
@@ -538,7 +519,7 @@ mcf_config_inline(struct cli *cli, const char * const *av, void *priv)
}
void
mcf_
config
_load
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
mcf_
vcl
_load
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
char
*
vf
,
*
vcl
;
struct
vsb
*
sb
;
...
...
@@ -598,7 +579,7 @@ mcf_find_vcl(struct cli *cli, const char *name)
}
void
mcf_
config
_use
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
mcf_
vcl
_use
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
unsigned
status
;
char
*
p
=
NULL
;
...
...
@@ -628,7 +609,7 @@ mcf_config_use(struct cli *cli, const char * const *av, void *priv)
}
void
mcf_
config
_discard
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
mcf_
vcl
_discard
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
unsigned
status
;
char
*
p
=
NULL
;
...
...
@@ -653,7 +634,7 @@ mcf_config_discard(struct cli *cli, const char * const *av, void *priv)
}
void
mcf_
config
_list
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
mcf_
vcl
_list
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
unsigned
status
;
char
*
p
;
...
...
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