summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-02-08 18:16:19 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-02-09 15:46:14 +0000
commita915d78ef9bccc88a12d63a2c863a3030ee9300e (patch)
tree7ddb769a09a83dc24281d712ada60c0c41cd0ef7
parent24d7889eba3eb6ee2f37ed9d384aa8734ebad7b7 (diff)
downloadlibguestfs-a915d78ef9bccc88a12d63a2c863a3030ee9300e.tar.gz
libguestfs-a915d78ef9bccc88a12d63a2c863a3030ee9300e.tar.xz
libguestfs-a915d78ef9bccc88a12d63a2c863a3030ee9300e.zip
New API: llz: This runs ls -laZ and is useful for showing SELinux contexts.
-rw-r--r--daemon/ls.c26
-rw-r--r--generator/generator_actions.ml9
-rw-r--r--src/MAX_PROC_NR2
3 files changed, 36 insertions, 1 deletions
diff --git a/daemon/ls.c b/daemon/ls.c
index d0c7b523..1df0b6a2 100644
--- a/daemon/ls.c
+++ b/daemon/ls.c
@@ -102,3 +102,29 @@ do_ll (const char *path)
free (err);
return out; /* caller frees */
}
+
+char *
+do_llz (const char *path)
+{
+ int r;
+ char *out, *err;
+ char *spath;
+
+ spath = sysroot_path (path);
+ if (!spath) {
+ reply_with_perror ("malloc");
+ return NULL;
+ }
+
+ r = command (&out, &err, "ls", "-laZ", spath, NULL);
+ free (spath);
+ if (r == -1) {
+ reply_with_error ("%s", err);
+ free (out);
+ free (err);
+ return NULL;
+ }
+
+ free (err);
+ return out; /* caller frees */
+}
diff --git a/generator/generator_actions.ml b/generator/generator_actions.ml
index 3a7be795..f9ba5c39 100644
--- a/generator/generator_actions.ml
+++ b/generator/generator_actions.ml
@@ -6651,6 +6651,15 @@ This option may not be specified at the same time as the C<correct> option.
=back");
+ ("llz", (RString "listing", [Pathname "directory"], []), 305, [],
+ [],
+ "list the files in a directory (long format with SELinux contexts)",
+ "\
+List the files in C<directory> in the format of 'ls -laZ'.
+
+This command is mostly useful for interactive sessions. It
+is I<not> intended that you try to parse the output string.");
+
]
let all_functions = non_daemon_functions @ daemon_functions
diff --git a/src/MAX_PROC_NR b/src/MAX_PROC_NR
index 873b744b..67d04b9f 100644
--- a/src/MAX_PROC_NR
+++ b/src/MAX_PROC_NR
@@ -1 +1 @@
-304
+305