Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
@ 2010-03-08 16:13 Pierre Muller
  2010-03-08 20:09 ` Daniel Jacobowitz
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre Muller @ 2010-03-08 16:13 UTC (permalink / raw)
  To: gdb-patches

http://sourceware.org/ml/gdb-patches/2010-03/msg00101.html

In order to complete the fix for 1.5 Cygwin API,
we need to fix the compilation failure in
remote-fileio.c source.

Christopher said in a previous email that he
didn't have an opinion about that part.
http://sourceware.org/ml/gdb-patches/2010-03/msg00260.html

I do not really know if there is a specific maintainer for this
file... Could someone (a global maintainr?)
please review this patch?

Pierre 

2010-03-04  Pierre Muller  <muller@ics.u-strasbg.fr>

	* remote-fileio.c:
	(__USE_OLD_CYGWIN_API_): New macro, set for
	older cygwin API that does not have cygwin_conv_path.
	(cygwin_conv_path): New static function emulating
	new cygwin API.
	


Index: remote-fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-fileio.c,v
retrieving revision 1.34
diff -u -p -r1.34 remote-fileio.c
--- remote-fileio.c	1 Mar 2010 09:09:24 -0000	1.34
+++ remote-fileio.c	4 Mar 2010 15:06:28 -0000
@@ -35,9 +35,45 @@
 #include <sys/time.h>
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>		/* For
cygwin_conv_to_full_posix_path.  */
+#include <cygwin/version.h>
+#if
CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API
_MINOR) < 181
+#define __USE_OLD_CYGWIN_API_
+#endif
+
 #endif
 #include <signal.h>
 
+#ifdef __USE_OLD_CYGWIN_API_
+/* Possible 'what' values in calls to cygwin_conv_path/cygwin_create_path.
*/
+enum
+{
+  CCP_POSIX_TO_WIN_A = 0, /* from is char*, to is char*       */
+  CCP_POSIX_TO_WIN_W,	  /* from is char*, to is wchar_t*    */
+  CCP_WIN_A_TO_POSIX,	  /* from is char*, to is char*       */
+  CCP_WIN_W_TO_POSIX,	  /* from is wchar_t*, to is char*    */
+
+  /* Or these values to the above as needed. */
+  CCP_ABSOLUTE = 0,	  /* Request absolute path (default). */
+  CCP_RELATIVE = 0x100    /* Request to keep path relative.   */
+};
+typedef unsigned int cygwin_conv_path_t;
+
+static ssize_t 
+cygwin_conv_path (cygwin_conv_path_t what, const void *from,
+				 void *to, size_t size)
+{
+  if (size < PATH_MAX) 
+    internal_error (__FILE__,__LINE__, 
+      "string buffer too short in cygwin_conv_path");
+ 
+  if (what == CCP_WIN_A_TO_POSIX) 
+    return cygwin_conv_to_full_posix_path (from, to);
+  else
+    internal_error (__FILE__,__LINE__,"Error in cygwin_conv_path");
+}
+#endif /* __USE_OLD_CYGWIN_API_ */
+
+
 static struct {
   int *fd_map;
   int fd_map_size;


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-08 16:13 [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API Pierre Muller
@ 2010-03-08 20:09 ` Daniel Jacobowitz
  2010-03-08 21:49   ` Christopher Faylor
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Jacobowitz @ 2010-03-08 20:09 UTC (permalink / raw)
  To: Pierre Muller; +Cc: gdb-patches

On Mon, Mar 08, 2010 at 05:13:06PM +0100, Pierre Muller wrote:
> http://sourceware.org/ml/gdb-patches/2010-03/msg00101.html
> 
> In order to complete the fix for 1.5 Cygwin API,
> we need to fix the compilation failure in
> remote-fileio.c source.
> 
> Christopher said in a previous email that he
> didn't have an opinion about that part.
> http://sourceware.org/ml/gdb-patches/2010-03/msg00260.html
> 
> I do not really know if there is a specific maintainer for this
> file... Could someone (a global maintainr?)
> please review this patch?

This is OK.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-08 20:09 ` Daniel Jacobowitz
@ 2010-03-08 21:49   ` Christopher Faylor
  2010-03-08 21:55     ` Daniel Jacobowitz
  2010-03-08 23:21     ` Pierre Muller
  0 siblings, 2 replies; 9+ messages in thread
From: Christopher Faylor @ 2010-03-08 21:49 UTC (permalink / raw)
  To: gdb-patches, Pierre Muller

On Mon, Mar 08, 2010 at 03:09:04PM -0500, Daniel Jacobowitz wrote:
>On Mon, Mar 08, 2010 at 05:13:06PM +0100, Pierre Muller wrote:
>> http://sourceware.org/ml/gdb-patches/2010-03/msg00101.html
>> 
>> In order to complete the fix for 1.5 Cygwin API,
>> we need to fix the compilation failure in
>> remote-fileio.c source.
>> 
>> Christopher said in a previous email that he
>> didn't have an opinion about that part.
>> http://sourceware.org/ml/gdb-patches/2010-03/msg00260.html
>> 
>> I do not really know if there is a specific maintainer for this
>> file... Could someone (a global maintainr?)
>> please review this patch?
>
>This is OK.

Sorry, I guess I was wrong about the opinion.  I do have a mild one.

While I said I didn't have an opinion about this, wouldn't it really
make sense to use the same mechanism that I adopted for windows-nat.c?

cgf


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-08 21:49   ` Christopher Faylor
@ 2010-03-08 21:55     ` Daniel Jacobowitz
  2010-03-08 23:21     ` Pierre Muller
  1 sibling, 0 replies; 9+ messages in thread
