Send plymouth mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.freedesktop.org/mailman/listinfo/plymouth
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of plymouth digest..."
Today's Topics:
1. Re: [PATCH] [main] Write the pid of plymouthd to a file
(Ray Strode)
2. [PATCH v2] [main] Write the pid of plymouthd to a file
(Scott James Remnant)
3. Re: [PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and
DATADIR paths (Scott James Remnant)
----------------------------------------------------------------------
Message: 1
Date: Tue, 2 Mar 2010 14:49:09 -0500
From: Ray Strode <[email protected]>
Subject: Re: [PATCH] [main] Write the pid of plymouthd to a file
To: Scott James Remnant <[email protected]>
Cc: [email protected]
Message-ID:
<[email protected]>
Content-Type: text/plain; charset=UTF-8
Hi,
On Tue, Mar 2, 2010 at 2:42 PM, Scott James Remnant <[email protected]> wrote:
> On Tue, 2010-03-02 at 14:20 -0500, Ray Strode wrote:
>
>> > +static char *pid_file = NULL;
>> This should probably go in the state_t structure with the other state.
>>
> I thought that too and actually modified Alberto's patch to do that, but
> then I realised that you don't have a pointed to that in on_crash() -
> it'd mean leaving the pid file around in case of crash.
>
> Which is better?
If you're accessing the variable from on_crash, then keeping it out of
the state struct is better.
--Ray
------------------------------
Message: 2
Date: Tue, 2 Mar 2010 19:52:25 +0000
From: Scott James Remnant <[email protected]>
Subject: [PATCH v2] [main] Write the pid of plymouthd to a file
To: [email protected]
Message-ID: <[email protected]>
Add a --pid-file option to plymouthd that will cause the daemon's
pid to be written to the named file. Useful to avoid grovelling
through ps output to find it again.
---
src/libply/ply-utils.c | 18 +++++++++++++++++-
src/libply/ply-utils.h | 2 +-
src/main.c | 19 ++++++++++++++++++-
3 files changed, 36 insertions(+), 3 deletions(-)
diff --git a/src/libply/ply-utils.c b/src/libply/ply-utils.c
index b26773c..cbc6473 100644
--- a/src/libply/ply-utils.c
+++ b/src/libply/ply-utils.c
@@ -794,7 +794,7 @@ ply_show_new_kernel_messages (bool should_show)
}
ply_daemon_handle_t *
-ply_create_daemon (void)
+ply_create_daemon (const char *pid_file)
{
pid_t pid;
int sender_fd, receiver_fd;
@@ -820,6 +820,22 @@ ply_create_daemon (void)
_exit (1);
}
+ if ((byte == 0) && (pid_file != NULL))
+ {
+ FILE *pidf;
+
+ pidf = fopen (pid_file, "w");
+ if (!pidf)
+ {
+ ply_error ("could not write pid file %s: %m", pid_file);
+ }
+ else
+ {
+ fprintf (pidf, "%d\n", (int)pid);
+ fclose (pidf);
+ }
+ }
+
_exit ((int) byte);
}
close (receiver_fd);
diff --git a/src/libply/ply-utils.h b/src/libply/ply-utils.h
index 5e41f84..712b869 100644
--- a/src/libply/ply-utils.h
+++ b/src/libply/ply-utils.h
@@ -98,7 +98,7 @@ bool ply_create_file_link (const char *source,
const char *destination);
void ply_show_new_kernel_messages (bool should_show);
-ply_daemon_handle_t *ply_create_daemon (void);
+ply_daemon_handle_t *ply_create_daemon (const char *pid_file);
bool ply_detach_daemon (ply_daemon_handle_t *handle,
int exit_code);
diff --git a/src/main.c b/src/main.c
index af956ee..a714079 100644
--- a/src/main.c
+++ b/src/main.c
@@ -134,6 +134,7 @@ static void on_error_message (ply_buffer_t *debug_buffer,
size_t number_of_bytes);
static ply_buffer_t *debug_buffer;
static char *debug_buffer_path = NULL;
+static char *pid_file = NULL;
static void check_for_consoles (state_t *state,
const char *default_tty,
bool should_add_displays);
@@ -688,6 +689,13 @@ quit_program (state_t *state)
ply_trace ("exiting event loop");
ply_event_loop_exit (state->loop, 0);
+ if (pid_file != NULL)
+ {
+ unlink (pid_file);
+ free (pid_file);
+ pid_file = NULL;
+ }
+
#ifdef PLY_ENABLE_GDM_TRANSITION
if (state->should_retain_splash)
{
@@ -1515,6 +1523,13 @@ on_crash (int signum)
pause ();
}
+ if (pid_file != NULL)
+ {
+ unlink (pid_file);
+ free (pid_file);
+ pid_file = NULL;
+ }
+
signal (signum, SIG_DFL);
raise(signum);
}
@@ -1543,6 +1558,7 @@ main (int argc,
"debug", "Output debugging information",
PLY_COMMAND_OPTION_TYPE_FLAG,
"debug-file", "File to output debugging
information to", PLY_COMMAND_OPTION_TYPE_STRING,
"mode", "Mode is one of: boot, shutdown",
PLY_COMMAND_OPTION_TYPE_STRING,
+ "pid-file", "Write the pid of the daemon to a
file", PLY_COMMAND_OPTION_TYPE_STRING,
NULL);
if (!ply_command_parser_parse_arguments (state.command_parser, state.loop,
argv, argc))
@@ -1564,6 +1580,7 @@ main (int argc,
"no-daemon", &no_daemon,
"debug", &debug,
"debug-file", &debug_buffer_path,
+ "pid-file", &pid_file,
NULL);
if (should_help)
@@ -1605,7 +1622,7 @@ main (int argc,
if (! no_daemon)
{
- daemon_handle = ply_create_daemon ();
+ daemon_handle = ply_create_daemon (pid_file);
if (daemon_handle == NULL)
{
--
1.6.3.3
------------------------------
Message: 3
Date: Tue, 02 Mar 2010 19:55:44 +0000
From: Scott James Remnant <[email protected]>
Subject: Re: [PATCH 2/2] [scripts] Don't hardcode LIBEXECDIR and
DATADIR paths
To: Ray Strode <[email protected]>
Cc: [email protected]
Message-ID: <1267559744.2005.2.ca...@quest>
Content-Type: text/plain; charset="utf-8"
On Tue, 2010-03-02 at 14:28 -0500, Ray Strode wrote:
> On Tue, Mar 2, 2010 at 1:13 PM, Scott James Remnant <[email protected]> wrote:
> > The scripts hard-coded the paths for LIBEXECDIR and DATADIR, unless
> > passed as environment variables. Instead of doing this, which breaks
> > if plymouth is installed outside of /usr, set these derived from the
> > configure @libexecdir@ and @datadir@ variables just as we do for
> > pkg-config, etc.
> >
> > Since we use so many variables, it makes more sense to generate these
> > scripts from config.status rather than having special Makefile rules
> > for them.
>
> I guess this is okay. I'm a little uneasy about config.status since it
> doesn't fully expand its arguments.
>
The other option would be to define those as PLYMOUTH_LIBEXEC_DIR
instead with something like this in configure.ac:
AS_AC_EXPAND(PLYMOUTH_LIBEXEC_DIR, $libexecdir)
Scott
--
Scott James Remnant
[email protected]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL:
<http://lists.freedesktop.org/archives/plymouth/attachments/20100302/34a34248/attachment-0001.pgp>
------------------------------
_______________________________________________
plymouth mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/plymouth
End of plymouth Digest, Vol 17, Issue 2
***************************************