Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2013 11:16:23 -0800
From:      Garrett Cooper <yanegomi@gmail.com>
To:        d@delphij.net
Cc:        "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>, Xin LI <delphij@gmail.com>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, Eitan Adler <eadler@freebsd.org>
Subject:   Re: svn commit: r245494 - head/bin/pwait
Message-ID:  <CAGH67wSZW3M1drsgLJ4Vuoxx1tqo=fC5JpHXKcxeYnB3qbkxxg@mail.gmail.com>
In-Reply-To: <50F6F450.50102@delphij.net>
References:  <201301160503.r0G53qie087155@svn.freebsd.org> <CAGMYy3smQv4-3oxZBFC1EkJQr%2B=3n08z=tBr_Lt58zxfTcYB6Q@mail.gmail.com> <CAF6rxgmthYBdGeZkRaDHL0bDYCHb_pKPQiGKaWmU2id0Cd_A5g@mail.gmail.com> <50F6ED68.50602@delphij.net> <0928E58E-F510-47CD-957F-8C321B1210CC@gmail.com> <50F6F450.50102@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 16, 2013 at 10:41 AM, Xin Li <delphij@delphij.net> wrote:

...

> Well, calling exit(3) actually do less on C++ (dtor's are not called
> in this case, if any local object is declared on stack, which is done
> when the code say 'return') but the difference is less on C.

Good to know -- thanks!

> In style(9) there is no explicit mention of using exit(3) but the
> example do use exit() instead of return() for main().

There's a fair amount of subtlety in style(9) ;)...

> By the way speaking for exit(3) preventing bugs on other OSes, do you
> have reference to these issue?  It sounds weird as I would see these
> as serious leakage which are normally fixed very quickly and we
> shouldn't be the first people who seeing them...

It wasn't really leakage, and it was only Windows (AFAICT) which is
its own special case. MSVC++ has copious warnings about using POSIX
APIs anyhow, so I figure it's a bad idea to depend on POSIX on Windows
:(...

There's a program that we have at $work that does dd equivalent logic
for writing/verifying files and what was happening is that whenever
the atexit handler was entered (basically whenever the terminating
condition was met) it would segfault on Windows. It might have been a
bug in terms of it entering the atexit(3) handler recursively (which
didn't occur on other OSes, e.g. FreeBSD, Linux, and OSX), but I
didn't take the time to track down the exact culprit (my goal was to
only stop the bleeding ;)..).

Thanks!
-Garrett



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGH67wSZW3M1drsgLJ4Vuoxx1tqo=fC5JpHXKcxeYnB3qbkxxg>