Skip to content

Commit

Permalink
lxccontainer: rework seccomp notify api function
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jun 21, 2019
1 parent daf6a72 commit 679289b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
16 changes: 4 additions & 12 deletions src/lxc/lxccontainer.c
Expand Up @@ -5247,23 +5247,15 @@ static int lxcapi_attach_run_waitl(struct lxc_container *c, lxc_attach_options_t
return ret;
}

static int do_lxcapi_seccomp_notify(struct lxc_container *c, unsigned int cmd, int fd)
static int do_lxcapi_seccomp_notify_fd(struct lxc_container *c)
{
if (!c || !c->lxc_conf)
return minus_one_set_errno(-EINVAL);

switch (cmd) {
case LXC_SECCOMP_NOTIFY_GET_FD:
if (fd)
return minus_one_set_errno(EINVAL);

return lxc_seccomp_get_notify_fd(&c->lxc_conf->seccomp);
}

return minus_one_set_errno(EINVAL);
return lxc_seccomp_get_notify_fd(&c->lxc_conf->seccomp);
}

WRAP_API_2(int, lxcapi_seccomp_notify, unsigned int, int)
WRAP_API(int, lxcapi_seccomp_notify_fd)

struct lxc_container *lxc_container_new(const char *name, const char *configpath)
{
Expand Down Expand Up @@ -5404,7 +5396,7 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath
c->console_log = lxcapi_console_log;
c->mount = lxcapi_mount;
c->umount = lxcapi_umount;
c->seccomp_notify = lxcapi_seccomp_notify;
c->seccomp_notify_fd = lxcapi_seccomp_notify_fd;

return c;

Expand Down
7 changes: 1 addition & 6 deletions src/lxc/lxccontainer.h
Expand Up @@ -60,11 +60,6 @@ struct lxc_mount {
int version;
};

enum {
LXC_SECCOMP_NOTIFY_GET_FD = 0,
LXC_SECCOMP_NOTIFY_MAX,
};

/*!
* An LXC container.
*
Expand Down Expand Up @@ -873,7 +868,7 @@ struct lxc_container {
int (*umount)(struct lxc_container *c, const char *target,
unsigned long mountflags, struct lxc_mount *mnt);

int (*seccomp_notify)(struct lxc_container *c, unsigned int cmd, int fd);
int (*seccomp_notify_fd)(struct lxc_container *c);
};

/*!
Expand Down

0 comments on commit 679289b

Please sign in to comment.