2011-8-3 16:27:21

 

 

 

2011-8-3 16:27:21


int
find_exec_pid (const char *file)
{
  char fullname[512];
  struct stat file_buf, exe_buf;

  if (stat (file, &file_buf) < 0)
    {
      perror (file);
      exit (2);
    }

  DIR *d = opendir ("/proc");
  if (d)
    {
      struct dirent *e;
      while ((e = readdir (d)))
 {
   strcpy (fullname, "/proc/");
   strcat (fullname, e->d_name);
   strcat (fullname, "/exe");
   if (stat (fullname, &exe_buf) >= 0)
     {
       if (file_buf.st_dev == exe_buf.st_dev
    && file_buf.st_ino == exe_buf.st_ino)
  {
    int pid = atoi (e->d_name);
    closedir (d);
    return pid;
  }
     }
 }
      closedir (d);
    }

  return -1;
}

对应的进程启动了没有


int
main (int argc, char **argv)
{
 
  FILE *f;
  GtkWidget *dialog;
  xexp *rescue_xexp = NULL;
  int rescue_success = 1;

  /* Check UFILE_BOOT flag file */
  f = user_file_open_for_read (UFILE_BOOT);
  if (f == NULL)
    {
      if (errno != ENOENT)
 perror (UFILE_BOOT);
      return 0;
    }
  fclose (f);
  user_file_remove (UFILE_BOOT);

  /* Check rescue mode last result */
  rescue_xexp = xexp_read_file (RESCUE_RESULT_FILE);
  if (rescue_xexp && xexp_is_text (rescue_xexp)
      && xexp_is (rescue_xexp, "success"))
    {
      rescue_success = xexp_text_as_int (rescue_xexp);
    }
  xexp_free (rescue_xexp);

  /* Show success banner only on success. Pretty logical, isn't it? */
  if (rescue_success)
    {
      hildon_gtk_init (&argc, &argv);

      /* For the OS update, make sure the icon will blink after reboot
         by deleting user files related to tapped and seen states */
      user_file_remove (UFILE_SEEN_UPDATES);
      user_file_remove (UFILE_TAPPED_UPDATES);

      dialog = hildon_note_new_information
        (NULL, _("ai_ni_system_update_installed"));

      gtk_widget_show_all (dialog);
      gtk_dialog_run (GTK_DIALOG (dialog));
      gtk_widget_destroy (dialog);
    }

  return 0;
}


gchar *
user_file_get_state_dir_path ()
{
  gchar *required_dir = NULL;

  required_dir = g_strdup_printf ("%s/%s",
      getenv ("HOME"),
      HAM_STATE_DIR);

  if (mkdir (required_dir, 0777) && errno != EEXIST)
    return NULL;

  return required_dir;
}

获取状态文件目录

  /* Check UFILE_BOOT flag file */
  f = user_file_open_for_read (UFILE_BOOT);
  if (f == NULL)
    {
      if (errno != ENOENT)
 perror (UFILE_BOOT);
      return 0;
    }
  fclose (f);
  user_file_remove (UFILE_BOOT);
 
  读取boot文件 移除boot文件
 
 


Introduction
------------

This is the architecture description of the Application Installer
application and its supporting components.

The supporting components are apt and GnuPG.  This document considers
them to be part of the subsystem and not as external dependencies.
The end-user oriented GUI program that these components are supporting
is termed "the GUI" in the following.

 

System context
--------------

* Functionality provided by the subsystem

The Application Installer allows the end-user to browse a externally
provided catalog of software components, to install those components
to the device filesystem, and to browse/upgrade/remove components that
have been installed in that way.  The Application Installer does not
aim to manage all software components that make up the Internet Tablet
2006 OS.  This is reflected in the design of the GUI, but dpkg and apt
are not restricted in any way.


* Software context

The Appliction Installer is not used by other components in the
system.

The GUI is a regular hildonized program with no unusual dependencies.
It is a mime handler for .deb files and listens for events on D-BUS
for this.  It appears in the "Others" menu in the Task Navigator and
is started as a D-BUS service.

监听dbus事件, 作为一个dbus服务来启动

For some access to local files, GnomeVFS might be used.

Part of the GUI runs as root and is started via "sudo".

The actual package management is ultimately carried out by dpkg.

部分以root的权限来执行


不小心更改了/usr/的权限.
在执行sudo 的时候出现 sudo: must be setuid root这个提示,
网上搜了下,解决了.特记录.

ls -l  /usr/bin/sudo

chown root:root /usr/bin/sudo

chmod 4755 /usr/bin/sudo

reboot

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值