From: mrdev <mis...@gm...> - 2008-03-31 00:48:18
|
Hi! I'm using MinGW, and I need the following functions: fcntl(), ftruncate(), sync() and bcopy(). These functions are missing in MinGW plataform. I would know what I can do? Sugestions? Thanks in advanced! -- View this message in context: http://www.nabble.com/functions-missing-tp16386002p16386002.html Sent from the MinGW - User mailing list archive at Nabble.com. |
From: Aaron W. L. <aar...@aa...> - 2008-03-31 02:34:56
|
mrdev wrote: > Hi! > I'm using MinGW, and I need the following functions: fcntl(), ftruncate(), > sync() and bcopy(). These functions are missing in MinGW plataform. Sorry, only a small loose subset of POSIX functions are provided. fcntl() is in <fcntl.h> or <io.h> ftruncate is in <unistd.h> sync() calls can probably be commented out. Use C standard memcpy() instead instead BSD bcopy(). |
From: Vincent T. <vt...@un...> - 2008-03-31 05:41:08
|
Hey, On Sun, 30 Mar 2008, Aaron W. LaFramboise wrote: > mrdev wrote: >> Hi! >> I'm using MinGW, and I need the following functions: fcntl(), ftruncate(), >> sync() and bcopy(). These functions are missing in MinGW plataform. > > Sorry, only a small loose subset of POSIX functions are provided. > > fcntl() is in <fcntl.h> or <io.h> afaik, fcntl is not declared in fcntl.h or io.h (mingw 5.1.3, candidate). I had to write a port of that function for my own purposes. But if it is defined in a lib, then, i would be glad to know :) I'm sure that my port is full of bugs :) regards Vincent Torri |
From: Aaron W. L. <aar...@aa...> - 2008-03-31 12:14:22
|
Vincent Torri wrote: > On Sun, 30 Mar 2008, Aaron W. LaFramboise wrote: > afaik, fcntl is not declared in fcntl.h or io.h (mingw 5.1.3, candidate). Oops, you are completely correct. fcntl.h only has the modes for open(). mrdev, you may need to do some porting work on your own then. Depending on what operation is being performed, you may be able to just comment the call out, or replace it with another appropriate call such as dup(). |
From: Erik de C. L. <ml...@me...> - 2008-03-31 02:50:13
|
mrdev wrote: > I'm using MinGW, and I need the following functions: fcntl(), ftruncate(), > sync() and bcopy(). These functions are missing in MinGW plataform. > I would know what I can do? Sugestions? Easy one first: static inline void bcopy (const void *src, void *dest, size_t n) { memcpy(dest, src, n) ; } As for fcntl() and sync(), I don't believe that there is really an equivalent on windows. Finally, for ftruncate(), there is a chsize() function that basically does the same, but it doesn't work for files larger than 2Gig. However, I highly recommend that you do not use any of the microsoft supplied POSIX API calls. I have over the years found numerous very obscure corner case bugs in the microsoft implementations. I blogged the most recent one here: http://www.mega-nerd.com/erikd/Blog/Windiots/posix.html which is present right up to and include windows XP. What I did with my libsndfile project was create a set of wrapper functions around the POSIX file I/O functions and then provide a windows specific versions of all the wrapper functions using the (particularly horrid) native windows file I/O API. Feel free to have a look at file_io.c in libsndfile which is released under the GNU LGPL. This file also documents some of the other broken-ness I have found in the comments. HTH, Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "I have never met anyone who can do Scheme, Haskell, and C pointers who can't pick up Java in two days, and create better Java code than people with five years of experience in Java." -- http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html |
From: Keith M. <kei...@us...> - 2008-03-31 17:03:27
|
On Monday 31 March 2008 03:49, Erik de Castro Lopo wrote: > Finally, for ftruncate(), there is a chsize() function that basically > does the same, but it doesn't work for files larger than 2Gig. There is an ftruncate() implementation in libmingwex.a, (which is a standard MinGW component library). Danny added it, mid-2004, IIRC. It too would likely have the 2Gb file size limitation, since I think it uses chsize() anyway, (I'm too lazy to check, at present). Regards, Keith. |
From: Misael R. <mis...@gm...> - 2008-04-01 00:38:27
|
Thanks!! Regards, mrdev 2008/3/31, Keith Marshall <kei...@us...>: > > On Monday 31 March 2008 03:49, Erik de Castro Lopo wrote: > > Finally, for ftruncate(), there is a chsize() function that basically > > does the same, but it doesn't work for files larger than 2Gig. > > There is an ftruncate() implementation in libmingwex.a, (which is a > standard MinGW component library). Danny added it, mid-2004, IIRC. It > too would likely have the 2Gb file size limitation, since I think it > uses chsize() anyway, (I'm too lazy to check, at present). > > Regards, > Keith. > > ------------------------------------------------------------------------- > Check out the new SourceForge.net Marketplace. > It's the best place to buy or sell services for > just about anything Open Source. > > http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > |