Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: RSyslog: users

[PATCH] fix error of not define HAVE_SETSID

 

 

RSyslog users RSS feed   Index | Next | Previous | View Threaded


penght at cn

Jan 5, 2012, 10:48 PM

Post #1 of 4 (111 views)
Permalink
[PATCH] fix error of not define HAVE_SETSID

[add list to the CC list]

When HAVE_SETSID is not defined, rsyslogd will use ioctl() make itself to daemon,
but this can not make rsyslogd process become the process group leader of a new
process group. In RHEL6.1, the status is as follows:
# uname -a
Linux RHEL6U1GA-Intel64-199 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
# /etc/init.d/rsyslog restart
Shutting down system logger: [ OK ]
Starting system logger: [ OK ]
# ps axo pgrp,ppid,pid,comm | grep rsyslog
6290 1 6301 rsyslogd

When we send SIGTERM signal to 6290, rsyslogd will die:( So I think we should
call setpgid() before ioctl().

Signed-off-by: Peng Haitao <penght [at] cn>
---
tools/syslogd.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/tools/syslogd.c b/tools/syslogd.c
index d1224f2..ac954b7 100644
--- a/tools/syslogd.c
+++ b/tools/syslogd.c
@@ -356,8 +356,15 @@ void untty(void)
#else
{
int i;
+ pid_t pid;

if(!Debug) {
+ pid = getpid();
+ if (setpgid(pid, pid) < 0) {
+ perror("setpgid");
+ exit(1);
+ }
+
i = open(_PATH_TTY, O_RDWR|O_CLOEXEC);
if (i >= 0) {
# if !defined(__hpux)
--
1.7.1

--
Best Regards,
Peng Haitao

_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/


penght at cn

Jan 15, 2012, 9:32 PM

Post #2 of 4 (93 views)
Permalink
Re: [PATCH] fix error of not define HAVE_SETSID [In reply to]

Peng Haitao said the following on 2012-1-6 14:48:
> [add list to the CC list]
>
> When HAVE_SETSID is not defined, rsyslogd will use ioctl() make itself to daemon,
> but this can not make rsyslogd process become the process group leader of a new
> process group. In RHEL6.1, the status is as follows:
> # uname -a
> Linux RHEL6U1GA-Intel64-199 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
> # /etc/init.d/rsyslog restart
> Shutting down system logger: [ OK ]
> Starting system logger: [ OK ]
> # ps axo pgrp,ppid,pid,comm | grep rsyslog
> 6290 1 6301 rsyslogd
>
> When we send SIGTERM signal to 6290, rsyslogd will die:( So I think we should
> call setpgid() before ioctl().
>

hi, anyone can comment the patch?

--
Best Regards,
Peng

> Signed-off-by: Peng Haitao <penght [at] cn>
> ---
> tools/syslogd.c | 7 +++++++
> 1 files changed, 7 insertions(+), 0 deletions(-)
>
> diff --git a/tools/syslogd.c b/tools/syslogd.c
> index d1224f2..ac954b7 100644
> --- a/tools/syslogd.c
> +++ b/tools/syslogd.c
> @@ -356,8 +356,15 @@ void untty(void)
> #else
> {
> int i;
> + pid_t pid;
>
> if(!Debug) {
> + pid = getpid();
> + if (setpgid(pid, pid) < 0) {
> + perror("setpgid");
> + exit(1);
> + }
> +
> i = open(_PATH_TTY, O_RDWR|O_CLOEXEC);
> if (i >= 0) {
> # if !defined(__hpux)


_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/


rgerhards at hq

Jan 16, 2012, 7:41 AM

Post #3 of 4 (91 views)
Permalink
Re: [PATCH] fix error of not define HAVE_SETSID [In reply to]

> -----Original Message-----
> From: Peng Haitao [mailto:penght [at] cn]
> Sent: Monday, January 16, 2012 6:33 AM
> To: Rainer Gerhards
> Cc: rsyslog-users
> Subject: Re: [rsyslog] [PATCH] fix error of not define HAVE_SETSID
>
>
> Peng Haitao said the following on 2012-1-6 14:48:
> > [add list to the CC list]
> >
> > When HAVE_SETSID is not defined, rsyslogd will use ioctl() make itself
> > to daemon, but this can not make rsyslogd process become the process
> > group leader of a new process group. In RHEL6.1, the status is as
follows:
> > # uname -a
> > Linux RHEL6U1GA-Intel64-199 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue May
> > 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux # /etc/init.d/rsyslog
> restart
> > Shutting down system logger: [ OK ]
> > Starting system logger: [ OK ]
> > # ps axo pgrp,ppid,pid,comm | grep rsyslog
> > 6290 1 6301 rsyslogd
> >
> > When we send SIGTERM signal to 6290, rsyslogd will die:( So I think we
> > should call setpgid() before ioctl().
> >
>
> hi, anyone can comment the patch?

Sorry, I am still busy, it's on my todo list and looks good on first
impression. Bear with me a little bit more, I hope to be able to go back to
real work soon... ;)

Rainer
>
> --
> Best Regards,
> Peng
>
> > Signed-off-by: Peng Haitao <penght [at] cn>
> > ---
> > tools/syslogd.c | 7 +++++++
> > 1 files changed, 7 insertions(+), 0 deletions(-)
> >
> > diff --git a/tools/syslogd.c b/tools/syslogd.c index d1224f2..ac954b7
> > 100644
> > --- a/tools/syslogd.c
> > +++ b/tools/syslogd.c
> > @@ -356,8 +356,15 @@ void untty(void)
> > #else
> > {
> > int i;
> > + pid_t pid;
> >
> > if(!Debug) {
> > + pid = getpid();
> > + if (setpgid(pid, pid) < 0) {
> > + perror("setpgid");
> > + exit(1);
> > + }
> > +
> > i = open(_PATH_TTY, O_RDWR|O_CLOEXEC);
> > if (i >= 0) {
> > # if !defined(__hpux)
>

_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/


rgerhards at hq

Jan 16, 2012, 8:15 AM

Post #4 of 4 (91 views)
Permalink
Re: [PATCH] fix error of not define HAVE_SETSID [In reply to]

I should have waited with my reply ;) I am currently merging things and it
seems to go rather smooth. So I also merged your patch:

http://git.adiscon.com/?p=rsyslog.git;a=commitdiff;h=167192666ba8905b83210ab7
c5f00cc6be9f7147

It goes into v5-devel.
Thanks!
Rainer

> -----Original Message-----
> From: rsyslog-bounces [at] lists [mailto:rsyslog-
> bounces [at] lists] On Behalf Of Rainer Gerhards
> Sent: Monday, January 16, 2012 4:42 PM
> To: Peng Haitao
> Cc: rsyslog-users
> Subject: Re: [rsyslog] [PATCH] fix error of not define HAVE_SETSID
>
>
>
> > -----Original Message-----
> > From: Peng Haitao [mailto:penght [at] cn]
> > Sent: Monday, January 16, 2012 6:33 AM
> > To: Rainer Gerhards
> > Cc: rsyslog-users
> > Subject: Re: [rsyslog] [PATCH] fix error of not define HAVE_SETSID
> >
> >
> > Peng Haitao said the following on 2012-1-6 14:48:
> > > [add list to the CC list]
> > >
> > > When HAVE_SETSID is not defined, rsyslogd will use ioctl() make
> > > itself to daemon, but this can not make rsyslogd process become the
> > > process group leader of a new process group. In RHEL6.1, the status
> > > is as
> follows:
> > > # uname -a
> > > Linux RHEL6U1GA-Intel64-199 2.6.32-131.0.15.el6.x86_64 #1 SMP Tue
> > > May
> > > 10 15:42:40 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux #
> > > /etc/init.d/rsyslog
> > restart
> > > Shutting down system logger: [ OK ]
> > > Starting system logger: [ OK ]
> > > # ps axo pgrp,ppid,pid,comm | grep rsyslog
> > > 6290 1 6301 rsyslogd
> > >
> > > When we send SIGTERM signal to 6290, rsyslogd will die:( So I think
> > > we should call setpgid() before ioctl().
> > >
> >
> > hi, anyone can comment the patch?
>
> Sorry, I am still busy, it's on my todo list and looks good on first
impression.
> Bear with me a little bit more, I hope to be able to go back to real work
> soon... ;)
>
> Rainer
> >
> > --
> > Best Regards,
> > Peng
> >
> > > Signed-off-by: Peng Haitao <penght [at] cn>
> > > ---
> > > tools/syslogd.c | 7 +++++++
> > > 1 files changed, 7 insertions(+), 0 deletions(-)
> > >
> > > diff --git a/tools/syslogd.c b/tools/syslogd.c index
> > > d1224f2..ac954b7
> > > 100644
> > > --- a/tools/syslogd.c
> > > +++ b/tools/syslogd.c
> > > @@ -356,8 +356,15 @@ void untty(void) #else {
> > > int i;
> > > + pid_t pid;
> > >
> > > if(!Debug) {
> > > + pid = getpid();
> > > + if (setpgid(pid, pid) < 0) {
> > > + perror("setpgid");
> > > + exit(1);
> > > + }
> > > +
> > > i = open(_PATH_TTY, O_RDWR|O_CLOEXEC);
> > > if (i >= 0) {
> > > # if !defined(__hpux)
> >
>
> _______________________________________________
> rsyslog mailing list
> http://lists.adiscon.net/mailman/listinfo/rsyslog
> http://www.rsyslog.com/professional-services/
_______________________________________________
rsyslog mailing list
http://lists.adiscon.net/mailman/listinfo/rsyslog
http://www.rsyslog.com/professional-services/

RSyslog users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.