summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-06-17 14:18:41 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-06-17 14:18:41 +0000
commitc05bc7fb7d92f8aa176c45356f145a49ddc45fff (patch)
tree7c79fa4db9aed3491e15c252ea5eb9396ea79d72
parentafc197d3422c6f7ada8b99b9f38bc543d768efd2 (diff)
downloadillumos-joyent-c05bc7fb7d92f8aa176c45356f145a49ddc45fff.tar.gz
OS-4430 need /proc/self/cgroup
-rw-r--r--usr/src/uts/common/brand/lx/procfs/lx_proc.h2
-rw-r--r--usr/src/uts/common/brand/lx/procfs/lx_prvnops.c32
2 files changed, 34 insertions, 0 deletions
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_proc.h b/usr/src/uts/common/brand/lx/procfs/lx_proc.h
index f59790cf61..e2765dbe07 100644
--- a/usr/src/uts/common/brand/lx/procfs/lx_proc.h
+++ b/usr/src/uts/common/brand/lx/procfs/lx_proc.h
@@ -107,6 +107,7 @@ extern "C" {
typedef enum lxpr_nodetype {
LXPR_PROCDIR, /* /proc */
LXPR_PIDDIR, /* /proc/<pid> */
+ LXPR_PID_CGROUP, /* /proc/<pid>/cgroup */
LXPR_PID_CMDLINE, /* /proc/<pid>/cmdline */
LXPR_PID_COMM, /* /proc/<pid>/comm */
LXPR_PID_CPU, /* /proc/<pid>/cpu */
@@ -125,6 +126,7 @@ typedef enum lxpr_nodetype {
LXPR_PID_TASK_IDDIR, /* /proc/<pid>/task/<tid> */
LXPR_PID_FDDIR, /* /proc/<pid>/fd */
LXPR_PID_FD_FD, /* /proc/<pid>/fd/nn */
+ LXPR_PID_TID_CGROUP, /* /proc/<pid>/task/<tid>/cgroup */
LXPR_PID_TID_CMDLINE, /* /proc/<pid>/task/<tid>/cmdline */
LXPR_PID_TID_COMM, /* /proc/<pid>/task/<tid>/comm */
LXPR_PID_TID_CPU, /* /proc/<pid>/task/<tid>/cpu */
diff --git a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
index c49cfab774..fae0d90f6b 100644
--- a/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
+++ b/usr/src/uts/common/brand/lx/procfs/lx_prvnops.c
@@ -151,6 +151,7 @@ static void lxpr_read_swaps(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_uptime(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_version(lxpr_node_t *, lxpr_uiobuf_t *);
+static void lxpr_read_pid_cgroup(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_pid_cmdline(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_pid_comm(lxpr_node_t *, lxpr_uiobuf_t *);
static void lxpr_read_pid_env(lxpr_node_t *, lxpr_uiobuf_t *);
@@ -274,6 +275,7 @@ static lxpr_dirent_t lx_procdir[] = {
* Contents of an lx /proc/<pid> directory.
*/
static lxpr_dirent_t piddir[] = {
+ { LXPR_PID_CGROUP, "cgroup" },
{ LXPR_PID_CMDLINE, "cmdline" },
{ LXPR_PID_COMM, "comm" },
{ LXPR_PID_CPU, "cpu" },
@@ -298,6 +300,7 @@ static lxpr_dirent_t piddir[] = {
* Contents of an lx /proc/<pid>/task/<tid> directory.
*/
static lxpr_dirent_t tiddir[] = {
+ { LXPR_PID_CGROUP, "cgroup" },
{ LXPR_PID_CMDLINE, "cmdline" },
{ LXPR_PID_TID_COMM, "comm" },
{ LXPR_PID_CPU, "cpu" },
@@ -506,6 +509,7 @@ lxpr_close(vnode_t *vp, int flag, int count, offset_t offset, cred_t *cr,
static void (*lxpr_read_function[LXPR_NFILES])() = {
lxpr_read_isdir, /* /proc */
lxpr_read_isdir, /* /proc/<pid> */
+ lxpr_read_pid_cgroup, /* /proc/<pid>/cgroup */
lxpr_read_pid_cmdline, /* /proc/<pid>/cmdline */
lxpr_read_pid_comm, /* /proc/<pid>/comm */
lxpr_read_empty, /* /proc/<pid>/cpu */
@@ -524,6 +528,7 @@ static void (*lxpr_read_function[LXPR_NFILES])() = {
lxpr_read_isdir, /* /proc/<pid>/task/nn */
lxpr_read_isdir, /* /proc/<pid>/fd */
lxpr_read_fd, /* /proc/<pid>/fd/nn */
+ lxpr_read_pid_cgroup, /* /proc/<pid>/task/<tid>/cgroup */
lxpr_read_pid_cmdline, /* /proc/<pid>/task/<tid>/cmdline */
lxpr_read_pid_comm, /* /proc/<pid>/task/<tid>/comm */
lxpr_read_empty, /* /proc/<pid>/task/<tid>/cpu */
@@ -605,6 +610,7 @@ static void (*lxpr_read_function[LXPR_NFILES])() = {
static vnode_t *(*lxpr_lookup_function[LXPR_NFILES])() = {
lxpr_lookup_procdir, /* /proc */
lxpr_lookup_piddir, /* /proc/<pid> */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/cgroup */
lxpr_lookup_not_a_dir, /* /proc/<pid>/cmdline */
lxpr_lookup_not_a_dir, /* /proc/<pid>/comm */
lxpr_lookup_not_a_dir, /* /proc/<pid>/cpu */
@@ -623,6 +629,7 @@ static vnode_t *(*lxpr_lookup_function[LXPR_NFILES])() = {
lxpr_lookup_task_tid_dir, /* /proc/<pid>/task/nn */
lxpr_lookup_fddir, /* /proc/<pid>/fd */
lxpr_lookup_not_a_dir, /* /proc/<pid>/fd/nn */
+ lxpr_lookup_not_a_dir, /* /proc/<pid>/task/<tid>/cgroup */
lxpr_lookup_not_a_dir, /* /proc/<pid>/task/<tid>/cmdline */
lxpr_lookup_not_a_dir, /* /proc/<pid>/task/<tid>/comm */
lxpr_lookup_not_a_dir, /* /proc/<pid>/task/<tid>/cpu */
@@ -704,6 +711,7 @@ static vnode_t *(*lxpr_lookup_function[LXPR_NFILES])() = {
static int (*lxpr_readdir_function[LXPR_NFILES])() = {
lxpr_readdir_procdir, /* /proc */
lxpr_readdir_piddir, /* /proc/<pid> */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/cgroup */
lxpr_readdir_not_a_dir, /* /proc/<pid>/cmdline */
lxpr_readdir_not_a_dir, /* /proc/<pid>/comm */
lxpr_readdir_not_a_dir, /* /proc/<pid>/cpu */
@@ -722,6 +730,7 @@ static int (*lxpr_readdir_function[LXPR_NFILES])() = {
lxpr_readdir_task_tid_dir, /* /proc/<pid>/task/nn */
lxpr_readdir_fddir, /* /proc/<pid>/fd */
lxpr_readdir_not_a_dir, /* /proc/<pid>/fd/nn */
+ lxpr_readdir_not_a_dir, /* /proc/<pid>/task/<tid>/cgroup */
lxpr_readdir_not_a_dir, /* /proc/<pid>/task/<tid>/cmdline */
lxpr_readdir_not_a_dir, /* /proc/<pid>/task/<tid>/comm */
lxpr_readdir_not_a_dir, /* /proc/<pid>/task/<tid>/cpu */
@@ -890,6 +899,29 @@ lxpr_read_empty(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
}
/*
+ * lxpr_read_pid_cgroup(): read cgroups for process
+ */
+static void
+lxpr_read_pid_cgroup(lxpr_node_t *lxpnp, lxpr_uiobuf_t *uiobuf)
+{
+ proc_t *p;
+
+ ASSERT(lxpnp->lxpr_type == LXPR_PID_CGROUP ||
+ lxpnp->lxpr_type == LXPR_PID_TID_CGROUP);
+
+ p = lxpr_lock(lxpnp->lxpr_pid);
+ if (p == NULL) {
+ lxpr_uiobuf_seterr(uiobuf, EINVAL);
+ return;
+ }
+
+ /* basic stub, 3rd field will need to be populated */
+ lxpr_uiobuf_printf(uiobuf, "1:name=systemd:/\n");
+
+ lxpr_unlock(p);
+}
+
+/*
* lxpr_read_pid_cmdline(): read argument vector from process
*/
static void