From: Daniel Jacobowitz @ 2010-03-08 21:55 UTC (permalink / raw)
  To: gdb-patches, Pierre Muller

On Mon, Mar 08, 2010 at 04:48:56PM -0500, Christopher Faylor wrote:
> Sorry, I guess I was wrong about the opinion.  I do have a mild one.

On the other hand, I definitely have no opinion.  To avoid confusion,
I'll defer to cgf.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-08 21:49   ` Christopher Faylor
  2010-03-08 21:55     ` Daniel Jacobowitz
@ 2010-03-08 23:21     ` Pierre Muller
  2010-03-09 19:15       ` Christopher Faylor
  1 sibling, 1 reply; 9+ messages in thread
From: Pierre Muller @ 2010-03-08 23:21 UTC (permalink / raw)
  To: gdb-patches

> >> I do not really know if there is a specific maintainer for this
> >> file... Could someone (a global maintainr?)
> >> please review this patch?
> >
> >This is OK.
> 
> Sorry, I guess I was wrong about the opinion.  I do have a mild one.
> 
> While I said I didn't have an opinion about this, wouldn't it really
> make sense to use the same mechanism that I adopted for windows-nat.c?

The problem is that this macro does not check the value of the first
argument, which makes me fear that if someone reuses
cygwin_conv_path function elsewhere inside remote-fileio.c source
we might get into the same troubles as the ones
I just discovered for windows-nat.c

See http://sourceware.org/ml/gdb-patches/2010-03/msg00344.html

Pierre


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-08 23:21     ` Pierre Muller
@ 2010-03-09 19:15       ` Christopher Faylor
  2010-03-09 23:50         ` Pierre Muller
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Faylor @ 2010-03-09 19:15 UTC (permalink / raw)
  To: gdb-patches, Pierre Muller

On Tue, Mar 09, 2010 at 12:21:05AM +0100, Pierre Muller wrote:
>> >> I do not really know if there is a specific maintainer for this
>> >> file... Could someone (a global maintainr?)
>> >> please review this patch?
>> >
>> >This is OK.
>> 
>> Sorry, I guess I was wrong about the opinion.  I do have a mild one.
>> 
>> While I said I didn't have an opinion about this, wouldn't it really
>> make sense to use the same mechanism that I adopted for windows-nat.c?
>
>The problem is that this macro does not check the value of the first
>argument, which makes me fear that if someone reuses
>cygwin_conv_path function elsewhere inside remote-fileio.c source
>we might get into the same troubles as the ones
>I just discovered for windows-nat.c
>
>See http://sourceware.org/ml/gdb-patches/2010-03/msg00344.html

You're right.  My macro was too simple minded.  I've checked in your
change to windows-nat.c.  If you want to use that in remote-fileio.c
that's fine.  Or not.  It really isn't a big deal either way.

