日期:2014-05-16  浏览次数:20551 次

请教几个问题:
1.数据结构struct   fasync_struct在哪里能够找到,做什么用的?
2.函数kill_fasync()作用
3.数据结构struct   fown_struct在哪里能够找到,做什么用的?


------解决方案--------------------
网上可以查询啊
------解决方案--------------------
这些东西是哪里的?源代码里面的?

你用任何一款专门看源代码的类似于si的软件,或者vim,只要定义文件在你的计算机上,都可以看到这些的定义
------解决方案--------------------
struct fasync_struct {
int magic;
int fa_fd;
struct fasync_struct *fa_next; /* singly linked list */
struct file *fa_file;
}; 源码/linux/fs.h
kill_fasync()在 ../fs/fcntl.c

struct fown_struct {
rwlock_t lock;
struct pid *pid;
enum pid_type pid_type;
uid_t uid, euid;
int signum;
};同第一个

作用不大清楚,刚才用SI查的。属于内核代码
进行文件系统的编写的时候会用到这些

------解决方案--------------------
这3个都在内核linux/fs.h中。

1. struct fasync_struct,异步操作的文件指针结构。

struct fasync_struct {
int magic;
int fa_fd;
struct fasync_struct *fa_next; /* singly linked list */
struct file *fa_file;
};

2.kill_fasync(), 释放异步文件指针。
extern void kill_fasync(struct fasync_struct **, int, int);可中断
extern void __kill_fasync(struct fasync_struct *, int, int);不可中断

3.struct fown_struct 异步操作的进程结构

struct fown_struct {
rwlock_t lock; /* protects pid, uid, euid fields */
int pid; /* pid or -pgrp where SIGIO should be sent */
uid_t uid, euid; /* uid/euid of process setting the owner */
void *security;
int signum; /* posix.1b rt signal to be delivered on IO */
};