[maemo-commits] [maemo-commits] r15418 - in projects/haf/trunk/maemo-launcher: . launcher

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Wed Apr 16 01:35:41 EEST 2008
Author: guillem
Date: 2008-04-16 01:35:40 +0300 (Wed, 16 Apr 2008)
New Revision: 15418

Modified:
   projects/haf/trunk/maemo-launcher/ChangeLog
   projects/haf/trunk/maemo-launcher/launcher/invoker.c
Log:
Move invoker magic sending logic into a new invoker_send_magic function


Modified: projects/haf/trunk/maemo-launcher/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-launcher/ChangeLog	2008-04-15 22:35:38 UTC (rev 15417)
+++ projects/haf/trunk/maemo-launcher/ChangeLog	2008-04-15 22:35:40 UTC (rev 15418)
@@ -1,5 +1,13 @@
 2008-02-22  Guillem Jover  <guillem.jover at nokia.com>
 
+	* launcher/invoker.c (invoker_init): Do not take a delay argument.
+	Fix all callers. Move magic sending logic to ...
+	(invoker_send_magic): ... here. New function.
+	(main): Initialize magic_options depending on the delay variable.
+	Call invoker_send_magic after invoker_init.
+
+2008-02-22  Guillem Jover  <guillem.jover at nokia.com>
+
 	* launcher/invoker.c (invoke_recv_ack): Use more descriptive names
 	for the msg variable.
 	(invoker_recv_pid): Likewise.

Modified: projects/haf/trunk/maemo-launcher/launcher/invoker.c
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/invoker.c	2008-04-15 22:35:38 UTC (rev 15417)
+++ projects/haf/trunk/maemo-launcher/launcher/invoker.c	2008-04-15 22:35:40 UTC (rev 15418)
@@ -101,10 +101,9 @@
 }
 
 static int
-invoker_init(unsigned int delay)
+invoker_init(void)
 {
   int fd;
-  int options = 0;
   struct sockaddr_un sun;
 
   fd = socket(PF_UNIX, SOCK_STREAM, 0);
@@ -117,14 +116,18 @@
   if (connect(fd, (struct sockaddr *)&sun, sizeof(sun)) < 0)
     die(1, "connecting to the launcher\n");
 
-  if (!delay)
-    options |= INVOKER_MSG_MAGIC_OPTION_WAIT;
+  return fd;
+}
 
+static bool
+invoker_send_magic(int fd, int options)
+{
   /* Send magic. */
   invoke_send_msg(fd, INVOKER_MSG_MAGIC | INVOKER_MSG_MAGIC_VERSION | options);
+
   invoke_recv_ack(fd);
 
-  return fd;
+  return true;
 }
 
 static bool
@@ -329,6 +332,7 @@
   char *launch = NULL;
   char *delay_str = NULL;
   unsigned int delay;
+  int magic_options = 0;
 
   if (strstr(argv[0], PROG_NAME))
   {
@@ -388,7 +392,12 @@
 
   delay = get_delay(delay_str);
 
-  fd = invoker_init(delay);
+  if (!delay)
+    magic_options |= INVOKER_MSG_MAGIC_OPTION_WAIT;
+
+  fd = invoker_init();
+
+  invoker_send_magic(fd, magic_options);
   invoker_send_name(fd, prog_argv[0]);
   invoker_send_exec(fd, prog_name);
   invoker_send_args(fd, prog_argc, prog_argv);


More information about the maemo-commits mailing list