satsukiの日記: Linuxお勉強メモ
日記 by
satsuki
Linuxのタイマハンドラにはunsigned long1個しか渡せないみたいです.
うーん困った.ポインタ渡せないのかー
いろいろ見て検討しませう.
でも,unsigned longだから入れりゃ収まるよな多分(ぼそ
include <linux/timer.h>
void add_timer(struct timer_list * timer);
int del_timer(struct timer_list * timer);
struct timer_list {
struct list_head entry;
unsigned long expires;
spinlock_t lock;
unsigned long magic;
void (*function)(unsigned long);
unsigned long data;
struct tvec_t_base_s *base;
};
[追記]
ざっと見た所,タイマハンドラの引数はあんまり有効に使われていない模様.
ただ,某所由来と思われるコードでは何のためらいもなく,
static void function(unsigned int data) {
struct foo *bar = (struct foo *)data;
...
なんてなっていたりするわけなのですが,本当にいいの?
うーん困った.ポインタ渡せないのかー
いろいろ見て検討しませう.
でも,unsigned longだから入れりゃ収まるよな多分(ぼそ
include <linux/timer.h>
void add_timer(struct timer_list * timer);
int del_timer(struct timer_list * timer);
struct timer_list {
struct list_head entry;
unsigned long expires;
spinlock_t lock;
unsigned long magic;
void (*function)(unsigned long);
unsigned long data;
struct tvec_t_base_s *base;
};
[追記]
ざっと見た所,タイマハンドラの引数はあんまり有効に使われていない模様.
ただ,某所由来と思われるコードでは何のためらいもなく,
static void function(unsigned int data) {
struct foo *bar = (struct foo *)data;
...
なんてなっていたりするわけなのですが,本当にいいの?
Linuxお勉強メモ More ログイン