How does mingw support 'pipe()' ?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

How does mingw support 'pipe()' ?

John Emmas
I've been thinking about using Mingw to build a program - but the program
requires pipe() (i.e. it needs the unistd.h version, rather than the io.h
version).  At the moment I don't have a copy of Mingw but I do have a copy
of Cygwin, which seems to include some Mingw headers.

>From the headers I can see that the io.h version is supported, having this
function signature (with a leading underscore):-

int __cdecl _pipe (int *,  unsigned int,  int);

but neither header file offers the version in Cygwin's unistd.h, which looks
like this:-

int _EXFUN(pipe ((int __fildes[2] ));

My copy of Cygwin is about a year old so its Mingw headers might be out of
date by now.  Is the unistd.h version supported yet in Mingw?

Thanks,

John


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

lrn-2
John Emmas wrote:

> I've been thinking about using Mingw to build a program - but the program
> requires pipe() (i.e. it needs the unistd.h version, rather than the io.h
> version).  At the moment I don't have a copy of Mingw but I do have a copy
> of Cygwin, which seems to include some Mingw headers.
>
> >From the headers I can see that the io.h version is supported, having this
> function signature (with a leading underscore):-
>
> int __cdecl _pipe (int *,  unsigned int,  int);
>
> but neither header file offers the version in Cygwin's unistd.h, which looks
> like this:-
>
> int _EXFUN(pipe ((int __fildes[2] ));
>
> My copy of Cygwin is about a year old so its Mingw headers might be out of
> date by now.  Is the unistd.h version supported yet in Mingw?
>
> Thanks,
>
> John
>
>  
I think MinGW just calls _pipe() from msvcrt.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

Greg Chicares
In reply to this post by John Emmas
On 2009-11-17 12:03Z, John Emmas wrote:
[...]
> From the headers I can see that the io.h version is supported, having this
> function signature (with a leading underscore):-
>
> int __cdecl _pipe (int *,  unsigned int,  int);
>
> but neither header file offers the version in Cygwin's unistd.h, which looks
> like this:-
>
> int _EXFUN(pipe ((int __fildes[2] ));
[...]
> Is the unistd.h version supported yet in Mingw?

By supporting the msvcrt functions _pipe() and CreatePipe() etc.,
MinGW has already achieved its design goals. See, e.g.:
  http://article.gmane.org/gmane.comp.gnu.mingw.user/28505/
MinGW never will provide a full posix implementation. If you want to
adapt your program to work on native msw, the archives will help;
otherwise, use Cygwin.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

Tor Lillqvist
In reply to this post by John Emmas
>  Is the unistd.h version supported yet in Mingw?

"Supported" from a syntax or semantics point of view?

For equal syntax as the POSIX pipe(), just do:

#define pipe(fds) _pipe(fds, 5000, _O_BINARY)

(replace 5000 with whatever buffer size you want to use, and
use_O_TEXT instead of _O_BINARY if you want "text" semantics).

For POSIX semantics for the file descriptors from pipe() (i.e., to be
usable in select(), for instance, and ditto for file descriptors from
open()), then you have to use some POSIX emulation layer, like Cygwin
or Interix.

--tml

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

John Emmas
In reply to this post by Greg Chicares
Many thanks guys for the prompt and clear responses.

Cheers,

John

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

John Emmas
----- Original Message -----
From: "Greg Chicares"
>
> MinGW has already achieved its design goals.

----- Original Message -----
From: "Tor Lillqvist"
>
> For POSIX semantics [...] you have to use some POSIX emulation layer,
> like Cygwin or Interix.


I don't know if this will be of interest to the Mingw dev team - but in my
search to find some POSIX functionality for Win32 I came across this
interesting project, in addition to the others mentioned above:-

http://gnuwin32.sourceforge.net/packages/libgw32c.htm

I'm not certain if it's still being maintained and I couldn't find out which
compiler(s) it was originally intended for.  It didn't seem to work very
well with Visual C++ so I suppose the target compiler is probably gcc.
Anyway, if there are ever any future plans to add further POSIX
functionality to MinGW/MSYS, I wondered if this might be a helpful starting
point for providing some of the functionality that's currently missing?
Libgw32c seems to be very comprehensive, even as it stands.  The license is
LGPL though (I haven't yet downloaded Mingw so I don't know if that's
compatible).

John


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

John Emmas
----- Original Message -----
From: "John Emmas"
>
> I couldn't find out which compiler(s) it was originally intended for.   It
> didn't seem to work very well with Visual C++ so I suppose the target
> compiler is probably gcc.
>
Just noticed there are two main "include" branches.  One does look like it's
intended for gcc generally and the other specifies a #ifdef __GW32__
guard.  Does this indicate the mingw compiler or something else?

Thanks,

John


----- Original Message -----
From: "John Emmas" <[hidden email]>
To: "MinGW Users List" <[hidden email]>
Sent: 18 November 2009 07:17
Subject: Re: [Mingw-users] How does mingw support 'pipe()' ?


> ----- Original Message -----
> From: "Greg Chicares"
>>
>> MinGW has already achieved its design goals.
>
> ----- Original Message -----
> From: "Tor Lillqvist"
>>
>> For POSIX semantics [...] you have to use some POSIX emulation layer,
>> like Cygwin or Interix.
>
>
> I don't know if this will be of interest to the Mingw dev team - but in my
> search to find some POSIX functionality for Win32 I came across this
> interesting project, in addition to the others mentioned above:-
>
> http://gnuwin32.sourceforge.net/packages/libgw32c.htm
>
> I'm not certain if it's still being maintained and I couldn't find out
> which
> compiler(s) it was originally intended for.  It didn't seem to work very
> well with Visual C++ so I suppose the target compiler is probably gcc.
> Anyway, if there are ever any future plans to add further POSIX
> functionality to MinGW/MSYS, I wondered if this might be a helpful
> starting
> point for providing some of the functionality that's currently missing?
> Libgw32c seems to be very comprehensive, even as it stands.  The license
> is
> LGPL though (I haven't yet downloaded Mingw so I don't know if that's
> compatible).
>
> John
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008
> 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> MinGW-users mailing list
> [hidden email]
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list
> etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users


--------------------------------------------------------------------------------



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.425 / Virus Database: 270.14.69/2508 - Release Date: 11/17/09
07:40:00


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

Tor Lillqvist
One friendly word of advice: Don't use libgw32c unless you *fully*
understand what it does (and especially what it does not) and how it
affects your code, and the impression of the platform that any
configure scripts you might be running will get.

(And when I say "understand", I mean "by reading the code in detail".)

Especially, check whether any "POSIX" functionality you are interested
in that it might seem to add actually does anything or not. Discussion
about libgw32c is probably best suited on the gnuwin32 list.

--tml

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

Keith Marshall
In reply to this post by John Emmas
On Wednesday 18 November 2009 07:17:26 John Emmas wrote:
> I don't know if this will be of interest to the Mingw dev team -

Not really, but thanks anyway.

> but in my search to find some POSIX functionality for Win32 I came
> across this interesting project, in addition to the others
> mentioned above:-
>
> http://gnuwin32.sourceforge.net/packages/libgw32c.htm

Many of us are already aware of this, and indeed *use* various
packages from their project repository.

> I'm not certain if it's still being maintained and I couldn't find
> out which compiler(s) it was originally intended for.

AFAIK, Kees Zeelenberg continues to maintain it, using our own MinGW
tool chain.

> It didn't
> seem to work very well with Visual C++ so I suppose the target
> compiler is probably gcc. Anyway, if there are ever any future
> plans to add further POSIX functionality to MinGW/MSYS,

It is unlikely that there ever will be any such future plans.  That
need is met by Cygwin, another project with which we have a close
working relationship.

> I wondered
> if this might be a helpful starting point for providing some of
> the functionality that's currently missing? Libgw32c seems to be
> very comprehensive, even as it stands.

If you expect this library to magically provide POSIX functionality,
I fear you will be disappointed; last time I looked, all those POSIX
APIs it "provided" were either simple wrappers to map the POSIX
function to an existing MSW function, e.g.

  int mkdir( const char *path, mode_t mode )
  {
    return _mkdir( path );
  }

(which I prefer to map with a simple

  #define mkdir(P,M)  _mkdir(P)

when I determine that I can safely ignore the mode argument), or they
are no-op stubs.

YMMV, but IMO this library is counterproductive, because those stubs
mask porting issues which really need my attention; if the linker
can't find an API reference, I learn about its absence immediately,
whereas when a no-op stub is silently linked in, I have to rely on
the observation of unexpected runtime behaviour.

> The license is LGPL though
> (I haven't yet downloaded Mingw so I don't know if that's
> compatible).

It isn't, for core MinGW functionality, (for which we require a more
liberal licence).  For MSYS, which is a minimal fork of Cygwin-1.3,
the POSIX emulation is already present, so while LGPL may be okay,
it is a moot issue anyway.  For user contributed MinGW add-ons, we
accept any licence which assures freedom of use.

--

Regards,
Keith.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Reply | Threaded
Open this post in threaded view
|

Re: How does mingw support 'pipe()' ?

Kees Zeelenberg
In reply to this post by John Emmas

> I don't know if this will be of interest to the Mingw dev team - but in my
> search to find some POSIX functionality for Win32 I came across this
> interesting project, in addition to the others mentioned above:-
>
> http://gnuwin32.sourceforge.net/packages/libgw32c.htm
>
> I'm not certain if it's still being maintained and I couldn't find out
> which
> compiler(s) it was originally intended for.  It didn't seem to work very
It isn't maintained anymore, precisely for the problems that Tor and Keith
mention in their messages. In fact, its web page mentions: "Use of LibGw32c
as a separate development library is very complicated."
Parts of the source code are however used in Gnuwin32 ports of various
packages, which are now self contained and do not rely on libgw32c. Similar
code may also be found in Gnulib, and it would perhaps be fruitful to
transfer all or some of the libgw32c code to Gnulib if its maintainers are
interested; but at present I do not have the time to do this.

kz

--
View this message in context: http://old.nabble.com/How-does-mingw-support-%27pipe%28%29%27---tp26388865p26503772.html
Sent from the MinGW - User mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users