cgf


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-09 19:15       ` Christopher Faylor
@ 2010-03-09 23:50         ` Pierre Muller
  2010-03-10 15:57           ` Christopher Faylor
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre Muller @ 2010-03-09 23:50 UTC (permalink / raw)
  To: gdb-patches

Hi Christopher,
> >I just discovered for windows-nat.c
> >
> >See http://sourceware.org/ml/gdb-patches/2010-03/msg00344.html
> 
> You're right.  My macro was too simple minded.  I've checked in your
> change to windows-nat.c.  If you want to use that in remote-fileio.c
> that's fine.  Or not.  It really isn't a big deal either way.
Thanks for the check-in.

 OK, here is a new, lighter version of the remote-fileio.c patch...
There is also a small problem remaining for windows-nat.c
(the previous definition of the cygwin_conv_path macro
needs to be removed).

Is this patch OK?

Pierre

2010-03-10  Pierre Muller  <muller@ics.u-strasbg.fr>

	* remote-fileio.c (cygwin_conv_path): Define macro for old cygwin
API.
	* windows-nat.c (cygwin_conv_path): Remove old macro.

Index: remote-fileio.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-fileio.c,v
retrieving revision 1.34
diff -u -p -r1.34 remote-fileio.c
--- remote-fileio.c	1 Mar 2010 09:09:24 -0000	1.34
+++ remote-fileio.c	9 Mar 2010 23:45:48 -0000
@@ -35,6 +35,15 @@
 #include <sys/time.h>
 #ifdef __CYGWIN__
 #include <sys/cygwin.h>		/* For
cygwin_conv_to_full_posix_path.  */
+#include <cygwin/version.h>
+#if
CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API
_MINOR) < 181
+# define CCP_POSIX_TO_WIN_A 0
+# define CCP_WIN_A_TO_POSIX 2
+# define cygwin_conv_path(op, from, to, size)  \
+         (op == CCP_WIN_A_TO_POSIX) ? \
+         cygwin_conv_to_full_posix_path (from, to) : \
+         cygwin_conv_to_win32_path (from, to)
+#endif
 #endif
 #include <signal.h>
 
Index: windows-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/windows-nat.c,v
retrieving revision 1.206
diff -u -p -r1.206 windows-nat.c
--- windows-nat.c	9 Mar 2010 19:10:39 -0000	1.206
+++ windows-nat.c	9 Mar 2010 23:45:49 -0000
@@ -121,7 +121,6 @@ static struct target_ops windows_ops;
          (op == CCP_WIN_W_TO_POSIX) ? \
          cygwin_conv_to_full_posix_path (from, to) : \
          cygwin_conv_to_win32_path (from, to)
-#   define cygwin_conv_path(op, from, to, size)
cygwin_conv_to_full_posix_path (from, to)
     typedef char cygwin_buf_t;
     static DWORD WINAPI (*GetModuleFileNameEx) (HANDLE, HMODULE, LPSTR,
DWORD);
 #   define STARTUPINFO STARTUPINFOA


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-09 23:50         ` Pierre Muller
@ 2010-03-10 15:57           ` Christopher Faylor
  2010-03-10 16:42             ` Pierre Muller
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Faylor @ 2010-03-10 15:57 UTC (permalink / raw)
  To: gdb-patches, Pierre Muller

On Wed, Mar 10, 2010 at 12:50:14AM +0100, Pierre Muller wrote:
>Hi Christopher,
>> >I just discovered for windows-nat.c
>> >
>> >See http://sourceware.org/ml/gdb-patches/2010-03/msg00344.html
>> 
>> You're right.  My macro was too simple minded.  I've checked in your
>> change to windows-nat.c.  If you want to use that in remote-fileio.c
>> that's fine.  Or not.  It really isn't a big deal either way.
>Thanks for the check-in.
>
> OK, here is a new, lighter version of the remote-fileio.c patch...
>There is also a small problem remaining for windows-nat.c
>(the previous definition of the cygwin_conv_path macro
>needs to be removed).
>
>Is this patch OK?
>
>Pierre
>
>2010-03-10  Pierre Muller  <muller@ics.u-strasbg.fr>
>
>	* remote-fileio.c (cygwin_conv_path): Define macro for old cygwin
>API.
>	* windows-nat.c (cygwin_conv_path): Remove old macro.

I've checked in the windows-nat.c change.  The remote-fileio.c change looks
good to me.

cgf


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API
  2010-03-10 15:57           ` Christopher Faylor
@ 2010-03-10 16:42             ` Pierre Muller
  0 siblings, 0 replies; 9+ messages in thread
From: Pierre Muller @ 2010-03-10 16:42 UTC (permalink / raw)
  To: gdb-patches

> > OK, here is a new, lighter version of the remote-fileio.c patch...
> >There is also a small problem remaining for windows-nat.c
> >(the previous definition of the cygwin_conv_path macro
> >needs to be removed).
> >
> >Is this patch OK?
> >
> >Pierre
> >
> >2010-03-10  Pierre Muller  <muller@ics.u-strasbg.fr>
> >
> >	* remote-fileio.c (cygwin_conv_path): Define macro for old cygwin
> >API.
> >	* windows-nat.c (cygwin_conv_path): Remove old macro.
> 
> I've checked in the windows-nat.c change.  The remote-fileio.c change
> looks
> good to me.


  As Daniel said that you should decide,
http://sourceware.org/ml/gdb-patches/2010-03/msg00337.html

I check the patch in.

Thanks 

Pierre



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2010-03-10 16:42 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-08 16:13 [RFA] Fix remote-fileio.c compilation for Cygwin 1.5 API Pierre Muller
2010-03-08 20:09 ` Daniel Jacobowitz
2010-03-08 21:49   ` Christopher Faylor
2010-03-08 21:55     ` Daniel Jacobowitz
2010-03-08 23:21     ` Pierre Muller
2010-03-09 19:15       ` Christopher Faylor
2010-03-09 23:50         ` Pierre Muller
2010-03-10 15:57           ` Christopher Faylor
2010-03-10 16:42             ` Pierre Muller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox