Skip to content

Commit

Permalink
Emit a warning if mlock() of VSM fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nigoroll committed Aug 19, 2024
1 parent d29dbda commit a8b3a8b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/varnishd/common/common_vsmw.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ static struct vsmw_cluster *
vsmw_newcluster(struct vsmw *vsmw, size_t len, const char *pfx)
{
struct vsmw_cluster *vc;
static int warn = 0;
int fd;
size_t ps;

Expand Down Expand Up @@ -307,7 +308,10 @@ vsmw_newcluster(struct vsmw *vsmw, size_t len, const char *pfx)

closefd(&fd);
assert(vc->ptr != MAP_FAILED);
(void)mlock(vc->ptr, len);
if (mlock(vc->ptr, len) && warn++ == 0) {
fprintf(stderr, "Warning: mlock() of VSM failed: %s (%d)\n",
VAS_errtxt(errno), errno);
}

return (vc);
}
Expand Down

0 comments on commit a8b3a8b

Please sign in to comment.