林丽 发表于 2006-10-9 14:27:27

wakeup目前改成wake_up了?

从前用过wakeup,现在是2.4.20-8,在用时候出现unsloved symbol wakeup。搜索后改成wake_up了?

struct wait_queue *wp = NULL;

wake_up(&wp);

编译总是警告:from incompatible pointer type

那么wake_up的参数是什么?

mozilla 发表于 2006-10-10 09:10:52

看sched.h

林丽 发表于 2006-10-10 16:05:42

大哥,1、在向你咨询前就看了sched.h文件,里面定义的参数和网络上说的有区别,我两个都试了,问题一样的警告,强行执行后结果当然不对,所以没有办法了;怎么办?

2、目前的2.4.8或 2.6.x等版本存在函数wakeup和sleep吗?怎么在网上搜索出现wake_up和sleep_on?他们是什么关系!

谢谢!

mozilla 发表于 2006-10-10 17:08:22

cat /proc/kallsyms |grep wake_up
看看结果

林丽 发表于 2006-10-11 10:30:54

没有kallsyms文件,而是ksyms,我版本2.4.8
显示_wake_up_Rb76c5fle不知道什么意思?

林丽 发表于 2006-10-11 11:50:39

下面是程序片段

#include "/usr/src/linux-2.4.20/include/linux/sched.h"

char buffer;

struct wait_queue_head_t *buffer_s = NULL;
struct wait_queue_head_t *buffer_g = NULL;
                                                                                                                                             
static int read_A(struct file *file, char *buf, size_t count, loff_t *p)
{

      while(buffer_flg == 0) sleep_on(&buffer_g);
      while(,,,)
                put_user(buffer, buf+i);
      buffer_flg = 0;
      wake_up(&buffer_g);
      return x;
}

编译时总是
warning: passing arg 1 of `sleep_on' from incompatible pointer type
warning: passing arg 1 of `__wake_up' from incompatible pointer type

十分郁闷:原型就是这个定义的,
struct wait_queue_head_t *
怎么会警告?

(如强制执行会出现内存方面的错误!)
望给予指导!
谢谢!

mozilla 发表于 2006-10-11 12:10:20

没有kallsyms文件,而是ksyms,我版本2.4.8
显示_wake_up_Rb76c5fle不知道什么意思?
2.6是kallsyms,2.4是ksyms

你得内核符号加了版本信息

重新编译内核,把

Loadable module support--->
    [*] Enable loadable module support
    [ ]   Set version information on all module symbols

不要选“Set version information on all module symbols ”

林丽 发表于 2006-10-11 12:32:29

谢谢大哥!我马上测试一下。
这是内核装载时才引起的,他和编译出现警告有什么联系呢?

mozilla 发表于 2006-10-11 12:39:47

原型定义是__wake_up(wait_queue_head_t *q, unsigned int mode, int nr);
你传进去的是wait_queue_head_t **

struct wait_queue_head_t *buffer_s = NULL;
struct wait_queue_head_t *buffer_g = NULL;
改成
struct wait_queue_head_t buffer_s;
struct wait_queue_head_t buffer_g;

林丽 发表于 2006-10-11 13:03:17

编译出现:
storage size of 'buffer_s' insn'tknown
storage size of 'buffer_g' insn'tknown
Error 1

mozilla 发表于 2006-10-11 14:00:24

#include <linux/wait.h>

林丽 发表于 2006-10-11 14:06:42

我在 compatmac.h 中查到
#define wait_queue_head_tstruct wait_queue *

struct wait_queue_head_t *buffer_s = NULL;
struct wait_queue_head_t *buffer_g = NULL;
改成
struct wait_queue **buffer_s;
struct wait_queue **buffer_g;

换成wake_up(&buffer_s);
一样是警告

我在网上搜索的例子就是这么用的,难道我的版本有问题(是正规发行的)?

林丽 发表于 2006-10-11 14:09:33

struct wait_queue_head_t *buffer_s = NULL;
struct wait_queue_head_t *buffer_g = NULL;
改成
struct wait_queue *buffer_s;
struct wait_queue *buffer_g;

上帖错了!抱歉!

林丽 发表于 2006-10-11 14:27:39


struct wait_queue_head_t *buffer_s = NULL;
struct wait_queue_head_t *buffer_g = NULL;
改成
wait_queue_head_t buffer_s;
wait_queue_head_t buffer_g;

编译通过了!谢谢!
看看运行结果怎么样!

mozilla 发表于 2006-10-11 15:43:44

不应该用compactmac.h,看名字就知道了,况且compactmac.h那个根本就不是wait_queue_head_t的定义,只是给它定义了个别名。

#include <linux/wait.h>
wait_queue_head_t的定义就在这里面
页: [1] 2
查看完整版本: wakeup目前改成wake_up了?