public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Oleg Nesterov <oleg@redhat.com>
Cc: "Zhang, Wei-Jovi (NSN - CN/Hangzhou)" <wei-jovi.zhang@nsn.com>,
	mingo@elte.hu, peterz@infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH]exit.c: support larger exit code
Date: Wed, 25 Aug 2010 14:49:54 -0700	[thread overview]
Message-ID: <20100825144954.233b6d3c.akpm@linux-foundation.org> (raw)
In-Reply-To: <20100806124456.GA9107@redhat.com>

On Fri, 6 Aug 2010 14:44:56 +0200
Oleg Nesterov <oleg@redhat.com> wrote:

> On 08/06, Zhang, Wei-Jovi (NSN - CN/Hangzhou) wrote:
> >
> > Nowadays userspace application use systemcall exit/exit_group only
> > support one byte exit code.
> > In some cases this exit code range is too small for some "big
> > application"(like telecom software, 255 is not enough).
> >
> > So we can give some "big application" a chance to get larger exit code
> > from child process.
> > For other application don't want use larger exit code, they can use
> > marco WEXITSTATUS to get lower one byte exit code.
> >
> > #define WEXITSTATUS(status)   __WEXITSTATUS (__WAIT_INT (status))
> > --- stdlib.h
> > #define       __WEXITSTATUS(status)   (((status) & 0xff00) >> 8)
> > --- usrbits/waitstatus.h
> >
> >
> > diff --git a/kernel/exit.c b/kernel/exit.c
> > index ceffc67..8b13676 100644
> > --- a/kernel/exit.c
> > +++ b/kernel/exit.c
> > @@ -1045,7 +1045,7 @@ EXPORT_SYMBOL(complete_and_exit);
> >
> >  SYSCALL_DEFINE1(exit, int, error_code)
> >  {
> > -       do_exit((error_code&0xff)<<8);
> > +       do_exit(error_code << 8);
> >  }
> >
> >  /*
> > @@ -1086,7 +1086,7 @@ do_group_exit(int exit_code)
> >   */
> >  SYSCALL_DEFINE1(exit_group, int, error_code)
> >  {
> > -       do_group_exit((error_code & 0xff) << 8);
> > +       do_group_exit(error_code << 8);
> >         /* NOTREACHED */
> >         return 0;
> >  }
> 
> Hmm. Looking at this patch, I am wondering what was the reason for the
> current one-byte limitation.
> 
> I think the patch is fine. si_status, wo_stat are int too, so I do not
> see any possibility for truncation before reporting to user-space.
> 

There are back-compatibility issues.   If my crufty old child does

	exit(0xff01);

and my crufty old parent does

	if (exit_code == 1)

then I think the patch just broke my application.  The company which
wrote it no longer exists and I don't have source...

Is it worth this risk?


Also, the patch was missing a signed-off-by: and was in some complicated
html-in-mime format.

  parent reply	other threads:[~2010-08-25 21:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <14414B36FFA0F1418CB707361EAA199A0194F7D2@CNBEEXC006.nsn-intra.net>
2010-08-06 12:44 ` [PATCH]exit.c: support larger exit code Oleg Nesterov
2010-08-07 10:41   ` Alexander Clouter
2010-08-25 21:49   ` Andrew Morton [this message]
2010-08-25 22:23     ` Tony Luck
2010-08-09  3:14 Zhang, Wei-Jovi (NSN - CN/Hangzhou)
2010-08-09  8:25 ` Alexander Clouter
2010-08-09 10:57   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100825144954.233b6d3c.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=wei-jovi.zhang@nsn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox