[Mesa-dev] [PATCH] Android: define PIPE_OS_BSD

Jonathan Gray jsg at jsg.id.au
Wed Jun 7 15:22:57 UTC 2017


On Wed, Jun 07, 2017 at 11:18:53PM +0800, Chih-Wei Huang wrote:
> 2017-06-07 22:47 GMT+08:00 Jonathan Gray <jsg at jsg.id.au>:
> > On Wed, Jun 07, 2017 at 10:30:49PM +0800, Chih-Wei Huang wrote:
> >> 2017-06-07 21:54 GMT+08:00 Jonathan Gray <jsg at jsg.id.au>:
> >> > On Wed, Jun 07, 2017 at 02:45:15PM +0100, Emil Velikov wrote:
> >> >> On 6 June 2017 at 07:30, Chih-Wei Huang <cwhuang at android-x86.org> wrote:
> >> >> >>> These are are due to program_invocation_short_name/getprogname. How
> >> >> >>> about updating the file alike xmlconfig.c?
> >> >> >>
> >> >> >> Oh... I didn't notice that.
> >> >> >> Let me check.
> >> >> >
> >> >> > Well, I saw several BSD OSes define
> >> >> > the same context:
> >> >> >
> >> >> > #elif defined(__NetBSD__) && defined(__NetBSD_Version__) &&
> >> >> > (__NetBSD_Version__ >= 106000100)
> >> >> > #    include <stdlib.h>
> >> >> > #    define GET_PROGRAM_NAME() getprogname()
> >> >> > #elif defined(__DragonFly__)
> >> >> > #    include <stdlib.h>
> >> >> > #    define GET_PROGRAM_NAME() getprogname()
> >> >> > #elif defined(__APPLE__)
> >> >> > #    include <stdlib.h>
> >> >> > #    define GET_PROGRAM_NAME() getprogname()
> >> >> > #elif ...
> >> >> >
> >> >> > Not sure why has no OpenBSD?
> >> >> Your guess is as good as mine. Jonathan, any ideas if/who this is
> >> >> supposed to work for you guys?
> >> >
> >> > I have no idea where that block comes from as the latest
> >> > src/gallium/auxiliary/os/os_process.c
> >>
> >> Sorry. A little off-topic.
> >> Yes, the original patch is about os_process.c.
> >> But now we are talking about xmlconfig.c
> >> (in src/mesa/drivers/dri/common/ )
> >
> > You miss the other relevant part of that file
> >
> > #if !defined(GET_PROGRAM_NAME)
> > #    if defined(__OpenBSD__) || defined(NetBSD) || defined(__UCLIBC__) || defined(ANDROID)
> > /* This is a hack. It's said to work on OpenBSD, NetBSD and GNU.
> >  * Rogelio M.Serrano Jr. reported it's also working with UCLIBC. It's
> >  * used as a last resort, if there is no documented facility available. */
> > static const char *__getProgramName () {
> >     extern const char *__progname;
> >     char * arg = strrchr(__progname, '/');
> >     if (arg)
> >         return arg+1;
> >     else
> >         return __progname;
> > }
> > #        define GET_PROGRAM_NAME() __getProgramName()
> > #    else
> > #        define GET_PROGRAM_NAME() ""
> > #        warning "Per application configuration won't work with your OS version."
> > #    endif
> > #endif
> >
> > __progname exists since BSD 4.4,  OpenBSD has had getprogname() since
> > 5.4 in 2013.  This should all be simplified to look like or use the
> > gallium code.
> 
> No. I didn't miss the part.

__progname was never mentioned in any mail I read.

> That's exact what I asked.
> OpenBSD has getprogname().
> Why should it fall back to the hack?

Clearly the code is older than 2013.


More information about the mesa-dev mailing list