Example #1
0
static int
read_lpj_from_files (guestfs_h *g)
{
  struct command *cmd;
  size_t files = 0;

  cmd = guestfs___new_command (g);
  guestfs___cmd_add_arg (cmd, "grep");
  guestfs___cmd_add_arg (cmd, GREP_FLAGS);
  guestfs___cmd_add_arg (cmd, GREP_REGEX);
  if (access (FILE1, R_OK) == 0) {
    guestfs___cmd_add_arg (cmd, FILE1);
    files++;
  }
  if (access (FILE2, R_OK) == 0) {
    guestfs___cmd_add_arg (cmd, FILE2);
    files++;
  }

  if (files > 0)
    return read_lpj_common (g, __func__, cmd);

  guestfs___cmd_close (cmd);
  debug (g, "%s: no boot messages files are readable", __func__);
  return -1;
}
Example #2
0
static int
read_lpj_from_dmesg (guestfs_h *g)
{
  CLEANUP_CMD_CLOSE struct command *cmd = guestfs___new_command (g);

  guestfs___cmd_add_string_unquoted (cmd, "dmesg | " GREP_CMD);

  return read_lpj_common (g, __func__, cmd);
}