structure alignment problems

usleepless at usleepless at
Sun Jan 28 11:24:54 UTC 2007


i am working on getting mythtv-0.20 talking to the pvrxxx driver.

the problem appears when i want to do:
  v4l2_capabilities vcap;
  ioctl(videofd, VIDIOC_QUERYCAP, &vcap);

the driver and mythtv have the struct differently aligned, and i get
an "inappropiate ioctl for device". this is what the struct + IOR look

struct v4l2_capability
        __u8    driver[16];     /* i.e. "bttv" */
        __u8    card[32];       /* i.e. "Hauppauge WinTV" */
        __u8    bus_info[32];   /* "PCI:" + pci_name(pci_dev) */
        __u32   version;        /* should use KERNEL_VERSION() */
        __u32   capabilities;   /* Device capabilities */
        __u32   reserved[4];
#define VIDIOC_QUERYCAP         _IOR  ('V',  0, struct v4l2_capability)

the driver is compiled like this:

cc -O -pipe -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I-  -I../../..
-I. -I@ -I@/contrib/altq -I@/../include -finline-limit=8000
-fno-common  -fno-omit-frame-pointer -mcmodel=kernel -mno-red-zone
-mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow  -msoft-float
-fno-asynchronous-unwind-tables -ffreestanding -Wall -Wredundant-decls
-Wnested-externs -Wstrict-prototypes  -Wmissing-prototypes
-Wpointer-arith -Winline -Wcast-qual  -fformat-extensions -std=c99 -c

it yields a struct-size of 104 bytes.

mythtv is compiled like this:

g++ -c -pipe -I/usr/local/include/artsc -D_REENTRANT
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -g
-Wall -W -O2 -pthread -Wall -Wno-switch -fomit-frame-pointer
-I/usr/local/include/freetype2 -I/usr/local/include -DPIC -fPIC
-DPREFIX=\"/usr/local\" -DLIBDIR=\"/usr/local/lib\"
-I/usr/local/share/qt/mkspecs/freebsd-g++ -I.
-I../../../../../../../X11R6/include -I../.. -I.. -I../libmyth
-I../libavcodec -I../libavutil -I../libmythmpeg2 -Idvbdev -Impeg
-I../../../../../../../local/include -I/usr/X11R6/include -o
cardutil.o cardutil.cpp

and it yields a struct-size of 128.

is it the -std=c99? is it because this is on amd64?

any help is greatly appreciated!



More information about the freebsd-questions mailing list