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
f1d356a0
Commit
f1d356a0
authored
May 05, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle our private pid-file parallel to the -P one for simplicity.
parent
b498b6d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
22 deletions
+25
-22
mgt_main.c
bin/varnishd/mgt/mgt_main.c
+25
-9
mgt_shmem.c
bin/varnishd/mgt/mgt_shmem.c
+0
-13
No files found.
bin/varnishd/mgt/mgt_main.c
View file @
f1d356a0
...
...
@@ -70,7 +70,8 @@ struct VSC_C_mgt *VSC_C_mgt;
static
int
I_fd
=
-
1
;
static
char
Cn_arg
[]
=
"/tmp/varnishd_C_XXXXXXX"
;
static
struct
vpf_fh
*
pfh
=
NULL
;
static
struct
vpf_fh
*
pfh1
=
NULL
;
static
struct
vpf_fh
*
pfh2
=
NULL
;
int
optreset
;
// Some has it, some doesn't. Cheaper than auto*
...
...
@@ -179,8 +180,9 @@ mgt_stdin_close(void *priv)
if
(
d_flag
)
{
MCH_Stop_Child
();
mgt_cli_close_all
();
if
(
pfh
!=
NULL
)
(
void
)
VPF_Remove
(
pfh
);
(
void
)
VPF_Remove
(
pfh1
);
if
(
pfh2
!=
NULL
)
(
void
)
VPF_Remove
(
pfh2
);
exit
(
0
);
}
else
{
VFIL_null_fd
(
STDIN_FILENO
);
...
...
@@ -787,13 +789,25 @@ main(int argc, char * const *argv)
dirname
,
strerror
(
errno
));
}
vsb
=
VSB_new_auto
();
AN
(
vsb
);
VSB_printf
(
vsb
,
"%s/_.pid"
,
dirname
);
AZ
(
VSB_finish
(
vsb
));
VJ_master
(
JAIL_MASTER_FILE
);
pfh1
=
VPF_Open
(
VSB_data
(
vsb
),
0644
,
&
pid
);
if
(
pfh1
==
NULL
&&
errno
==
EEXIST
)
ARGV_ERR
(
"Varnishd is already running (pid=%jd)
\n
"
,
(
intmax_t
)
pid
);
if
(
pfh1
==
NULL
)
ARGV_ERR
(
"Could not open pid-file (%s): %s
\n
"
,
VSB_data
(
vsb
),
strerror
(
errno
));
VSB_destroy
(
&
vsb
);
if
(
P_arg
)
{
pfh
=
VPF_Open
(
P_arg
,
0644
,
&
pid
);
if
(
pfh
==
NULL
&&
errno
==
EEXIST
)
pfh
2
=
VPF_Open
(
P_arg
,
0644
,
&
pid
);
if
(
pfh
2
==
NULL
&&
errno
==
EEXIST
)
ARGV_ERR
(
"Varnishd is already running (pid=%jd)
\n
"
,
(
intmax_t
)
pid
);
if
(
pfh
==
NULL
)
if
(
pfh
2
==
NULL
)
ARGV_ERR
(
"Could not open pid-file (%s): %s
\n
"
,
P_arg
,
strerror
(
errno
));
}
...
...
@@ -854,7 +868,8 @@ main(int argc, char * const *argv)
S_arg
=
make_secret
(
dirname
);
AN
(
S_arg
);
assert
(
pfh
==
NULL
||
!
VPF_Write
(
pfh
));
assert
(
!
VPF_Write
(
pfh1
));
assert
(
pfh2
==
NULL
||
!
VPF_Write
(
pfh2
));
MGT_Complain
(
C_DEBUG
,
"Platform: %s"
,
VSB_data
(
vident
)
+
1
);
...
...
@@ -931,7 +946,8 @@ main(int argc, char * const *argv)
MGT_Complain
(
C_ERR
,
"vev_schedule() = %d"
,
o
);
MGT_Complain
(
C_INFO
,
"manager dies"
);
if
(
pfh
!=
NULL
)
(
void
)
VPF_Remove
(
pfh
);
(
void
)
VPF_Remove
(
pfh1
);
if
(
pfh2
!=
NULL
)
(
void
)
VPF_Remove
(
pfh2
);
exit
(
exit_status
);
}
bin/varnishd/mgt/mgt_shmem.c
View file @
f1d356a0
...
...
@@ -43,7 +43,6 @@
#include "common/heritage.h"
#include "vfl.h"
#include "vpf.h"
#include "vsm_priv.h"
#include "vfil.h"
...
...
@@ -60,8 +59,6 @@
static
void
*
mgt_vsm_p
;
static
ssize_t
mgt_vsm_l
;
static
struct
vpf_fh
*
priv_vpf
;
/*--------------------------------------------------------------------
* Use a bogo-VSM to hold master-copies of the VSM chunks the master
* publishes, such as -S & -T arguments.
...
...
@@ -276,16 +273,6 @@ mgt_shm_atexit(void)
void
mgt_SHM_Init
(
void
)
{
pid_t
pid
=
0
;
priv_vpf
=
VPF_Open
(
"_.pid"
,
0644
,
&
pid
);
if
(
priv_vpf
==
NULL
&&
errno
==
EEXIST
)
ARGV_ERR
(
"Varnishd is already running (pid=%jd)
\n
"
,
(
intmax_t
)
pid
);
if
(
priv_vpf
==
NULL
)
ARGV_ERR
(
"Failure on _.pid: %s
\n
"
,
strerror
(
errno
));
AZ
(
VPF_Write
(
priv_vpf
));
/* Create our static VSM instance */
static_vsm
=
VSM_common_new
(
static_vsm_buf
,
sizeof
static_vsm_buf
);
...
...
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