Re: what am I missing?

new topic     » goto parent     » topic index » view thread      » older message » newer message
SDPringle said...

You guys shouldn't be counting bytes. Use the sizeof() operator the C compiler will tell you how big the structure is.

I'm not writing C code but euphoria binding to termios, so sizeof() is of no use to me. Anyway there is not padding as when I peek the struct all members are at expected position here the code:

function peek_termios(atom pTermios) 
  return peek4u({pTermios,4}) & peek(pTermios+16) &  
         {peek({pTermios+17,NCCS})} & peek4u({pTermios+17+NCCS,2}) 
end function 
 
 

the extra byte is at end of allocated struct. Matt code give this on Linpus lite compiled with gcc 4.1.2

termios2: 44 
c_iflag:  0xbfc9e408 
c_oflag:  0xbfc9e40c 
c_cflag:  0xbfc9e410 
c_lflag:  0xbfc9e414 
c_line:   0xbfc9e418 
c_cc:     0xbfc9e419 
c_ispeed: 0xbfc9e42c 
c_ospeed: 0xbfc9e430 
So there is no padding between fields but allocationg 44 crash my program. Well I will take it as a mystery and go on with TERMIOS_SIZE=45

jacques

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu