ucontext.h or sys/ucontext.h

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

ucontext.h or sys/ucontext.h

stes
 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


Minor technical issue.

Regarding platforms/unix/vm/include_ucontext.h

Solaris has a #include <sys/ucontext.h> so the build was working,
but some versions adhere to the "Single Unix Specification v2" (SUS v2).

According to some info (I'm no expert in this) this is Solaris 7/8

           SUSv2        superset of SUS extended      Solaris 7
                        to support POSIX.1b-1993,
                        POSIX.1c-1996, and ISO/IEC
                        9899 (C Standard)
                        Amendment 1

Now that standard speficies that you can #include <ucontext.h>
instead of #include <sys/ucontext.h>

Also see
https://pubs.opengroup.org/onlinepubs/7908799/xsh/ucontext.h.html

I've added a small #ifdef __sun fix to use #include <ucontext.h> in the
Solaris case.

Alternatively perhaps the configure script could check for the
existence of the <ucontext.h> header file ...

Unfortunately the #include's that the program issues,
does have obviously major impact on the behaviour of the VM.

Another issue one of the fixes I submitted in the sunos branch is

or was :

  # include <sys/file.h> /* FASYNC or ioctl FIOASYNC will be issued  */

in the file platforms/unix/vm/aio.c

The issue there (completely unrelated to the ucontext.h issue) is that
that header file determines how the code in aio.c works

Because in aio.c there is code

#if defined(O_ASYNC)
#elif defined(FASYNC)
#elif defined(FIOASYNC)

great care about the configuration of header files (#include) is needed.

Perhaps also in the case of aio.c this could be dealt with in the configure
script.

The configure script could also in that case try to figure out what
the correct #include is, but it has major impact of course on the
behavior of the VM ...

David Stes

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJepDBDAAoJEAwpOKXMq1Mab1oH/iGxCG89bwpvE2PxVyAbRVkR
LRPoT0t9GZydOr4qWHCGl13DOLvUUfLXH4vkSD1VHCC0Qlnxir9xwgIxSL1mDxpJ
KhEOyddTwnfaALNiwJ9bU3HA5pRMwH1U9eCHhUdUJHXcx4YL9dt/zG9bIMwx+Z3y
x92YqEqJ99qDeYPJ9Ap6KzRMC5/QgHxQWbS5GP1WrqpwzHbUtv7Y/sdXGtOVYfE2
VKHEoCR+yHZjnige1kVF+WejDEvyFG+65ScicEFDfCXB7yXTHpxrkAbNkp2gO1xM
PXnCe25yn6rj861N2ndmnL61iMk4rzqNMomDkaG+KT7CYa6bJdPMeHiXNOkZgxg=
=IsL8
-----END PGP SIGNATURE-----




--
Sent from: http://forum.world.st/Squeak-VM-f104410.html
Reply | Threaded
Open this post in threaded view
|

Re: ucontext.h or sys/ucontext.h

Tobias Pape
 
Hi Stes

> On 25.04.2020, at 14:45, stes <[hidden email]> wrote:
>
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
>
> Minor technical issue.
>
> Regarding platforms/unix/vm/include_ucontext.h
>
> Solaris has a #include <sys/ucontext.h> so the build was working,
> but some versions adhere to the "Single Unix Specification v2" (SUS v2).
>
> According to some info (I'm no expert in this) this is Solaris 7/8
>
>           SUSv2        superset of SUS extended      Solaris 7
>                        to support POSIX.1b-1993,
>                        POSIX.1c-1996, and ISO/IEC
>                        9899 (C Standard)
>                        Amendment 1
>
> Now that standard speficies that you can #include <ucontext.h>
> instead of #include <sys/ucontext.h>
>
> Also see
> https://pubs.opengroup.org/onlinepubs/7908799/xsh/ucontext.h.html
>
> I've added a small #ifdef __sun fix to use #include <ucontext.h> in the
> Solaris case.
>
> Alternatively perhaps the configure script could check for the
> existence of the <ucontext.h> header file ...

Thanks for pointing that out.

Meanwhile I found this: https://github.com/torproject/tor/blob/master/m4/pc_from_ucontext.m4
which suggests that simply using <ucontext.h> is not the best idea, funnily enough because of
OSX (which is the only SUSv2 Unix I've ever used...)

We could use an updated version (https://github.com/gperftools/gperftools/blob/master/m4/pc_from_ucontext.m4)
and derive this information automatically.

what do you all think?


>
> Unfortunately the #include's that the program issues,
> does have obviously major impact on the behaviour of the VM.
>
> Another issue one of the fixes I submitted in the sunos branch is
>
> or was :
>
>  # include <sys/file.h> /* FASYNC or ioctl FIOASYNC will be issued  */
>
> in the file platforms/unix/vm/aio.c
>
> The issue there (completely unrelated to the ucontext.h issue) is that
> that header file determines how the code in aio.c works
>
> Because in aio.c there is code
>
> #if defined(O_ASYNC)
> #elif defined(FASYNC)
> #elif defined(FIOASYNC)
>
> great care about the configuration of header files (#include) is needed.

Sorry, I have no Idea about that one.

Best regards
        -Tobias

>
> Perhaps also in the case of aio.c this could be dealt with in the configure
> script.
>
> The configure script could also in that case try to figure out what
> the correct #include is, but it has major impact of course on the
> behavior of the VM ...
>
> David Stes
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v2
>
> iQEcBAEBCAAGBQJepDBDAAoJEAwpOKXMq1Mab1oH/iGxCG89bwpvE2PxVyAbRVkR
> LRPoT0t9GZydOr4qWHCGl13DOLvUUfLXH4vkSD1VHCC0Qlnxir9xwgIxSL1mDxpJ
> KhEOyddTwnfaALNiwJ9bU3HA5pRMwH1U9eCHhUdUJHXcx4YL9dt/zG9bIMwx+Z3y
> x92YqEqJ99qDeYPJ9Ap6KzRMC5/QgHxQWbS5GP1WrqpwzHbUtv7Y/sdXGtOVYfE2
> VKHEoCR+yHZjnige1kVF+WejDEvyFG+65ScicEFDfCXB7yXTHpxrkAbNkp2gO1xM
> PXnCe25yn6rj861N2ndmnL61iMk4rzqNMomDkaG+KT7CYa6bJdPMeHiXNOkZgxg=
> =IsL8
> -----END PGP SIGNATURE-----



Reply | Threaded
Open this post in threaded view
|

Re: ucontext.h or sys/ucontext.h

stes
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256


The issue on aio.c is totally unrelated, it's just something I wrote,
because it is also related to platform-dependent #include files,
and the big impact they can have.

Regarding the <ucontext.h> issue, it is not a big deal.

I think the files

sqUnixMain.c:#include "include_ucontext.h"

and

sqUnixVMProfile.c:#include "include_ucontext.h"

they both #include a local header file include_ucontext.h

which is doing something like:

#ifdef __OpenBSD__
# include <sys/signal.h>
#else
# include <sys/ucontext.h>
#endif

The code that is including <sys/ucontext.h> is working on Solaris,
but not entirely correct.

It depends on how the Solaris system is setup, I see that the Solaris
docs say that you have to #include <ucontext.h>

Whether <sys/ucontext.h> or <ucontext.h> it seems a little bit like
a Byzantine discussion on the sex of angels, and it seems
something that for the last 23 years (since 1997) or so caused some
discussion, as some SUS or POSIX standard committee said that the header was
#include <ucontext.h> and the de-facto standard is not following them.

Basically in the Solaris case #include <ucontext.h> is including
<sys/ucontext.h>

However I submit a minor change for the <ucontext.h> in the __sun case.

This has no impact on any other platform,
and in fact I don't think anything should be changed for other platforms.

However hopefully my pull request for the __sun change is accepted !

David

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJeqnosAAoJEAwpOKXMq1MacEQH/RF7AzzssWuUeSfqFWyOTSB0
No5GowOydEjAuGnOjHGczgAAlZwUkqtmT0AjFDwsOprLSXPrPlhbBMh7D/FMgKD8
Zk+7XO0ltK1PLj9tUCc8X56Rd8l3eTZaZ5cvDX43LIbyLQIdDPui2xrdsnfIJWij
iP2tUGgbdSXpFRLKy5UjJriC/KbfmqtGtknoJ84MHM85NobdFPbWH/S8Rcdc3JsT
u1H1ceEmTOaYhjhyOTMmKi+JwpfJ51SnjNufrZWX+55YZIGAeRAwXLE9Muq0ESe2
M/iQRHet7m957b9IQsLvAMswSoivenC8C0hw1t7Kw8GR20dbv4RWqPtVn5NZz6Y=
=FNOr
-----END PGP SIGNATURE-----




--
Sent from: http://forum.world.st/Squeak-VM-f104410.html