| 网站首页 | 业界新闻 | 技术文章 | 视频教程 | 下载频道 | 程序源码 | 个人空间 | 编程论坛 |
 
| 技术教程首页 | 开发语言 | WEB开发 | .NET技术 | 数据库 | 操作系统 | 网页制作 |
 
 
您现在的位置: 编程中国 >> 技术教程 >> 操作系统 >> Linux >> 正文
  ►  Linux Data Structures(Linux数据结构)
Linux Data Structures(Linux数据结构)
作者:佚名    阅读人次:……    文章来源:未知    发布时间:2005-11-3    网友评论()条
 



socket

 

每一个socket数据结构都存放一个BSD socket的信息。它不会独立存在,实际上是VFS inode数据结构的一部分

参见include/linux/net.h

 

struct socket {

short type; /* SOCK_STREAM, ... */

socket_state state;

long flags;

struct proto_ops *ops; /* protocols do most everything */

void *data; /* protocol data */

struct socket *conn; /* server socket connected to */

struct socket *iconn; /* incomplete client conn.s */

struct socket *next;

struct wait_queue **wait; /* ptr to place to wait on */

struct inode *inode;

struct fasync_struct *fasync_list; /* Asynchronous wake up list */

struct file *file; /* File back pointer for gc */

};

 

task_struct

每一个task_struct描述系统中的一个任务或进程

参见include/linux/sched.h

struct task_struct {

/* these are hardcoded - don't touch */

volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */

long counter;

long priority;

unsigned long signal;

unsigned long blocked; /* bitmap of masked signals */

unsigned long flags; /* per process flags, defined below */

int errno;

long debugreg[8]; /* Hardware debugging registers */

struct exec_domain *exec_domain;

/* various fields */

struct linux_binfmt *binfmt;

struct task_struct *next_task, *prev_task;

struct task_struct *next_run, *prev_run;

unsigned long saved_kernel_stack;

unsigned long kernel_stack_page;

int exit_code, exit_signal;

/* ??? */

unsigned long personality;

int dumpable:1;

int did_exec:1;

int pid;

int pgrp;

int tty_old_pgrp;

int session;

/* boolean value for session group leader */

int leader;

int groups[NGROUPS];

/*

* pointers to (original) parent process, youngest child, younger sibling,

* older sibling, respectively. (p->father can be replaced with

* p->p_pptr->pid)

*/

struct task_struct *p_opptr, *p_pptr, *p_cptr,

*p_ysptr, *p_osptr;

struct wait_queue *wait_chldexit;

unsigned short uid,euid,suid,fsuid;

unsigned short gid,egid,sgid,fsgid;

unsigned long timeout, policy, rt_priority;

unsigned long it_real_value, it_prof_value, it_virt_value;

unsigned long it_real_incr, it_prof_incr, it_virt_incr;

struct timer_list real_timer;

long utime, stime, cutime, cstime, start_time;

/* mm fault and swap info: this can arguably be seen as either

mm-specific or thread-specific */

unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;

int swappable:1;

unsigned long swap_address;

unsigned long old_maj_flt; /* old value of maj_flt */

unsigned long dec_flt; /* page fault count of the last time */

unsigned long swap_cnt; /* number of pages to swap on next pass */

/* limits */

struct rlimit rlim[RLIM_NLIMITS];

unsigned short used_math;

char comm[16];

/* file system info */

int link_count;

struct tty_struct *tty; /* NULL if no tty */

/* ipc stuff */

struct sem_undo *semundo;

struct sem_queue *semsleeping;

/* ldt for this task - used by Wine. If NULL, default_ldt is used */

struct desc_struct *ldt;

/* tss for this task */

struct thread_struct tss;

/* filesystem information */

struct fs_struct *fs;

/* open file information */

struct files_struct *files;

/* memory management info */

struct mm_struct *mm;

/* signal handlers */

struct signal_struct *sig;

#ifdef __SMP__

int processor;

int last_processor;

int lock_depth; /* Lock depth.

We can context switch in and out

of holding a syscall kernel lock... */

#endif

};

 

timer_list

timer_list数据结构用于实现进程的实时计时器。

参见include/linux/timer.h

 

struct timer_list {

struct timer_list *next;

struct timer_list *prev;

unsigned long expires;

unsigned long data;

void (*function)(unsigned long);

};

 

tq_struct

每一个任务队列(tq_struct)数据结构都存放正在排队的工作的信息。通常是一个设备驱动程序需要的任务,但是不需要立即完成。

参见include/linux/tqueue.h

 

struct tq_struct {

struct tq_struct *next; /* linked list of active bh's */

int sync; /* must be initialized to zero */

void (*routine)(void *); /* function to call */

void *data; /* argument to function */

};

 

vm_area_struct

 

每一个vm_area_struct数据结构描述一个进程的一个虚拟内存区

参见include/linux/mm.h

 

struct vm_area_struct {

struct mm_struct * vm_mm; /* VM area parameters */

unsigned long vm_start;

unsigned long vm_end;

pgprot_t vm_page_prot;

unsigned short vm_flags;

/* AVL tree of VM areas per task, sorted by address */

short vm_avl_height;

struct vm_area_struct * vm_avl_left;

struct vm_area_struct * vm_avl_right;

/* linked list of VM areas per task, sorted by address */

struct vm_area_struct * vm_next;

/* for areas with inode, the circular list inode->i_mmap */

/* for shm areas, the circular list of attaches */

/* otherwise unused */

struct vm_area_struct * vm_next_share;

struct vm_area_struct * vm_prev_share;

/* more */

struct vm_operations_struct * vm_ops;

unsigned long vm_offset;

struct inode * vm_inode;

unsigned long vm_pte; /* shared mem */

}

上一页  [1] [2] [3] [4] [5] 

 

 
文章录入:静夜思    责任编辑:静夜思 
  • 上一篇文章:

  • 下一篇文章:

  •  
    相关文章
    原创地带
    24小时热门帖子