uclinux-2008R1-RC8(bf561)到VDSP5的移植(13):未命名union的问题
2008-05-04 11:55
375 查看
在include/linux/shed.h中定义了一个结构体:
/*
* NOTE! "signal_struct" does not have it's own
* locking, because a shared signal_struct always
* implies a shared sighand_struct, so locking
* sighand_struct is always a proper superset of
* the locking of signal_struct.
*/
struct signal_struct {
…
/* job control IDs */
pid_t pgrp;
struct pid *tty_old_pgrp;
union {
pid_t session __deprecated;
pid_t __session;
};
…
};
在include/linux/init_task.h中定义了一个宏来对这个结构体进行初始化:
#define INIT_SIGNALS(sig) { /
.count = ATOMIC_INIT(1), /
.wait_chldexit = __WAIT_QUEUE_HEAD_INITIALIZER(sig.wait_chldexit),/
.shared_pending = { /
.list = LIST_HEAD_INIT(sig.shared_pending.list), /
.signal = {{0}}}, /
.posix_timers = LIST_HEAD_INIT(sig.posix_timers), /
.cpu_timers = INIT_CPU_TIMERS(sig.cpu_timers), /
.rlim = INIT_RLIMITS, /
.pgrp = 0, /
.tty_old_pgrp = NULL, /
{ .__session = 0}, /
}
在这里
{ .__session = 0}, /
会引发一个错误:
"../../arch/blackfin/kernel/init_task.c", line 38: cc0136: error: union
"<unnamed>" has no field "__session"
static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
怎么看都有__session这个成员啊,实际引发这个错误的原因是在结构体中使用了未命名的union。因此必须做如下修改:
struct signal_struct {
…
/* job control IDs */
pid_t pgrp;
struct pid *tty_old_pgrp;
union {
pid_t session __deprecated;
pid_t __session;
}signal_struct_session;
…
};
其实就是随便给这个union定义一个变量。
相关文章推荐
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(50):jiffies_64的定义问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(54): initramfs的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(55): filemap.c的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(12):init_thread_union
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(47): d_alloc引出的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(48): __cmpxchg的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(49):kernel_thread_helper的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(53):reboot.c的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(43):__builtin_return_address的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(44):kmalloc和kzalloc的问题
- uclinux-2008R1.5-RC3(bf561)到VDSP5的移植(38):未命名union的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(52):cache.s的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(42):__bad_size的问题
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(30):atomic_t
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(5):CONFIG_BANK_x
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(25):smp.h
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(27):cpumask_t
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(61): KBUILD_MODNAME
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(36):__per_cpu_start
- uclinux-2008R1-RC8(bf561)到VDSP5的移植(38):cache与spinlock