Re: svn commit: r240060 - in head: include/rpc sys/rpc

2012-09-03 Thread Konstantin Belousov
On Sun, Sep 02, 2012 at 09:04:40PM +, Pedro F. Giffuni wrote:
 Author: pfg
 Date: Sun Sep  2 21:04:40 2012
 New Revision: 240060
 URL: http://svn.freebsd.org/changeset/base/240060
 
 Log:
   Fix RPC headers for C++
   
   C++ mangling will cause trouble with variables like __rpc_xdr
   in xdr.h so rename this to XDR.
Which troubles ?

Although not very useful due to many other namespace pollution problems
in the rpc headers, __rpc_xdr is in the implementation-reserved namespace,
while XDR is not.


pgpx7NQVCbnpQ.pgp
Description: PGP signature


Re: svn commit: r240060 - in head: include/rpc sys/rpc

2012-09-03 Thread Pedro Giffuni
Hello,

Sorry for the brevity but I can inly anser on a mobile device
right now ...

--- Lun 3/9/12, Konstantin Belousov kostik...@gmail.com ha scritto:

 Da: Konstantin Belousov kostik...@gmail.com
 Oggetto: Re: svn commit: r240060 - in head: include/rpc sys/rpc
 A: Pedro F. Giffuni p...@freebsd.org
 Cc: src-committ...@freebsd.org, svn-src-...@freebsd.org, 
 svn-src-head@freebsd.org
 Data: Lunedì 3 settembre 2012, 02:31
 On Sun, Sep 02, 2012 at 09:04:40PM
 +, Pedro F. Giffuni wrote:
  Author: pfg
  Date: Sun Sep  2 21:04:40 2012
  New Revision: 240060
  URL: http://svn.freebsd.org/changeset/base/240060
  
  Log:
    Fix RPC headers for C++
    
    C++ mangling will cause trouble with
 variables like __rpc_xdr
    in xdr.h so rename this to XDR.
 Which troubles ?

 
PR 137443

 Although not very useful due to many other namespace
 pollution problems
 in the rpc headers, __rpc_xdr is in the
 implementation-reserved namespace,
 while XDR is not.
 

The forced reference here is {Open}Solaris:

http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/rpc/xdr.h

OpenGrok found no reference to __rpc_xdr
in OpenSolaris/illumos.

Cheers,

Pedro.



___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r240060 - in head: include/rpc sys/rpc

2012-09-03 Thread Konstantin Belousov
On Mon, Sep 03, 2012 at 07:13:19AM -0700, Pedro Giffuni wrote:
 Hello,
 
 Sorry for the brevity but I can inly anser on a mobile device
 right now ...
 
 --- Lun 3/9/12, Konstantin Belousov kostik...@gmail.com ha scritto:
 
  Da: Konstantin Belousov kostik...@gmail.com
  Oggetto: Re: svn commit: r240060 - in head: include/rpc sys/rpc
  A: Pedro F. Giffuni p...@freebsd.org
  Cc: src-committ...@freebsd.org, svn-src-...@freebsd.org, 
  svn-src-head@freebsd.org
  Data: Luned? 3 settembre 2012, 02:31
  On Sun, Sep 02, 2012 at 09:04:40PM
  +, Pedro F. Giffuni wrote:
   Author: pfg
   Date: Sun Sep  2 21:04:40 2012
   New Revision: 240060
   URL: http://svn.freebsd.org/changeset/base/240060
   
   Log:
     Fix RPC headers for C++
     
     C++ mangling will cause trouble with
  variables like __rpc_xdr
     in xdr.h so rename this to XDR.
  Which troubles ?
 
  
 PR 137443
From the PR, I fail to see what is the problem in our headers, and why
the issue is not in some third-party C++ code.

It is definitely has nothing to do with C++ name mangling.

 
  Although not very useful due to many other namespace
  pollution problems
  in the rpc headers, __rpc_xdr is in the
  implementation-reserved namespace,
  while XDR is not.
  
 
 The forced reference here is {Open}Solaris:
 
 http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/rpc/xdr.h
 
 OpenGrok found no reference to __rpc_xdr
 in OpenSolaris/illumos.
I see, Solaris does
typedef struct XDR { ... } XDR;
and we now use the same trick.

So my objections, if any, were against the commit message and not the actual
code change then.

Thanks.


pgp9NWa42aEdW.pgp
Description: PGP signature


Re: svn commit: r240060 - in head: include/rpc sys/rpc

2012-09-03 Thread Pedro Giffuni
...


From: Konstantin Belousov
 
...

  
 PR 137443
From the PR, I fail to see what is the problem in our headers, and why
the issue is not in some third-party C++ code.

