Page 1 of 1

[Solved] Problem with serial_struct

Posted: Thu Feb 28, 2013 10:57 am
by infratec
Hi,

I have to call ioctl_() with

Code: Select all

#TIOCGSERIAL = $541E
#TIOCSSERIAL = $541F
During the search for my thread bug, I enabled the Purifier.
And found a 'procedure stack corruption' at the call ioctl_()
The linux serial_struct

Code: Select all

struct serial_struct {
int     type;
int     line;
unsigned int    port;
int     irq;
int     flags;
int     xmit_fifo_size;
int     custom_divisor;
int     baud_base;
unsigned short  close_delay;
char    io_type;
char    reserved_char[1];
int     hub6;
unsigned short  closing_wait; /* time to wait before closing */
unsigned short  closing_wait2; /* no longer used... */
unsigned char   *iomem_base;
unsigned short  iomem_reg_shift;
unsigned int    port_high;
unsigned long   iomap_base;     /* cookie passed into ioremap */
}
is translated to:

Code: Select all

Structure serial_struct
  type.i
  line.i
  port.i
  irq.i
  flags.i
  xmit_fifo_size.i
  custom_divisor.i
  baud_base.i
  close_delay.u
  io_type.b
  reserved_char.b[1]
  hub6.i
  closing_wait.u
  closing_wait2.u
  *iomem_base
  iomem_reg_shift.u
  port_high.i
  iomap_base.l
EndStructure
In my opinion it's Ok.

But:
SizeOf() PB: 58
SizeOf() C: 60 :!: :!: :!:


Aghhh :!:

I need

Code: Select all

Structure serial_struct Align 4
Maybe this helps someone else.

Bernd

Re: [Solved] Problem with serial_struct

Posted: Thu Feb 28, 2013 11:00 am
by Fred
You should be able to use 'Align #PB_Structure_AlignC' since 5.10 to easy C translate