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
1e09f422
Commit
1e09f422
authored
Nov 05, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Emit_UDS_Path() to vcc_backend.c where it belongs
parent
1a6bef96
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
41 deletions
+41
-41
vcc_backend.c
lib/libvcc/vcc_backend.c
+41
-0
vcc_compile.h
lib/libvcc/vcc_compile.h
+0
-2
vcc_utils.c
lib/libvcc/vcc_utils.c
+0
-39
No files found.
lib/libvcc/vcc_backend.c
View file @
1e09f422
...
...
@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "vcc_compile.h"
...
...
@@ -86,6 +87,46 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host,
Fb
(
tl
,
0
,
"
\t
.path = (void *) 0,
\n
"
);
}
/*
* For UDS, we do not create a VSA. Check if it's an absolute path, can
* be accessed, and is a socket. If so, just emit the path field and set
* the IP suckaddrs to NULL.
*/
static
void
Emit_UDS_Path
(
struct
vcc
*
tl
,
const
struct
token
*
t_path
,
const
char
*
errid
)
{
struct
stat
st
;
AN
(
t_path
);
AN
(
t_path
->
dec
);
if
(
*
t_path
->
dec
!=
'/'
)
{
VSB_printf
(
tl
->
sb
,
"%s: Must be an absolute path:
\n
"
,
errid
);
vcc_ErrWhere
(
tl
,
t_path
);
return
;
}
errno
=
0
;
if
(
stat
(
t_path
->
dec
,
&
st
)
!=
0
)
{
int
err
=
errno
;
VSB_printf
(
tl
->
sb
,
"%s: Cannot stat: %s
\n
"
,
errid
,
strerror
(
errno
));
vcc_ErrWhere
(
tl
,
t_path
);
if
(
err
==
ENOENT
||
err
==
EACCES
)
vcc_Warn
(
tl
);
else
return
;
}
else
if
(
!
S_ISSOCK
(
st
.
st_mode
))
{
VSB_printf
(
tl
->
sb
,
"%s: Not a socket:
\n
"
,
errid
);
vcc_ErrWhere
(
tl
,
t_path
);
return
;
}
Fb
(
tl
,
0
,
"
\t
.path =
\"
%s
\"
,
\n
"
,
t_path
->
dec
);
Fb
(
tl
,
0
,
"
\t
.ipv4_suckaddr = (void *) 0,
\n
"
);
Fb
(
tl
,
0
,
"
\t
.ipv6_suckaddr = (void *) 0,
\n
"
);
}
/*--------------------------------------------------------------------
* Disallow mutually exclusive field definitions
*/
...
...
lib/libvcc/vcc_compile.h
View file @
1e09f422
...
...
@@ -360,8 +360,6 @@ void Resolve_Sockaddr(struct vcc *tl, const char *host, const char *defport,
const
char
**
ipv4
,
const
char
**
ipv4_ascii
,
const
char
**
ipv6
,
const
char
**
ipv6_ascii
,
const
char
**
p_ascii
,
int
maxips
,
const
struct
token
*
t_err
,
const
char
*
errid
);
void
Emit_UDS_Path
(
struct
vcc
*
tl
,
const
struct
token
*
t_path
,
const
char
*
errid
);
double
vcc_DurationUnit
(
struct
vcc
*
);
void
vcc_ByteVal
(
struct
vcc
*
,
double
*
);
void
vcc_Duration
(
struct
vcc
*
tl
,
double
*
);
...
...
lib/libvcc/vcc_utils.c
View file @
1e09f422
...
...
@@ -257,45 +257,6 @@ Resolve_Sockaddr(struct vcc *tl,
ZERO_OBJ
(
rss
,
sizeof
rss
);
}
/*
* For UDS, we do not create a VSA. Check if it's an absolute path, can
* be accessed, and is a socket. If so, just emit the path field and set
* the IP suckaddrs to NULL.
*/
void
Emit_UDS_Path
(
struct
vcc
*
tl
,
const
struct
token
*
t_path
,
const
char
*
errid
)
{
struct
stat
st
;
AN
(
t_path
);
AN
(
t_path
->
dec
);
if
(
*
t_path
->
dec
!=
'/'
)
{
VSB_printf
(
tl
->
sb
,
"%s: Must be an absolute path:
\n
"
,
errid
);
vcc_ErrWhere
(
tl
,
t_path
);
return
;
}
errno
=
0
;
if
(
stat
(
t_path
->
dec
,
&
st
)
!=
0
)
{
int
err
=
errno
;
VSB_printf
(
tl
->
sb
,
"%s: Cannot stat: %s
\n
"
,
errid
,
strerror
(
errno
));
vcc_ErrWhere
(
tl
,
t_path
);
if
(
err
==
ENOENT
||
err
==
EACCES
)
vcc_Warn
(
tl
);
else
return
;
}
else
if
(
!
S_ISSOCK
(
st
.
st_mode
))
{
VSB_printf
(
tl
->
sb
,
"%s: Not a socket:
\n
"
,
errid
);
vcc_ErrWhere
(
tl
,
t_path
);
return
;
}
Fb
(
tl
,
0
,
"
\t
.path =
\"
%s
\"
,
\n
"
,
t_path
->
dec
);
Fb
(
tl
,
0
,
"
\t
.ipv4_suckaddr = (void *) 0,
\n
"
);
Fb
(
tl
,
0
,
"
\t
.ipv6_suckaddr = (void *) 0,
\n
"
);
}
/*--------------------------------------------------------------------
* Recognize and convert units of duration, return seconds.
*/
...
...
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