Re: [Patch] gio-standalone build fail with suncc because retrun value in void function

Takao Fujiwara - Tokyo S/W Center <[email protected]>
Newsgroups gmane.comp.gnome.vfs.general
Organization Sun Microsystems
Message-ID <[email protected]>
I think it can be resolved to set $CFLAGS instead of changing any codes on Solaris.

export CFLAGS="%optflags -D_POSIX_PTHREAD_SEMANTICS"

Thanks,
fujiwara

Halton Huo wrote:
> Hi Alexl,
> 
> When I try to build gio-standalone trunk code on Solaris with suncc, I 
> get build fail with following message:
> 
> /ws/onnv-tools-prc/SUNWspro/SS11/bin/cc -DHAVE_CONFIG_H -I. -I.. -I.. 
> -I.. -DGIO_MODULE_DIR=\"/export/home/halton/work/dist//lib/gio/modules\" 
> -D_REENTRANT -D_PTHREADS -I/usr/include/glib-2.0 
> -I/usr/lib/glib-2.0/include -DG_LOG_DOMAIN=\"GIO\" 
> -DG_DISABLE_DEPRECATED -DDBUS_API_SUBJECT_TO_CHANGE -g -c 
> glocalfileinfo.c  -KPIC -DPIC -o .libs/glocalfileinfo.o
> "glocalfileinfo.c", line 975: prototype mismatch: 5 args passed, 4 expected
> "glocalfileinfo.c", line 1056: prototype mismatch: 5 args passed, 4 expected
> 
> It is because getgrgid_r is differrent between Linux and Solaris.
> 
> On Solaris:
> struct passwd *getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, 
> int  buflen);
> 
> On Linux:
> int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
>        size_t bufsize, struct passwd **result)
> 
> getgrgid_r have similar difference. The patch is attached.
> 
> Halton.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: trunk/configure.ac
> ===================================================================
> --- trunk/configure.ac	(revision 722)
> +++ trunk/configure.ac	(working copy)
> @@ -89,6 +89,9 @@
>    *-*-mingw*)
>      glib_native_win32=yes
>      ;;
> +  *solaris*)
> +    AC_DEFINE(ON_SOLARIS, 1, [Define to 1 if os is solaris])
> +    ;;
>    *)
>      glib_native_win32=no
>      ;;
> Index: trunk/gio/glocalfileinfo.c
> ===================================================================
> --- trunk/gio/glocalfileinfo.c	(revision 722)
> +++ trunk/gio/glocalfileinfo.c	(working copy)
> @@ -972,7 +972,11 @@
>  
>    data = g_new0 (UidData, 1);
>  
> +#if ON_SOLARIS
> +  pwbufp = getpwuid_r (uid, &pwbuf, buffer, sizeof(buffer));
> +#else
>    getpwuid_r (uid, &pwbuf, buffer, sizeof(buffer), &pwbufp);
> +#endif
>  
>    if (pwbufp != NULL)
>      {
> @@ -1053,7 +1057,11 @@
>    if (name)
>      return name;
>  
> +#if ON_SOLARIS
> +  gbufp = getgrgid_r (gid, &gbuf, buffer, sizeof(buffer));
> +#else
>    getgrgid_r (gid, &gbuf, buffer, sizeof(buffer), &gbufp);
> +#endif
>  
>    if (gbufp != NULL &&
>        gbufp->gr_name != NULL &&
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> gnome-vfs-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.