Re: Make ip.h and tcp.h work under -fnative-struct or -mms-bitfields
Sorry for my ignorance and noise, but I still want to ask what problems could occur if I use u_char instead of u_int to denote bit fields. Any answer is appreciated. (Of course I would like to have a header file working across all my Windows compilers. Others may appreciate it too.) Best regards, Wu Yongwei --- Original Message from Christopher Faylor --- Danny's suggestion is correct. The rest of the header files which accomodate this are probably using __attribute__((packed)) . The argument that the header works ok for you on MSVC is a non-issue for cygwin. cgf
Re: Make ip.h and tcp.h work under -fnative-struct or -fms-bitfields
On Mon, Nov 11, 2002 at 04:55:25PM +0800, Wu Yongwei wrote: >Hi, > >What's the status of this patch? > >-- >ChangeLog: > >2002-10-28 Wu Yongwei <[EMAIL PROTECTED]> > >* ip.h (struct ip): Use u_char to indicate bitfields to make it >work with -fnative-struct/-fms-bitfields. >(struct ip_timestamp): Ditto. >* tcp.h (struct tcphdr): Ditto. >-- > >Am I really going the wrong way (any examples)? Or should I submit a new >patch as Danny suggests? Danny's suggestion is correct. The rest of the header files which accomodate this are probably using __attribute__((packed)) . The argument that the header works ok for you on MSVC is a non-issue for cygwin. cgf
dll_index NO_COPY patch
The attached patch fixes the problem described in the following thread: http://cygwin.com/ml/cygwin-developers/2002-11/msg00019.html Given the following facts: 1. During fork(), fork_copy() is run after dll_list::load_after_fork(). 2. The static dll_index variable in include/cygwin/cygwin_dll.h is not marked NO_COPY. 3. The dll structure allocated by dll_list::alloc() is not guaranteed to be the same in the parent and child. I believe that the following is the correct root cause analysis of the problem: When #3 above occurs, fork_copy() overwrites the child's dll_index with the parent's value. This causes dll_list::detach() to access unallocated memory which in turn causes the child to stackdump. Jason -- PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers Fingerprint: 7A73 1405 7F2B E669 C19D 8784 1AFD E4CC ECF4 8EF6 Index: include/cygwin/cygwin_dll.h === RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/cygwin_dll.h,v retrieving revision 1.8 diff -u -p -r1.8 cygwin_dll.h --- include/cygwin/cygwin_dll.h 11 Sep 2001 20:01:01 - 1.8 +++ include/cygwin/cygwin_dll.h 11 Nov 2002 15:23:39 - @@ -12,6 +12,7 @@ details. */ #define __CYGWIN_CYGWIN_DLL_H__ #include +#include "winsup.h" #ifdef __cplusplus #define CDECL_BEGIN extern "C" { @@ -39,7 +40,7 @@ static int __dllMain (int a, char **b, c return Entry (storedHandle, storedReason, storedPtr); \ }\ \ -static DWORD dll_index; \ +static NO_COPY DWORD dll_index; \ \ int WINAPI _cygwin_dll_entry (HINSTANCE h, DWORD reason, void *ptr) \ {\ Mon Nov 11 10:45:37 2002 <[EMAIL PROTECTED]> * include/cygwin/cygwin_dll.h: Add #include "winsup.h". (dll_index): Make NO_COPY.
Re: Make ip.h and tcp.h work under -fnative-struct or -fms-bitfields
Wu Yongwei <[EMAIL PROTECTED]> wrote: > work with -fnative-struct/-fms-bitfields. It's -mms-bitfields. Max.
Re: Make ip.h and tcp.h work under -fnative-struct or -fms-bitfields
Hi, What's the status of this patch? -- ChangeLog: 2002-10-28 Wu Yongwei <[EMAIL PROTECTED]> * ip.h (struct ip): Use u_char to indicate bitfields to make it work with -fnative-struct/-fms-bitfields. (struct ip_timestamp): Ditto. * tcp.h (struct tcphdr): Ditto. -- Am I really going the wrong way (any examples)? Or should I submit a new patch as Danny suggests? Best regards, Wu Yongwei