It is definitely has nothing to do with C++ name mangling.

 
Hmm.. yes, not a mangling issue but it is rather weird that it happens on C++.
Salome is not a toy app.

 
  Although not very useful due to many other namespace
  pollution problems
  in the rpc headers, __rpc_xdr is in the
  implementation-reserved namespace,
  while XDR is not.
  
 
 The forced reference here is {Open}Solaris:
 
 http://src.illumos.org/source/xref/illumos-gate/usr/src/uts/common/rpc/xdr.h
 
 OpenGrok found no reference to __rpc_xdr
 in OpenSolaris/illumos.
I see, Solaris does
    typedef struct XDR { ... } XDR;
and we now use the same trick.

So my objections, if any, were against the commit message and not the actual
code change then.

 
Quite definitely :( .. I mixed two different issues that I was trying to solve
(and one of them was not an issue at all). I will do a better job when I
MFC.
 
Thanks for checking though: I do feel nervous when touching a standard
header even if it's just to follow a change from upstream!
 
 
Pedro.
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to svn-src-head-unsubscr...@freebsd.org


Re: svn commit: r240060 - in head: include/rpc sys/rpc

2012-09-02 Thread Yuri Pankov

On Sun, 2 Sep 2012 21:04:40 + (UTC), Pedro F. Giffuni wrote:

Author: pfg
Date: Sun Sep  2 21:04:40 2012
New Revision: 240060
URL: http://svn.freebsd.org/changeset/base/240060

Log:
   Fix RPC headers for C++

   C++ mangling will cause trouble with variables like __rpc_xdr
   in xdr.h so rename this to XDR.
   While here add proper C++ guards to RPC headers.

   PR:  137443
   MFC after:   2 weeks

Modified:
   head/include/rpc/auth.h
   head/include/rpc/auth_unix.h
   head/include/rpc/clnt.h
   head/include/rpc/clnt_soc.h
   head/include/rpc/des_crypt.h
   head/include/rpc/nettype.h
   head/include/rpc/pmap_clnt.h
   head/include/rpc/pmap_rmt.h
   head/include/rpc/rpc_com.h
   head/include/rpc/rpc_msg.h
   head/include/rpc/rpcb_clnt.h
   head/include/rpc/rpcent.h
   head/include/rpc/rpcsec_gss.h
   head/include/rpc/svc.h
   head/include/rpc/svc_soc.h
   head/include/rpc/xdr.h
   head/sys/rpc/rpc_com.h
   head/sys/rpc/xdr.h

Modified: head/include/rpc/auth.h
==
--- head/include/rpc/auth.h Sun Sep  2 18:54:51 2012(r240059)
+++ head/include/rpc/auth.h Sun Sep  2 21:04:40 2012(r240060)
@@ -51,6 +51,10 @@
  #include sys/cdefs.h
  #include sys/socket.h

+#ifdef __cplusplus
+extern C {
+#endif
+
  #define MAX_AUTH_BYTES400
  #define MAXNETNAMELEN 255 /* maximum length of network user's name */

@@ -366,4 +370,8 @@ __END_DECLS
  #define   RPCSEC_GSS_KRB5I390004
  #define   RPCSEC_GSS_KRB5P390005

+#ifdef __cplusplus
+}
+#endif
+
  #endif /* !_RPC_AUTH_H */

Modified: head/include/rpc/auth_unix.h
==
--- head/include/rpc/auth_unix.hSun Sep  2 18:54:51 2012
(r240059)
+++ head/include/rpc/auth_unix.hSun Sep  2 21:04:40 2012
(r240060)
@@ -48,6 +48,10 @@
  #define _RPC_AUTH_UNIX_H
  #include sys/cdefs.h

+#ifdef __cplusplus
+extern C {
+#endif
+
  /* The machine name is part of a credential; it may not exceed 255 bytes */
  #define MAX_MACHINE_NAME 255

@@ -81,4 +85,8 @@ struct short_hand_verf {
struct opaque_auth new_cred;
  };

+#ifdef __cplusplus
+}
+#endif
+
  #endif /* !_RPC_AUTH_UNIX_H */

Modified: head/include/rpc/clnt.h
==
--- head/include/rpc/clnt.h Sun Sep  2 18:54:51 2012(r240059)
+++ head/include/rpc/clnt.h Sun Sep  2 21:04:40 2012(r240060)
@@ -64,6 +64,10 @@
  #include netconfig.h
  #include sys/un.h

+#ifdef __cplusplus
+extern C {
+#endif
+
  /*
   * Well-known IPV6 RPC broadcast address.
   */
@@ -551,6 +555,10 @@ extern enum clnt_stat rpc_broadcast_exp(
const int, const char *);
  __END_DECLS

+#ifdef __cplusplus
+}
+#endif
+
  /* For backward compatibility */
  #include rpc/clnt_soc.h


Modified: head/include/rpc/clnt_soc.h
==
--- head/include/rpc/clnt_soc.h Sun Sep  2 18:54:51 2012(r240059)
+++ head/include/rpc/clnt_soc.h Sun Sep  2 21:04:40 2012(r240060)
@@ -49,6 +49,10 @@

  #include sys/cdefs.h

+#ifdef __cplusplus
+extern C {
+#endif
+
  #define UDPMSGSIZE  8800/* rpc imposed limit on udp msg size */

  /*
@@ -103,4 +107,8 @@ extern CLIENT *clntudp_bufcreate(struct
 struct timeval, int *, u_int, u_int);
  __END_DECLS

+#ifdef __cplusplus
+}
+#endif
+
  #endif /* _RPC_CLNT_SOC_H */

Modified: head/include/rpc/des_crypt.h
==
--- head/include/rpc/des_crypt.hSun Sep  2 18:54:51 2012
(r240059)
+++ head/include/rpc/des_crypt.hSun Sep  2 21:04:40 2012
(r240060)
@@ -47,6 +47,10 @@
  #include sys/cdefs.h
  #include rpc/rpc.h

+#ifdef __cplusplus
+extern C {
+#endif
+
  #define DES_MAXDATA 8192  /* max bytes encrypted in one call */
  #define DES_DIRMASK (1  0)
  #define DES_ENCRYPT (0*DES_DIRMASK)   /* Encrypt */
@@ -103,4 +107,8 @@ __BEGIN_DECLS
  void des_setparity( char *);
  __END_DECLS

+#ifdef __cplusplus
+}
+#endif
+
  #endif  /* _DES_DES_CRYPT_H */

Modified: head/include/rpc/nettype.h
==
--- head/include/rpc/nettype.h  Sun Sep  2 18:54:51 2012(r240059)
+++ head/include/rpc/nettype.h  Sun Sep  2 21:04:40 2012(r240060)
@@ -44,6 +44,10 @@

  #include netconfig.h

+#ifdef __cplusplus
+extern C {
+#endif
+
  #define   _RPC_NONE   0
  #define   _RPC_NETPATH1
  #define   _RPC_VISIBLE2
@@ -61,4 +65,8 @@ extern struct netconfig *__rpc_getconf(v
  extern struct netconfig *__rpc_getconfip(const char *);
  __END_DECLS

+#ifdef __cplusplus
+}
+#endif
+
  #endif/* !_RPC_NETTYPE_H */

Modified: head/include/rpc/pmap_clnt.h

Re: svn commit: r240060 - in head: include/rpc sys/rpc

2012-09-02 Thread Pedro Giffuni
Yes, indeed! I will revert most of it.
 
Thanks for checking!
 
Pedro.



 From: Yuri Pankov yuri.pan...@gmail.com
To: Pedro F. Giffuni p...@freebsd.org 
Cc: src-committ...@freebsd.org; svn-src-...@freebsd.org; 
svn-src-head@freebsd.org 
Sent: Sunday, September 2, 2012 4:16 PM
Subject: Re: svn commit: r240060 - in head: include/rpc sys/rpc
  
On Sun, 2 Sep 2012 21:04:40 + (UTC), Pedro F. Giffuni wrote:
 Author: pfg
 Date: Sun Sep  2 21:04:40 2012
 New Revision: 240060
 URL: http://svn.freebsd.org/changeset/base/240060

 Log:
    Fix RPC headers for C++

    C++ mangling will cause trouble with variables like __rpc_xdr
    in xdr.h so rename this to XDR.
    While here add proper C++ guards to RPC headers.

    PR:        137443
    MFC after:    2 weeks

 Modified:
    head/include/rpc/auth.h
    head/include/rpc/auth_unix.h
    head/include/rpc/clnt.h
    head/include/rpc/clnt_soc.h
    head/include/rpc/des_crypt.h
    head/include/rpc/nettype.h
    head/include/rpc/pmap_clnt.h
    head/include/rpc/pmap_rmt.h
    head/include/rpc/rpc_com.h
    head/include/rpc/rpc_msg.h
    head/include/rpc/rpcb_clnt.h
    head/include/rpc/rpcent.h
    head/include/rpc/rpcsec_gss.h
    head/include/rpc/svc.h
    head/include/rpc/svc_soc.h
    head/include/rpc/xdr.h
    head/sys/rpc/rpc_com.h
    head/sys/rpc/xdr.h

 Modified: head/include/rpc/auth.h
 ==
 --- head/include/rpc/auth.h    Sun Sep  2 18:54:51 2012    (r240059)
 +++ head/include/rpc/auth.h    Sun Sep  2 21:04:40 2012    (r240060)
 @@ -51,6 +51,10 @@
   #include sys/cdefs.h
   #include sys/socket.h

 +#ifdef    __cplusplus
 +extern C {
 +#endif
 +
   #define MAX_AUTH_BYTES    400
   #define MAXNETNAMELEN    255    /* maximum length of network user's name */

 @@ -366,4 +370,8 @@ __END_DECLS
   #define    RPCSEC_GSS_KRB5I    390004
   #define    RPCSEC_GSS_KRB5P    390005

 +#ifdef    __cplusplus
 +}
 +#endif
 +
   #endif /* !_RPC_AUTH_H */

 Modified: head/include/rpc/auth_unix.h
 ==
 --- head/include/rpc/auth_unix.h    Sun Sep  2 18:54:51 2012    (r240059)
 +++ head/include/rpc/auth_unix.h    Sun Sep  2 21:04:40 2012    (r240060)
 @@ -48,6 +48,10 @@
   #define _RPC_AUTH_UNIX_H
   #include sys/cdefs.h

 +#ifdef    __cplusplus
 +extern C {
 +#endif
 +
   /* The machine name is part of a credential; it may not exceed 255 bytes */
   #define MAX_MACHINE_NAME 255

 @@ -81,4 +85,8 @@ struct short_hand_verf {
       struct opaque_auth new_cred;
   };

 +#ifdef    __cplusplus
 +}
 +#endif
 +
   #endif /* !_RPC_AUTH_UNIX_H */

 Modified: head/include/rpc/clnt.h
 ==
 --- head/include/rpc/clnt.h    Sun Sep  2 18:54:51 2012    (r240059)
 +++ head/include/rpc/clnt.h    Sun Sep  2 21:04:40 2012    (r240060)
 @@ -64,6 +64,10 @@
   #include netconfig.h
   #include sys/un.h

 +#ifdef    __cplusplus
 +extern C {
 +#endif
 +
   /*
    * Well-known IPV6 RPC broadcast address.
    */
 @@ -551,6 +555,10 @@ extern enum clnt_stat rpc_broadcast_exp(
                       const int, const char *);
   __END_DECLS

 +#ifdef    __cplusplus
 +}
 +#endif
 +
   /* For backward compatibility */
   #include rpc/clnt_soc.h


 Modified: head/include/rpc/clnt_soc.h
 ==
 --- head/include/rpc/clnt_soc.h    Sun Sep  2 18:54:51 2012    (r240059)
 +++ head/include/rpc/clnt_soc.h    Sun Sep  2 21:04:40 2012    (r240060)
 @@ -49,6 +49,10 @@

   #include sys/cdefs.h

 +#ifdef    __cplusplus
 +extern C {
 +#endif
 +
   #define UDPMSGSIZE      8800    /* rpc imposed limit on udp msg size */

   /*
 @@ -103,4 +107,8 @@ extern CLIENT *clntudp_bufcreate(struct
                    struct timeval, int *, u_int, u_int);
   __END_DECLS

 +#ifdef    __cplusplus
 +}
 +#endif
 +
   #endif /* _RPC_CLNT_SOC_H */

 Modified: head/include/rpc/des_crypt.h
 ==
 --- head/include/rpc/des_crypt.h    Sun Sep  2 18:54:51 2012    (r240059)
 +++ head/include/rpc/des_crypt.h    Sun Sep  2 21:04:40 2012    (r240060)
 @@ -47,6 +47,10 @@
   #include sys/cdefs.h
   #include rpc/rpc.h

 +#ifdef    __cplusplus
 +extern C {
 +#endif
 +
   #define DES_MAXDATA 8192    /* max bytes encrypted in one call */
   #define DES_DIRMASK (1  0)
   #define DES_ENCRYPT (0*DES_DIRMASK)    /* Encrypt */
 @@ -103,4 +107,8 @@ __BEGIN_DECLS
   void des_setparity( char *);
   __END_DECLS

 +#ifdef    __cplusplus
 +}
 +#endif
 +
   #endif  /* _DES_DES_CRYPT_H */

 Modified: head/include/rpc/nettype.h
 ==
 --- head/include/rpc/nettype.h    Sun Sep  2 18:54:51 2012    (r240059)
 +++ head/include/rpc/nettype.h    Sun Sep  2 21:04:40 2012    (r240060)
 @@ -44,6 +44,10