Linux Source v0.11: Main Page

Linux Source v0.11 Documentation

乾坤一笑 友情奉献 ^_^

大家都共享自己的一点点经验 中国Coder素质就会更快速地发展

Generated by smileonce
My Blog : 一笑聊斋 http://blog.vckbase.com/smileonce
Email: smileonce@yeah.net

Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: File Index

Linux Source v0.11 File List

Here is a list of all files with brief descriptions:
K:/Linux/fs/bitmap.c [code]
K:/Linux/fs/block_dev.c [code]
K:/Linux/fs/buffer.c [code]
K:/Linux/fs/char_dev.c [code]
K:/Linux/fs/exec.c [code]
K:/Linux/fs/fcntl.c [code]
K:/Linux/fs/file_dev.c [code]
K:/Linux/fs/file_table.c [code]
K:/Linux/fs/inode.c [code]
K:/Linux/fs/ioctl.c [code]
K:/Linux/fs/namei.c [code]
K:/Linux/fs/open.c [code]
K:/Linux/fs/pipe.c [code]
K:/Linux/fs/read_write.c [code]
K:/Linux/fs/stat.c [code]
K:/Linux/fs/super.c [code]
K:/Linux/fs/truncate.c [code]
K:/Linux/include/a.out.h [code]
K:/Linux/include/const.h [code]
K:/Linux/include/ctype.h [code]
K:/Linux/include/errno.h [code]
K:/Linux/include/fcntl.h [code]
K:/Linux/include/signal.h [code]
K:/Linux/include/stdarg.h [code]
K:/Linux/include/stddef.h [code]
K:/Linux/include/string.h [code]
K:/Linux/include/termios.h [code]
K:/Linux/include/time.h [code]
K:/Linux/include/unistd.h [code]
K:/Linux/include/utime.h [code]
K:/Linux/include/asm/io.h [code]
K:/Linux/include/asm/memory.h [code]
K:/Linux/include/asm/segment.h [code]
K:/Linux/include/asm/system.h [code]
K:/Linux/include/linux/config.h [code]
K:/Linux/include/linux/fdreg.h [code]
K:/Linux/include/linux/fs.h [code]
K:/Linux/include/linux/hdreg.h [code]
K:/Linux/include/linux/head.h [code]
K:/Linux/include/linux/kernel.h [code]
K:/Linux/include/linux/mm.h [code]
K:/Linux/include/linux/sched.h [code]
K:/Linux/include/linux/sys.h [code]
K:/Linux/include/linux/tty.h [code]
K:/Linux/include/sys/stat.h [code]
K:/Linux/include/sys/times.h [code]
K:/Linux/include/sys/types.h [code]
K:/Linux/include/sys/utsname.h [code]
K:/Linux/include/sys/wait.h [code]
K:/Linux/init/main.c [code]
K:/Linux/kernel/exit.c [code]
K:/Linux/kernel/fork.c [code]
K:/Linux/kernel/mktime.c [code]
K:/Linux/kernel/panic.c [code]
K:/Linux/kernel/printk.c [code]
K:/Linux/kernel/sched.c [code]
K:/Linux/kernel/signal.c [code]
K:/Linux/kernel/sys.c [code]
K:/Linux/kernel/traps.c [code]
K:/Linux/kernel/vsprintf.c [code]
K:/Linux/kernel/blk_drv/blk.h [code]
K:/Linux/kernel/blk_drv/floppy.c [code]
K:/Linux/kernel/blk_drv/hd.c [code]
K:/Linux/kernel/blk_drv/ll_rw_blk.c [code]
K:/Linux/kernel/blk_drv/ramdisk.c [code]
K:/Linux/kernel/chr_drv/console.c [code]
K:/Linux/kernel/chr_drv/serial.c [code]
K:/Linux/kernel/chr_drv/tty_io.c [code]
K:/Linux/kernel/chr_drv/tty_ioctl.c [code]
K:/Linux/kernel/math/math_emulate.c [code]
K:/Linux/lib/_exit.c [code]
K:/Linux/lib/close.c [code]
K:/Linux/lib/ctype.c [code]
K:/Linux/lib/dup.c [code]
K:/Linux/lib/errno.c [code]
K:/Linux/lib/execve.c [code]
K:/Linux/lib/malloc.c [code]
K:/Linux/lib/open.c [code]
K:/Linux/lib/setsid.c [code]
K:/Linux/lib/string.c [code]
K:/Linux/lib/wait.c [code]
K:/Linux/lib/write.c [code]
K:/Linux/mm/memory.c [code]
K:/Linux/tools/build.c [code]
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/bitmap.c File Reference

bitmap.c File Reference

#include <string.h>
#include <linux/sched.h>
#include <linux/kernel.h>

Go to the source code of this file.

Defines

#define | clear_block(addr)
#define | set_bit(nr, addr)
#define | clear_bit(nr, addr)
#define | find_first_zero(addr)

Functions

void | free_block (int dev, int block)
int | new_block (int dev)
void | free_inode (struct m_inode *inode)
m_inode * | new_inode (int dev)

Define Documentation

#define clear_bit | ( | nr,
 |  | addr | )

Value:

({\
register int res ; \
__asm__ __volatile__("btrl %2,%3\n\tsetnb %%al": \
"=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
res;})

Definition at line 25 of file bitmap.c.

Referenced by free_block(), and free_inode().

#define clear_block ( addr )

Value:

__asm__ __volatile__ ("cld\n\t" \
    "rep\n\t" \
    "stosl" \
    ::"a" (0),"c" (BLOCK_SIZE/4),"D" ((long) (addr)))

Definition at line 13 of file bitmap.c.

Referenced by new_block().

#define find_first_zero ( addr )

Value:

({ \
int __res; \
__asm__ __volatile__ ("cld\n" \
    "1:\tlodsl\n\t" \
    "notl %%eax\n\t" \
    "bsfl %%eax,%%edx\n\t" \
    "je 2f\n\t" \
    "addl %%edx,%%ecx\n\t" \
    "jmp 3f\n" \
    "2:\taddl $32,%%ecx\n\t" \
    "cmpl $8192,%%ecx\n\t" \
    "jl 1b\n" \
    "3:" \
    :"=c" (__res):"c" (0),"S" (addr)); \
__res;})

Definition at line 31 of file bitmap.c.

Referenced by new_block(), and new_inode().

#define set_bit | ( | nr,
 |  | addr | )

Value:

({\
register int res ; \
__asm__ __volatile__("btsl %2,%3\n\tsetb %%al": \
"=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
res;})

Definition at line 19 of file bitmap.c.

Referenced by mount_root(), new_block(), and new_inode().

Function Documentation

void free_block | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 47 of file bitmap.c.

References buffer_head::b_count, buffer_head::b_data, buffer_head::b_dirt, buffer_head::b_uptodate, brelse(), clear_bit, get_hash_table(), get_super(), panic(), printk(), super_block::s_firstdatazone, super_block::s_nzones, and super_block::s_zmap.

Referenced by free_dind(), free_ind(), sys_mkdir(), and truncate().

void free_inode ( struct m_inode * inode )

Definition at line 107 of file bitmap.c.

References buffer_head::b_data, buffer_head::b_dirt, clear_bit, get_super(), memset(), panic(), printk(), super_block::s_imap, and super_block::s_ninodes.

Referenced by iput().

int new_block ( int dev )

Definition at line 75 of file bitmap.c.

References buffer_head::b_count, buffer_head::b_data, buffer_head::b_dirt, buffer_head::b_uptodate, brelse(), clear_block, find_first_zero, get_super(), getblk(), panic(), super_block::s_firstdatazone, super_block::s_nzones, super_block::s_zmap, and set_bit.

Referenced by _bmap(), and sys_mkdir().

struct m_inode* new_inode ( int dev )

Definition at line 136 of file bitmap.c.

References buffer_head::b_data, buffer_head::b_dirt, current, CURRENT_TIME, task_struct::egid, task_struct::euid, find_first_zero, get_empty_inode(), get_super(), m_inode::i_atime, m_inode::i_count, m_inode::i_ctime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_gid, m_inode::i_mtime, m_inode::i_nlinks, m_inode::i_num, m_inode::i_uid, iput(), NULL, panic(), super_block::s_imap, super_block::s_ninodes, and set_bit.

Referenced by open_namei(), sys_mkdir(), and sys_mknod().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/block_dev.c File Reference

block_dev.c File Reference

#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <asm/system.h>

Go to the source code of this file.

Functions

int | block_write (int dev, long *pos, char *buf, int count)
int | block_read (int dev, unsigned long *pos, char *buf, int count)

Function Documentation

int block_read | ( | int | dev,
 |  | unsigned long * | pos,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 47 of file block_dev.c.

References buffer_head::b_data, BLOCK_SIZE, BLOCK_SIZE_BITS, breada(), brelse(), EIO, put_fs_byte(), and read().

Referenced by sys_read().

int block_write | ( | int | dev,
 |  | long * | pos,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 14 of file block_dev.c.

References buffer_head::b_data, buffer_head::b_dirt, BLOCK_SIZE, BLOCK_SIZE_BITS, breada(), brelse(), EIO, get_fs_byte(), and getblk().

Referenced by sys_write().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/buffer.c File Reference

buffer.c File Reference

#include <stdarg.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/io.h>

Go to the source code of this file.

Defines

#define | _hashfn(dev, block) (((unsigned)(dev^block))%NR_HASH)
#define | hash(dev, block) hash_table[_hashfn(dev,block)]
#define | BADNESS(bh) (((bh)->b_dirt<<1)+(bh)->b_lock)
#define | COPYBLK(from, to)

Functions

void | put_super (int)
void | invalidate_inodes (int)
static void | wait_on_buffer (struct buffer_head *bh)
int | sys_sync (void)
int | sync_dev (int dev)
void | invalidate_buffers (int dev)
void | check_disk_change (int dev)
static void | remove_from_queues (struct buffer_head *bh)
static void | insert_into_queues (struct buffer_head *bh)
static struct buffer_head * | find_buffer (int dev, int block)
buffer_head * | get_hash_table (int dev, int block)
buffer_head * | getblk (int dev, int block)
void | brelse (struct buffer_head *buf)
buffer_head * | bread (int dev, int block)
void | bread_page (unsigned long address, int dev, int b[4])
buffer_head * | breada (int dev, int first,...)
void | buffer_init (long buffer_end)

Variables

int | end
buffer_head * | start_buffer = (struct buffer_head *) &end
buffer_head * | hash_table [NR_HASH]
static struct buffer_head * | free_list
static struct task_struct * | buffer_wait = NULL
int | NR_BUFFERS = 0

Define Documentation

#define _hashfn | ( | dev,
 |  | block | ) | (((unsigned)(dev^block))%NR_HASH)

Definition at line 131 of file buffer.c.

#define BADNESS ( bh ) (((bh)->b_dirt<<1)+(bh)->b_lock)

Definition at line 208 of file buffer.c.

Referenced by getblk().

#define COPYBLK | ( | from,
 |  | to | )

Value:

__asm__("cld\n\t" \
    "rep\n\t" \
    "movsl\n\t" \
    ::"c" (BLOCK_SIZE/4),"S" (from),"D" (to) \
    )

Definition at line 286 of file buffer.c.

Referenced by bread_page().

#define hash | ( | dev,
 |  | block | ) | hash_table[_hashfn(dev,block)]

Definition at line 132 of file buffer.c.

Referenced by find_buffer(), insert_into_queues(), and remove_from_queues().

Function Documentation

struct buffer_head* bread | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 270 of file buffer.c.

References buffer_head::b_uptodate, brelse(), getblk(), ll_rw_block(), NULL, panic(), READ, and wait_on_buffer().

Referenced by _bmap(), add_entry(), do_execve(), empty_dir(), file_read(), file_write(), find_entry(), free_dind(), free_ind(), rd_load(), read_inode(), read_super(), sys_mkdir(), sys_setup(), and write_inode().

void bread_page | ( | unsigned long | address,
 |  | int | dev,
 |  | int | b[4]
 | ) |

Definition at line 299 of file buffer.c.

References b, BLOCK_SIZE, brelse(), COPYBLK, getblk(), ll_rw_block(), NULL, READ, and wait_on_buffer().

Referenced by do_no_page().

struct buffer_head* breada | ( | int | dev,
 |  | int | first,
 |  |  | ...
 | ) |

Definition at line 325 of file buffer.c.

References buffer_head::b_count, buffer_head::b_uptodate, brelse(), getblk(), ll_rw_block(), NULL, panic(), READ, READA, va_arg, va_end, va_start, and wait_on_buffer().

Referenced by block_read(), block_write(), and rd_load().

void brelse ( struct buffer_head * buf )

Definition at line 256 of file buffer.c.

References buffer_wait, panic(), wait_on_buffer(), and wake_up().

Referenced by _bmap(), add_entry(), block_read(), block_write(), bread(), bread_page(), breada(), do_execve(), empty_dir(), file_read(), file_write(), find_entry(), free_block(), free_dind(), free_ind(), get_dir(), namei(), new_block(), open_namei(), put_super(), rd_load(), read_inode(), read_super(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), sys_setup(), sys_unlink(), and write_inode().

void buffer_init ( long buffer_end )

Definition at line 351 of file buffer.c.

References b, buffer_head::b_count, buffer_head::b_data, buffer_head::b_dev, buffer_head::b_dirt, buffer_head::b_lock, buffer_head::b_next, buffer_head::b_next_free, buffer_head::b_prev, buffer_head::b_prev_free, buffer_head::b_uptodate, buffer_head::b_wait, BLOCK_SIZE, free_list, hash_table, NR_BUFFERS, NR_HASH, NULL, and start_buffer.

Referenced by main().

void check_disk_change ( int dev )

Definition at line 116 of file buffer.c.

References floppy_change(), invalidate_buffers(), invalidate_inodes(), MAJOR, NR_SUPER, and put_super().

Referenced by read_super(), and sys_open().

static struct buffer_head* find_buffer | ( | int | dev,
 |  | int | block
 | ) | [static]

Definition at line 169 of file buffer.c.

References buffer_head::b_blocknr, buffer_head::b_dev, buffer_head::b_next, hash, and NULL.

Referenced by get_hash_table(), and getblk().

struct buffer_head* get_hash_table | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 186 of file buffer.c.

References buffer_head::b_blocknr, buffer_head::b_count, buffer_head::b_dev, find_buffer(), NULL, and wait_on_buffer().

Referenced by free_block(), and getblk().

struct buffer_head* getblk | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 209 of file buffer.c.

References buffer_head::b_blocknr, buffer_head::b_count, buffer_head::b_dev, buffer_head::b_dirt, buffer_head::b_next_free, buffer_head::b_uptodate, BADNESS, buffer_wait, find_buffer(), free_list, get_hash_table(), insert_into_queues(), remove_from_queues(), sleep_on(), sync_dev(), and wait_on_buffer().

Referenced by block_write(), bread(), bread_page(), breada(), and new_block().

static void insert_into_queues ( struct buffer_head * bh ) [inline, static]

Definition at line 152 of file buffer.c.

References buffer_head::b_next, buffer_head::b_next_free, buffer_head::b_prev, buffer_head::b_prev_free, free_list, hash, and NULL.

Referenced by getblk().

void invalidate_buffers ( int dev ) [inline]

Definition at line 87 of file buffer.c.

References buffer_head::b_dev, buffer_head::b_dirt, buffer_head::b_uptodate, NR_BUFFERS, start_buffer, and wait_on_buffer().

Referenced by check_disk_change().

void invalidate_inodes ( int )

Definition at line 43 of file inode.c.

References m_inode::i_count, m_inode::i_dev, m_inode::i_dirt, inode_table, NR_INODE, printk(), and wait_on_inode().

Referenced by check_disk_change().

void put_super ( int )

Definition at line 74 of file super.c.

References brelse(), free_super(), get_super(), I_MAP_SLOTS, lock_super(), printk(), ROOT_DEV, super_block::s_dev, super_block::s_imap, super_block::s_imount, super_block::s_zmap, super_block, and Z_MAP_SLOTS.

Referenced by check_disk_change(), and sys_umount().

static void remove_from_queues ( struct buffer_head * bh ) [inline, static]

Definition at line 134 of file buffer.c.

References buffer_head::b_next, buffer_head::b_next_free, buffer_head::b_prev, buffer_head::b_prev_free, free_list, hash, and panic().

Referenced by getblk().

int sync_dev ( int dev )

Definition at line 62 of file buffer.c.

References buffer_head::b_dev, buffer_head::b_dirt, ll_rw_block(), NR_BUFFERS, start_buffer, sync_inodes(), wait_on_buffer(), and WRITE.

Referenced by getblk(), iput(), and sys_umount().

int sys_sync ( void )

Definition at line 47 of file buffer.c.

References buffer_head::b_dirt, ll_rw_block(), NR_BUFFERS, start_buffer, sync_inodes(), wait_on_buffer(), and WRITE.

Referenced by panic().

static void wait_on_buffer ( struct buffer_head * bh ) [inline, static]

Definition at line 39 of file buffer.c.

References cli, sleep_on(), and sti.

Referenced by bread(), bread_page(), breada(), brelse(), get_hash_table(), getblk(), invalidate_buffers(), sync_dev(), and sys_sync().

Variable Documentation

struct task_struct* buffer_wait = NULL [static]

Definition at line 36 of file buffer.c.

Referenced by brelse(), and getblk().

int end

struct buffer_head* free_list [static]

Definition at line 35 of file buffer.c.

Referenced by buffer_init(), getblk(), insert_into_queues(), and remove_from_queues().

struct buffer_head* hash_table[NR_HASH]

Definition at line 34 of file buffer.c.

Referenced by buffer_init().

int NR_BUFFERS = 0

Definition at line 37 of file buffer.c.

struct buffer_head* start_buffer = (struct buffer_head *) &end

Definition at line 33 of file buffer.c.

Referenced by buffer_init(), invalidate_buffers(), sync_dev(), and sys_sync().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/char_dev.c File Reference

char_dev.c File Reference

#include <errno.h>
#include <sys/types.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <asm/io.h>

Go to the source code of this file.

Defines

#define | NRDEVS ((sizeof (crw_table))/(sizeof (crw_ptr)))

Typedefs

typedef int(* | crw_ptr )(int rw, unsigned minor, char *buf, int count, off_t *pos)

Functions

int | tty_read (unsigned minor, char *buf, int count)
int | tty_write (unsigned minor, char *buf, int count)
static int | rw_ttyx (int rw, unsigned minor, char *buf, int count, off_t *pos)
static int | rw_tty (int rw, unsigned minor, char *buf, int count, off_t *pos)
static int | rw_ram (int rw, char *buf, int count, off_t *pos)
static int | rw_mem (int rw, char *buf, int count, off_t *pos)
static int | rw_kmem (int rw, char *buf, int count, off_t *pos)
static int | rw_port (int rw, char *buf, int count, off_t *pos)
static int | rw_memory (int rw, unsigned minor, char *buf, int count, off_t *pos)
int | rw_char (int rw, int dev, char *buf, int count, off_t *pos)

Variables

static crw_ptr | crw_table []

Define Documentation

#define NRDEVS ((sizeof (crw_table))/(sizeof (crw_ptr)))

Definition at line 83 of file char_dev.c.

Referenced by rw_char(), and sys_ioctl().

Typedef Documentation

typedef int(* crw_ptr)(int rw, unsigned minor, char *buf, int count, off_t *pos)

Definition at line 19 of file char_dev.c.

Function Documentation

int rw_char | ( | int | rw,
 |  | int | dev,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) |

Definition at line 95 of file char_dev.c.

References crw_table, ENODEV, MAJOR, MINOR, and NRDEVS.

Referenced by sys_read(), and sys_write().

static int rw_kmem | ( | int | rw,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 44 of file char_dev.c.

References EIO.

Referenced by rw_memory().

static int rw_mem | ( | int | rw,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 39 of file char_dev.c.

References EIO.

Referenced by rw_memory().

static int rw_memory | ( | int | rw,
 |  | unsigned | minor,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 65 of file char_dev.c.

References EIO, READ, rw_kmem(), rw_mem(), rw_port(), and rw_ram().

static int rw_port | ( | int | rw,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 49 of file char_dev.c.

References get_fs_byte(), inb, outb, put_fs_byte(), and READ.

Referenced by rw_memory().

static int rw_ram | ( | int | rw,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 34 of file char_dev.c.

References EIO.

Referenced by rw_memory().

static int rw_tty | ( | int | rw,
 |  | unsigned | minor,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 27 of file char_dev.c.

References current, EPERM, rw_ttyx(), and task_struct::tty.

static int rw_ttyx | ( | int | rw,
 |  | unsigned | minor,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) | [static]

Definition at line 21 of file char_dev.c.

References READ, tty_read(), and tty_write().

Referenced by rw_tty().

int tty_read | ( | unsigned | minor,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 230 of file tty_io.c.

Referenced by rw_ttyx().

int tty_write | ( | unsigned | minor,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 291 of file tty_io.c.

Referenced by rw_ttyx().

Variable Documentation

crw_ptr crw_table[] [static]

Initial value:

{
    NULL,
    rw_memory,
    NULL,
    NULL,
    rw_ttyx,
    rw_tty,
    NULL,
    NULL}

Definition at line 85 of file char_dev.c.

Referenced by rw_char().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/exec.c File Reference

exec.c File Reference

#include <errno.h>
#include <string.h>
#include <sys/stat.h>
#include <a.out.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/segment.h>

Go to the source code of this file.

Defines

#define | MAX_ARG_PAGES 32

Functions

int | sys_exit (int exit_code)
int | sys_close (int fd)
static unsigned long * | create_tables (char *p, int argc, int envc)
static int | count (char **argv)
static unsigned long | copy_strings (int argc, char **argv, unsigned long *page, unsigned long p, int from_kmem)
static unsigned long | change_ldt (unsigned long text_size, unsigned long *page)
int | do_execve (unsigned long *eip, long tmp, char *filename, char **argv, char **envp)

Define Documentation

#define MAX_ARG_PAGES 32

Definition at line 39 of file exec.c.

Referenced by change_ldt(), and do_execve().

Function Documentation

static unsigned long change_ldt | ( | unsigned long | text_size,
 |  | unsigned long * | page
 | ) | [static]

Definition at line 154 of file exec.c.

References current, get_base, task_struct::ldt, MAX_ARG_PAGES, PAGE_SIZE, put_page(), set_base, and set_limit.

Referenced by do_execve().

static unsigned long copy_strings | ( | int | argc,
 |  | char ** | argv,
 |  | unsigned long * | page,
 |  | unsigned long | p,
 |  | int | from_kmem
 | ) | [static]

Definition at line 104 of file exec.c.

References get_ds(), get_free_page(), get_fs(), get_fs_byte(), get_fs_long(), NULL, PAGE_SIZE, panic(), and set_fs().

Referenced by do_execve().

static int count ( char ** argv ) [static]

Definition at line 75 of file exec.c.

References get_fs_long().

Referenced by do_execve().

static unsigned long* create_tables | ( | char * | p,
 |  | int | argc,
 |  | int | envc
 | ) | [static]

Definition at line 46 of file exec.c.

References get_fs_byte(), and put_fs_long().

Referenced by do_execve().

int do_execve | ( | unsigned long * | eip,
 |  | long | tmp,
 |  | char * | filename,
 |  | char ** | argv,
 |  | char ** | envp
 | ) |

Definition at line 182 of file exec.c.

References exec::a_bss, exec::a_data, exec::a_drsize, exec::a_entry, exec::a_syms, exec::a_text, exec::a_trsize, buffer_head::b_data, BLOCK_SIZE, bread(), brelse(), task_struct::brk, change_ldt(), task_struct::close_on_exec, copy_strings(), count(), create_tables(), current, EACCES, task_struct::egid, task_struct::end_code, task_struct::end_data, ENOENT, ENOEXEC, ENOMEM, task_struct::euid, task_struct::executable, free_page(), free_page_tables(), get_base, get_ds(), get_fs(), get_limit, m_inode::i_dev, m_inode::i_gid, m_inode::i_mode, m_inode::i_size, m_inode::i_uid, m_inode::i_zone, iput(), last_task_used_math, task_struct::ldt, MAX_ARG_PAGES, N_MAGIC, N_TXTOFF, namei(), NR_OPEN, NULL, PAGE_SIZE, panic(), printk(), put_fs_byte(), S_ISGID, S_ISREG, S_ISUID, sigaction::sa_handler, set_fs(), task_struct::sigaction, task_struct::start_stack, strchr(), strncpy(), suser, sys_close(), task_struct::used_math, and ZMAGIC.

int sys_close ( int fd )

Referenced by do_execve(), do_exit(), and sys_dup2().

int sys_exit ( int exit_code )

Definition at line 136 of file exit.c.

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/fcntl.c File Reference

fcntl.c File Reference

#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <fcntl.h>
#include <sys/stat.h>

Go to the source code of this file.

Functions

int | sys_close (int fd)
static int | dupfd (unsigned int fd, unsigned int arg)
int | sys_dup2 (unsigned int oldfd, unsigned int newfd)
int | sys_dup (unsigned int fildes)
int | sys_fcntl (unsigned int fd, unsigned int cmd, unsigned long arg)

Function Documentation

static int dupfd | ( | unsigned int | fd,
 |  | unsigned int | arg
 | ) | [static]

Definition at line 18 of file fcntl.c.

References task_struct::close_on_exec, current, EBADF, EINVAL, EMFILE, task_struct::filp, and NR_OPEN.

Referenced by sys_dup(), sys_dup2(), and sys_fcntl().

int sys_close ( int fd )

int sys_dup ( unsigned int fildes )

Definition at line 42 of file fcntl.c.

References dupfd().

int sys_dup2 | ( | unsigned int | oldfd,
 |  | unsigned int | newfd
 | ) |

Definition at line 36 of file fcntl.c.

References dupfd(), and sys_close().

int sys_fcntl | ( | unsigned int | fd,
 |  | unsigned int | cmd,
 |  | unsigned long | arg
 | ) |

Definition at line 47 of file fcntl.c.

References task_struct::close_on_exec, current, dupfd(), EBADF, F_DUPFD, file::f_flags, F_GETFD, F_GETFL, F_GETLK, F_SETFD, F_SETFL, F_SETLK, F_SETLKW, task_struct::filp, NR_OPEN, O_APPEND, and O_NONBLOCK.

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/file_dev.c File Reference

file_dev.c File Reference

#include <errno.h>
#include <fcntl.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>

Go to the source code of this file.

Defines

#define | MIN(a, b) (((a)<(b))?(a):(b))
#define | MAX(a, b) (((a)>(b))?(a):(b))

Functions

int | file_read (struct m_inode *inode, struct file *filp, char *buf, int count)
int | file_write (struct m_inode *inode, struct file *filp, char *buf, int count)

Define Documentation

#define MAX | ( | a,
 |  | b | ) | (((a)>(b))?(a):(b))

Definition at line 15 of file file_dev.c.

#define MIN | ( | a,
 |  | b | ) | (((a)<(b))?(a):(b))

Definition at line 14 of file file_dev.c.

Referenced by file_read().

Function Documentation

int file_read | ( | struct m_inode * | inode,
 |  | struct file * | filp,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 17 of file file_dev.c.

References buffer_head::b_data, BLOCK_SIZE, bmap(), bread(), brelse(), CURRENT_TIME, ERROR, MIN, NULL, and put_fs_byte().

Referenced by sys_read().

int file_write | ( | struct m_inode * | inode,
 |  | struct file * | filp,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 48 of file file_dev.c.

References buffer_head::b_data, buffer_head::b_dirt, BLOCK_SIZE, bread(), brelse(), create_block(), CURRENT_TIME, get_fs_byte(), and O_APPEND.

Referenced by sys_write().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/file_table.c File Reference

file_table.c File Reference

#include <linux/fs.h>

Go to the source code of this file.

Variables

file file_table [NR_FILE]

Variable Documentation

struct file file_table[NR_FILE]

Definition at line 9 of file file_table.c.

Referenced by mount_root(), sys_open(), and sys_pipe().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/inode.c File Reference

inode.c File Reference

#include <string.h>
#include <sys/stat.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/system.h>

Go to the source code of this file.

Functions

static void | read_inode (struct m_inode *inode)
static void | write_inode (struct m_inode *inode)
static void | wait_on_inode (struct m_inode *inode)
static void | lock_inode (struct m_inode *inode)
static void | unlock_inode (struct m_inode *inode)
void | invalidate_inodes (int dev)
void | sync_inodes (void)
static int | _bmap (struct m_inode *inode, int block, int create)
int | bmap (struct m_inode *inode, int block)
int | create_block (struct m_inode *inode, int block)
void | iput (struct m_inode *inode)
m_inode * | get_empty_inode (void)
m_inode * | get_pipe_inode (void)
m_inode * | iget (int dev, int nr)

Variables

m_inode | inode_table [NR_INODE] = {{0,},}

Function Documentation

static int _bmap | ( | struct m_inode * | inode,
 |  | int | block,
 |  | int | create
 | ) | [static]

Definition at line 72 of file inode.c.

References buffer_head::b_data, buffer_head::b_dirt, bread(), brelse(), CURRENT_TIME, m_inode::i_ctime, m_inode::i_dirt, m_inode::i_zone, new_block(), and panic().

Referenced by bmap(), and create_block().

int bmap | ( | struct m_inode * | inode,
 |  | int | block
 | ) |

Definition at line 140 of file inode.c.

References _bmap().

Referenced by do_no_page(), empty_dir(), file_read(), and find_entry().

int create_block | ( | struct m_inode * | inode,
 |  | int | block
 | ) |

Definition at line 145 of file inode.c.

References _bmap().

Referenced by add_entry(), and file_write().

struct m_inode* get_empty_inode ( void )

Definition at line 194 of file inode.c.

References m_inode::i_count, m_inode::i_dirt, m_inode::i_lock, inode_table, memset(), NR_INODE, NULL, panic(), printk(), wait_on_inode(), and write_inode().

Referenced by get_pipe_inode(), iget(), and new_inode().

struct m_inode* get_pipe_inode ( void )

Definition at line 228 of file inode.c.

References get_empty_inode(), get_free_page(), m_inode::i_count, m_inode::i_pipe, m_inode::i_size, NULL, PIPE_HEAD, and PIPE_TAIL.

Referenced by sys_pipe().

struct m_inode* iget | ( | int | dev,
 |  | int | nr
 | ) |

Definition at line 244 of file inode.c.

References get_empty_inode(), m_inode::i_count, m_inode::i_dev, m_inode::i_mount, m_inode::i_num, inode_table, iput(), NR_INODE, NR_SUPER, NULL, panic(), printk(), read_inode(), ROOT_INO, and wait_on_inode().

Referenced by get_dir(), mount_root(), namei(), open_namei(), sys_rmdir(), and sys_unlink().

void invalidate_inodes ( int dev )

Definition at line 43 of file inode.c.

References m_inode::i_count, m_inode::i_dev, m_inode::i_dirt, inode_table, NR_INODE, printk(), and wait_on_inode().

Referenced by check_disk_change().

void iput ( struct m_inode * inode )

Definition at line 150 of file inode.c.

References free_inode(), free_page(), panic(), S_ISBLK, sync_dev(), truncate(), wait_on_inode(), wake_up(), and write_inode().

Referenced by do_execve(), do_exit(), find_entry(), get_dir(), iget(), namei(), new_inode(), open_namei(), sys_access(), sys_chdir(), sys_chmod(), sys_chown(), sys_chroot(), sys_close(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), sys_open(), sys_rmdir(), sys_stat(), sys_umount(), sys_unlink(), and sys_utime().

static void lock_inode ( struct m_inode * inode ) [inline, static]

Definition at line 28 of file inode.c.

References cli, m_inode::i_lock, sleep_on(), and sti.

Referenced by read_inode(), and write_inode().

static void read_inode ( struct m_inode * inode ) [static]

Definition at line 294 of file inode.c.

References buffer_head::b_data, bread(), brelse(), get_super(), INODES_PER_BLOCK, lock_inode(), panic(), super_block::s_imap_blocks, super_block::s_zmap_blocks, and unlock_inode().

Referenced by iget().

void sync_inodes ( void )

Definition at line 59 of file inode.c.

References m_inode::i_dirt, m_inode::i_pipe, inode_table, NR_INODE, wait_on_inode(), and write_inode().

Referenced by sync_dev(), and sys_sync().

static void unlock_inode ( struct m_inode * inode ) [inline, static]

Definition at line 37 of file inode.c.

References m_inode::i_lock, and wake_up().

Referenced by read_inode(), and write_inode().

static void wait_on_inode ( struct m_inode * inode ) [inline, static]

Definition at line 20 of file inode.c.

References cli, sleep_on(), and sti.

Referenced by get_empty_inode(), iget(), invalidate_inodes(), iput(), and sync_inodes().

static void write_inode ( struct m_inode * inode ) [static]

Definition at line 314 of file inode.c.

References buffer_head::b_data, buffer_head::b_dirt, bread(), brelse(), get_super(), INODES_PER_BLOCK, lock_inode(), panic(), super_block::s_imap_blocks, super_block::s_zmap_blocks, and unlock_inode().

Referenced by get_empty_inode(), iput(), and sync_inodes().

Variable Documentation

struct m_inode inode_table[NR_INODE] = {{0,},}

Definition at line 15 of file inode.c.

Referenced by get_empty_inode(), iget(), invalidate_inodes(), sync_inodes(), and sys_umount().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/ioctl.c File Reference

ioctl.c File Reference

#include <errno.h>
#include <sys/stat.h>
#include <linux/sched.h>

Go to the source code of this file.

Defines

#define | NRDEVS ((sizeof (ioctl_table))/(sizeof (ioctl_ptr)))

Typedefs

typedef int(* | ioctl_ptr )(int dev, int cmd, int arg)

Functions

int | tty_ioctl (int dev, int cmd, int arg)
int | sys_ioctl (unsigned int fd, unsigned int cmd, unsigned long arg)

Variables

static ioctl_ptr | ioctl_table []

Define Documentation

#define NRDEVS ((sizeof (ioctl_table))/(sizeof (ioctl_ptr)))

Definition at line 17 of file ioctl.c.

Typedef Documentation

typedef int(* ioctl_ptr)(int dev, int cmd, int arg)

Definition at line 15 of file ioctl.c.

Function Documentation

int sys_ioctl | ( | unsigned int | fd,
 |  | unsigned int | cmd,
 |  | unsigned long | arg
 | ) |

Definition at line 30 of file ioctl.c.

References current, EBADF, EINVAL, ENODEV, ENOTTY, file::f_inode, task_struct::filp, m_inode::i_mode, m_inode::i_zone, ioctl_table, MAJOR, NR_OPEN, NRDEVS, S_ISBLK, and S_ISCHR.

int tty_ioctl | ( | int | dev,
 |  | int | cmd,
 |  | int | arg
 | ) |

Definition at line 115 of file tty_ioctl.c.

References CHARS, current, EINVAL, flush(), get_fs_long(), get_termio(), get_termios(), MAJOR, MINOR, panic(), tty_struct::pgrp, put_fs_long(), tty_struct::read_q, tty_struct::secondary, send_break(), set_termio(), set_termios(), TCFLSH, TCGETA, TCGETS, TCSBRK, TCSETA, TCSETAF, TCSETAW, TCSETS, TCSETSF, TCSETSW, TCXONC, TIOCEXCL, TIOCGPGRP, TIOCGSOFTCAR, TIOCGWINSZ, TIOCINQ, TIOCMBIC, TIOCMBIS, TIOCMGET, TIOCMSET, TIOCNXCL, TIOCOUTQ, TIOCSCTTY, TIOCSPGRP, TIOCSSOFTCAR, TIOCSTI, TIOCSWINSZ, task_struct::tty, tty_table, verify_area(), wait_until_sent(), and tty_struct::write_q.

Variable Documentation

ioctl_ptr ioctl_table[] [static]

Initial value:

{
    NULL,
    NULL,
    NULL,
    NULL,
    tty_ioctl,
    tty_ioctl,
    NULL,
    NULL}

Definition at line 19 of file ioctl.c.

Referenced by sys_ioctl().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/namei.c File Reference

namei.c File Reference

#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include <const.h>
#include <sys/stat.h>

Go to the source code of this file.

Defines

#define | ACC_MODE(x) ("\004\002\006\377"[(x)&O_ACCMODE])
#define | MAY_EXEC 1
#define | MAY_WRITE 2
#define | MAY_READ 4

Functions

static int | permission (struct m_inode *inode, int mask)
static int | match (int len, const char *name, struct dir_entry *de)
static struct buffer_head * | find_entry (struct m_inode **dir, const char *name, int namelen, struct dir_entry **res_dir)
static struct buffer_head * | add_entry (struct m_inode *dir, const char *name, int namelen, struct dir_entry **res_dir)
static struct m_inode * | get_dir (const char *pathname)
static struct m_inode * | dir_namei (const char *pathname, int *namelen, const char **name)
m_inode * | namei (const char *pathname)
int | open_namei (const char *pathname, int flag, int mode, struct m_inode **res_inode)
int | sys_mknod (const char *filename, int mode, int dev)
int | sys_mkdir (const char *pathname, int mode)
static int | empty_dir (struct m_inode *inode)
int | sys_rmdir (const char *name)
int | sys_unlink (const char *name)
int | sys_link (const char *oldname, const char *newname)

Define Documentation

#define ACC_MODE ( x ) ("\004\002\006\377"[(x)&O_ACCMODE])

Definition at line 21 of file namei.c.

Referenced by open_namei().

#define MAY_EXEC 1

Definition at line 29 of file namei.c.

Referenced by get_dir().

#define MAY_READ 4

Definition at line 31 of file namei.c.

#define MAY_WRITE 2

Definition at line 30 of file namei.c.

Referenced by open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_unlink().

Function Documentation

static struct buffer_head* add_entry | ( | struct m_inode * | dir,
 |  | const char * | name,
 |  | int | namelen,
 |  | struct dir_entry ** | res_dir
 | ) | [static]

Definition at line 165 of file namei.c.

References buffer_head::b_data, buffer_head::b_dirt, BLOCK_SIZE, bread(), brelse(), create_block(), CURRENT_TIME, DIR_ENTRIES_PER_BLOCK, get_fs_byte(), dir_entry::inode, dir_entry::name, NAME_LEN, and NULL.

Referenced by open_namei(), sys_link(), sys_mkdir(), and sys_mknod().

static struct m_inode* dir_namei | ( | const char * | pathname,
 |  | int * | namelen,
 |  | const char ** | name
 | ) | [static]

Definition at line 278 of file namei.c.

References get_dir(), get_fs_byte(), and NULL.

Referenced by namei(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_unlink().

static int empty_dir ( struct m_inode * inode ) [static]

Definition at line 543 of file namei.c.

References buffer_head::b_data, BLOCK_SIZE, bmap(), bread(), brelse(), DIR_ENTRIES_PER_BLOCK, m_inode::i_size, dir_entry::inode, printk(), and strcmp().

Referenced by sys_rmdir().

static struct buffer_head* find_entry | ( | struct m_inode ** | dir,
 |  | const char * | name,
 |  | int | namelen,
 |  | struct dir_entry ** | res_dir
 | ) | [static]

Definition at line 91 of file namei.c.

References buffer_head::b_data, BLOCK_SIZE, bmap(), bread(), brelse(), current, DIR_ENTRIES_PER_BLOCK, get_fs_byte(), get_super(), m_inode::i_count, iput(), match(), NAME_LEN, NULL, task_struct::root, ROOT_INO, and super_block::s_imount.

Referenced by get_dir(), namei(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_unlink().

static struct m_inode* get_dir ( const char * pathname ) [static]

Definition at line 228 of file namei.c.

References brelse(), current, find_entry(), get_fs_byte(), m_inode::i_count, m_inode::i_dev, m_inode::i_mode, iget(), dir_entry::inode, iput(), MAY_EXEC, NULL, panic(), permission(), task_struct::pwd, task_struct::root, and S_ISDIR.

Referenced by dir_namei().

static int match | ( | int | len,
 |  | const char * | name,
 |  | struct dir_entry * | de
 | ) | [static]

Definition at line 63 of file namei.c.

References NAME_LEN.

Referenced by find_entry().

struct m_inode* namei ( const char * pathname )

Definition at line 303 of file namei.c.

References brelse(), CURRENT_TIME, dir_namei(), find_entry(), m_inode::i_atime, m_inode::i_dev, m_inode::i_dirt, iget(), dir_entry::inode, iput(), and NULL.

Referenced by do_execve(), sys_access(), sys_chdir(), sys_chmod(), sys_chown(), sys_chroot(), sys_link(), sys_mount(), sys_stat(), sys_umount(), and sys_utime().

int open_namei | ( | const char * | pathname,
 |  | int | flag,
 |  | int | mode,
 |  | struct m_inode ** | res_inode
 | ) |

Definition at line 337 of file namei.c.

References ACC_MODE, add_entry(), buffer_head::b_dirt, brelse(), current, CURRENT_TIME, dir_namei(), EACCES, EEXIST, EISDIR, ENOENT, ENOSPC, EPERM, task_struct::euid, find_entry(), m_inode::i_atime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_mode, m_inode::i_nlinks, m_inode::i_num, I_REGULAR, m_inode::i_uid, iget(), dir_entry::inode, iput(), MAY_WRITE, new_inode(), O_ACCMODE, O_CREAT, O_EXCL, O_TRUNC, O_WRONLY, permission(), S_ISDIR, truncate(), and task_struct::umask.

Referenced by sys_open().

static int permission | ( | struct m_inode * | inode,
 |  | int | mask
 | ) | [static]

Definition at line 40 of file namei.c.

References current, task_struct::egid, task_struct::euid, and suser.

Referenced by get_dir(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_unlink().

int sys_link | ( | const char * | oldname,
 |  | const char * | newname
 | ) |

Definition at line 721 of file namei.c.

References add_entry(), buffer_head::b_dirt, brelse(), CURRENT_TIME, dir_namei(), EACCES, EEXIST, ENOENT, ENOSPC, EPERM, EXDEV, find_entry(), m_inode::i_ctime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_mode, m_inode::i_nlinks, m_inode::i_num, dir_entry::inode, iput(), MAY_WRITE, namei(), permission(), and S_ISDIR.

int sys_mkdir | ( | const char * | pathname,
 |  | int | mode
 | ) |

Definition at line 463 of file namei.c.

References add_entry(), buffer_head::b_data, buffer_head::b_dirt, bread(), brelse(), current, CURRENT_TIME, dir_namei(), EEXIST, ENOENT, ENOSPC, EPERM, ERROR, find_entry(), free_block(), m_inode::i_atime, m_inode::i_dev, I_DIRECTORY, m_inode::i_dirt, m_inode::i_mode, m_inode::i_mtime, m_inode::i_nlinks, m_inode::i_num, m_inode::i_size, m_inode::i_zone, dir_entry::inode, iput(), MAY_WRITE, dir_entry::name, new_block(), new_inode(), permission(), strcpy(), suser, and task_struct::umask.

int sys_mknod | ( | const char * | filename,
 |  | int | mode,
 |  | int | dev
 | ) |

Definition at line 412 of file namei.c.

References add_entry(), buffer_head::b_dirt, brelse(), CURRENT_TIME, dir_namei(), EEXIST, ENOENT, ENOSPC, EPERM, find_entry(), m_inode::i_atime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_mode, m_inode::i_mtime, m_inode::i_nlinks, m_inode::i_num, m_inode::i_zone, dir_entry::inode, iput(), MAY_WRITE, new_inode(), permission(), S_ISBLK, S_ISCHR, and suser.

int sys_rmdir ( const char * name )

Definition at line 587 of file namei.c.

References buffer_head::b_dirt, brelse(), current, CURRENT_TIME, dir_namei(), empty_dir(), ENOENT, ENOTDIR, ENOTEMPTY, EPERM, task_struct::euid, find_entry(), m_inode::i_count, m_inode::i_ctime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_mode, m_inode::i_mtime, m_inode::i_nlinks, m_inode::i_uid, iget(), dir_entry::inode, iput(), MAY_WRITE, permission(), printk(), S_ISDIR, S_ISVTX, and suser.

int sys_unlink ( const char * name )

Definition at line 663 of file namei.c.

References buffer_head::b_dirt, brelse(), current, CURRENT_TIME, dir_namei(), ENOENT, EPERM, task_struct::euid, find_entry(), m_inode::i_ctime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_mode, m_inode::i_nlinks, m_inode::i_num, m_inode::i_uid, iget(), dir_entry::inode, iput(), MAY_WRITE, permission(), printk(), S_ISDIR, S_ISVTX, and suser.

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/open.c File Reference

open.c File Reference

#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <utime.h>
#include <sys/stat.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <linux/kernel.h>
#include <asm/segment.h>

Go to the source code of this file.

Functions

int | sys_ustat (int dev, struct ustat *ubuf)
int | sys_utime (char *filename, struct utimbuf *times)
int | sys_access (const char *filename, int mode)
int | sys_chdir (const char *filename)
int | sys_chroot (const char *filename)
int | sys_chmod (const char *filename, int mode)
int | sys_chown (const char *filename, int uid, int gid)
int | sys_open (const char *filename, int flag, int mode)
int | sys_creat (const char *pathname, int mode)
int | sys_close (unsigned int fd)

Function Documentation

int sys_access | ( | const char * | filename,
 |  | int | mode
 | ) |

Definition at line 47 of file open.c.

References current, EACCES, task_struct::gid, m_inode::i_gid, m_inode::i_mode, m_inode::i_uid, iput(), namei(), and task_struct::uid.

int sys_chdir ( const char * filename )

Definition at line 75 of file open.c.

References current, ENOENT, ENOTDIR, m_inode::i_mode, iput(), namei(), task_struct::pwd, and S_ISDIR.

int sys_chmod | ( | const char * | filename,
 |  | int | mode
 | ) |

Definition at line 105 of file open.c.

References current, EACCES, ENOENT, task_struct::euid, m_inode::i_dirt, m_inode::i_mode, m_inode::i_uid, iput(), namei(), and suser.

int sys_chown | ( | const char * | filename,
 |  | int | uid,
 |  | int | gid
 | ) |

Definition at line 121 of file open.c.

References EACCES, ENOENT, m_inode::i_dirt, m_inode::i_gid, m_inode::i_uid, iput(), namei(), and suser.

int sys_chroot ( const char * filename )

Definition at line 90 of file open.c.

References current, ENOENT, ENOTDIR, m_inode::i_mode, iput(), namei(), task_struct::root, and S_ISDIR.

int sys_close ( unsigned int fd )

Definition at line 193 of file open.c.

References task_struct::close_on_exec, current, EINVAL, file::f_count, file::f_inode, task_struct::filp, iput(), NR_OPEN, NULL, and panic().

int sys_creat | ( | const char * | pathname,
 |  | int | mode
 | ) |

Definition at line 188 of file open.c.

References O_CREAT, O_TRUNC, and sys_open().

int sys_open | ( | const char * | filename,
 |  | int | flag,
 |  | int | mode
 | ) |

Definition at line 138 of file open.c.

References check_disk_change(), task_struct::close_on_exec, current, EINVAL, EPERM, file::f_count, file::f_flags, file::f_inode, file::f_mode, file::f_pos, file_table, task_struct::filp, m_inode::i_mode, m_inode::i_zone, iput(), task_struct::leader, MAJOR, MINOR, NR_FILE, NR_OPEN, NULL, open_namei(), task_struct::pgrp, tty_struct::pgrp, S_ISBLK, S_ISCHR, task_struct::tty, tty_table, and task_struct::umask.

Referenced by sys_creat().

int sys_ustat | ( | int | dev,
 |  | struct ustat * | ubuf
 | ) |

Definition at line 19 of file open.c.

References ENOSYS.

int sys_utime | ( | char * | filename,
 |  | struct utimbuf * | times
 | ) |

Definition at line 24 of file open.c.

References CURRENT_TIME, ENOENT, get_fs_long(), m_inode::i_atime, m_inode::i_dirt, m_inode::i_mtime, iput(), namei(), and times().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/pipe.c File Reference

pipe.c File Reference

#include <signal.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <asm/segment.h>

Go to the source code of this file.

Functions

int | read_pipe (struct m_inode *inode, char *buf, int count)
int | write_pipe (struct m_inode *inode, char *buf, int count)
int | sys_pipe (unsigned long *fildes)

Function Documentation

int read_pipe | ( | struct m_inode * | inode,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 13 of file pipe.c.

References PAGE_SIZE, PIPE_SIZE, PIPE_TAIL, put_fs_byte(), read(), sleep_on(), and wake_up().

Referenced by sys_read().

int sys_pipe ( unsigned long * fildes )

Definition at line 71 of file pipe.c.

References current, file::f_count, file::f_inode, file::f_mode, file::f_pos, file_table, task_struct::filp, get_pipe_inode(), NR_FILE, NR_OPEN, NULL, and put_fs_long().

int write_pipe | ( | struct m_inode * | inode,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 41 of file pipe.c.

References current, get_fs_byte(), PAGE_SIZE, PIPE_HEAD, PIPE_SIZE, task_struct::signal, SIGPIPE, sleep_on(), and wake_up().

Referenced by sys_write().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/read_write.c File Reference

read_write.c File Reference

#include <sys/stat.h>
#include <errno.h>
#include <sys/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/segment.h>

Go to the source code of this file.

Functions

int | rw_char (int rw, int dev, char *buf, int count, off_t *pos)
int | read_pipe (struct m_inode *inode, char *buf, int count)
int | write_pipe (struct m_inode *inode, char *buf, int count)
int | block_read (int dev, off_t *pos, char *buf, int count)
int | block_write (int dev, off_t *pos, char *buf, int count)
int | file_read (struct m_inode *inode, struct file *filp, char *buf, int count)
int | file_write (struct m_inode *inode, struct file *filp, char *buf, int count)
int | sys_lseek (unsigned int fd, off_t offset, int origin)
int | sys_read (unsigned int fd, char *buf, int count)
int | sys_write (unsigned int fd, char *buf, int count)

Function Documentation

int block_read | ( | int | dev,
 |  | off_t * | pos,
 |  | char * | buf,
 |  | int | count
 | ) |

int block_write | ( | int | dev,
 |  | off_t * | pos,
 |  | char * | buf,
 |  | int | count
 | ) |

int file_read | ( | struct m_inode * | inode,
 |  | struct file * | filp,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 17 of file file_dev.c.

References buffer_head::b_data, BLOCK_SIZE, bmap(), bread(), brelse(), CURRENT_TIME, ERROR, MIN, NULL, and put_fs_byte().

Referenced by sys_read().

int file_write | ( | struct m_inode * | inode,
 |  | struct file * | filp,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 48 of file file_dev.c.

References buffer_head::b_data, buffer_head::b_dirt, BLOCK_SIZE, bread(), brelse(), create_block(), CURRENT_TIME, get_fs_byte(), and O_APPEND.

Referenced by sys_write().

int read_pipe | ( | struct m_inode * | inode,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 13 of file pipe.c.

References PAGE_SIZE, PIPE_SIZE, PIPE_TAIL, put_fs_byte(), read(), sleep_on(), and wake_up().

Referenced by sys_read().

int rw_char | ( | int | rw,
 |  | int | dev,
 |  | char * | buf,
 |  | int | count,
 |  | off_t * | pos
 | ) |

Definition at line 95 of file char_dev.c.

References crw_table, ENODEV, MAJOR, MINOR, and NRDEVS.

Referenced by sys_read(), and sys_write().

int sys_lseek | ( | unsigned int | fd,
 |  | off_t | offset,
 |  | int | origin
 | ) |

Definition at line 25 of file read_write.c.

References current, EBADF, EINVAL, ESPIPE, file::f_inode, file::f_pos, task_struct::filp, m_inode::i_dev, m_inode::i_pipe, m_inode::i_size, IS_SEEKABLE, MAJOR, and NR_OPEN.

int sys_read | ( | unsigned int | fd,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 55 of file read_write.c.

References block_read(), EINVAL, EIO, file::f_inode, file::f_mode, file::f_pos, file_read(), m_inode::i_mode, m_inode::i_pipe, m_inode::i_size, m_inode::i_zone, NR_OPEN, printk(), READ, read_pipe(), rw_char(), S_ISBLK, S_ISCHR, S_ISDIR, S_ISREG, and verify_area().

int sys_write | ( | unsigned int | fd,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 83 of file read_write.c.

References block_write(), EINVAL, EIO, file::f_inode, file::f_mode, file::f_pos, file_write(), m_inode::i_mode, m_inode::i_pipe, m_inode::i_zone, NR_OPEN, printk(), rw_char(), S_ISBLK, S_ISCHR, S_ISREG, WRITE, and write_pipe().

int write_pipe | ( | struct m_inode * | inode,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 41 of file pipe.c.

References current, get_fs_byte(), PAGE_SIZE, PIPE_HEAD, PIPE_SIZE, task_struct::signal, SIGPIPE, sleep_on(), and wake_up().

Referenced by sys_write().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/stat.c File Reference

stat.c File Reference

#include <errno.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>

Go to the source code of this file.

Functions

static void | cp_stat (struct m_inode *inode, struct stat *statbuf)
int | sys_stat (char *filename, struct stat *statbuf)
int | sys_fstat (unsigned int fd, struct stat *statbuf)

Function Documentation

static void cp_stat | ( | struct m_inode * | inode,
 |  | struct stat * | statbuf
 | ) | [static]

Definition at line 15 of file stat.c.

References put_fs_byte(), stat::st_atime, stat::st_ctime, stat::st_dev, stat::st_gid, stat::st_ino, stat::st_mode, stat::st_mtime, stat::st_nlink, stat::st_rdev, stat::st_size, stat::st_uid, and verify_area().

Referenced by sys_fstat(), and sys_stat().

int sys_fstat | ( | unsigned int | fd,
 |  | struct stat * | statbuf
 | ) |

Definition at line 47 of file stat.c.

References cp_stat(), current, EBADF, file::f_inode, task_struct::filp, and NR_OPEN.

int sys_stat | ( | char * | filename,
 |  | struct stat * | statbuf
 | ) |

Definition at line 36 of file stat.c.

References cp_stat(), ENOENT, iput(), and namei().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/super.c File Reference

super.c File Reference

#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <errno.h>
#include <sys/stat.h>

Go to the source code of this file.

Defines

#define | set_bit(bitnr, addr)

Functions

int | sync_dev (int dev)
void | wait_for_keypress (void)
static void | lock_super (struct super_block *sb)
static void | free_super (struct super_block *sb)
static void | wait_on_super (struct super_block *sb)
super_block * | get_super (int dev)
void | put_super (int dev)
static struct super_block * | read_super (int dev)
int | sys_umount (char *dev_name)
int | sys_mount (char *dev_name, char *dir_name, int rw_flag)
void | mount_root (void)

Variables

super_block | super_block [NR_SUPER]
int | ROOT_DEV = 0

Define Documentation

#define set_bit | ( | bitnr,
 |  | addr | )

Value:

({ \
register int __res ; \
__asm__("bt %2,%3;setb %%al":"=a" (__res):"a" (0),"r" (bitnr),"m" (*(addr))); \
__res; })

Definition at line 22 of file super.c.

Function Documentation

static void free_super ( struct super_block * sb ) [static]

Definition at line 40 of file super.c.

References cli, super_block::s_lock, sti, and wake_up().

Referenced by put_super(), and read_super().

struct super_block* get_super ( int dev )

Definition at line 56 of file super.c.

References NR_SUPER, NULL, super_block::s_dev, super_block, and wait_on_super().

Referenced by find_entry(), free_block(), free_inode(), new_block(), new_inode(), put_super(), read_inode(), read_super(), sys_umount(), and write_inode().

static void lock_super ( struct super_block * sb ) [static]

Definition at line 31 of file super.c.

References cli, super_block::s_lock, sleep_on(), and sti.

Referenced by put_super(), and read_super().

void mount_root ( void )

Definition at line 242 of file super.c.

References buffer_head::b_data, current, file::f_count, file_table, free, m_inode::i_count, iget(), MAJOR, NR_FILE, NR_SUPER, NULL, panic(), printk(), task_struct::pwd, read_super(), task_struct::root, ROOT_DEV, ROOT_INO, super_block::s_dev, super_block::s_imap, super_block::s_imount, super_block::s_isup, super_block::s_lock, super_block::s_ninodes, super_block::s_nzones, super_block::s_wait, super_block::s_zmap, set_bit, super_block, and wait_for_keypress().

Referenced by sys_setup().

void put_super ( int dev )

Definition at line 74 of file super.c.

References brelse(), free_super(), get_super(), I_MAP_SLOTS, lock_super(), printk(), ROOT_DEV, super_block::s_dev, super_block::s_imap, super_block::s_imount, super_block::s_zmap, super_block, and Z_MAP_SLOTS.

Referenced by check_disk_change(), and sys_umount().

static struct super_block* read_super ( int dev ) [static]

Definition at line 100 of file super.c.

References buffer_head::b_data, bread(), brelse(), check_disk_change(), free_super(), get_super(), I_MAP_SLOTS, lock_super(), NR_SUPER, NULL, super_block::s_dev, super_block::s_dirt, super_block::s_imap, super_block::s_imap_blocks, super_block::s_imount, super_block::s_isup, super_block::s_magic, super_block::s_rd_only, super_block::s_time, super_block::s_zmap, super_block::s_zmap_blocks, super_block, SUPER_MAGIC, and Z_MAP_SLOTS.

Referenced by mount_root(), and sys_mount().

int sync_dev ( int dev )

Definition at line 62 of file buffer.c.

int sys_mount | ( | char * | dev_name,
 |  | char * | dir_name,
 |  | int | rw_flag
 | ) |

Definition at line 200 of file super.c.

References EBUSY, ENOENT, EPERM, m_inode::i_count, m_inode::i_dirt, m_inode::i_mode, m_inode::i_mount, m_inode::i_num, m_inode::i_zone, iput(), namei(), read_super(), ROOT_INO, super_block::s_imount, S_ISBLK, S_ISDIR, and super_block.

int sys_umount ( char * dev_name )

Definition at line 167 of file super.c.

References EBUSY, ENOENT, ENOTBLK, get_super(), m_inode::i_count, m_inode::i_dev, m_inode::i_mode, m_inode::i_mount, m_inode::i_zone, inode_table, iput(), namei(), NR_INODE, NULL, printk(), put_super(), ROOT_DEV, super_block::s_imount, S_ISBLK, super_block::s_isup, super_block, and sync_dev().

void wait_for_keypress ( void )

Definition at line 140 of file tty_io.c.

References sleep_if_empty(), and tty_table.

Referenced by mount_root().

static void wait_on_super ( struct super_block * sb ) [static]

Definition at line 48 of file super.c.

References cli, sleep_on(), and sti.

Referenced by get_super().

Variable Documentation

int ROOT_DEV = 0

Definition at line 29 of file super.c.

Referenced by main(), mount_root(), put_super(), rd_load(), and sys_umount().

struct super_block super_block[NR_SUPER]

Definition at line 27 of file super.c.

Referenced by get_super(), mount_root(), put_super(), read_super(), sys_mount(), and sys_umount().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/truncate.c File Reference

truncate.c File Reference

#include <linux/sched.h>
#include <sys/stat.h>

Go to the source code of this file.

Functions

static void | free_ind (int dev, int block)
static void | free_dind (int dev, int block)
void | truncate (struct m_inode *inode)

Function Documentation

static void free_dind | ( | int | dev,
 |  | int | block
 | ) | [static]

Definition at line 29 of file truncate.c.

References buffer_head::b_data, bread(), brelse(), free_block(), and free_ind().

Referenced by truncate().

static void free_ind | ( | int | dev,
 |  | int | block
 | ) | [static]

Definition at line 11 of file truncate.c.

References buffer_head::b_data, bread(), brelse(), and free_block().

Referenced by free_dind(), and truncate().

void truncate ( struct m_inode * inode )

Definition at line 47 of file truncate.c.

References CURRENT_TIME, free_block(), free_dind(), free_ind(), S_ISDIR, and S_ISREG.

Referenced by iput(), and open_namei().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/a.out.h File Reference

a.out.h File Reference

Go to the source code of this file.

Defines

#define | __GNU_EXEC_MACROS__
#define | N_MAGIC(exec) ((exec).a_magic)
#define | OMAGIC 0407
#define | NMAGIC 0410
#define | ZMAGIC 0413
#define | N_BADMAG(x)
#define | _N_BADMAG(x)
#define | _N_HDROFF(x) (SEGMENT_SIZE - sizeof (struct exec))
#define | N_TXTOFF(x) (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : sizeof (struct exec))
#define | N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
#define | N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
#define | N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
#define | N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
#define | N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
#define | N_TXTADDR(x) 0
#define | PAGE_SIZE 4096
#define | SEGMENT_SIZE 1024
#define | _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
#define | _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
#define | N_DATADDR(x)
#define | N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
#define | N_UNDF 0
#define | N_ABS 2
#define | N_TEXT 4
#define | N_DATA 6
#define | N_BSS 8
#define | N_COMM 18
#define | N_FN 15
#define | N_EXT 1
#define | N_TYPE 036
#define | N_STAB 0340
#define | N_INDR 0xa
#define | N_SETA 0x14
#define | N_SETT 0x16
#define | N_SETD 0x18
#define | N_SETB 0x1A
#define | N_SETV 0x1C

Define Documentation

#define __GNU_EXEC_MACROS__

Definition at line 4 of file a.out.h.

#define _N_BADMAG ( x )

Value:

(N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC       \
  && N_MAGIC(x) != ZMAGIC)

Definition at line 36 of file a.out.h.

#define _N_HDROFF ( x ) (SEGMENT_SIZE - sizeof (struct exec))

Definition at line 40 of file a.out.h.

#define _N_SEGMENT_ROUND ( x ) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))

Definition at line 95 of file a.out.h.

#define _N_TXTENDADDR ( x ) (N_TXTADDR(x)+(x).a_text)

Definition at line 97 of file a.out.h.

#define N_ABS 2

Definition at line 128 of file a.out.h.

#define N_BADMAG ( x )

Value:

(N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC       \
  && N_MAGIC(x) != ZMAGIC)

Definition at line 31 of file a.out.h.

#define N_BSS 8

Definition at line 137 of file a.out.h.

#define N_BSSADDR ( x ) (N_DATADDR(x) + (x).a_data)

Definition at line 107 of file a.out.h.

#define N_COMM 18

Definition at line 140 of file a.out.h.

#define N_DATA 6

Definition at line 134 of file a.out.h.

#define N_DATADDR ( x )

Value:

(N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
     : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))

Definition at line 100 of file a.out.h.

#define N_DATOFF ( x ) (N_TXTOFF(x) + (x).a_text)

Definition at line 48 of file a.out.h.

#define N_DRELOFF ( x ) (N_TRELOFF(x) + (x).a_trsize)

Definition at line 56 of file a.out.h.

#define N_EXT 1

Definition at line 147 of file a.out.h.

#define N_FN 15

Definition at line 143 of file a.out.h.

#define N_INDR 0xa

Definition at line 164 of file a.out.h.

#define N_MAGIC ( exec ) ((exec).a_magic)

Definition at line 18 of file a.out.h.

Referenced by do_execve().

#define N_SETA 0x14

Definition at line 178 of file a.out.h.

#define N_SETB 0x1A

Definition at line 181 of file a.out.h.

#define N_SETD 0x18

Definition at line 180 of file a.out.h.

#define N_SETT 0x16

Definition at line 179 of file a.out.h.

#define N_SETV 0x1C

Definition at line 184 of file a.out.h.

#define N_STAB 0340

Definition at line 153 of file a.out.h.

#define N_STROFF ( x ) (N_SYMOFF(x) + (x).a_syms)

Definition at line 64 of file a.out.h.

#define N_SYMOFF ( x ) (N_DRELOFF(x) + (x).a_drsize)

Definition at line 60 of file a.out.h.

#define N_TEXT 4

Definition at line 131 of file a.out.h.

#define N_TRELOFF ( x ) (N_DATOFF(x) + (x).a_data)

Definition at line 52 of file a.out.h.

#define N_TXTADDR ( x ) 0

Definition at line 69 of file a.out.h.

#define N_TXTOFF ( x ) (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : sizeof (struct exec))

Definition at line 43 of file a.out.h.

Referenced by do_execve().

#define N_TYPE 036

Definition at line 150 of file a.out.h.

#define N_UNDF 0

Definition at line 125 of file a.out.h.

#define NMAGIC 0410

Definition at line 25 of file a.out.h.

#define OMAGIC 0407

Definition at line 23 of file a.out.h.

#define PAGE_SIZE 4096

Definition at line 92 of file a.out.h.

Referenced by change_ldt(), copy_process(), copy_strings(), do_execve(), init_bucket_desc(), malloc(), read_pipe(), and write_pipe().

#define SEGMENT_SIZE 1024

Definition at line 93 of file a.out.h.

#define ZMAGIC 0413

Definition at line 27 of file a.out.h.

Referenced by do_execve().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/const.h File Reference

const.h File Reference

Go to the source code of this file.

Defines

#define | BUFFER_END 0x200000
#define | I_TYPE 0170000
#define | I_DIRECTORY 0040000
#define | I_REGULAR 0100000
#define | I_BLOCK_SPECIAL 0060000
#define | I_CHAR_SPECIAL 0020000
#define | I_NAMED_PIPE 0010000
#define | I_SET_UID_BIT 0004000
#define | I_SET_GID_BIT 0002000

Define Documentation

#define BUFFER_END 0x200000

Definition at line 4 of file const.h.

#define I_BLOCK_SPECIAL 0060000

Definition at line 9 of file const.h.

#define I_CHAR_SPECIAL 0020000

Definition at line 10 of file const.h.

#define I_DIRECTORY 0040000

Definition at line 7 of file const.h.

Referenced by sys_mkdir().

#define I_NAMED_PIPE 0010000

Definition at line 11 of file const.h.

#define I_REGULAR 0100000

Definition at line 8 of file const.h.

Referenced by open_namei().

#define I_SET_GID_BIT 0002000

Definition at line 13 of file const.h.

#define I_SET_UID_BIT 0004000

Definition at line 12 of file const.h.

#define I_TYPE 0170000

Definition at line 6 of file const.h.

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/ctype.h File Reference

ctype.h File Reference

Go to the source code of this file.

Defines

#define | _U 0x01
#define | _L 0x02
#define | _D 0x04
#define | _C 0x08
#define | _P 0x10
#define | _S 0x20
#define | _X 0x40
#define | _SP 0x80
#define | isalnum(c) ((_ctype+1)[c]&(_U|_L|_D))
#define | isalpha(c) ((_ctype+1)[c]&(_U|_L))
#define | iscntrl(c) ((_ctype+1)[c]&(_C))
#define | isdigit(c) ((_ctype+1)[c]&(_D))
#define | isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D))
#define | islower(c) ((_ctype+1)[c]&(_L))
#define | isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP))
#define | ispunct(c) ((_ctype+1)[c]&(_P))
#define | isspace(c) ((_ctype+1)[c]&(_S))
#define | isupper(c) ((_ctype+1)[c]&(_U))
#define | isxdigit(c) ((_ctype+1)[c]&(_D|_X))
#define | isascii(c) (((unsigned) c)<=0x7f)
#define | toascii(c) (((unsigned) c)&0x7f)
#define | tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
#define | toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)

Variables

unsigned char | _ctype []
char | _ctmp

Define Documentation

#define _C 0x08

Definition at line 7 of file ctype.h.

#define _D 0x04

Definition at line 6 of file ctype.h.

#define _L 0x02

Definition at line 5 of file ctype.h.

#define _P 0x10

Definition at line 8 of file ctype.h.

#define _S 0x20

Definition at line 9 of file ctype.h.

#define _SP 0x80

Definition at line 11 of file ctype.h.

#define _U 0x01

Definition at line 4 of file ctype.h.

#define _X 0x40

Definition at line 10 of file ctype.h.

#define isalnum ( c ) ((_ctype+1)[c]&(_U|_L|_D))

Definition at line 16 of file ctype.h.

#define isalpha ( c ) ((_ctype+1)[c]&(_U|_L))

Definition at line 17 of file ctype.h.

#define isascii ( c ) (((unsigned) c)<=0x7f)

Definition at line 28 of file ctype.h.

#define iscntrl ( c ) ((_ctype+1)[c]&(_C))

Definition at line 18 of file ctype.h.

#define isdigit ( c ) ((_ctype+1)[c]&(_D))

Definition at line 19 of file ctype.h.

#define isgraph ( c ) ((_ctype+1)[c]&(_P|_U|_L|_D))

Definition at line 20 of file ctype.h.

#define islower ( c ) ((_ctype+1)[c]&(_L))

Definition at line 21 of file ctype.h.

#define isprint ( c ) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP))

Definition at line 22 of file ctype.h.

#define ispunct ( c ) ((_ctype+1)[c]&(_P))

Definition at line 23 of file ctype.h.

#define isspace ( c ) ((_ctype+1)[c]&(_S))

Definition at line 24 of file ctype.h.

#define isupper ( c ) ((_ctype+1)[c]&(_U))

Definition at line 25 of file ctype.h.

#define isxdigit ( c ) ((_ctype+1)[c]&(_D|_X))

Definition at line 26 of file ctype.h.

#define toascii ( c ) (((unsigned) c)&0x7f)

Definition at line 29 of file ctype.h.

#define tolower ( c ) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)

Definition at line 31 of file ctype.h.

Referenced by copy_to_cooked().

#define toupper ( c ) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)

Definition at line 32 of file ctype.h.

Referenced by tty_write().

Variable Documentation

char _ctmp

Definition at line 9 of file ctype.c.

unsigned char _ctype[]

Definition at line 10 of file ctype.c.

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/errno.h File Reference

errno.h File Reference

Go to the source code of this file.

Defines

#define | ERROR 99
#define | EPERM 1
#define | ENOENT 2
#define | ESRCH 3
#define | EINTR 4
#define | EIO 5
#define | ENXIO 6
#define | E2BIG 7
#define | ENOEXEC 8
#define | EBADF 9
#define | ECHILD 10
#define | EAGAIN 11
#define | ENOMEM 12
#define | EACCES 13
#define | EFAULT 14
#define | ENOTBLK 15
#define | EBUSY 16
#define | EEXIST 17
#define | EXDEV 18
#define | ENODEV 19
#define | ENOTDIR 20
#define | EISDIR 21
#define | EINVAL 22
#define | ENFILE 23
#define | EMFILE 24
#define | ENOTTY 25
#define | ETXTBSY 26
#define | EFBIG 27
#define | ENOSPC 28
#define | ESPIPE 29
#define | EROFS 30
#define | EMLINK 31
#define | EPIPE 32
#define | EDOM 33
#define | ERANGE 34
#define | EDEADLK 35
#define | ENAMETOOLONG 36
#define | ENOLCK 37
#define | ENOSYS 38
#define | ENOTEMPTY 39

Variables

int | errno

Define Documentation

#define E2BIG 7

Definition at line 26 of file errno.h.

#define EACCES 13

Definition at line 32 of file errno.h.

Referenced by do_execve(), open_namei(), sys_access(), sys_chmod(), sys_chown(), and sys_link().

#define EAGAIN 11

Definition at line 30 of file errno.h.

Referenced by copy_process(), and find_empty_process().

#define EBADF 9

Definition at line 28 of file errno.h.

Referenced by dupfd(), sys_fcntl(), sys_fstat(), sys_ioctl(), and sys_lseek().

#define EBUSY 16

Definition at line 35 of file errno.h.

Referenced by sys_mount(), and sys_umount().

#define ECHILD 10

Definition at line 29 of file errno.h.

Referenced by sys_waitpid().

#define EDEADLK 35

Definition at line 54 of file errno.h.

#define EDOM 33

Definition at line 52 of file errno.h.

#define EEXIST 17

Definition at line 36 of file errno.h.

Referenced by open_namei(), sys_link(), sys_mkdir(), and sys_mknod().

#define EFAULT 14

Definition at line 33 of file errno.h.

#define EFBIG 27

Definition at line 46 of file errno.h.

#define EINTR 4

Definition at line 23 of file errno.h.

Referenced by sys_waitpid(), and tty_read().

#define EINVAL 22

Definition at line 41 of file errno.h.

Referenced by dupfd(), send_sig(), sys_close(), sys_ioctl(), sys_lseek(), sys_open(), sys_read(), sys_write(), and tty_ioctl().

#define EIO 5

Definition at line 24 of file errno.h.

Referenced by block_read(), block_write(), rw_kmem(), rw_mem(), rw_memory(), rw_ram(), sys_read(), and sys_write().

#define EISDIR 21

Definition at line 40 of file errno.h.

Referenced by open_namei().

#define EMFILE 24

Definition at line 43 of file errno.h.

Referenced by dupfd().

#define EMLINK 31

Definition at line 50 of file errno.h.

#define ENAMETOOLONG 36

Definition at line 55 of file errno.h.

#define ENFILE 23

Definition at line 42 of file errno.h.

#define ENODEV 19

Definition at line 38 of file errno.h.

Referenced by rw_char(), and sys_ioctl().

#define ENOENT 2

Definition at line 21 of file errno.h.

Referenced by do_execve(), open_namei(), sys_chdir(), sys_chmod(), sys_chown(), sys_chroot(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), sys_rmdir(), sys_stat(), sys_umount(), sys_unlink(), and sys_utime().

#define ENOEXEC 8

Definition at line 27 of file errno.h.

Referenced by do_execve().

#define ENOLCK 37

Definition at line 56 of file errno.h.

#define ENOMEM 12

Definition at line 31 of file errno.h.

Referenced by copy_mem(), and do_execve().

#define ENOSPC 28

Definition at line 47 of file errno.h.

Referenced by open_namei(), sys_link(), sys_mkdir(), and sys_mknod().

#define ENOSYS 38

Definition at line 57 of file errno.h.

Referenced by sys_acct(), sys_break(), sys_ftime(), sys_gtty(), sys_lock(), sys_mpx(), sys_phys(), sys_prof(), sys_ptrace(), sys_rename(), sys_stty(), sys_ulimit(), and sys_ustat().

#define ENOTBLK 15

Definition at line 34 of file errno.h.

Referenced by sys_umount().

#define ENOTDIR 20

Definition at line 39 of file errno.h.

Referenced by sys_chdir(), sys_chroot(), and sys_rmdir().

#define ENOTEMPTY 39

Definition at line 58 of file errno.h.

Referenced by sys_rmdir().

#define ENOTTY 25

Definition at line 44 of file errno.h.

Referenced by sys_ioctl().

#define ENXIO 6

Definition at line 25 of file errno.h.

#define EPERM 1

Definition at line 20 of file errno.h.

Referenced by open_namei(), rw_tty(), send_sig(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), sys_open(), sys_rmdir(), sys_setpgid(), sys_setregid(), sys_setreuid(), sys_setsid(), sys_stime(), and sys_unlink().

#define EPIPE 32

Definition at line 51 of file errno.h.

#define ERANGE 34

Definition at line 53 of file errno.h.

#define EROFS 30

Definition at line 49 of file errno.h.

#define ERROR 99

Definition at line 19 of file errno.h.

Referenced by file_read(), sys_mkdir(), and sys_uname().

#define ESPIPE 29

Definition at line 48 of file errno.h.

Referenced by sys_lseek().

#define ESRCH 3

Definition at line 22 of file errno.h.

Referenced by sys_setpgid().

#define ETXTBSY 26

Definition at line 45 of file errno.h.

#define EXDEV 18

Definition at line 37 of file errno.h.

Referenced by sys_link().

Variable Documentation

int errno

Definition at line 7 of file errno.c.

Referenced by open().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/fcntl.h File Reference

fcntl.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Defines

#define | O_ACCMODE 00003
#define | O_RDONLY 00
#define | O_WRONLY 01
#define | O_RDWR 02
#define | O_CREAT 00100
#define | O_EXCL 00200
#define | O_NOCTTY 00400
#define | O_TRUNC 01000
#define | O_APPEND 02000
#define | O_NONBLOCK 04000
#define | O_NDELAY O_NONBLOCK
#define | F_DUPFD 0
#define | F_GETFD 1
#define | F_SETFD 2
#define | F_GETFL 3
#define | F_SETFL 4
#define | F_GETLK 5
#define | F_SETLK 6
#define | F_SETLKW 7
#define | FD_CLOEXEC 1
#define | F_RDLCK 0
#define | F_WRLCK 1
#define | F_UNLCK 2

Functions

int | creat (const char *filename, mode_t mode)
int | fcntl (int fildes, int cmd,...)
int | open (const char *filename, int flags,...)

Define Documentation

#define F_DUPFD 0

Definition at line 23 of file fcntl.h.

Referenced by sys_fcntl().

#define F_GETFD 1

Definition at line 24 of file fcntl.h.

Referenced by sys_fcntl().

#define F_GETFL 3

Definition at line 26 of file fcntl.h.

Referenced by sys_fcntl().

#define F_GETLK 5

Definition at line 28 of file fcntl.h.

Referenced by sys_fcntl().

#define F_RDLCK 0

Definition at line 38 of file fcntl.h.

#define F_SETFD 2

Definition at line 25 of file fcntl.h.

Referenced by sys_fcntl().

#define F_SETFL 4

Definition at line 27 of file fcntl.h.

Referenced by sys_fcntl().

#define F_SETLK 6

Definition at line 29 of file fcntl.h.

Referenced by sys_fcntl().

#define F_SETLKW 7

Definition at line 30 of file fcntl.h.

Referenced by sys_fcntl().

#define F_UNLCK 2

Definition at line 40 of file fcntl.h.

#define F_WRLCK 1

Definition at line 39 of file fcntl.h.

#define FD_CLOEXEC 1

Definition at line 33 of file fcntl.h.

#define O_ACCMODE 00003

Definition at line 7 of file fcntl.h.

Referenced by open_namei().

#define O_APPEND 02000

Definition at line 15 of file fcntl.h.

Referenced by file_write(), and sys_fcntl().

#define O_CREAT 00100

Definition at line 11 of file fcntl.h.

Referenced by open_namei(), and sys_creat().

#define O_EXCL 00200

Definition at line 12 of file fcntl.h.

Referenced by open_namei().

#define O_NDELAY O_NONBLOCK

Definition at line 17 of file fcntl.h.

#define O_NOCTTY 00400

Definition at line 13 of file fcntl.h.

#define O_NONBLOCK 04000

Definition at line 16 of file fcntl.h.

Referenced by sys_fcntl().

#define O_RDONLY 00

Definition at line 8 of file fcntl.h.

Referenced by init(), and main().

#define O_RDWR 02

Definition at line 10 of file fcntl.h.

Referenced by init().

#define O_TRUNC 01000

Definition at line 14 of file fcntl.h.

Referenced by open_namei(), and sys_creat().

#define O_WRONLY 01

Definition at line 9 of file fcntl.h.

Referenced by open_namei().

Function Documentation

int creat | ( | const char * | filename,
 |  | mode_t | mode
 | ) |

int fcntl | ( | int | fildes,
 |  | int | cmd,
 |  |  | ...
 | ) |

int open | ( | const char * | filename,
 |  | int | flags,
 |  |  | ...
 | ) |

Definition at line 11 of file open.c.

Referenced by init(), and main().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/signal.h File Reference

signal.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Defines

#define | _NSIG 32
#define | NSIG _NSIG
#define | SIGHUP 1
#define | SIGINT 2
#define | SIGQUIT 3
#define | SIGILL 4
#define | SIGTRAP 5
#define | SIGABRT 6
#define | SIGIOT 6
#define | SIGUNUSED 7
#define | SIGFPE 8
#define | SIGKILL 9
#define | SIGUSR1 10
#define | SIGSEGV 11
#define | SIGUSR2 12
#define | SIGPIPE 13
#define | SIGALRM 14
#define | SIGTERM 15
#define | SIGSTKFLT 16
#define | SIGCHLD 17
#define | SIGCONT 18
#define | SIGSTOP 19
#define | SIGTSTP 20
#define | SIGTTIN 21
#define | SIGTTOU 22
#define | SA_NOCLDSTOP 1
#define | SA_NOMASK 0x40000000
#define | SA_ONESHOT 0x80000000
#define | SIG_BLOCK 0
#define | SIG_UNBLOCK 1
#define | SIG_SETMASK 2
#define | SIG_DFL ((void (*)(int))0)
#define | SIG_IGN ((void (*)(int))1)

Typedefs

typedef int | sig_atomic_t
typedef unsigned int | sigset_t

Functions

int | raise (int sig)
int | kill (pid_t pid, int sig)
int | sigaddset (sigset_t *mask, int signo)
int | sigdelset (sigset_t *mask, int signo)
int | sigemptyset (sigset_t *mask)
int | sigfillset (sigset_t *mask)
int | sigismember (sigset_t *mask, int signo)
int | sigpending (sigset_t *set)
int | sigprocmask (int how, sigset_t *set, sigset_t *oldset)
int | sigsuspend (sigset_t *sigmask)
int | sigaction (int sig, struct sigaction *act, struct sigaction *oldact)

Variables

void(*)(int) | signal (int _sig, void(*_func)(int))

Define Documentation

#define _NSIG 32

Definition at line 9 of file signal.h.

#define NSIG _NSIG

Definition at line 10 of file signal.h.

#define SA_NOCLDSTOP 1

Definition at line 37 of file signal.h.

#define SA_NOMASK 0x40000000

Definition at line 38 of file signal.h.

Referenced by do_signal(), sys_sigaction(), and sys_signal().

#define SA_ONESHOT 0x80000000

Definition at line 39 of file signal.h.

Referenced by do_signal(), and sys_signal().

#define SIG_BLOCK 0

Definition at line 41 of file signal.h.

#define SIG_DFL ((void (*)(int))0)

Definition at line 45 of file signal.h.

#define SIG_IGN ((void (*)(int))1)

Definition at line 46 of file signal.h.

#define SIG_SETMASK 2

Definition at line 43 of file signal.h.

#define SIG_UNBLOCK 1

Definition at line 42 of file signal.h.

#define SIGABRT 6

Definition at line 17 of file signal.h.

#define SIGALRM 14

Definition at line 26 of file signal.h.

Referenced by schedule().

#define SIGCHLD 17

Definition at line 29 of file signal.h.

Referenced by do_exit(), do_signal(), sys_waitpid(), and tell_father().

#define SIGCONT 18

Definition at line 30 of file signal.h.

#define SIGFPE 8

Definition at line 20 of file signal.h.

Referenced by math_emulate(), and math_error().

#define SIGHUP 1

Definition at line 12 of file signal.h.

Referenced by kill_session().

#define SIGILL 4

Definition at line 15 of file signal.h.

#define SIGINT 2

Definition at line 13 of file signal.h.

#define SIGIOT 6

Definition at line 18 of file signal.h.

#define SIGKILL 9

Definition at line 21 of file signal.h.

Referenced by sys_sigaction(), sys_signal(), and sys_ssetmask().

#define SIGPIPE 13

Definition at line 25 of file signal.h.

Referenced by write_pipe().

#define SIGQUIT 3

Definition at line 14 of file signal.h.

#define SIGSEGV 11

Definition at line 23 of file signal.h.

Referenced by do_wp_page(), and oom().

#define SIGSTKFLT 16

Definition at line 28 of file signal.h.

#define SIGSTOP 19

Definition at line 31 of file signal.h.

#define SIGTERM 15

Definition at line 27 of file signal.h.

#define SIGTRAP 5

Definition at line 16 of file signal.h.

#define SIGTSTP 20

Definition at line 32 of file signal.h.

#define SIGTTIN 21

Definition at line 33 of file signal.h.

#define SIGTTOU 22

Definition at line 34 of file signal.h.

#define SIGUNUSED 7

Definition at line 19 of file signal.h.

#define SIGUSR1 10

Definition at line 22 of file signal.h.

#define SIGUSR2 12

Definition at line 24 of file signal.h.

Typedef Documentation

typedef int sig_atomic_t

Definition at line 6 of file signal.h.

typedef unsigned int sigset_t

Definition at line 7 of file signal.h.

Function Documentation

int kill | ( | pid_t | pid,
 |  | int | sig
 | ) |

int raise ( int sig )

int sigaction | ( | int | sig,
 |  | struct sigaction * | act,
 |  | struct sigaction * | oldact
 | ) |

Referenced by save_old().

int sigaddset | ( | sigset_t * | mask,
 |  | int | signo
 | ) |

int sigdelset | ( | sigset_t * | mask,
 |  | int | signo
 | ) |

int sigemptyset ( sigset_t * mask )

int sigfillset ( sigset_t * mask )

int sigismember | ( | sigset_t * | mask,
 |  | int | signo
 | ) |

int sigpending ( sigset_t * set )

int sigprocmask | ( | int | how,
 |  | sigset_t * | set,
 |  | sigset_t * | oldset
 | ) |

int sigsuspend ( sigset_t * sigmask )

Variable Documentation

void(*)(int) signal(int _sig, void(*_func)(int))

Definition at line 55 of file signal.h.

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/stdarg.h File Reference

stdarg.h File Reference

Go to the source code of this file.

Defines

#define | __va_rounded_size(TYPE) (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#define | va_start(AP, LASTARG) (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
#define | va_end(AP)
#define | va_arg(AP, TYPE)

Typedefs

typedef char * | va_list

Functions

void | va_end (va_list)

Define Documentation

#define __va_rounded_size ( TYPE ) (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))

Definition at line 9 of file stdarg.h.

#define va_arg | ( | AP,
 |  | TYPE | )

Value:

(AP += __va_rounded_size (TYPE),                    \
  *((TYPE *) (AP - __va_rounded_size (TYPE))))

Definition at line 24 of file stdarg.h.

Referenced by breada(), open(), and vsprintf().

#define va_end ( AP )

Definition at line 22 of file stdarg.h.

Referenced by breada(), printf(), and printk().

#define va_start | ( | AP,
 |  | LASTARG | ) | (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))

Definition at line 13 of file stdarg.h.

Referenced by breada(), open(), printf(), and printk().

Typedef Documentation

typedef char* va_list

Definition at line 4 of file stdarg.h.

Function Documentation

void va_end ( va_list )

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/stddef.h File Reference

stddef.h File Reference

Go to the source code of this file.

Defines

#define | NULL ((void *)0)
#define | offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)

Typedefs

typedef long | ptrdiff_t
typedef unsigned long | size_t

Define Documentation

#define NULL ((void *)0)

Definition at line 15 of file stddef.h.

#define offsetof | ( | TYPE,
 |  | MEMBER | ) | ((size_t) &((TYPE *)0)->MEMBER)

Definition at line 17 of file stddef.h.

Typedef Documentation

typedef long ptrdiff_t

Definition at line 6 of file stddef.h.

typedef unsigned long size_t

Definition at line 11 of file stddef.h.

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/string.h File Reference

string.h File Reference

Go to the source code of this file.

Defines

#define | NULL ((void *) 0)

Typedefs

typedef unsigned int | size_t

Functions

char * | strerror (int errno)
char * | strcpy (char *dest, const char *src)
static char * | strncpy (char *dest, const char *src, int count)
char * | strcat (char *dest, const char *src)
static char * | strncat (char *dest, const char *src, int count)
int | strcmp (const char *cs, const char *ct)
static int | strncmp (const char *cs, const char *ct, int count)
static char * | strchr (const char *s, char c)
static char * | strrchr (const char *s, char c)
int | strspn (const char *cs, const char *ct)
int | strcspn (const char *cs, const char *ct)
char * | strpbrk (const char *cs, const char *ct)
char * | strstr (const char *cs, const char *ct)
int | strlen (const char *s)
char * | strtok (char *s, const char *ct)
static void * | memcpy (void *dest, const void *src, int n)
void * | memmove (void *dest, const void *src, int n)
static int | memcmp (const void *cs, const void *ct, int count)
void * | memchr (const void *cs, char c, int count)
static void * | memset (void *s, char c, int count)

Variables

char * | ___strtok

Define Documentation

#define NULL ((void *) 0)

Definition at line 5 of file string.h.

Typedef Documentation

typedef unsigned int size_t

Definition at line 10 of file string.h.

Function Documentation

void* memchr | ( | const void * | cs,
 |  | char | c,
 |  | int | count
 | ) | [inline]

Definition at line 379 of file string.h.

References NULL.

static int memcmp | ( | const void * | cs,
 |  | const void * | ct,
 |  | int | count
 | ) | [inline, static]

Definition at line 363 of file string.h.

static void* memcpy | ( | void * | dest,
 |  | const void * | src,
 |  | int | n
 | ) | [inline, static]

Definition at line 336 of file string.h.

void* memmove | ( | void * | dest,
 |  | const void * | src,
 |  | int | n
 | ) | [inline]

Definition at line 346 of file string.h.

static void* memset | ( | void * | s,
 |  | char | c,
 |  | int | count
 | ) | [inline, static]

Definition at line 395 of file string.h.

Referenced by free_inode(), and get_empty_inode().

char* strcat | ( | char * | dest,
 |  | const char * | src
 | ) | [inline]

Definition at line 54 of file string.h.

static char* strchr | ( | const char * | s,
 |  | char | c
 | ) | [inline, static]

Definition at line 128 of file string.h.

Referenced by do_execve().

int strcmp | ( | const char * | cs,
 |  | const char * | ct
 | ) | [inline]

Definition at line 88 of file string.h.

Referenced by empty_dir(), and main().

char* strcpy | ( | char * | dest,
 |  | const char * | src
 | ) | [inline]

Definition at line 27 of file string.h.

Referenced by sys_mkdir().

int strcspn | ( | const char * | cs,
 |  | const char * | ct
 | ) | [inline]

Definition at line 185 of file string.h.

char* strerror ( int errno )

int strlen ( const char * s ) [inline]

Definition at line 263 of file string.h.

Referenced by vsprintf().

static char* strncat | ( | char * | dest,
 |  | const char * | src,
 |  | int | count
 | ) | [inline, static]

Definition at line 68 of file string.h.

static int strncmp | ( | const char * | cs,
 |  | const char * | ct,
 |  | int | count
 | ) | [inline, static]

Definition at line 107 of file string.h.

static char* strncpy | ( | char * | dest,
 |  | const char * | src,
 |  | int | count
 | ) | [inline, static]

Definition at line 38 of file string.h.

Referenced by do_execve().

char* strpbrk | ( | const char * | cs,
 |  | const char * | ct
 | ) | [inline]

Definition at line 209 of file string.h.

static char* strrchr | ( | const char * | s,
 |  | char | c
 | ) | [inline, static]

Definition at line 145 of file string.h.

int strspn | ( | const char * | cs,
 |  | const char * | ct
 | ) | [inline]

Definition at line 161 of file string.h.

char* strstr | ( | const char * | cs,
 |  | const char * | ct
 | ) | [inline]

Definition at line 236 of file string.h.

char* strtok | ( | char * | s,
 |  | const char * | ct
 | ) | [inline]

Definition at line 277 of file string.h.

References ___strtok.

Variable Documentation

char* ___strtok

Referenced by strtok().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/termios.h File Reference

termios.h File Reference

Go to the source code of this file.

Defines

#define | TTY_BUF_SIZE 1024
#define | TCGETS 0x5401
#define | TCSETS 0x5402
#define | TCSETSW 0x5403
#define | TCSETSF 0x5404
#define | TCGETA 0x5405
#define | TCSETA 0x5406
#define | TCSETAW 0x5407
#define | TCSETAF 0x5408
#define | TCSBRK 0x5409
#define | TCXONC 0x540A
#define | TCFLSH 0x540B
#define | TIOCEXCL 0x540C
#define | TIOCNXCL 0x540D
#define | TIOCSCTTY 0x540E
#define | TIOCGPGRP 0x540F
#define | TIOCSPGRP 0x5410
#define | TIOCOUTQ 0x5411
#define | TIOCSTI 0x5412
#define | TIOCGWINSZ 0x5413
#define | TIOCSWINSZ 0x5414
#define | TIOCMGET 0x5415
#define | TIOCMBIS 0x5416
#define | TIOCMBIC 0x5417
#define | TIOCMSET 0x5418
#define | TIOCGSOFTCAR 0x5419
#define | TIOCSSOFTCAR 0x541A
#define | TIOCINQ 0x541B
#define | NCC 8
#define | NCCS 17
#define | VINTR 0
#define | VQUIT 1
#define | VERASE 2
#define | VKILL 3
#define | VEOF 4
#define | VTIME 5
#define | VMIN 6
#define | VSWTC 7
#define | VSTART 8
#define | VSTOP 9
#define | VSUSP 10
#define | VEOL 11
#define | VREPRINT 12
#define | VDISCARD 13
#define | VWERASE 14
#define | VLNEXT 15
#define | VEOL2 16
#define | IGNBRK 0000001
#define | BRKINT 0000002
#define | IGNPAR 0000004
#define | PARMRK 0000010
#define | INPCK 0000020
#define | ISTRIP 0000040
#define | INLCR 0000100
#define | IGNCR 0000200
#define | ICRNL 0000400
#define | IUCLC 0001000
#define | IXON 0002000
#define | IXANY 0004000
#define | IXOFF 0010000
#define | IMAXBEL 0020000
#define | OPOST 0000001
#define | OLCUC 0000002
#define | ONLCR 0000004
#define | OCRNL 0000010
#define | ONOCR 0000020
#define | ONLRET 0000040
#define | OFILL 0000100
#define | OFDEL 0000200
#define | NLDLY 0000400
#define | NL0 0000000
#define | NL1 0000400
#define | CRDLY 0003000
#define | CR0 0000000
#define | CR1 0001000
#define | CR2 0002000
#define | CR3 0003000
#define | TABDLY 0014000
#define | TAB0 0000000
#define | TAB1 0004000
#define | TAB2 0010000
#define | TAB3 0014000
#define | XTABS 0014000
#define | BSDLY 0020000
#define | BS0 0000000
#define | BS1 0020000
#define | VTDLY 0040000
#define | VT0 0000000
#define | VT1 0040000
#define | FFDLY 0040000
#define | FF0 0000000
#define | FF1 0040000
#define | CBAUD 0000017
#define | B0 0000000
#define | B50 0000001
#define | B75 0000002
#define | B110 0000003
#define | B134 0000004
#define | B150 0000005
#define | B200 0000006
#define | B300 0000007
#define | B600 0000010
#define | B1200 0000011
#define | B1800 0000012
#define | B2400 0000013
#define | B4800 0000014
#define | B9600 0000015
#define | B19200 0000016
#define | B38400 0000017
#define | EXTA B19200
#define | EXTB B38400
#define | CSIZE 0000060
#define | CS5 0000000
#define | CS6 0000020
#define | CS7 0000040
#define | CS8 0000060
#define | CSTOPB 0000100
#define | CREAD 0000200
#define | CPARENB 0000400
#define | CPARODD 0001000
#define | HUPCL 0002000
#define | CLOCAL 0004000
#define | CIBAUD 03600000
#define | CRTSCTS 020000000000
#define | PARENB CPARENB
#define | PARODD CPARODD
#define | ISIG 0000001
#define | ICANON 0000002
#define | XCASE 0000004
#define | ECHO 0000010
#define | ECHOE 0000020
#define | ECHOK 0000040
#define | ECHONL 0000100
#define | NOFLSH 0000200
#define | TOSTOP 0000400
#define | ECHOCTL 0001000
#define | ECHOPRT 0002000
#define | ECHOKE 0004000
#define | FLUSHO 0010000
#define | PENDIN 0040000
#define | IEXTEN 0100000
#define | TIOCM_LE 0x001
#define | TIOCM_DTR 0x002
#define | TIOCM_RTS 0x004
#define | TIOCM_ST 0x008
#define | TIOCM_SR 0x010
#define | TIOCM_CTS 0x020
#define | TIOCM_CAR 0x040
#define | TIOCM_RNG 0x080
#define | TIOCM_DSR 0x100
#define | TIOCM_CD TIOCM_CAR
#define | TIOCM_RI TIOCM_RNG
#define | TCOOFF 0
#define | TCOON 1
#define | TCIOFF 2
#define | TCION 3
#define | TCIFLUSH 0
#define | TCOFLUSH 1
#define | TCIOFLUSH 2
#define | TCSANOW 0
#define | TCSADRAIN 1
#define | TCSAFLUSH 2

Typedefs

typedef int | speed_t

Functions

speed_t | cfgetispeed (struct termios *termios_p)
speed_t | cfgetospeed (struct termios *termios_p)
int | cfsetispeed (struct termios *termios_p, speed_t speed)
int | cfsetospeed (struct termios *termios_p, speed_t speed)
int | tcdrain (int fildes)
int | tcflow (int fildes, int action)
int | tcflush (int fildes, int queue_selector)
int | tcgetattr (int fildes, struct termios *termios_p)
int | tcsendbreak (int fildes, int duration)
int | tcsetattr (int fildes, int optional_actions, struct termios *termios_p)

Define Documentation

#define B0 0000000

Definition at line 133 of file termios.h.

#define B110 0000003

Definition at line 136 of file termios.h.

#define B1200 0000011

Definition at line 142 of file termios.h.

#define B134 0000004

Definition at line 137 of file termios.h.

#define B150 0000005

Definition at line 138 of file termios.h.

#define B1800 0000012

Definition at line 143 of file termios.h.

#define B19200 0000016

Definition at line 147 of file termios.h.

#define B200 0000006

Definition at line 139 of file termios.h.

#define B2400 0000013

Definition at line 144 of file termios.h.

#define B300 0000007

Definition at line 140 of file termios.h.

#define B38400 0000017

Definition at line 148 of file termios.h.

#define B4800 0000014

Definition at line 145 of file termios.h.

#define B50 0000001

Definition at line 134 of file termios.h.

#define B600 0000010

Definition at line 141 of file termios.h.

#define B75 0000002

Definition at line 135 of file termios.h.

#define B9600 0000015

Definition at line 146 of file termios.h.

#define BRKINT 0000002

Definition at line 84 of file termios.h.

#define BS0 0000000

Definition at line 122 of file termios.h.

#define BS1 0020000

Definition at line 123 of file termios.h.

#define BSDLY 0020000

Definition at line 121 of file termios.h.

#define CBAUD 0000017

Definition at line 132 of file termios.h.

Referenced by change_speed().

#define CIBAUD 03600000

Definition at line 162 of file termios.h.

#define CLOCAL 0004000

Definition at line 161 of file termios.h.

#define CPARENB 0000400

Definition at line 158 of file termios.h.

#define CPARODD 0001000

Definition at line 159 of file termios.h.

#define CR0 0000000

Definition at line 111 of file termios.h.

#define CR1 0001000

Definition at line 112 of file termios.h.

#define CR2 0002000

Definition at line 113 of file termios.h.

#define CR3 0003000

Definition at line 114 of file termios.h.

#define CRDLY 0003000

Definition at line 110 of file termios.h.

#define CREAD 0000200

Definition at line 157 of file termios.h.

#define CRTSCTS 020000000000

Definition at line 163 of file termios.h.

#define CS5 0000000

Definition at line 152 of file termios.h.

#define CS6 0000020

Definition at line 153 of file termios.h.

#define CS7 0000040

Definition at line 154 of file termios.h.

#define CS8 0000060

Definition at line 155 of file termios.h.

#define CSIZE 0000060

Definition at line 151 of file termios.h.

#define CSTOPB 0000100

Definition at line 156 of file termios.h.

#define ECHO 0000010

Definition at line 172 of file termios.h.

#define ECHOCTL 0001000

Definition at line 178 of file termios.h.

#define ECHOE 0000020

Definition at line 173 of file termios.h.

#define ECHOK 0000040

Definition at line 174 of file termios.h.

#define ECHOKE 0004000

Definition at line 180 of file termios.h.

#define ECHONL 0000100

Definition at line 175 of file termios.h.

#define ECHOPRT 0002000

Definition at line 179 of file termios.h.

#define EXTA B19200

Definition at line 149 of file termios.h.

#define EXTB B38400

Definition at line 150 of file termios.h.

#define FF0 0000000

Definition at line 128 of file termios.h.

#define FF1 0040000

Definition at line 129 of file termios.h.

#define FFDLY 0040000

Definition at line 127 of file termios.h.

#define FLUSHO 0010000

Definition at line 181 of file termios.h.

#define HUPCL 0002000

Definition at line 160 of file termios.h.

#define ICANON 0000002

Definition at line 170 of file termios.h.

#define ICRNL 0000400

Definition at line 91 of file termios.h.

#define IEXTEN 0100000

Definition at line 183 of file termios.h.

#define IGNBRK 0000001

Definition at line 83 of file termios.h.

#define IGNCR 0000200

Definition at line 90 of file termios.h.

#define IGNPAR 0000004

Definition at line 85 of file termios.h.

#define IMAXBEL 0020000

Definition at line 96 of file termios.h.

#define INLCR 0000100

Definition at line 89 of file termios.h.

#define INPCK 0000020

Definition at line 87 of file termios.h.

#define ISIG 0000001

Definition at line 169 of file termios.h.

#define ISTRIP 0000040

Definition at line 88 of file termios.h.

#define IUCLC 0001000

Definition at line 92 of file termios.h.

#define IXANY 0004000

Definition at line 94 of file termios.h.

#define IXOFF 0010000

Definition at line 95 of file termios.h.

#define IXON 0002000

Definition at line 93 of file termios.h.

#define NCC 8

Definition at line 43 of file termios.h.

Referenced by get_termio(), and set_termio().

#define NCCS 17

Definition at line 53 of file termios.h.

#define NL0 0000000

Definition at line 108 of file termios.h.

#define NL1 0000400

Definition at line 109 of file termios.h.

#define NLDLY 0000400

Definition at line 107 of file termios.h.

#define NOFLSH 0000200

Definition at line 176 of file termios.h.

#define OCRNL 0000010

Definition at line 102 of file termios.h.

#define OFDEL 0000200

Definition at line 106 of file termios.h.

#define OFILL 0000100

Definition at line 105 of file termios.h.

#define OLCUC 0000002

Definition at line 100 of file termios.h.

#define ONLCR 0000004

Definition at line 101 of file termios.h.

#define ONLRET 0000040

Definition at line 104 of file termios.h.

#define ONOCR 0000020

Definition at line 103 of file termios.h.

#define OPOST 0000001

Definition at line 99 of file termios.h.

#define PARENB CPARENB

Definition at line 165 of file termios.h.

#define PARMRK 0000010

Definition at line 86 of file termios.h.

#define PARODD CPARODD

Definition at line 166 of file termios.h.

#define PENDIN 0040000

Definition at line 182 of file termios.h.

#define TAB0 0000000

Definition at line 116 of file termios.h.

#define TAB1 0004000

Definition at line 117 of file termios.h.

#define TAB2 0010000

Definition at line 118 of file termios.h.

#define TAB3 0014000

Definition at line 119 of file termios.h.

#define TABDLY 0014000

Definition at line 115 of file termios.h.

#define TCFLSH 0x540B

Definition at line 18 of file termios.h.

Referenced by tty_ioctl().

#define TCGETA 0x5405

Definition at line 12 of file termios.h.

Referenced by tty_ioctl().

#define TCGETS 0x5401

Definition at line 8 of file termios.h.

Referenced by tty_ioctl().

#define TCIFLUSH 0

Definition at line 205 of file termios.h.

#define TCIOFF 2

Definition at line 201 of file termios.h.

#define TCIOFLUSH 2

Definition at line 207 of file termios.h.

#define TCION 3

Definition at line 202 of file termios.h.

#define TCOFLUSH 1

Definition at line 206 of file termios.h.

#define TCOOFF 0

Definition at line 199 of file termios.h.

#define TCOON 1

Definition at line 200 of file termios.h.

#define TCSADRAIN 1

Definition at line 211 of file termios.h.

#define TCSAFLUSH 2

Definition at line 212 of file termios.h.

#define TCSANOW 0

Definition at line 210 of file termios.h.

#define TCSBRK 0x5409

Definition at line 16 of file termios.h.

Referenced by tty_ioctl().

#define TCSETA 0x5406

Definition at line 13 of file termios.h.

Referenced by tty_ioctl().

#define TCSETAF 0x5408

Definition at line 15 of file termios.h.

Referenced by tty_ioctl().

#define TCSETAW 0x5407

Definition at line 14 of file termios.h.

Referenced by tty_ioctl().

#define TCSETS 0x5402

Definition at line 9 of file termios.h.

Referenced by tty_ioctl().

#define TCSETSF 0x5404

Definition at line 11 of file termios.h.

Referenced by tty_ioctl().

#define TCSETSW 0x5403

Definition at line 10 of file termios.h.

Referenced by tty_ioctl().

#define TCXONC 0x540A

Definition at line 17 of file termios.h.

Referenced by tty_ioctl().

#define TIOCEXCL 0x540C

Definition at line 19 of file termios.h.

Referenced by tty_ioctl().

#define TIOCGPGRP 0x540F

Definition at line 22 of file termios.h.

Referenced by tty_ioctl().

#define TIOCGSOFTCAR 0x5419

Definition at line 32 of file termios.h.

Referenced by tty_ioctl().

#define TIOCGWINSZ 0x5413

Definition at line 26 of file termios.h.

Referenced by tty_ioctl().

#define TIOCINQ 0x541B

Definition at line 34 of file termios.h.

Referenced by tty_ioctl().

#define TIOCM_CAR 0x040

Definition at line 192 of file termios.h.

#define TIOCM_CD TIOCM_CAR

Definition at line 195 of file termios.h.

#define TIOCM_CTS 0x020

Definition at line 191 of file termios.h.

#define TIOCM_DSR 0x100

Definition at line 194 of file termios.h.

#define TIOCM_DTR 0x002

Definition at line 187 of file termios.h.

#define TIOCM_LE 0x001

Definition at line 186 of file termios.h.

#define TIOCM_RI TIOCM_RNG

Definition at line 196 of file termios.h.

#define TIOCM_RNG 0x080

Definition at line 193 of file termios.h.

#define TIOCM_RTS 0x004

Definition at line 188 of file termios.h.

#define TIOCM_SR 0x010

Definition at line 190 of file termios.h.

#define TIOCM_ST 0x008

Definition at line 189 of file termios.h.

#define TIOCMBIC 0x5417

Definition at line 30 of file termios.h.

Referenced by tty_ioctl().

#define TIOCMBIS 0x5416

Definition at line 29 of file termios.h.

Referenced by tty_ioctl().

#define TIOCMGET 0x5415

Definition at line 28 of file termios.h.

Referenced by tty_ioctl().

#define TIOCMSET 0x5418

Definition at line 31 of file termios.h.

Referenced by tty_ioctl().

#define TIOCNXCL 0x540D

Definition at line 20 of file termios.h.

Referenced by tty_ioctl().

#define TIOCOUTQ 0x5411

Definition at line 24 of file termios.h.

Referenced by tty_ioctl().

#define TIOCSCTTY 0x540E

Definition at line 21 of file termios.h.

Referenced by tty_ioctl().

#define TIOCSPGRP 0x5410

Definition at line 23 of file termios.h.

Referenced by tty_ioctl().

#define TIOCSSOFTCAR 0x541A

Definition at line 33 of file termios.h.

Referenced by tty_ioctl().

#define TIOCSTI 0x5412

Definition at line 25 of file termios.h.

Referenced by tty_ioctl().

#define TIOCSWINSZ 0x5414

Definition at line 27 of file termios.h.

Referenced by tty_ioctl().

#define TOSTOP 0000400

Definition at line 177 of file termios.h.

#define TTY_BUF_SIZE 1024

Definition at line 4 of file termios.h.

#define VDISCARD 13

Definition at line 77 of file termios.h.

#define VEOF 4

Definition at line 68 of file termios.h.

#define VEOL 11

Definition at line 75 of file termios.h.

#define VEOL2 16

Definition at line 80 of file termios.h.

#define VERASE 2

Definition at line 66 of file termios.h.

#define VINTR 0

Definition at line 64 of file termios.h.

#define VKILL 3

Definition at line 67 of file termios.h.

#define VLNEXT 15

Definition at line 79 of file termios.h.

#define VMIN 6

Definition at line 70 of file termios.h.

Referenced by tty_read().

#define VQUIT 1

Definition at line 65 of file termios.h.

#define VREPRINT 12

Definition at line 76 of file termios.h.

#define VSTART 8

Definition at line 72 of file termios.h.

#define VSTOP 9

Definition at line 73 of file termios.h.

#define VSUSP 10

Definition at line 74 of file termios.h.

#define VSWTC 7

Definition at line 71 of file termios.h.

#define VT0 0000000

Definition at line 125 of file termios.h.

#define VT1 0040000

Definition at line 126 of file termios.h.

#define VTDLY 0040000

Definition at line 124 of file termios.h.

#define VTIME 5

Definition at line 69 of file termios.h.

Referenced by tty_read().

#define VWERASE 14

Definition at line 78 of file termios.h.

#define XCASE 0000004

Definition at line 171 of file termios.h.

#define XTABS 0014000

Definition at line 120 of file termios.h.

Typedef Documentation

typedef int speed_t

Definition at line 214 of file termios.h.

Function Documentation

speed_t cfgetispeed ( struct termios * termios_p )

speed_t cfgetospeed ( struct termios * termios_p )

int cfsetispeed | ( | struct termios * | termios_p,
 |  | speed_t | speed
 | ) |

int cfsetospeed | ( | struct termios * | termios_p,
 |  | speed_t | speed
 | ) |

int tcdrain ( int fildes )

int tcflow | ( | int | fildes,
 |  | int | action
 | ) |

int tcflush | ( | int | fildes,
 |  | int | queue_selector
 | ) |

int tcgetattr | ( | int | fildes,
 |  | struct termios * | termios_p
 | ) |

int tcsendbreak | ( | int | fildes,
 |  | int | duration
 | ) |

int tcsetattr | ( | int | fildes,
 |  | int | optional_actions,
 |  | struct termios * | termios_p
 | ) |

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/time.h File Reference

time.h File Reference

Go to the source code of this file.

Defines

#define | CLOCKS_PER_SEC 100

Typedefs

typedef long | time_t
typedef unsigned int | size_t
typedef long | clock_t

Functions

clock_t | clock (void)
time_t | time (time_t *tp)
double | difftime (time_t time2, time_t time1)
time_t | mktime (struct tm *tp)
char * | asctime (const struct tm *tp)
char * | ctime (const time_t *tp)
tm * | gmtime (const time_t *tp)
tm * | localtime (const time_t *tp)
size_t | strftime (char *s, size_t smax, const char *fmt, const struct tm *tp)
void | tzset (void)

Define Documentation

#define CLOCKS_PER_SEC 100

Definition at line 14 of file time.h.

Typedef Documentation

typedef long clock_t

Definition at line 16 of file time.h.

typedef unsigned int size_t

Definition at line 11 of file time.h.

typedef long time_t

Definition at line 6 of file time.h.

Function Documentation

char* asctime ( const struct tm * tp )

clock_t clock ( void )

char* ctime ( const time_t * tp )

double difftime | ( | time_t | time2,
 |  | time_t | time1
 | ) |

struct tm* gmtime ( const time_t * tp )

struct tm* localtime ( const time_t * tp )

time_t mktime ( struct tm * tp )

size_t strftime | ( | char * | s,
 |  | size_t | smax,
 |  | const char * | fmt,
 |  | const struct tm * | tp
 | ) |

time_t time ( time_t * tp )

Referenced by tty_read().

void tzset ( void )

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/unistd.h File Reference

unistd.h File Reference

#include <sys/stat.h>
#include <sys/times.h>
#include <sys/utsname.h>
#include <utime.h>

Go to the source code of this file.

Defines

#define | _POSIX_VERSION 198808L
#define | _POSIX_CHOWN_RESTRICTED
#define | _POSIX_NO_TRUNC
#define | _POSIX_VDISABLE '\0'
#define | STDIN_FILENO 0
#define | STDOUT_FILENO 1
#define | STDERR_FILENO 2
#define | NULL ((void *)0)
#define | F_OK 0
#define | X_OK 1
#define | W_OK 2
#define | R_OK 4
#define | SEEK_SET 0
#define | SEEK_CUR 1
#define | SEEK_END 2
#define | _SC_ARG_MAX 1
#define | _SC_CHILD_MAX 2
#define | _SC_CLOCKS_PER_SEC 3
#define | _SC_NGROUPS_MAX 4
#define | _SC_OPEN_MAX 5
#define | _SC_JOB_CONTROL 6
#define | _SC_SAVED_IDS 7
#define | _SC_VERSION 8
#define | _PC_LINK_MAX 1
#define | _PC_MAX_CANON 2
#define | _PC_MAX_INPUT 3
#define | _PC_NAME_MAX 4
#define | _PC_PATH_MAX 5
#define | _PC_PIPE_BUF 6
#define | _PC_NO_TRUNC 7
#define | _PC_VDISABLE 8
#define | _PC_CHOWN_RESTRICTED 9

Functions

int | access (const char *filename, mode_t mode)
int | acct (const char *filename)
int | alarm (int sec)
int | brk (void *end_data_segment)
void * | sbrk (ptrdiff_t increment)
int | chdir (const char *filename)
int | chmod (const char *filename, mode_t mode)
int | chown (const char *filename, uid_t owner, gid_t group)
int | chroot (const char *filename)
int | close (int fildes)
int | creat (const char *filename, mode_t mode)
int | dup (int fildes)
int | execve (const char *filename, char **argv, char **envp)
int | execv (const char *pathname, char **argv)
int | execvp (const char *file, char **argv)
int | execl (const char *pathname, char *arg0,...)
int | execlp (const char *file, char *arg0,...)
int | execle (const char *pathname, char *arg0,...)
volatile void | exit (int status)
volatile void | _exit (int status)
int | fcntl (int fildes, int cmd,...)
int | fork (void)
int | getpid (void)
int | getuid (void)
int | geteuid (void)
int | getgid (void)
int | getegid (void)
int | ioctl (int fildes, int cmd,...)
int | kill (pid_t pid, int signal)
int | link (const char *filename1, const char *filename2)
int | lseek (int fildes, off_t offset, int origin)
int | mknod (const char *filename, mode_t mode, dev_t dev)
int | mount (const char *specialfile, const char *dir, int rwflag)
int | nice (int val)
int | open (const char *filename, int flag,...)
int | pause (void)
int | pipe (int *fildes)
int | read (int fildes, char *buf, off_t count)
int | setpgrp (void)
int | setpgid (pid_t pid, pid_t pgid)
int | setuid (uid_t uid)
int | setgid (gid_t gid)
int | stat (const char *filename, struct stat *stat_buf)
int | fstat (int fildes, struct stat *stat_buf)
int | stime (time_t *tptr)
int | sync (void)
time_t | time (time_t *tloc)
time_t | times (struct tms *tbuf)
int | ulimit (int cmd, long limit)
mode_t | umask (mode_t mask)
int | umount (const char *specialfile)
int | uname (struct utsname *name)
int | unlink (const char *filename)
int | ustat (dev_t dev, struct ustat *ubuf)
int | utime (const char *filename, struct utimbuf *times)
pid_t | waitpid (pid_t pid, int *wait_stat, int options)
pid_t | wait (int *wait_stat)
int | write (int fildes, const char *buf, off_t count)
int | dup2 (int oldfd, int newfd)
int | getppid (void)
pid_t | getpgrp (void)
pid_t | setsid (void)

Variables

int | errno
void(*)(int) | signal (int sig, void(*fn)(int))

Define Documentation

#define _PC_CHOWN_RESTRICTED 9

Definition at line 51 of file unistd.h.

#define _PC_LINK_MAX 1

Definition at line 43 of file unistd.h.

#define _PC_MAX_CANON 2

Definition at line 44 of file unistd.h.

#define _PC_MAX_INPUT 3

Definition at line 45 of file unistd.h.

#define _PC_NAME_MAX 4

Definition at line 46 of file unistd.h.

#define _PC_NO_TRUNC 7

Definition at line 49 of file unistd.h.

#define _PC_PATH_MAX 5

Definition at line 47 of file unistd.h.

#define _PC_PIPE_BUF 6

Definition at line 48 of file unistd.h.

#define _PC_VDISABLE 8

Definition at line 50 of file unistd.h.

#define _POSIX_CHOWN_RESTRICTED

Definition at line 7 of file unistd.h.

#define _POSIX_NO_TRUNC

Definition at line 8 of file unistd.h.

#define _POSIX_VDISABLE '\0'

Definition at line 9 of file unistd.h.

#define _POSIX_VERSION 198808L

Definition at line 5 of file unistd.h.

#define _SC_ARG_MAX 1

Definition at line 33 of file unistd.h.

#define _SC_CHILD_MAX 2

Definition at line 34 of file unistd.h.

#define _SC_CLOCKS_PER_SEC 3

Definition at line 35 of file unistd.h.

#define _SC_JOB_CONTROL 6

Definition at line 38 of file unistd.h.

#define _SC_NGROUPS_MAX 4

Definition at line 36 of file unistd.h.

#define _SC_OPEN_MAX 5

Definition at line 37 of file unistd.h.

#define _SC_SAVED_IDS 7

Definition at line 39 of file unistd.h.

#define _SC_VERSION 8

Definition at line 40 of file unistd.h.

#define F_OK 0

Definition at line 22 of file unistd.h.

#define NULL ((void *)0)

Definition at line 18 of file unistd.h.

#define R_OK 4

Definition at line 25 of file unistd.h.

#define SEEK_CUR 1

Definition at line 29 of file unistd.h.

#define SEEK_END 2

Definition at line 30 of file unistd.h.

#define SEEK_SET 0

Definition at line 28 of file unistd.h.

#define STDERR_FILENO 2

Definition at line 15 of file unistd.h.

#define STDIN_FILENO 0

Definition at line 13 of file unistd.h.

#define STDOUT_FILENO 1

Definition at line 14 of file unistd.h.

#define W_OK 2

Definition at line 24 of file unistd.h.

#define X_OK 1

Definition at line 23 of file unistd.h.

Function Documentation

volatile void _exit ( int status )

Definition at line 10 of file _exit.c.

Referenced by init().

int access | ( | const char * | filename,
 |  | mode_t | mode
 | ) |

int acct ( const char * filename )

int alarm ( int sec )

int brk ( void * end_data_segment )

int chdir ( const char * filename )

int chmod | ( | const char * | filename,
 |  | mode_t | mode
 | ) |

int chown | ( | const char * | filename,
 |  | uid_t | owner,
 |  | gid_t | group
 | ) |

int chroot ( const char * filename )

int close ( int fildes )

Referenced by init(), and main().

int creat | ( | const char * | filename,
 |  | mode_t | mode
 | ) |

int dup ( int fildes )

Referenced by init().

int dup2 | ( | int | oldfd,
 |  | int | newfd
 | ) |

int execl | ( | const char * | pathname,
 |  | char * | arg0,
 |  |  | ...
 | ) |

int execle | ( | const char * | pathname,
 |  | char * | arg0,
 |  |  | ...
 | ) |

int execlp | ( | const char * | file,
 |  | char * | arg0,
 |  |  | ...
 | ) |

int execv | ( | const char * | pathname,
 |  | char ** | argv
 | ) |

int execve | ( | const char * | filename,
 |  | char ** | argv,
 |  | char ** | envp
 | ) |

Referenced by init().

int execvp | ( | const char * | file,
 |  | char ** | argv
 | ) |

volatile void exit ( int status )

Referenced by die().

int fcntl | ( | int | fildes,
 |  | int | cmd,
 |  |  | ...
 | ) |

int fork ( void )

Referenced by init(), and main().

int fstat | ( | int | fildes,
 |  | struct stat * | stat_buf
 | ) |

int getegid ( void )

int geteuid ( void )

int getgid ( void )

pid_t getpgrp ( void )

int getpid ( void )

int getppid ( void )

int getuid ( void )

int ioctl | ( | int | fildes,
 |  | int | cmd,
 |  |  | ...
 | ) |

int kill | ( | pid_t | pid,
 |  | int | signal
 | ) |

int link | ( | const char * | filename1,
 |  | const char * | filename2
 | ) |

int lseek | ( | int | fildes,
 |  | off_t | offset,
 |  | int | origin
 | ) |

int mknod | ( | const char * | filename,
 |  | mode_t | mode,
 |  | dev_t | dev
 | ) |

int mount | ( | const char * | specialfile,
 |  | const char * | dir,
 |  | int | rwflag
 | ) |

int nice ( int val )

int open | ( | const char * | filename,
 |  | int | flag,
 |  |  | ...
 | ) |

Definition at line 11 of file open.c.

References errno, va_arg, and va_start.

int pause ( void )

Referenced by main().

int pipe ( int * fildes )

int read | ( | int | fildes,
 |  | char * | buf,
 |  | off_t | count
 | ) |

Referenced by block_read(), main(), and read_pipe().

void* sbrk ( ptrdiff_t increment )

int setgid ( gid_t gid )

int setpgid | ( | pid_t | pid,
 |  | pid_t | pgid
 | ) |

int setpgrp ( void )

pid_t setsid ( void )

Referenced by init().

int setuid ( uid_t uid )

int stat | ( | const char * | filename,
 |  | struct stat * | stat_buf
 | ) |

int stime ( time_t * tptr )

int sync ( void )

Referenced by init().

time_t time ( time_t * tloc )

time_t times ( struct tms * tbuf )

int ulimit | ( | int | cmd,
 |  | long | limit
 | ) |

mode_t umask ( mode_t mask )

int umount ( const char * specialfile )

int uname ( struct utsname * name )

int unlink ( const char * filename )

int ustat | ( | dev_t | dev,
 |  | struct ustat * | ubuf
 | ) |

int utime | ( | const char * | filename,
 |  | struct utimbuf * | times
 | ) |

pid_t wait ( int * wait_stat )

pid_t waitpid | ( | pid_t | pid,
 |  | int * | wait_stat,
 |  | int | options
 | ) |

int write | ( | int | fildes,
 |  | const char * | buf,
 |  | off_t | count
 | ) |

Referenced by main(), and printf().

Variable Documentation

int errno

Definition at line 7 of file errno.c.

void(*)(int) signal(int sig, void(*fn)(int))

Definition at line 231 of file unistd.h.

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/utime.h File Reference

utime.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Functions

int utime (const char *filename, struct utimbuf *times)

Function Documentation

int utime | ( | const char * | filename,
 |  | struct utimbuf * | times
 | ) |

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/io.h File Reference

io.h File Reference

Go to the source code of this file.

Defines

#define | outb(value, port) __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))
#define | inb(port)
#define | outb_p(value, port)
#define | inb_p(port)

Define Documentation

#define inb ( port )

Value:

({ \
unsigned char _v; \
__asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
_v; \
})

Definition at line 5 of file io.h.

Referenced by drive_busy(), floppy_change(), init(), reset_controller(), rw_port(), and win_result().

#define inb_p ( port )

Value:

({ \
unsigned char _v; \
__asm__ volatile ("inb %%dx,%%al\n" \
    "\tjmp 1f\n" \
    "1:\tjmp 1f\n" \
    "1:":"=a" (_v):"d" (port)); \
_v; \
})

Definition at line 17 of file io.h.

Referenced by _syscall0(), con_init(), controller_ready(), do_hd_request(), drive_busy(), floppy_init(), hd_init(), output_byte(), result(), rs_init(), rs_write(), sched_init(), sysbeep(), sysbeepstop(), trap_init(), and win_result().

#define outb | ( | value,
 |  | port | ) | __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))

Definition at line 1 of file io.h.

Referenced by change_speed(), con_init(), do_floppy_timer(), floppy_init(), floppy_on_interrupt(), hd_init(), hd_out(), output_byte(), reset_controller(), reset_floppy(), rs_init(), rs_write(), rw_port(), sched_init(), sysbeep(), sysbeepstop(), ticks_to_floppy_on(), and trap_init().

#define outb_p | ( | value,
 |  | port | )

Value:

__asm__ ("outb %%al,%%dx\n" \
        "\tjmp 1f\n" \
        "1:\tjmp 1f\n" \
        "1:"::"a" (value),"d" (port))

Definition at line 11 of file io.h.

Referenced by _syscall0(), change_speed(), con_init(), hd_init(), hd_out(), init(), reset_floppy(), sched_init(), set_cursor(), set_origin(), sysbeep(), transfer(), and trap_init().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/memory.h File Reference

memory.h File Reference

Go to the source code of this file.

Defines

#define memcpy(dest, src, n)

Define Documentation

#define memcpy | ( | dest,
 |  | src,
 |  | n | )

Value:

({ \
void * _res = dest; \
__asm__ ("cld;rep;movsb" \
    ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \
    ); \
_res; \
})

Definition at line 8 of file memory.h.

Referenced by do_rd_request(), and rd_load().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/segment.h File Reference

segment.h File Reference

Go to the source code of this file.

Functions

static unsigned char | get_fs_byte (const char *addr)
static unsigned short | get_fs_word (const unsigned short *addr)
static unsigned long | get_fs_long (const unsigned long *addr)
static void | put_fs_byte (char val, char *addr)
static void | put_fs_word (short val, short *addr)
static void | put_fs_long (unsigned long val, unsigned long *addr)
static unsigned long | get_fs ()
static unsigned long | get_ds ()
static void | set_fs (unsigned long val)

Function Documentation

static unsigned long get_ds ( ) [inline, static]

Definition at line 54 of file segment.h.

Referenced by copy_strings(), and do_execve().

static unsigned long get_fs ( ) [inline, static]

Definition at line 47 of file segment.h.

Referenced by copy_strings(), and do_execve().

static unsigned char get_fs_byte ( const char * addr ) [inline, static]

Definition at line 1 of file segment.h.

Referenced by add_entry(), block_write(), copy_strings(), create_tables(), dir_namei(), file_write(), find_entry(), get_dir(), get_new(), math_emulate(), rw_port(), set_termio(), set_termios(), tty_write(), and write_pipe().

static unsigned long get_fs_long ( const unsigned long * addr ) [inline, static]

Definition at line 17 of file segment.h.

Referenced by copy_strings(), count(), sys_stime(), sys_utime(), and tty_ioctl().

static unsigned short get_fs_word ( const unsigned short * addr ) [inline, static]

Definition at line 9 of file segment.h.

static void put_fs_byte | ( | char | val,
 |  | char * | addr
 | ) | [inline, static]

Definition at line 25 of file segment.h.

Referenced by block_read(), cp_stat(), do_execve(), file_read(), get_termio(), get_termios(), read_pipe(), rw_port(), save_old(), sys_uname(), and tty_read().

static void put_fs_long | ( | unsigned long | val,
 |  | unsigned long * | addr
 | ) | [inline, static]

Definition at line 35 of file segment.h.

Referenced by create_tables(), do_signal(), sys_pipe(), sys_time(), sys_times(), sys_waitpid(), and tty_ioctl().

static void put_fs_word | ( | short | val,
 |  | short * | addr
 | ) | [inline, static]

Definition at line 30 of file segment.h.

static void set_fs ( unsigned long val ) [inline, static]

Definition at line 61 of file segment.h.

Referenced by copy_strings(), and do_execve().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/system.h File Reference

system.h File Reference

Go to the source code of this file.

Defines

#define | move_to_user_mode()
#define | sti() __asm__ ("sti"::)
#define | cli() __asm__ ("cli"::)
#define | nop() __asm__ ("nop"::)
#define | iret() __asm__ ("iret"::)
#define | _set_gate(gate_addr, type, dpl, addr)
#define | set_intr_gate(n, addr) _set_gate(&idt[n],14,0,addr)
#define | set_trap_gate(n, addr) _set_gate(&idt[n],15,0,addr)
#define | set_system_gate(n, addr) _set_gate(&idt[n],15,3,addr)
#define | _set_seg_desc(gate_addr, type, dpl, base, limit)
#define | _set_tssldt_desc(n, addr, type)
#define | set_tss_desc(n, addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),"0x89")
#define | set_ldt_desc(n, addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),"0x82")

Define Documentation

#define _set_gate | ( | gate_addr,
 |  | type,
 |  | dpl,
 |  | addr | )

Value:

__asm__ ("movw %%dx,%%ax\n\t" \
    "movw %0,%%dx\n\t" \
    "movl %%eax,%1\n\t" \
    "movl %%edx,%2" \
    : \
    : "i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
    "o" (*((char *) (gate_addr))), \
    "o" (*(4+(char *) (gate_addr))), \
    "d" ((char *) (addr)),"a" (0x00080000))

Definition at line 22 of file system.h.

#define _set_seg_desc | ( | gate_addr,
 |  | type,
 |  | dpl,
 |  | base,
 |  | limit | )

Value:

{\
    *(gate_addr) = ((base) & 0xff000000) | \
        (((base) & 0x00ff0000)>>16) | \
        ((limit) & 0xf0000) | \
        ((dpl)<<13) | \
        (0x00408000) | \
        ((type)<<8); \
    *((gate_addr)+1) = (((base) & 0x0000ffff)<<16) | \
        ((limit) & 0x0ffff); }

Definition at line 42 of file system.h.

#define _set_tssldt_desc | ( | n,
 |  | addr,
 |  | type | )

Value:

__asm__ ("movw $104,%1\n\t" \
    "movw %%ax,%2\n\t" \
    "rorl $16,%%eax\n\t" \
    "movb %%al,%3\n\t" \
    "movb $" type ",%4\n\t" \
    "movb $0x00,%5\n\t" \
    "movb %%ah,%6\n\t" \
    "rorl $16,%%eax" \
    ::"a" (addr), "m" (*(n)), "m" (*(n+2)), "m" (*(n+4)), \
     "m" (*(n+5)), "m" (*(n+6)), "m" (*(n+7)) \
    )

Definition at line 52 of file system.h.

#define cli ( ) __asm__ ("cli"::)

Definition at line 17 of file system.h.

Referenced by add_request(), add_timer(), change_speed(), floppy_on(), flush(), free_s(), free_super(), lock_buffer(), lock_inode(), lock_super(), malloc(), reset_floppy(), respond(), rs_write(), set_cursor(), set_origin(), setup_DMA(), sleep_if_empty(), sleep_if_full(), ticks_to_floppy_on(), wait_on_buffer(), wait_on_inode(), and wait_on_super().

#define iret ( ) __asm__ ("iret"::)

Definition at line 20 of file system.h.

#define move_to_user_mode ( )

Value:

__asm__ ("movl %%esp,%%eax\n\t" \
    "pushl $0x17\n\t" \
    "pushl %%eax\n\t" \
    "pushfl\n\t" \
    "pushl $0x0f\n\t" \
    "pushl $1f\n\t" \
    "iret\n" \
    "1:\tmovl $0x17,%%eax\n\t" \
    "movw %%ax,%%ds\n\t" \
    "movw %%ax,%%es\n\t" \
    "movw %%ax,%%fs\n\t" \
    "movw %%ax,%%gs" \
    :::"ax")

Definition at line 1 of file system.h.

Referenced by main().

#define nop ( ) __asm__ ("nop"::)

Definition at line 18 of file system.h.

Referenced by reset_controller().

#define set_intr_gate | ( | n,
 |  | addr | ) | _set_gate(&idt[n],14,0,addr)

Definition at line 33 of file system.h.

Referenced by hd_init(), rs_init(), and sched_init().

#define set_ldt_desc | ( | n,
 |  | addr | ) | _set_tssldt_desc(((char *) (n)),((int)(addr)),"0x82")

Definition at line 66 of file system.h.

Referenced by copy_process(), and sched_init().

#define set_system_gate | ( | n,
 |  | addr | ) | _set_gate(&idt[n],15,3,addr)

Definition at line 39 of file system.h.

Referenced by sched_init(), and trap_init().

#define set_trap_gate | ( | n,
 |  | addr | ) | _set_gate(&idt[n],15,0,addr)

Definition at line 36 of file system.h.

Referenced by con_init(), floppy_init(), and trap_init().

#define set_tss_desc | ( | n,
 |  | addr | ) | _set_tssldt_desc(((char *) (n)),((int)(addr)),"0x89")

Definition at line 65 of file system.h.

Referenced by copy_process(), and sched_init().

#define sti ( ) __asm__ ("sti"::)

Definition at line 16 of file system.h.

Referenced by add_request(), add_timer(), change_speed(), floppy_on(), flush(), free_s(), free_super(), lock_buffer(), lock_inode(), lock_super(), main(), malloc(), reset_floppy(), respond(), rs_write(), set_cursor(), set_origin(), setup_DMA(), sleep_if_empty(), sleep_if_full(), ticks_to_floppy_on(), wait_on_buffer(), wait_on_inode(), and wait_on_super().

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/config.h File Reference

config.h File Reference

Go to the source code of this file.

Defines

#define KBD_US

Define Documentation

#define KBD_US

Definition at line 16 of file config.h.

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/fdreg.h File Reference

fdreg.h File Reference

Go to the source code of this file.

Defines

#define | FD_STATUS 0x3f4
#define | FD_DATA 0x3f5
#define | FD_DOR 0x3f2
#define | FD_DIR 0x3f7
#define | FD_DCR 0x3f7
#define | STATUS_BUSYMASK 0x0F
#define | STATUS_BUSY 0x10
#define | STATUS_DMA 0x20
#define | STATUS_DIR 0x40
#define | STATUS_READY 0x80
#define | ST0_DS 0x03
#define | ST0_HA 0x04
#define | ST0_NR 0x08
#define | ST0_ECE 0x10
#define | ST0_SE 0x20
#define | ST0_INTR 0xC0
#define | ST1_MAM 0x01
#define | ST1_WP 0x02
#define | ST1_ND 0x04
#define | ST1_OR 0x10
#define | ST1_CRC 0x20
#define | ST1_EOC 0x80
#define | ST2_MAM 0x01
#define | ST2_BC 0x02
#define | ST2_SNS 0x04
#define | ST2_SEH 0x08
#define | ST2_WC 0x10
#define | ST2_CRC 0x20
#define | ST2_CM 0x40
#define | ST3_HA 0x04
#define | ST3_TZ 0x10
#define | ST3_WP 0x40
#define | FD_RECALIBRATE 0x07
#define | FD_SEEK 0x0F
#define | FD_READ 0xE6
#define | FD_WRITE 0xC5
#define | FD_SENSEI 0x08
#define | FD_SPECIFY 0x03
#define | DMA_READ 0x46
#define | DMA_WRITE 0x4A

Functions

int | ticks_to_floppy_on (unsigned int nr)
void | floppy_on (unsigned int nr)
void | floppy_off (unsigned int nr)
void | floppy_select (unsigned int nr)
void | floppy_deselect (unsigned int nr)

Define Documentation

#define DMA_READ 0x46

Definition at line 68 of file fdreg.h.

#define DMA_WRITE 0x4A

Definition at line 69 of file fdreg.h.

#define FD_DATA 0x3f5

Definition at line 17 of file fdreg.h.

Referenced by output_byte(), and result().

#define FD_DCR 0x3f7

Definition at line 20 of file fdreg.h.

Referenced by transfer().

#define FD_DIR 0x3f7

Definition at line 19 of file fdreg.h.

Referenced by floppy_change().

#define FD_DOR 0x3f2

Definition at line 18 of file fdreg.h.

Referenced by do_floppy_timer(), floppy_on_interrupt(), reset_floppy(), and ticks_to_floppy_on().

#define FD_READ 0xE6

Definition at line 62 of file fdreg.h.

Referenced by do_fd_request(), rw_interrupt(), and setup_DMA().

#define FD_RECALIBRATE 0x07

Definition at line 60 of file fdreg.h.

Referenced by recalibrate_floppy(), and transfer().

#define FD_SEEK 0x0F

Definition at line 61 of file fdreg.h.

Referenced by transfer().

#define FD_SENSEI 0x08

Definition at line 64 of file fdreg.h.

Referenced by recal_interrupt(), reset_interrupt(), seek_interrupt(), and unexpected_floppy_interrupt().

#define FD_SPECIFY 0x03

Definition at line 65 of file fdreg.h.

Referenced by reset_interrupt(), and transfer().

#define FD_STATUS 0x3f4

Definition at line 16 of file fdreg.h.

Referenced by output_byte(), and result().

#define FD_WRITE 0xC5

Definition at line 63 of file fdreg.h.

Referenced by do_fd_request(), and setup_DMA().

#define ST0_DS 0x03

Definition at line 30 of file fdreg.h.

#define ST0_ECE 0x10

Definition at line 33 of file fdreg.h.

#define ST0_HA 0x04

Definition at line 31 of file fdreg.h.

#define ST0_INTR 0xC0

Definition at line 35 of file fdreg.h.

#define ST0_NR 0x08

Definition at line 32 of file fdreg.h.

#define ST0_SE 0x20

Definition at line 34 of file fdreg.h.

#define ST1_CRC 0x20

Definition at line 42 of file fdreg.h.

#define ST1_EOC 0x80

Definition at line 43 of file fdreg.h.

#define ST1_MAM 0x01

Definition at line 38 of file fdreg.h.

#define ST1_ND 0x04

Definition at line 40 of file fdreg.h.

#define ST1_OR 0x10

Definition at line 41 of file fdreg.h.

#define ST1_WP 0x02

Definition at line 39 of file fdreg.h.

#define ST2_BC 0x02

Definition at line 47 of file fdreg.h.

#define ST2_CM 0x40

Definition at line 52 of file fdreg.h.

#define ST2_CRC 0x20

Definition at line 51 of file fdreg.h.

#define ST2_MAM 0x01

Definition at line 46 of file fdreg.h.

#define ST2_SEH 0x08

Definition at line 49 of file fdreg.h.

#define ST2_SNS 0x04

Definition at line 48 of file fdreg.h.

#define ST2_WC 0x10

Definition at line 50 of file fdreg.h.

#define ST3_HA 0x04

Definition at line 55 of file fdreg.h.

#define ST3_TZ 0x10

Definition at line 56 of file fdreg.h.

#define ST3_WP 0x40

Definition at line 57 of file fdreg.h.

#define STATUS_BUSY 0x10

Definition at line 24 of file fdreg.h.

Referenced by result().

#define STATUS_BUSYMASK 0x0F

Definition at line 23 of file fdreg.h.

#define STATUS_DIR 0x40

Definition at line 26 of file fdreg.h.

Referenced by output_byte(), and result().

#define STATUS_DMA 0x20

Definition at line 25 of file fdreg.h.

#define STATUS_READY 0x80

Definition at line 27 of file fdreg.h.

Referenced by output_byte(), and result().

Function Documentation

void floppy_deselect ( unsigned int nr )

Definition at line 125 of file floppy.c.

References current_DOR, printk(), selected, wait_on_floppy_select, and wake_up().

Referenced by bad_flp_intr(), and rw_interrupt().

void floppy_off ( unsigned int nr )

Definition at line 240 of file sched.c.

Referenced by floppy_change().

void floppy_on ( unsigned int nr )

Definition at line 232 of file sched.c.

Referenced by floppy_change().

void floppy_select ( unsigned int nr )

int ticks_to_floppy_on ( unsigned int nr )

Definition at line 206 of file sched.c.

Referenced by do_fd_request(), and floppy_on().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/fs.h File Reference

fs.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Defines

#define | IS_SEEKABLE(x) ((x)>=1 && (x)<=3)
#define | READ 0
#define | WRITE 1
#define | READA 2
#define | WRITEA 3
#define | MAJOR(a) (((unsigned)(a))>>8)
#define | MINOR(a) ((a)&0xff)
#define | NAME_LEN 14
#define | ROOT_INO 1
#define | I_MAP_SLOTS 8
#define | Z_MAP_SLOTS 8
#define | SUPER_MAGIC 0x137F
#define | NR_OPEN 20
#define | NR_INODE 32
#define | NR_FILE 64
#define | NR_SUPER 8
#define | NR_HASH 307
#define | NR_BUFFERS nr_buffers
#define | BLOCK_SIZE 1024
#define | BLOCK_SIZE_BITS 10
#define | NULL ((void *) 0)
#define | INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct d_inode)))
#define | DIR_ENTRIES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct dir_entry)))
#define | PIPE_HEAD(inode) ((inode).i_zone[0])
#define | PIPE_TAIL(inode) ((inode).i_zone[1])
#define | PIPE_SIZE(inode) ((PIPE_HEAD(inode)-PIPE_TAIL(inode))&(PAGE_SIZE-1))
#define | PIPE_EMPTY(inode) (PIPE_HEAD(inode)==PIPE_TAIL(inode))
#define | PIPE_FULL(inode) (PIPE_SIZE(inode)==(PAGE_SIZE-1))
#define | INC_PIPE(head) __asm__("incl %0\n\tandl $4095,%0"::"m" (head))

Typedefs

typedef char | buffer_block [BLOCK_SIZE]

Functions

void | buffer_init (long buffer_end)
void | check_disk_change (int dev)
int | floppy_change (unsigned int nr)
int | ticks_to_floppy_on (unsigned int dev)
void | floppy_on (unsigned int dev)
void | floppy_off (unsigned int dev)
void | truncate (struct m_inode *inode)
void | sync_inodes (void)
void | wait_on (struct m_inode *inode)
int | bmap (struct m_inode *inode, int block)
int | create_block (struct m_inode *inode, int block)
m_inode * | namei (const char *pathname)
int | open_namei (const char *pathname, int flag, int mode, struct m_inode **res_inode)
void | iput (struct m_inode *inode)
m_inode * | iget (int dev, int nr)
m_inode * | get_empty_inode (void)
m_inode * | get_pipe_inode (void)
buffer_head * | get_hash_table (int dev, int block)
buffer_head * | getblk (int dev, int block)
void | ll_rw_block (int rw, struct buffer_head *bh)
void | brelse (struct buffer_head *buf)
buffer_head * | bread (int dev, int block)
void | bread_page (unsigned long addr, int dev, int b[4])
buffer_head * | breada (int dev, int block,...)
int | new_block (int dev)
void | free_block (int dev, int block)
m_inode * | new_inode (int dev)
void | free_inode (struct m_inode *inode)
int | sync_dev (int dev)
super_block * | get_super (int dev)
void | mount_root (void)

Variables

m_inode | inode_table [NR_INODE]
file | file_table [NR_FILE]
super_block | super_block [NR_SUPER]
buffer_head * start_buffer
int | nr_buffers
int | ROOT_DEV

Define Documentation

#define BLOCK_SIZE 1024

Definition at line 49 of file fs.h.

Referenced by add_entry(), block_read(), block_write(), bread_page(), buffer_init(), do_execve(), do_no_page(), empty_dir(), file_read(), file_write(), find_entry(), init(), and rd_load().

#define BLOCK_SIZE_BITS 10

Definition at line 50 of file fs.h.

Referenced by block_read(), block_write(), and rd_load().

#define DIR_ENTRIES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct dir_entry)))

Definition at line 56 of file fs.h.

Referenced by add_entry(), empty_dir(), and find_entry().

#define I_MAP_SLOTS 8

Definition at line 39 of file fs.h.

Referenced by put_super(), and read_super().

#define INC_PIPE ( head ) __asm__("incl %0\n\tandl $4095,%0"::"m" (head))

Definition at line 63 of file fs.h.

#define INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct d_inode)))

Definition at line 55 of file fs.h.

Referenced by read_inode(), and write_inode().

#define IS_SEEKABLE ( x ) ((x)>=1 && (x)<=3)

Definition at line 24 of file fs.h.

Referenced by sys_lseek().

#define MAJOR ( a ) (((unsigned)(a))>>8)

Definition at line 33 of file fs.h.

Referenced by check_disk_change(), ll_rw_block(), main(), mount_root(), rd_load(), rw_char(), sys_ioctl(), sys_lseek(), sys_open(), and tty_ioctl().

#define MINOR ( a ) ((a)&0xff)

Definition at line 34 of file fs.h.

Referenced by do_fd_request(), do_hd_request(), do_rd_request(), main(), rw_char(), sys_open(), and tty_ioctl().

#define NAME_LEN 14

Definition at line 36 of file fs.h.

Referenced by add_entry(), find_entry(), and match().

#define NR_BUFFERS nr_buffers

Definition at line 48 of file fs.h.

Referenced by buffer_init(), init(), invalidate_buffers(), sync_dev(), and sys_sync().

#define NR_FILE 64

Definition at line 45 of file fs.h.

Referenced by mount_root(), sys_open(), and sys_pipe().

#define NR_HASH 307

Definition at line 47 of file fs.h.

Referenced by buffer_init().

#define NR_INODE 32

Definition at line 44 of file fs.h.

Referenced by get_empty_inode(), iget(), invalidate_inodes(), sync_inodes(), and sys_umount().

#define NR_OPEN 20

Definition at line 43 of file fs.h.

Referenced by copy_process(), do_execve(), do_exit(), dupfd(), sys_close(), sys_fcntl(), sys_fstat(), sys_ioctl(), sys_lseek(), sys_open(), sys_pipe(), sys_read(), and sys_write().

#define NR_SUPER 8

Definition at line 46 of file fs.h.

Referenced by check_disk_change(), get_super(), iget(), mount_root(), and read_super().

#define NULL ((void *) 0)

Definition at line 52 of file fs.h.

Referenced by add_entry(), add_request(), blk_dev_init(), bread(), bread_page(), breada(), buffer_init(), copy_process(), copy_strings(), dir_namei(), do_execve(), do_exit(), do_signal(), do_timer(), file_read(), find_buffer(), find_entry(), get_dir(), get_empty_inode(), get_hash_table(), get_pipe_inode(), get_super(), iget(), insert_into_queues(), interruptible_sleep_on(), make_request(), memchr(), mount_root(), namei(), new_inode(), read_super(), release(), sched_init(), sys_close(), sys_open(), sys_pipe(), sys_umount(), and wake_up().

#define PIPE_EMPTY ( inode ) (PIPE_HEAD(inode)==PIPE_TAIL(inode))

Definition at line 61 of file fs.h.

#define PIPE_FULL ( inode ) (PIPE_SIZE(inode)==(PAGE_SIZE-1))

Definition at line 62 of file fs.h.

#define PIPE_HEAD ( inode ) ((inode).i_zone[0])

Definition at line 58 of file fs.h.

Referenced by get_pipe_inode(), and write_pipe().

#define PIPE_SIZE ( inode ) ((PIPE_HEAD(inode)-PIPE_TAIL(inode))&(PAGE_SIZE-1))

Definition at line 60 of file fs.h.

Referenced by read_pipe(), and write_pipe().

#define PIPE_TAIL ( inode ) ((inode).i_zone[1])

Definition at line 59 of file fs.h.

Referenced by get_pipe_inode(), and read_pipe().

#define READ 0

Definition at line 26 of file fs.h.

Referenced by bread(), bread_page(), breada(), do_fd_request(), do_hd_request(), do_rd_request(), make_request(), rw_memory(), rw_port(), rw_ttyx(), and sys_read().

#define READA 2

Definition at line 28 of file fs.h.

Referenced by breada(), and make_request().

#define ROOT_INO 1

Definition at line 37 of file fs.h.

Referenced by find_entry(), iget(), mount_root(), and sys_mount().

#define SUPER_MAGIC 0x137F

Definition at line 41 of file fs.h.

Referenced by rd_load(), and read_super().

#define WRITE 1

Definition at line 27 of file fs.h.

Referenced by do_fd_request(), do_hd_request(), do_rd_request(), make_request(), sync_dev(), sys_sync(), and sys_write().

#define WRITEA 3

Definition at line 29 of file fs.h.

Referenced by make_request().

#define Z_MAP_SLOTS 8

Definition at line 40 of file fs.h.

Referenced by put_super(), and read_super().

Typedef Documentation

typedef char buffer_block[BLOCK_SIZE]

Definition at line 66 of file fs.h.

Function Documentation

int bmap | ( | struct m_inode * | inode,
 |  | int | block
 | ) |

Definition at line 140 of file inode.c.

References _bmap().

Referenced by do_no_page(), empty_dir(), file_read(), and find_entry().

struct buffer_head* bread | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 270 of file buffer.c.

References buffer_head::b_uptodate, brelse(), getblk(), ll_rw_block(), NULL, panic(), READ, and wait_on_buffer().

Referenced by _bmap(), add_entry(), do_execve(), empty_dir(), file_read(), file_write(), find_entry(), free_dind(), free_ind(), rd_load(), read_inode(), read_super(), sys_mkdir(), sys_setup(), and write_inode().

void bread_page | ( | unsigned long | addr,
 |  | int | dev,
 |  | int | b[4]
 | ) |

Definition at line 299 of file buffer.c.

References b, BLOCK_SIZE, brelse(), COPYBLK, getblk(), ll_rw_block(), NULL, READ, and wait_on_buffer().

Referenced by do_no_page().

struct buffer_head* breada | ( | int | dev,
 |  | int | block,
 |  |  | ...
 | ) |

Definition at line 325 of file buffer.c.

References buffer_head::b_count, buffer_head::b_uptodate, brelse(), getblk(), ll_rw_block(), NULL, panic(), READ, READA, va_arg, va_end, va_start, and wait_on_buffer().

Referenced by block_read(), block_write(), and rd_load().

void brelse ( struct buffer_head * buf )

Definition at line 256 of file buffer.c.

References buffer_wait, panic(), wait_on_buffer(), and wake_up().

Referenced by _bmap(), add_entry(), block_read(), block_write(), bread(), bread_page(), breada(), do_execve(), empty_dir(), file_read(), file_write(), find_entry(), free_block(), free_dind(), free_ind(), get_dir(), namei(), new_block(), open_namei(), put_super(), rd_load(), read_inode(), read_super(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), sys_setup(), sys_unlink(), and write_inode().

void buffer_init ( long buffer_end )

Definition at line 351 of file buffer.c.

References b, buffer_head::b_count, buffer_head::b_data, buffer_head::b_dev, buffer_head::b_dirt, buffer_head::b_lock, buffer_head::b_next, buffer_head::b_next_free, buffer_head::b_prev, buffer_head::b_prev_free, buffer_head::b_uptodate, buffer_head::b_wait, BLOCK_SIZE, free_list, hash_table, NR_BUFFERS, NR_HASH, NULL, and start_buffer.

Referenced by main().

void check_disk_change ( int dev )

Definition at line 116 of file buffer.c.

References floppy_change(), invalidate_buffers(), invalidate_inodes(), MAJOR, NR_SUPER, and put_super().

Referenced by read_super(), and sys_open().

int create_block | ( | struct m_inode * | inode,
 |  | int | block
 | ) |

Definition at line 145 of file inode.c.

References _bmap().

Referenced by add_entry(), and file_write().

int floppy_change ( unsigned int nr )

Definition at line 139 of file floppy.c.

References current_DOR, FD_DIR, floppy_off(), floppy_on(), inb, interruptible_sleep_on(), selected, and wait_on_floppy_select.

Referenced by check_disk_change().

void floppy_off ( unsigned int dev )

Definition at line 240 of file sched.c.

References HZ, and moff_timer.

void floppy_on ( unsigned int dev )

Definition at line 232 of file sched.c.

References cli, sleep_on(), sti, ticks_to_floppy_on(), and wait_motor.

void free_block | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 47 of file bitmap.c.

References buffer_head::b_count, buffer_head::b_data, buffer_head::b_dirt, buffer_head::b_uptodate, brelse(), clear_bit, get_hash_table(), get_super(), panic(), printk(), super_block::s_firstdatazone, super_block::s_nzones, and super_block::s_zmap.

Referenced by free_dind(), free_ind(), sys_mkdir(), and truncate().

void free_inode ( struct m_inode * inode )

Definition at line 107 of file bitmap.c.

References buffer_head::b_data, buffer_head::b_dirt, clear_bit, get_super(), memset(), panic(), printk(), super_block::s_imap, and super_block::s_ninodes.

Referenced by iput().

struct m_inode* get_empty_inode ( void )

Definition at line 194 of file inode.c.

References m_inode::i_count, m_inode::i_dirt, m_inode::i_lock, inode_table, memset(), NR_INODE, NULL, panic(), printk(), wait_on_inode(), and write_inode().

Referenced by get_pipe_inode(), iget(), and new_inode().

struct buffer_head* get_hash_table | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 186 of file buffer.c.

References buffer_head::b_blocknr, buffer_head::b_count, buffer_head::b_dev, find_buffer(), NULL, and wait_on_buffer().

Referenced by free_block(), and getblk().

struct m_inode* get_pipe_inode ( void )

Definition at line 228 of file inode.c.

References get_empty_inode(), get_free_page(), m_inode::i_count, m_inode::i_pipe, m_inode::i_size, NULL, PIPE_HEAD, and PIPE_TAIL.

Referenced by sys_pipe().

struct super_block* get_super ( int dev )

Definition at line 56 of file super.c.

References NR_SUPER, NULL, super_block::s_dev, super_block, and wait_on_super().

Referenced by find_entry(), free_block(), free_inode(), new_block(), new_inode(), put_super(), read_inode(), read_super(), sys_umount(), and write_inode().

struct buffer_head* getblk | ( | int | dev,
 |  | int | block
 | ) |

Definition at line 209 of file buffer.c.

References buffer_head::b_blocknr, buffer_head::b_count, buffer_head::b_dev, buffer_head::b_dirt, buffer_head::b_next_free, buffer_head::b_uptodate, BADNESS, buffer_wait, find_buffer(), free_list, get_hash_table(), insert_into_queues(), remove_from_queues(), sleep_on(), sync_dev(), and wait_on_buffer().

Referenced by block_write(), bread(), bread_page(), breada(), and new_block().

struct m_inode* iget | ( | int | dev,
 |  | int | nr
 | ) |

Definition at line 244 of file inode.c.

References get_empty_inode(), m_inode::i_count, m_inode::i_dev, m_inode::i_mount, m_inode::i_num, inode_table, iput(), NR_INODE, NR_SUPER, NULL, panic(), printk(), read_inode(), ROOT_INO, and wait_on_inode().

Referenced by get_dir(), mount_root(), namei(), open_namei(), sys_rmdir(), and sys_unlink().

void iput ( struct m_inode * inode )

Definition at line 150 of file inode.c.

References free_inode(), free_page(), panic(), S_ISBLK, sync_dev(), truncate(), wait_on_inode(), wake_up(), and write_inode().

Referenced by do_execve(), do_exit(), find_entry(), get_dir(), iget(), namei(), new_inode(), open_namei(), sys_access(), sys_chdir(), sys_chmod(), sys_chown(), sys_chroot(), sys_close(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), sys_open(), sys_rmdir(), sys_stat(), sys_umount(), sys_unlink(), and sys_utime().

void ll_rw_block | ( | int | rw,
 |  | struct buffer_head * | bh
 | ) |

Definition at line 145 of file ll_rw_blk.c.

References blk_dev, MAJOR, make_request(), NR_BLK_DEV, printk(), and blk_dev_struct::request_fn.

Referenced by bread(), bread_page(), breada(), sync_dev(), and sys_sync().

void mount_root ( void )

Definition at line 242 of file super.c.

References buffer_head::b_data, current, file::f_count, file_table, free, m_inode::i_count, iget(), MAJOR, NR_FILE, NR_SUPER, NULL, panic(), printk(), task_struct::pwd, read_super(), task_struct::root, ROOT_DEV, ROOT_INO, super_block::s_dev, super_block::s_imap, super_block::s_imount, super_block::s_isup, super_block::s_lock, super_block::s_ninodes, super_block::s_nzones, super_block::s_wait, super_block::s_zmap, set_bit, super_block, and wait_for_keypress().

Referenced by sys_setup().

struct m_inode* namei ( const char * pathname )

Definition at line 303 of file namei.c.

References brelse(), CURRENT_TIME, dir_namei(), find_entry(), m_inode::i_atime, m_inode::i_dev, m_inode::i_dirt, iget(), dir_entry::inode, iput(), and NULL.

Referenced by do_execve(), sys_access(), sys_chdir(), sys_chmod(), sys_chown(), sys_chroot(), sys_link(), sys_mount(), sys_stat(), sys_umount(), and sys_utime().

int new_block ( int dev )

Definition at line 75 of file bitmap.c.

References buffer_head::b_count, buffer_head::b_data, buffer_head::b_dirt, buffer_head::b_uptodate, brelse(), clear_block, find_first_zero, get_super(), getblk(), panic(), super_block::s_firstdatazone, super_block::s_nzones, super_block::s_zmap, and set_bit.

Referenced by _bmap(), and sys_mkdir().

struct m_inode* new_inode ( int dev )

Definition at line 136 of file bitmap.c.

References buffer_head::b_data, buffer_head::b_dirt, current, CURRENT_TIME, task_struct::egid, task_struct::euid, find_first_zero, get_empty_inode(), get_super(), m_inode::i_atime, m_inode::i_count, m_inode::i_ctime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_gid, m_inode::i_mtime, m_inode::i_nlinks, m_inode::i_num, m_inode::i_uid, iput(), NULL, panic(), super_block::s_imap, super_block::s_ninodes, and set_bit.

Referenced by open_namei(), sys_mkdir(), and sys_mknod().

int open_namei | ( | const char * | pathname,
 |  | int | flag,
 |  | int | mode,
 |  | struct m_inode ** | res_inode
 | ) |

Definition at line 337 of file namei.c.

References ACC_MODE, add_entry(), buffer_head::b_dirt, brelse(), current, CURRENT_TIME, dir_namei(), EACCES, EEXIST, EISDIR, ENOENT, ENOSPC, EPERM, task_struct::euid, find_entry(), m_inode::i_atime, m_inode::i_dev, m_inode::i_dirt, m_inode::i_mode, m_inode::i_nlinks, m_inode::i_num, I_REGULAR, m_inode::i_uid, iget(), dir_entry::inode, iput(), MAY_WRITE, new_inode(), O_ACCMODE, O_CREAT, O_EXCL, O_TRUNC, O_WRONLY, permission(), S_ISDIR, truncate(), and task_struct::umask.

Referenced by sys_open().

int sync_dev ( int dev )

Definition at line 62 of file buffer.c.

References buffer_head::b_dev, buffer_head::b_dirt, ll_rw_block(), NR_BUFFERS, start_buffer, sync_inodes(), wait_on_buffer(), and WRITE.

Referenced by getblk(), iput(), and sys_umount().

void sync_inodes ( void )

Definition at line 59 of file inode.c.

References m_inode::i_dirt, m_inode::i_pipe, inode_table, NR_INODE, wait_on_inode(), and write_inode().

Referenced by sync_dev(), and sys_sync().

int ticks_to_floppy_on ( unsigned int dev )

Definition at line 206 of file sched.c.

References cli, current_DOR, FD_DOR, HZ, moff_timer, mon_timer, outb, panic(), selected, and sti.

void truncate ( struct m_inode * inode )

Definition at line 47 of file truncate.c.

References CURRENT_TIME, free_block(), free_dind(), free_ind(), S_ISDIR, and S_ISREG.

Referenced by iput(), and open_namei().

void wait_on ( struct m_inode * inode )

Variable Documentation

struct file file_table[NR_FILE]

Definition at line 9 of file file_table.c.

Referenced by mount_root(), sys_open(), and sys_pipe().

struct m_inode inode_table[NR_INODE]

Definition at line 15 of file inode.c.

Referenced by get_empty_inode(), iget(), invalidate_inodes(), sync_inodes(), and sys_umount().

int nr_buffers

int ROOT_DEV

Definition at line 29 of file super.c.

Referenced by main(), mount_root(), put_super(), rd_load(), and sys_umount().

struct buffer_head* start_buffer

Definition at line 33 of file buffer.c.

Referenced by buffer_init(), invalidate_buffers(), sync_dev(), and sys_sync().

struct super_block super_block[NR_SUPER]

Definition at line 27 of file super.c.

Referenced by get_super(), mount_root(), put_super(), read_super(), sys_mount(), and sys_umount().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/hdreg.h File Reference

hdreg.h File Reference

Go to the source code of this file.

Defines

#define | HD_DATA 0x1f0
#define | HD_ERROR 0x1f1
#define | HD_NSECTOR 0x1f2
#define | HD_SECTOR 0x1f3
#define | HD_LCYL 0x1f4
#define | HD_HCYL 0x1f5
#define | HD_CURRENT 0x1f6
#define | HD_STATUS 0x1f7
#define | HD_PRECOMP HD_ERROR
#define | HD_COMMAND HD_STATUS
#define | HD_CMD 0x3f6
#define | ERR_STAT 0x01
#define | INDEX_STAT 0x02
#define | ECC_STAT 0x04
#define | DRQ_STAT 0x08
#define | SEEK_STAT 0x10
#define | WRERR_STAT 0x20
#define | READY_STAT 0x40
#define | BUSY_STAT 0x80
#define | WIN_RESTORE 0x10
#define | WIN_READ 0x20
#define | WIN_WRITE 0x30
#define | WIN_VERIFY 0x40
#define | WIN_FORMAT 0x50
#define | WIN_INIT 0x60
#define | WIN_SEEK 0x70
#define | WIN_DIAGNOSE 0x90
#define | WIN_SPECIFY 0x91
#define | MARK_ERR 0x01
#define | TRK0_ERR 0x02
#define | ABRT_ERR 0x04
#define | ID_ERR 0x10
#define | ECC_ERR 0x40
#define | BBD_ERR 0x80

Define Documentation

#define ABRT_ERR 0x04

Definition at line 47 of file hdreg.h.

#define BBD_ERR 0x80

Definition at line 50 of file hdreg.h.

#define BUSY_STAT 0x80

Definition at line 31 of file hdreg.h.

Referenced by drive_busy(), and win_result().

#define DRQ_STAT 0x08

Definition at line 27 of file hdreg.h.

Referenced by do_hd_request().

#define ECC_ERR 0x40

Definition at line 49 of file hdreg.h.

#define ECC_STAT 0x04

Definition at line 26 of file hdreg.h.

#define ERR_STAT 0x01

Definition at line 24 of file hdreg.h.

Referenced by win_result().

#define HD_CMD 0x3f6

Definition at line 21 of file hdreg.h.

Referenced by hd_out(), and reset_controller().

#define HD_COMMAND HD_STATUS

Definition at line 19 of file hdreg.h.

#define HD_CURRENT 0x1f6

Definition at line 16 of file hdreg.h.

#define HD_DATA 0x1f0

Definition at line 10 of file hdreg.h.

Referenced by do_hd_request(), hd_out(), read_intr(), and write_intr().

#define HD_ERROR 0x1f1

Definition at line 11 of file hdreg.h.

Referenced by reset_controller(), and win_result().

#define HD_HCYL 0x1f5

Definition at line 15 of file hdreg.h.

#define HD_LCYL 0x1f4

Definition at line 14 of file hdreg.h.

#define HD_NSECTOR 0x1f2

Definition at line 12 of file hdreg.h.

#define HD_PRECOMP HD_ERROR

Definition at line 18 of file hdreg.h.

#define HD_SECTOR 0x1f3

Definition at line 13 of file hdreg.h.

#define HD_STATUS 0x1f7

Definition at line 17 of file hdreg.h.

Referenced by controller_ready(), do_hd_request(), drive_busy(), and win_result().

#define ID_ERR 0x10

Definition at line 48 of file hdreg.h.

#define INDEX_STAT 0x02

Definition at line 25 of file hdreg.h.

#define MARK_ERR 0x01

Definition at line 45 of file hdreg.h.

#define READY_STAT 0x40

Definition at line 30 of file hdreg.h.

Referenced by drive_busy(), and win_result().

#define SEEK_STAT 0x10

Definition at line 28 of file hdreg.h.

Referenced by drive_busy(), and win_result().

#define TRK0_ERR 0x02

Definition at line 46 of file hdreg.h.

#define WIN_DIAGNOSE 0x90

Definition at line 41 of file hdreg.h.

#define WIN_FORMAT 0x50

Definition at line 38 of file hdreg.h.

#define WIN_INIT 0x60

Definition at line 39 of file hdreg.h.

#define WIN_READ 0x20

Definition at line 35 of file hdreg.h.

Referenced by do_hd_request().

#define WIN_RESTORE 0x10

Definition at line 34 of file hdreg.h.

Referenced by do_hd_request().

#define WIN_SEEK 0x70

Definition at line 40 of file hdreg.h.

#define WIN_SPECIFY 0x91

Definition at line 42 of file hdreg.h.

Referenced by reset_hd().

#define WIN_VERIFY 0x40

Definition at line 37 of file hdreg.h.

#define WIN_WRITE 0x30

Definition at line 36 of file hdreg.h.

Referenced by do_hd_request().

#define WRERR_STAT 0x20

Definition at line 29 of file hdreg.h.

Referenced by win_result().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/head.h File Reference

head.h File Reference

Go to the source code of this file.

Defines

#define | GDT_NUL 0
#define | GDT_CODE 1
#define | GDT_DATA 2
#define | GDT_TMP 3
#define | LDT_NUL 0
#define | LDT_CODE 1
#define | LDT_DATA 2

Typedefs

typedef desc_struct | desc_table [256]

Variables

unsigned long | pg_dir [1024]
desc_table idt
desc_table gdt

Define Documentation

#define GDT_CODE 1

Definition at line 12 of file head.h.

#define GDT_DATA 2

Definition at line 13 of file head.h.

#define GDT_NUL 0

Definition at line 11 of file head.h.

#define GDT_TMP 3

Definition at line 14 of file head.h.

#define LDT_CODE 1

Definition at line 17 of file head.h.

#define LDT_DATA 2

Definition at line 18 of file head.h.

#define LDT_NUL 0

Definition at line 16 of file head.h.

Typedef Documentation

typedef struct desc_struct desc_table[256]

Variable Documentation

desc_table gdt

Referenced by copy_process(), and sched_init().

desc_table idt

unsigned long pg_dir[1024]

Referenced by calc_mem().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/kernel.h File Reference

kernel.h File Reference

Go to the source code of this file.

Defines

#define | free(x) free_s((x), 0)
#define | suser() (current->euid == 0)

Functions

void | verify_area (void *addr, int count)
volatile void | panic (const char *str)
int | printf (const char *fmt,...)
int | printk (const char *fmt,...)
int | tty_write (unsigned ch, char *buf, int count)
void * | malloc (unsigned int size)
void | free_s (void *obj, int size)

Define Documentation

#define free ( x ) free_s((x), 0)

Definition at line 12 of file kernel.h.

Referenced by calc_mem(), and mount_root().

#define suser ( ) (current->euid == 0)

Definition at line 21 of file kernel.h.

Referenced by do_execve(), permission(), send_sig(), sys_chmod(), sys_chown(), sys_mkdir(), sys_mknod(), sys_rmdir(), sys_setregid(), sys_setreuid(), sys_setsid(), sys_stime(), and sys_unlink().

Function Documentation

void free_s | ( | void * | obj,
 |  | int | size
 | ) |

Definition at line 182 of file malloc.c.

References bucket_dir, _bucket_dir::chain, cli, free_bucket_desc, free_page(), bucket_desc::freeptr, bucket_desc::next, bucket_desc::page, panic(), bucket_desc::refcnt, _bucket_dir::size, and sti.

void* malloc ( unsigned int size )

Definition at line 117 of file malloc.c.

References bucket_dir, bucket_desc::bucket_size, _bucket_dir::chain, cli, free_bucket_desc, bucket_desc::freeptr, get_free_page(), init_bucket_desc(), bucket_desc::next, bucket_desc::page, PAGE_SIZE, panic(), printk(), bucket_desc::refcnt, _bucket_dir::size, and sti.

volatile void panic ( const char * str )

Definition at line 18 of file panic.c.

Referenced by _bmap(), add_timer(), bread(), breada(), brelse(), copy_mem(), copy_page_tables(), copy_strings(), do_execve(), do_fd_request(), do_hd_request(), do_rd_request(), free_block(), free_inode(), free_page(), free_page_tables(), free_s(), get_dir(), get_empty_inode(), hd_out(), iget(), init_bucket_desc(), interruptible_sleep_on(), iput(), make_request(), malloc(), math_emulate(), mount_root(), new_block(), new_inode(), read_inode(), release(), remove_from_queues(), sched_init(), sleep_on(), sys_close(), sys_setup(), ticks_to_floppy_on(), try_to_share(), tty_ioctl(), and write_inode().

int printf | ( | const char * | fmt,
 |  |  | ...
 | ) |

Referenced by init().

int printk | ( | const char * | fmt,
 |  |  | ...
 | ) |

Definition at line 21 of file printk.c.

References buf, va_end, va_start, and vsprintf().

Referenced by calc_mem(), copy_mem(), die(), do_execve(), do_int3(), drive_busy(), empty_dir(), floppy_deselect(), free_block(), free_inode(), get_empty_inode(), iget(), invalidate_inodes(), ll_rw_block(), malloc(), math_emulate(), mount_root(), oom(), output_byte(), panic(), put_page(), put_super(), rd_load(), reset_controller(), reset_floppy(), result(), rw_interrupt(), show_task(), sys_read(), sys_rmdir(), sys_setup(), sys_umount(), sys_unlink(), sys_write(), tell_father(), unexpected_hd_interrupt(), and unlock_buffer().

int tty_write | ( | unsigned | ch,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 291 of file tty_io.c.

void verify_area | ( | void * | addr,
 |  | int | count
 | ) |

Definition at line 24 of file fork.c.

References current, get_base, task_struct::ldt, and write_verify().

Referenced by cp_stat(), do_signal(), get_termio(), get_termios(), save_old(), sys_read(), sys_time(), sys_times(), sys_uname(), sys_waitpid(), and tty_ioctl().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/mm.h File Reference

mm.h File Reference

Go to the source code of this file.

Defines

#define | PAGE_SIZE 4096

Functions

unsigned long | get_free_page (void)
unsigned long | put_page (unsigned long page, unsigned long address)
void | free_page (unsigned long addr)

Define Documentation

#define PAGE_SIZE 4096

Definition at line 4 of file mm.h.

Function Documentation

void free_page ( unsigned long addr )

Definition at line 89 of file memory.c.

References HIGH_MEMORY, LOW_MEM, mem_map, and panic().

Referenced by copy_process(), do_execve(), do_no_page(), free_page_tables(), free_s(), get_empty_page(), iput(), and release().

unsigned long get_free_page ( void )

Definition at line 63 of file memory.c.

References LOW_MEM, mem_map, and PAGING_PAGES.

Referenced by copy_page_tables(), copy_process(), copy_strings(), do_no_page(), get_empty_page(), get_pipe_inode(), init_bucket_desc(), malloc(), put_page(), try_to_share(), and un_wp_page().

unsigned long put_page | ( | unsigned long | page,
 |  | unsigned long | address
 | ) |

Definition at line 197 of file memory.c.

References get_free_page(), HIGH_MEMORY, LOW_MEM, mem_map, and printk().

Referenced by change_ldt(), do_no_page(), and get_empty_page().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/sched.h File Reference

sched.h File Reference

#include <linux/head.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <signal.h>

Go to the source code of this file.

Defines

#define | NR_TASKS 64
#define | HZ 100
#define | FIRST_TASK task[0]
#define | LAST_TASK task[NR_TASKS-1]
#define | TASK_RUNNING 0
#define | TASK_INTERRUPTIBLE 1
#define | TASK_UNINTERRUPTIBLE 2
#define | TASK_ZOMBIE 3
#define | TASK_STOPPED 4
#define | NULL ((void *) 0)
#define | INIT_TASK
#define | CURRENT_TIME (startup_time+jiffies/HZ)
#define | FIRST_TSS_ENTRY 4
#define | FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1)
#define | _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))
#define | _LDT(n) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))
#define | ltr(n) __asm__("ltr %%ax"::"a" (_TSS(n)))
#define | lldt(n) __asm__("lldt %%ax"::"a" (_LDT(n)))
#define | str(n)
#define | switch_to(n)
#define | PAGE_ALIGN(n) (((n)+0xfff)&0xfffff000)
#define | _set_base(addr, base)
#define | _set_limit(addr, limit)
#define | set_base(ldt, base) _set_base( ((char *)&(ldt)) , (base) )
#define | set_limit(ldt, limit) _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )
#define | get_base(ldt) _get_base( ((char *)&(ldt)) )
#define | get_limit(segment)

Typedefs

typedef int(* | fn_ptr )()

Functions

int | copy_page_tables (unsigned long from, unsigned long to, long size)
int | free_page_tables (unsigned long from, unsigned long size)
void | sched_init (void)
void | schedule (void)
void | trap_init (void)
volatile void | panic (const char *str)
int | tty_write (unsigned minor, char *buf, int count)
void | add_timer (long jiffies, void(*fn)(void))
void | sleep_on (struct task_struct **p)
void | interruptible_sleep_on (struct task_struct **p)
void | wake_up (struct task_struct **p)
static unsigned long | _get_base (char *addr)

Variables

task_struct * | task [NR_TASKS]
task_struct * last_task_used_math
task_struct * current
long volatile | jiffies
long | startup_time

Define Documentation

#define _LDT ( n ) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))

Definition at line 158 of file sched.h.

Referenced by copy_process().

#define _set_base | ( | addr,
 |  | base | )

Value:

__asm__ ("push %%edx\n\t" \
    "movw %%dx,%0\n\t" \
    "rorl $16,%%edx\n\t" \
    "movb %%dl,%1\n\t" \
    "movb %%dh,%2\n\t" \
    "pop %%edx" \
    ::"m" (*((addr)+2)), \
     "m" (*((addr)+4)), \
     "m" (*((addr)+7)), \
     "d" (base) \
    )

Definition at line 190 of file sched.h.

#define _set_limit | ( | addr,
 |  | limit | )

Value:

__asm__ ("push %%edx\n\t" \
    "movw %%dx,%0\n\t" \
    "rorl $16,%%edx\n\t" \
    "movb %1,%%dh\n\t" \
    "andb $0xf0,%%dh\n\t" \
    "orb %%dh,%%dl\n\t" \
    "movb %%dl,%1\n\t" \
    "pop %%edx" \
    ::"m" (*(addr)), \
     "m" (*((addr)+6)), \
     "d" (limit) \
    )

Definition at line 203 of file sched.h.

#define _TSS ( n ) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))

Definition at line 157 of file sched.h.

#define CURRENT_TIME (startup_time+jiffies/HZ)

Definition at line 144 of file sched.h.

Referenced by _bmap(), add_entry(), file_read(), file_write(), namei(), new_inode(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), sys_time(), sys_unlink(), sys_utime(), and truncate().

#define FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1)

Definition at line 156 of file sched.h.

Referenced by copy_process(), and sched_init().

#define FIRST_TASK task[0]

Definition at line 7 of file sched.h.

Referenced by kill_session(), schedule(), share_page(), sys_kill(), and sys_waitpid().

#define FIRST_TSS_ENTRY 4

Definition at line 155 of file sched.h.

Referenced by copy_process(), and sched_init().

#define get_base ( ldt ) _get_base( ((char *)&(ldt)) )

Definition at line 249 of file sched.h.

Referenced by change_ldt(), copy_mem(), die(), do_execve(), do_exit(), and verify_area().

#define get_limit ( segment )

Value:

({ \
unsigned long __limit; \
__asm__("lsll %1,%0\n\tincl %0":"=r" (__limit):"r" (segment)); \
__limit;})

Definition at line 251 of file sched.h.

Referenced by copy_mem(), die(), do_execve(), and do_exit().

#define HZ 100

Definition at line 5 of file sched.h.

Referenced by floppy_off(), sys_alarm(), sys_stime(), sysbeep(), and ticks_to_floppy_on().

#define INIT_TASK

Value:

/* state etc */ { 0,15,15, \
/* signals */   0,{{},},0, \
/* ec,brk... */ 0,0,0,0,0,0, \
/* pid etc.. */ 0,-1,0,0,0, \
/* uid etc */   0,0,0,0,0,0, \
/* alarm */ 0,0,0,0,0,0, \
/* math */  0, \
/* fs info */   -1,0022,NULL,NULL,NULL,0, \
/* filp */  {NULL,}, \
    { \
        {0,0}, \
/* ldt */   {0x9f,0xc0fa00}, \
        {0x9f,0xc0f200}, \
    }, \
/*tss*/ {0,PAGE_SIZE+(long)&init_task,0x10,0,0,0,0,(long)&pg_dir,\
     0,0,0,0,0,0,0,0, \
     0,0,0x17,0x17,0x17,0x17,0x17,0x17, \
     _LDT(0),0x80000000, \
        {} \
    }, \
}

Definition at line 115 of file sched.h.

#define LAST_TASK task[NR_TASKS-1]

Definition at line 8 of file sched.h.

Referenced by schedule(), share_page(), and sys_waitpid().

#define lldt ( n ) __asm__("lldt %%ax"::"a" (_LDT(n)))

Definition at line 160 of file sched.h.

Referenced by sched_init().

#define ltr ( n ) __asm__("ltr %%ax"::"a" (_TSS(n)))

Definition at line 159 of file sched.h.

Referenced by sched_init().

#define NR_TASKS 64

Definition at line 4 of file sched.h.

Referenced by do_exit(), find_empty_process(), kill_session(), release(), sched_init(), schedule(), show_stat(), sys_kill(), sys_setpgid(), tell_father(), and tty_intr().

#define NULL ((void *) 0)

Definition at line 26 of file sched.h.

#define PAGE_ALIGN ( n ) (((n)+0xfff)&0xfffff000)

Definition at line 188 of file sched.h.

#define set_base | ( | ldt,
 |  | base | ) | _set_base( ((char *)&(ldt)) , (base) )

Definition at line 217 of file sched.h.

Referenced by change_ldt(), and copy_mem().

#define set_limit | ( | ldt,
 |  | limit | ) | _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )

Definition at line 218 of file sched.h.

Referenced by change_ldt().

#define str ( n )

Value:

__asm__("str %%ax\n\t" \
    "subl %2,%%eax\n\t" \
    "shrl $4,%%eax" \
    :"=a" (n) \
    :"a" (0),"i" (FIRST_TSS_ENTRY<<3))

Definition at line 161 of file sched.h.

Referenced by die(), number(), and vsprintf().

#define switch_to ( n )

Value:

{\
struct {long a,b;} __tmp; \
__asm__("cmpl %%ecx,current\n\t" \
    "je 1f\n\t" \
    "movw %%dx,%1\n\t" \
    "xchgl %%ecx,current\n\t" \
    "ljmp *%0\n\t" \
    "cmpl %%ecx,last_task_used_math\n\t" \
    "jne 1f\n\t" \
    "clts\n" \
    "1:" \
    ::"m" (*&__tmp.a),"m" (*&__tmp.b), \
    "d" (_TSS(n)),"c" ((long) task[n])); \
}

Definition at line 173 of file sched.h.

Referenced by schedule().

#define TASK_INTERRUPTIBLE 1

Definition at line 20 of file sched.h.

Referenced by interruptible_sleep_on(), schedule(), sys_pause(), and sys_waitpid().

#define TASK_RUNNING 0

Definition at line 19 of file sched.h.

Referenced by copy_process(), and schedule().

#define TASK_STOPPED 4

Definition at line 23 of file sched.h.

Referenced by sys_waitpid().

#define TASK_UNINTERRUPTIBLE 2

Definition at line 21 of file sched.h.

Referenced by copy_process(), and sleep_on().

#define TASK_ZOMBIE 3

Definition at line 22 of file sched.h.

Referenced by do_exit().

Typedef Documentation

typedef int(* fn_ptr)()

Definition at line 40 of file sched.h.

Function Documentation

static unsigned long _get_base ( char * addr ) [inline, static]

#define _get_base(addr) ({\ unsigned long __base; \ __asm__("movb %3,%%dh\n\t" \ "movb %2,%%dl\n\t" \ "shll $16,%%edx\n\t" \ "movw %1,%%dx" \ :"=d" (__base) \ :"m" (*((addr)+2)), \ "m" (*((addr)+4)), \ "m" (*((addr)+7)) \ :"memory"); \ __base;})

Definition at line 235 of file sched.h.

void add_timer | ( | long | jiffies,
 |  | void(*)(void) | fn
 | ) |

Definition at line 272 of file sched.c.

References cli, timer_list::fn, jiffies, timer_list::jiffies, timer_list::next, next_timer, panic(), sti, and TIME_REQUESTS.

Referenced by do_fd_request(), and floppy_on_interrupt().

int copy_page_tables | ( | unsigned long | from,
 |  | unsigned long | to,
 |  | long | size
 | ) |

Definition at line 150 of file memory.c.

References get_free_page(), invalidate, LOW_MEM, mem_map, and panic().

Referenced by copy_mem().

int free_page_tables | ( | unsigned long | from,
 |  | unsigned long | size
 | ) |

Definition at line 105 of file memory.c.

References free_page(), invalidate, and panic().

Referenced by copy_mem(), do_execve(), and do_exit().

void interruptible_sleep_on ( struct task_struct ** p )

Definition at line 167 of file sched.c.

References current, init_task, NULL, panic(), schedule(), task_struct::state, task_union::task, and TASK_INTERRUPTIBLE.

Referenced by floppy_change(), sleep_if_empty(), and sleep_if_full().

volatile void panic ( const char * str )

Definition at line 18 of file panic.c.

References current, printk(), sys_sync(), and task.

void sched_init ( void )

Definition at line 385 of file sched.c.

References desc_struct::a, desc_struct::b, FIRST_LDT_ENTRY, FIRST_TSS_ENTRY, gdt, inb_p, init_task, LATCH, task_struct::ldt, lldt, ltr, NR_TASKS, NULL, outb, outb_p, panic(), set_intr_gate, set_ldt_desc, set_system_gate, set_tss_desc, system_call(), task_union::task, task, timer_interrupt(), and task_struct::tss.

Referenced by main().

void schedule ( void )

Definition at line 104 of file sched.c.

References _BLOCKABLE, task_struct::alarm, task_struct::counter, FIRST_TASK, jiffies, LAST_TASK, NR_TASKS, task_struct::priority, SIGALRM, task_struct::signal, task_struct::state, switch_to, task, TASK_INTERRUPTIBLE, and TASK_RUNNING.

Referenced by do_exit(), do_timer(), interruptible_sleep_on(), release(), sleep_on(), sys_pause(), sys_waitpid(), and tty_write().

void sleep_on ( struct task_struct ** p )

Definition at line 151 of file sched.c.

References current, init_task, panic(), schedule(), task_struct::state, task_union::task, and TASK_UNINTERRUPTIBLE.

Referenced by floppy_on(), getblk(), lock_buffer(), lock_inode(), lock_super(), make_request(), read_pipe(), wait_on_buffer(), wait_on_inode(), wait_on_super(), and write_pipe().

void trap_init ( void )

Definition at line 181 of file traps.c.

References bounds(), coprocessor_error(), coprocessor_segment_overrun(), debug(), device_not_available(), divide_error(), double_fault(), general_protection(), inb_p, int3(), invalid_op(), invalid_TSS(), irq13(), nmi(), outb, outb_p, overflow(), page_fault(), parallel_interrupt(), reserved(), segment_not_present(), set_system_gate, set_trap_gate, and stack_segment().

Referenced by main().

int tty_write | ( | unsigned | minor,
 |  | char * | buf,
 |  | int | count
 | ) |

Definition at line 291 of file tty_io.c.

void wake_up ( struct task_struct ** p )

Definition at line 188 of file sched.c.

References NULL, and task_struct::state.

Referenced by brelse(), copy_to_cooked(), do_floppy_timer(), floppy_deselect(), free_super(), iput(), read_pipe(), unlock_buffer(), unlock_inode(), and write_pipe().

Variable Documentation

struct task_struct* current

Definition at line 62 of file sched.c.

Referenced by change_ldt(), copy_mem(), copy_process(), die(), do_coprocessor_error(), do_execve(), do_exit(), do_no_page(), do_signal(), do_timer(), dupfd(), find_entry(), get_dir(), interruptible_sleep_on(), kill_session(), math_emulate(), math_state_restore(), mount_root(), new_inode(), open_namei(), panic(), permission(), rw_tty(), send_sig(), share_page(), sleep_if_empty(), sleep_if_full(), sleep_on(), sys_access(), sys_alarm(), sys_brk(), sys_chdir(), sys_chmod(), sys_chroot(), sys_close(), sys_fcntl(), sys_fstat(), sys_getegid(), sys_geteuid(), sys_getgid(), sys_getpgrp(), sys_getpid(), sys_getppid(), sys_getuid(), sys_ioctl(), sys_kill(), sys_lseek(), sys_mkdir(), sys_nice(), sys_open(), sys_pause(), sys_pipe(), sys_rmdir(), sys_setpgid(), sys_setregid(), sys_setreuid(), sys_setsid(), sys_sgetmask(), sys_sigaction(), sys_signal(), sys_ssetmask(), sys_times(), sys_umask(), sys_unlink(), sys_waitpid(), tell_father(), try_to_share(), tty_ioctl(), tty_read(), tty_write(), verify_area(), and write_pipe().

long volatile jiffies

Definition at line 60 of file sched.c.

Referenced by add_timer(), copy_process(), schedule(), sys_alarm(), sys_stime(), sys_times(), and tty_read().

struct task_struct* last_task_used_math

Definition at line 63 of file sched.c.

Referenced by copy_process(), do_coprocessor_error(), do_execve(), do_exit(), math_error(), and math_state_restore().

long startup_time

Definition at line 61 of file sched.c.

Referenced by sys_stime().

struct task_struct* task[NR_TASKS]

Definition at line 65 of file sched.c.

Referenced by copy_process(), do_exit(), find_empty_process(), kill_session(), panic(), release(), sched_init(), schedule(), show_stat(), sys_kill(), sys_setpgid(), tell_father(), and tty_intr().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/sys.h File Reference

sys.h File Reference

Go to the source code of this file.

Functions

int | sys_setup ()
int | sys_exit ()
int | sys_fork ()
int | sys_read ()
int | sys_write ()
int | sys_open ()
int | sys_close ()
int | sys_waitpid ()
int | sys_creat ()
int | sys_link ()
int | sys_unlink ()
int | sys_execve ()
int | sys_chdir ()
int | sys_time ()
int | sys_mknod ()
int | sys_chmod ()
int | sys_chown ()
int | sys_break ()
int | sys_stat ()
int | sys_lseek ()
int | sys_getpid ()
int | sys_mount ()
int | sys_umount ()
int | sys_setuid ()
int | sys_getuid ()
int | sys_stime ()
int | sys_ptrace ()
int | sys_alarm ()
int | sys_fstat ()
int | sys_pause ()
int | sys_utime ()
int | sys_stty ()
int | sys_gtty ()
int | sys_access ()
int | sys_nice ()
int | sys_ftime ()
int | sys_sync ()
int | sys_kill ()
int | sys_rename ()
int | sys_mkdir ()
int | sys_rmdir ()
int | sys_dup ()
int | sys_pipe ()
int | sys_times ()
int | sys_prof ()
int | sys_brk ()
int | sys_setgid ()
int | sys_getgid ()
int | sys_signal ()
int | sys_geteuid ()
int | sys_getegid ()
int | sys_acct ()
int | sys_phys ()
int | sys_lock ()
int | sys_ioctl ()
int | sys_fcntl ()
int | sys_mpx ()
int | sys_setpgid ()
int | sys_ulimit ()
int | sys_uname ()
int | sys_umask ()
int | sys_chroot ()
int | sys_ustat ()
int | sys_dup2 ()
int | sys_getppid ()
int | sys_getpgrp ()
int | sys_setsid ()
int | sys_sigaction ()
int | sys_sgetmask ()
int | sys_ssetmask ()
int | sys_setreuid ()
int | sys_setregid ()

Variables

fn_ptr sys_call_table []

Function Documentation

int sys_access ( )

int sys_acct ( )

Definition at line 77 of file sys.c.

References ENOSYS.

int sys_alarm ( )

int sys_break ( )

Definition at line 21 of file sys.c.

References ENOSYS.

int sys_brk ( )

int sys_chdir ( )

int sys_chmod ( )

int sys_chown ( )

int sys_chroot ( )

int sys_close ( )

int sys_creat ( )

int sys_dup ( )

int sys_dup2 ( )

int sys_execve ( )

int sys_exit ( )

int sys_fcntl ( )

int sys_fork ( )

int sys_fstat ( )

int sys_ftime ( )

Definition at line 16 of file sys.c.

References ENOSYS.

int sys_getegid ( )

Definition at line 373 of file sched.c.

References current, and task_struct::egid.

int sys_geteuid ( )

Definition at line 363 of file sched.c.

References current, and task_struct::euid.

int sys_getgid ( )

Definition at line 368 of file sched.c.

References current, and task_struct::gid.

int sys_getpgrp ( )

Definition at line 201 of file sys.c.

References current, and task_struct::pgrp.

int sys_getpid ( )

Definition at line 348 of file sched.c.

References current, and task_struct::pid.

int sys_getppid ( )

Definition at line 353 of file sched.c.

References current, and task_struct::father.

int sys_getuid ( )

Definition at line 358 of file sched.c.

References current, and task_struct::uid.

int sys_gtty ( )

Definition at line 36 of file sys.c.

References ENOSYS.

int sys_ioctl ( )

int sys_kill ( )

int sys_link ( )

int sys_lock ( )

Definition at line 87 of file sys.c.

References ENOSYS.

int sys_lseek ( )

int sys_mkdir ( )

int sys_mknod ( )

int sys_mount ( )

int sys_mpx ( )

Definition at line 92 of file sys.c.

References ENOSYS.

int sys_nice ( )

int sys_open ( )

int sys_pause ( )

Definition at line 144 of file sched.c.

int sys_phys ( )

Definition at line 82 of file sys.c.

References ENOSYS.

int sys_pipe ( )

int sys_prof ( )

Definition at line 46 of file sys.c.

References ENOSYS.

int sys_ptrace ( )

Definition at line 26 of file sys.c.

References ENOSYS.

int sys_read ( )

int sys_rename ( )

Definition at line 41 of file sys.c.

References ENOSYS.

int sys_rmdir ( )

int sys_setgid ( )

int sys_setpgid ( )

int sys_setregid ( )

Referenced by sys_setgid().

int sys_setreuid ( )

Referenced by sys_setuid().

int sys_setsid ( )

Definition at line 206 of file sys.c.

References current, EPERM, task_struct::leader, task_struct::pgrp, task_struct::pid, task_struct::session, suser, and task_struct::tty.

int sys_setuid ( )

int sys_setup ( )

int sys_sgetmask ( )

Definition at line 15 of file signal.c.

References task_struct::blocked, and current.

int sys_sigaction ( )

int sys_signal ( )

int sys_ssetmask ( )

int sys_stat ( )

int sys_stime ( )

int sys_stty ( )

Definition at line 31 of file sys.c.

References ENOSYS.

int sys_sync ( )

Definition at line 47 of file buffer.c.

int sys_time ( )

int sys_times ( )

int sys_ulimit ( )

Definition at line 97 of file sys.c.

References ENOSYS.

int sys_umask ( )

int sys_umount ( )

int sys_uname ( )

int sys_unlink ( )

int sys_ustat ( )

int sys_utime ( )

int sys_waitpid ( )

int sys_write ( )

Variable Documentation

fn_ptr sys_call_table[]

Initial value:

 { sys_setup, sys_exit, sys_fork, sys_read,
sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link,
sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod,
sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount,
sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm,
sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access,
sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir,
sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid,
sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys,
sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit,
sys_uname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid,
sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask,
sys_setreuid,sys_setregid }

Definition at line 74 of file sys.h.

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/tty.h File Reference

tty.h File Reference

#include <termios.h>

Go to the source code of this file.

Defines

#define | TTY_BUF_SIZE 1024
#define | INC(a) ((a) = ((a)+1) & (TTY_BUF_SIZE-1))
#define | DEC(a) ((a) = ((a)-1) & (TTY_BUF_SIZE-1))
#define | EMPTY(a) ((a).head == (a).tail)
#define | LEFT(a) (((a).tail-(a).head-1)&(TTY_BUF_SIZE-1))
#define | LAST(a) ((a).buf[(TTY_BUF_SIZE-1)&((a).head-1)])
#define | FULL(a) (!LEFT(a))
#define | CHARS(a) (((a).head-(a).tail)&(TTY_BUF_SIZE-1))
#define | GETCH(queue, c) (void)({c=(queue).buf[(queue).tail];INC((queue).tail);})
#define | PUTCH(c, queue) (void)({(queue).buf[(queue).head]=(c);INC((queue).head);})
#define | INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
#define | QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
#define | ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
#define | KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
#define | EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
#define | START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
#define | STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
#define | SUSPEND_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
#define | INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"

Functions

void | rs_init (void)
void | con_init (void)
void | tty_init (void)
int | tty_read (unsigned c, char *buf, int n)
int | tty_write (unsigned c, char *buf, int n)
void | rs_write (struct tty_struct *tty)
void | con_write (struct tty_struct *tty)
void | copy_to_cooked (struct tty_struct *tty)

Variables

tty_struct tty_table []

Define Documentation

#define CHARS ( a ) (((a).head-(a).tail)&(TTY_BUF_SIZE-1))

Definition at line 30 of file tty.h.

Referenced by con_write(), and tty_ioctl().

#define DEC ( a ) ((a) = ((a)-1) & (TTY_BUF_SIZE-1))

Definition at line 25 of file tty.h.

Referenced by copy_to_cooked().

#define EMPTY ( a ) ((a).head == (a).tail)

Definition at line 26 of file tty.h.

Referenced by copy_to_cooked(), rs_write(), sleep_if_empty(), and tty_read().

#define EOF_CHAR ( tty ) ((tty)->termios.c_cc[VEOF])

Definition at line 40 of file tty.h.

Referenced by copy_to_cooked(), and tty_read().

#define ERASE_CHAR ( tty ) ((tty)->termios.c_cc[VERASE])

Definition at line 38 of file tty.h.

Referenced by con_write(), and copy_to_cooked().

#define FULL ( a ) (!LEFT(a))

Definition at line 29 of file tty.h.

Referenced by copy_to_cooked(), sleep_if_full(), and tty_write().

#define GETCH | ( | queue,
 |  | c | ) | (void)({c=(queue).buf[(queue).tail];INC((queue).tail);})

Definition at line 31 of file tty.h.

Referenced by con_write(), copy_to_cooked(), and tty_read().

#define INC ( a ) ((a) = ((a)+1) & (TTY_BUF_SIZE-1))

Definition at line 24 of file tty.h.

#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"

Definition at line 63 of file tty.h.

#define INTR_CHAR ( tty ) ((tty)->termios.c_cc[VINTR])

Definition at line 36 of file tty.h.

Referenced by copy_to_cooked().

#define KILL_CHAR ( tty ) ((tty)->termios.c_cc[VKILL])

Definition at line 39 of file tty.h.

Referenced by copy_to_cooked().

#define LAST ( a ) ((a).buf[(TTY_BUF_SIZE-1)&((a).head-1)])

Definition at line 28 of file tty.h.

Referenced by copy_to_cooked().

#define LEFT ( a ) (((a).tail-(a).head-1)&(TTY_BUF_SIZE-1))

Definition at line 27 of file tty.h.

Referenced by number(), sleep_if_full(), tty_read(), and vsprintf().

#define PUTCH | ( | c,
 |  | queue | ) | (void)({(queue).buf[(queue).head]=(c);INC((queue).head);})

Definition at line 33 of file tty.h.

Referenced by copy_to_cooked(), respond(), and tty_write().

#define QUIT_CHAR ( tty ) ((tty)->termios.c_cc[VQUIT])

Definition at line 37 of file tty.h.

Referenced by copy_to_cooked().

#define START_CHAR ( tty ) ((tty)->termios.c_cc[VSTART])

Definition at line 41 of file tty.h.

Referenced by copy_to_cooked().

#define STOP_CHAR ( tty ) ((tty)->termios.c_cc[VSTOP])

Definition at line 42 of file tty.h.

Referenced by copy_to_cooked().

#define SUSPEND_CHAR ( tty ) ((tty)->termios.c_cc[VSUSP])

Definition at line 43 of file tty.h.

#define TTY_BUF_SIZE 1024

Definition at line 14 of file tty.h.

Function Documentation

void con_init ( void )

Definition at line 617 of file console.c.

References a, bottom, gotoxy(), inb_p, keyboard_interrupt(), ORIG_VIDEO_COLS, ORIG_VIDEO_EGA_BX, ORIG_VIDEO_LINES, ORIG_VIDEO_MODE, ORIG_VIDEO_PAGE, ORIG_X, ORIG_Y, origin, outb, outb_p, scr_end, set_trap_gate, top, video_erase_char, video_mem_end, video_mem_start, video_num_columns, video_num_lines, video_page, video_port_reg, video_port_val, video_size_row, video_type, VIDEO_TYPE_CGA, VIDEO_TYPE_EGAC, VIDEO_TYPE_EGAM, and VIDEO_TYPE_MDA.

Referenced by tty_init().

void con_write ( struct tty_struct * tty )

Definition at line 445 of file console.c.

References bottom, CHARS, cr(), csi_at(), csi_J(), csi_K(), csi_L(), csi_M(), csi_m(), csi_P(), del(), ERASE_CHAR, GETCH, gotoxy(), lf(), npar, NPAR, par, pos, ques, respond(), restore_cur(), ri(), save_cur(), set_cursor(), state, sysbeep(), top, video_num_columns, video_num_lines, video_size_row, x, and y.

void copy_to_cooked ( struct tty_struct * tty )

Definition at line 145 of file tty_io.c.

References DEC, EMPTY, EOF_CHAR, ERASE_CHAR, FULL, GETCH, I_CRNL, I_NLCR, I_NOCR, I_UCLC, INTMASK, INTR_CHAR, KILL_CHAR, L_CANON, L_ECHO, L_ECHOCTL, L_ISIG, LAST, PUTCH, QUIT_CHAR, QUITMASK, START_CHAR, STOP_CHAR, tolower, tty_intr(), and wake_up().

Referenced by do_tty_interrupt(), and respond().

void rs_init ( void )

Definition at line 37 of file serial.c.

References inb_p, init(), outb, rs1_interrupt(), rs2_interrupt(), set_intr_gate, and tty_table.

Referenced by tty_init().

void rs_write ( struct tty_struct * tty )

Definition at line 53 of file serial.c.

References cli, EMPTY, inb_p, outb, and sti.

void tty_init ( void )

Definition at line 105 of file tty_io.c.

References con_init(), and rs_init().

Referenced by main().

int tty_read | ( | unsigned | c,
 |  | char * | buf,
 |  | int | n
 | ) |

Definition at line 230 of file tty_io.c.

References task_struct::alarm, ALRMMASK, b, termios::c_cc, current, tty_queue::data, EINTR, EMPTY, EOF_CHAR, GETCH, jiffies, L_CANON, LEFT, put_fs_byte(), tty_struct::secondary, task_struct::signal, sleep_if_empty(), tty_struct::termios, time(), tty_table, VMIN, and VTIME.

int tty_write | ( | unsigned | c,
 |  | char * | buf,
 |  | int | n
 | ) |

Definition at line 291 of file tty_io.c.

References b, current, FULL, get_fs_byte(), O_CRNL, O_LCUC, O_NLCR, O_NLRET, O_POST, PUTCH, schedule(), task_struct::signal, sleep_if_full(), toupper, tty_table, tty_struct::write, and tty_struct::write_q.

Variable Documentation

struct tty_struct tty_table[]

Definition at line 51 of file tty_io.c.

Referenced by do_exit(), do_tty_interrupt(), rs_init(), sys_open(), tty_ioctl(), tty_read(), tty_write(), and wait_for_keypress().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/stat.h File Reference

stat.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Defines

#define | S_IFMT 00170000
#define | S_IFREG 0100000
#define | S_IFBLK 0060000
#define | S_IFDIR 0040000
#define | S_IFCHR 0020000
#define | S_IFIFO 0010000
#define | S_ISUID 0004000
#define | S_ISGID 0002000
#define | S_ISVTX 0001000
#define | S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define | S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define | S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define | S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
#define | S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
#define | S_IRWXU 00700
#define | S_IRUSR 00400
#define | S_IWUSR 00200
#define | S_IXUSR 00100
#define | S_IRWXG 00070
#define | S_IRGRP 00040
#define | S_IWGRP 00020
#define | S_IXGRP 00010
#define | S_IRWXO 00007
#define | S_IROTH 00004
#define | S_IWOTH 00002
#define | S_IXOTH 00001

Functions

int | chmod (const char *_path, mode_t mode)
int | fstat (int fildes, struct stat *stat_buf)
int | mkdir (const char *_path, mode_t mode)
int | mkfifo (const char *_path, mode_t mode)
int | stat (const char *filename, struct stat *stat_buf)
mode_t | umask (mode_t mask)

Define Documentation

#define S_IFBLK 0060000

Definition at line 22 of file stat.h.

#define S_IFCHR 0020000

Definition at line 24 of file stat.h.

#define S_IFDIR 0040000

Definition at line 23 of file stat.h.

#define S_IFIFO 0010000

Definition at line 25 of file stat.h.

#define S_IFMT 00170000

Definition at line 20 of file stat.h.

#define S_IFREG 0100000

Definition at line 21 of file stat.h.

#define S_IRGRP 00040

Definition at line 42 of file stat.h.

#define S_IROTH 00004

Definition at line 47 of file stat.h.

#define S_IRUSR 00400

Definition at line 37 of file stat.h.

#define S_IRWXG 00070

Definition at line 41 of file stat.h.

#define S_IRWXO 00007

Definition at line 46 of file stat.h.

#define S_IRWXU 00700

Definition at line 36 of file stat.h.

#define S_ISBLK ( m ) (((m) & S_IFMT) == S_IFBLK)

Definition at line 33 of file stat.h.

Referenced by iput(), sys_ioctl(), sys_mknod(), sys_mount(), sys_open(), sys_read(), sys_umount(), and sys_write().

#define S_ISCHR ( m ) (((m) & S_IFMT) == S_IFCHR)

Definition at line 32 of file stat.h.

Referenced by sys_ioctl(), sys_mknod(), sys_open(), sys_read(), and sys_write().

#define S_ISDIR ( m ) (((m) & S_IFMT) == S_IFDIR)

Definition at line 31 of file stat.h.

Referenced by get_dir(), open_namei(), sys_chdir(), sys_chroot(), sys_link(), sys_mount(), sys_read(), sys_rmdir(), sys_unlink(), and truncate().

#define S_ISFIFO ( m ) (((m) & S_IFMT) == S_IFIFO)

Definition at line 34 of file stat.h.

#define S_ISGID 0002000

Definition at line 27 of file stat.h.

Referenced by do_execve().

#define S_ISREG ( m ) (((m) & S_IFMT) == S_IFREG)

Definition at line 30 of file stat.h.

Referenced by do_execve(), sys_read(), sys_write(), and truncate().

#define S_ISUID 0004000

Definition at line 26 of file stat.h.

Referenced by do_execve().

#define S_ISVTX 0001000

Definition at line 28 of file stat.h.

Referenced by sys_rmdir(), and sys_unlink().

#define S_IWGRP 00020

Definition at line 43 of file stat.h.

#define S_IWOTH 00002

Definition at line 48 of file stat.h.

#define S_IWUSR 00200

Definition at line 38 of file stat.h.

#define S_IXGRP 00010

Definition at line 44 of file stat.h.

#define S_IXOTH 00001

Definition at line 49 of file stat.h.

#define S_IXUSR 00100

Definition at line 39 of file stat.h.

Function Documentation

int chmod | ( | const char * | _path,
 |  | mode_t | mode
 | ) |

int fstat | ( | int | fildes,
 |  | struct stat * | stat_buf
 | ) |

int mkdir | ( | const char * | _path,
 |  | mode_t | mode
 | ) |

int mkfifo | ( | const char * | _path,
 |  | mode_t | mode
 | ) |

int stat | ( | const char * | filename,
 |  | struct stat * | stat_buf
 | ) |

Referenced by main().

mode_t umask ( mode_t mask )

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/times.h File Reference

times.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Functions

time_t times (struct tms *tp)

Function Documentation

time_t times ( struct tms * tp )

Referenced by sys_utime().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/types.h File Reference

types.h File Reference

Go to the source code of this file.

Defines

#define | NULL ((void *) 0)

Typedefs

typedef unsigned int | size_t
typedef long | time_t
typedef long | ptrdiff_t
typedef int | pid_t
typedef unsigned short | uid_t
typedef unsigned char | gid_t
typedef unsigned short | dev_t
typedef unsigned short | ino_t
typedef unsigned short | mode_t
typedef unsigned short | umode_t
typedef unsigned char | nlink_t
typedef int | daddr_t
typedef long | off_t
typedef unsigned char | u_char
typedef unsigned short | ushort

Define Documentation

#define NULL ((void *) 0)

Definition at line 20 of file types.h.

Typedef Documentation

typedef int daddr_t

Definition at line 31 of file types.h.

typedef unsigned short dev_t

Definition at line 26 of file types.h.

typedef unsigned char gid_t

Definition at line 25 of file types.h.

typedef unsigned short ino_t

Definition at line 27 of file types.h.

typedef unsigned short mode_t

Definition at line 28 of file types.h.

typedef unsigned char nlink_t

Definition at line 30 of file types.h.

typedef long off_t

Definition at line 32 of file types.h.

typedef int pid_t

Definition at line 23 of file types.h.

typedef long ptrdiff_t

Definition at line 16 of file types.h.

typedef unsigned int size_t

Definition at line 6 of file types.h.

typedef long time_t

Definition at line 11 of file types.h.

typedef unsigned char u_char

Definition at line 33 of file types.h.

typedef unsigned short uid_t

Definition at line 24 of file types.h.

typedef unsigned short umode_t

Definition at line 29 of file types.h.

typedef unsigned short ushort

Definition at line 34 of file types.h.

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/utsname.h File Reference

utsname.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Functions

int uname (struct utsname *utsbuf)

Function Documentation

int uname ( struct utsname * utsbuf )

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/wait.h File Reference

wait.h File Reference

#include <sys/types.h>

Go to the source code of this file.

Defines

#define | _LOW(v) ( (v) & 0377)
#define | _HIGH(v) ( ((v) >> 8) & 0377)
#define | WNOHANG 1
#define | WUNTRACED 2
#define | WIFEXITED(s) (!((s)&0xFF)
#define | WIFSTOPPED(s) (((s)&0xFF)==0x7F)
#define | WEXITSTATUS(s) (((s)>>8)&0xFF)
#define | WTERMSIG(s) ((s)&0x7F)
#define | WSTOPSIG(s) (((s)>>8)&0xFF)
#define | WIFSIGNALED(s) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF)

Functions

pid_t | wait (int *stat_loc)
pid_t | waitpid (pid_t pid, int *stat_loc, int options)

Define Documentation

#define _HIGH ( v ) ( ((v) >> 8) & 0377)

Definition at line 7 of file wait.h.

#define _LOW ( v ) ( (v) & 0377)

Definition at line 6 of file wait.h.

#define WEXITSTATUS ( s ) (((s)>>8)&0xFF)

Definition at line 15 of file wait.h.

#define WIFEXITED ( s ) (!((s)&0xFF)

Definition at line 13 of file wait.h.

#define WIFSIGNALED ( s ) (((unsigned int)(s)-1 & 0xFFFF) < 0xFF)

Definition at line 18 of file wait.h.

#define WIFSTOPPED ( s ) (((s)&0xFF)==0x7F)

Definition at line 14 of file wait.h.

#define WNOHANG 1

Definition at line 10 of file wait.h.

Referenced by sys_waitpid().

#define WSTOPSIG ( s ) (((s)>>8)&0xFF)

Definition at line 17 of file wait.h.

#define WTERMSIG ( s ) ((s)&0x7F)

Definition at line 16 of file wait.h.

#define WUNTRACED 2

Definition at line 11 of file wait.h.

Referenced by sys_waitpid().

Function Documentation

pid_t wait ( int * stat_loc )

Referenced by init().

pid_t waitpid | ( | pid_t | pid,
 |  | int * | stat_loc,
 |  | int | options
 | ) |

Referenced by _syscall3().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/init/main.c File Reference

main.c File Reference

#include <unistd.h>
#include <time.h>
#include <linux/tty.h>
#include <linux/sched.h>
#include <linux/head.h>
#include <asm/system.h>
#include <asm/io.h>
#include <stddef.h>
#include <stdarg.h>
#include <fcntl.h>
#include <sys/types.h>
#include <linux/fs.h>

Go to the source code of this file.

Defines

#define | __LIBRARY__
#define | EXT_MEM_K (*(unsigned short *)0x90002)
#define | DRIVE_INFO (*(struct drive_info *)0x90080)
#define | ORIG_ROOT_DEV (*(unsigned short *)0x901FC)
#define | CMOS_READ(addr)
#define | BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)

Functions

static | _syscall0 (static inline _syscall0(int, fork)
void | main (void)
static int | printf (const char *fmt,...)
void | init (void)

Variables

static long | memory_end = 0
static long | buffer_memory_end = 0
static long | main_memory_start = 0
drive_info drive_info
static char * | argv_rc [] = { "/bin/sh", NULL }
static char * | envp_rc [] = { "HOME=/", NULL }
static char * | argv [] = { "-/bin/sh",NULL }
static char * | envp [] = { "HOME=/usr/root", NULL }

Define Documentation

#define __LIBRARY__

Definition at line 7 of file main.c.

#define BCD_TO_BIN ( val ) ((val)=((val)&15) + ((val)>>4)*10)

#define CMOS_READ ( addr )

Value:

({ \
outb_p(0x80|addr,0x70); \
inb_p(0x71); \
})

Referenced by sys_setup().

#define DRIVE_INFO (*(struct drive_info *)0x90080)

Referenced by main().

#define EXT_MEM_K (*(unsigned short *)0x90002)

Referenced by main().

#define ORIG_ROOT_DEV (*(unsigned short *)0x901FC)

Referenced by main().

Function Documentation

static _syscall0 | ( | static inline _syscall0( | int,
 |  | fork |
 | ) | [inline, static]

Definition at line 23 of file main.c.

References inb_p, and outb_p.

void init ( void )

Definition at line 168 of file main.c.

References _exit(), argv, argv_rc, BLOCK_SIZE, close(), dup(), envp, envp_rc, execve(), fork(), main_memory_start, memory_end, NR_BUFFERS, O_RDONLY, O_RDWR, open(), printf(), setsid(), sync(), and wait().

Referenced by main(), and rs_init().

void main ( void )

Definition at line 104 of file main.c.

References blk_dev_init(), buffer_init(), buffer_memory_end, chr_dev_init(), DRIVE_INFO, EXT_MEM_K, floppy_init(), fork(), hd_init(), init(), main_memory_start, mem_init(), memory_end, move_to_user_mode, ORIG_ROOT_DEV, pause(), rd_init(), ROOT_DEV, sched_init(), sti, trap_init(), and tty_init().

static int printf | ( | const char * | fmt,
 |  |  | ...
 | ) | [static]

Definition at line 151 of file main.c.

References va_end, va_start, vsprintf(), and write().

Variable Documentation

char* argv[] = { "-/bin/sh",NULL } [static]

Definition at line 165 of file main.c.

Referenced by init().

char* argv_rc[] = { "/bin/sh", NULL } [static]

Definition at line 162 of file main.c.

Referenced by init().

long buffer_memory_end = 0 [static]

Definition at line 99 of file main.c.

Referenced by main().

struct drive_info drive_info

char* envp[] = { "HOME=/usr/root", NULL } [static]

Definition at line 166 of file main.c.

Referenced by init().

char* envp_rc[] = { "HOME=/", NULL } [static]

Definition at line 163 of file main.c.

Referenced by init().

long main_memory_start = 0 [static]

Definition at line 100 of file main.c.

Referenced by init(), and main().

long memory_end = 0 [static]

Definition at line 98 of file main.c.

Referenced by init(), and main().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/exit.c File Reference

exit.c File Reference

#include <errno.h>
#include <signal.h>
#include <sys/wait.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/tty.h>
#include <asm/segment.h>

Go to the source code of this file.

Functions

int | sys_pause (void)
int | sys_close (int fd)
void | release (struct task_struct *p)
static int | send_sig (long sig, struct task_struct *p, int priv)
static void | kill_session (void)
int | sys_kill (int pid, int sig)
static void | tell_father (int pid)
int | do_exit (long code)
int | sys_exit (int error_code)
int | sys_waitpid (pid_t pid, unsigned long *stat_addr, int options)

Function Documentation

int do_exit ( long code )

Definition at line 102 of file exit.c.

References current, task_struct::executable, task_struct::exit_code, task_struct::father, task_struct::filp, free_page_tables(), get_base, get_limit, iput(), kill_session(), last_task_used_math, task_struct::ldt, task_struct::leader, NR_OPEN, NR_TASKS, NULL, tty_struct::pgrp, task_struct::pid, task_struct::pwd, task_struct::root, schedule(), send_sig(), SIGCHLD, task_struct::state, sys_close(), task, TASK_ZOMBIE, tell_father(), task_struct::tty, and tty_table.

Referenced by die(), do_signal(), do_wp_page(), oom(), and sys_exit().

static void kill_session ( void ) [static]

Definition at line 46 of file exit.c.

References current, FIRST_TASK, NR_TASKS, task_struct::session, SIGHUP, task_struct::signal, and task.

Referenced by do_exit().

void release ( struct task_struct * p )

Definition at line 19 of file exit.c.

References free_page(), NR_TASKS, NULL, panic(), schedule(), and task.

Referenced by sys_waitpid(), and tell_father().

static int send_sig | ( | long | sig,
 |  | struct task_struct * | p,
 |  | int | priv
 | ) | [inline, static]

Definition at line 35 of file exit.c.

References current, EINVAL, EPERM, task_struct::euid, task_struct::signal, and suser.

Referenced by do_exit(), and sys_kill().

int sys_close ( int fd )

int sys_exit ( int error_code )

Definition at line 136 of file exit.c.

References do_exit().

int sys_kill | ( | int | pid,
 |  | int | sig
 | ) |

Definition at line 60 of file exit.c.

References current, FIRST_TASK, NR_TASKS, task_struct::pgrp, task_struct::pid, send_sig(), and task.

int sys_pause ( void )

Definition at line 144 of file sched.c.

References current, schedule(), task_struct::state, and TASK_INTERRUPTIBLE.

int sys_waitpid | ( | pid_t | pid,
 |  | unsigned long * | stat_addr,
 |  | int | options
 | ) |

Definition at line 141 of file exit.c.

References task_struct::cstime, current, task_struct::cutime, ECHILD, EINTR, task_struct::exit_code, FIRST_TASK, LAST_TASK, task_struct::pgrp, task_struct::pid, put_fs_long(), release(), schedule(), SIGCHLD, task_struct::signal, task_struct::state, task_struct::stime, TASK_INTERRUPTIBLE, TASK_STOPPED, task_struct::utime, verify_area(), WNOHANG, and WUNTRACED.

static void tell_father ( int pid ) [static]

Definition at line 83 of file exit.c.

References current, NR_TASKS, printk(), release(), SIGCHLD, task_struct::signal, and task.

Referenced by do_exit().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/fork.c File Reference

fork.c File Reference

#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <asm/system.h>

Go to the source code of this file.

Functions

void | write_verify (unsigned long address)
void | verify_area (void *addr, int size)
int | copy_mem (int nr, struct task_struct *p)
int | copy_process (int nr, long ebp, long edi, long esi, long gs, long none, long ebx, long ecx, long edx, long fs, long es, long ds, long eip, long cs, long eflags, long esp, long ss)
int | find_empty_process (void)

Variables

long | last_pid = 0

Function Documentation

int copy_mem | ( | int | nr,
 |  | struct task_struct * | p
 | ) |

Definition at line 39 of file fork.c.

References copy_page_tables(), current, ENOMEM, free_page_tables(), get_base, get_limit, task_struct::ldt, panic(), printk(), and set_base.

Referenced by copy_process().

int copy_process | ( | int | nr,
 |  | long | ebp,
 |  | long | edi,
 |  | long | esi,
 |  | long | gs,
 |  | long | none,
 |  | long | ebx,
 |  | long | ecx,
 |  | long | edx,
 |  | long | fs,
 |  | long | es,
 |  | long | ds,
 |  | long | eip,
 |  | long | cs,
 |  | long | eflags,
 |  | long | esp,
 |  | long | ss
 | ) |

Definition at line 69 of file fork.c.

References _LDT, task_struct::alarm, tss_struct::back_link, copy_mem(), task_struct::counter, tss_struct::cs, task_struct::cstime, current, task_struct::cutime, tss_struct::ds, EAGAIN, tss_struct::eax, tss_struct::ebp, tss_struct::ebx, tss_struct::ecx, tss_struct::edi, tss_struct::edx, tss_struct::eflags, tss_struct::eip, tss_struct::es, tss_struct::esi, tss_struct::esp, tss_struct::esp0, task_struct::executable, file::f_count, task_struct::father, task_struct::filp, FIRST_LDT_ENTRY, FIRST_TSS_ENTRY, free_page(), tss_struct::fs, gdt, get_free_page(), tss_struct::gs, tss_struct::i387, m_inode::i_count, jiffies, last_pid, last_task_used_math, task_struct::ldt, tss_struct::ldt, task_struct::leader, NR_OPEN, NULL, PAGE_SIZE, task_struct::pid, task_struct::priority, task_struct::pwd, task_struct::root, set_ldt_desc, set_tss_desc, task_struct::signal, tss_struct::ss, tss_struct::ss0, task_struct::start_time, task_struct::state, task_struct::stime, task, TASK_RUNNING, TASK_UNINTERRUPTIBLE, tss_struct::trace_bitmap, task_struct::tss, and task_struct::utime.

int find_empty_process ( void )

Definition at line 136 of file fork.c.

References EAGAIN, last_pid, NR_TASKS, and task.

void verify_area | ( | void * | addr,
 |  | int | size
 | ) |

Definition at line 24 of file fork.c.

References current, get_base, task_struct::ldt, and write_verify().

Referenced by cp_stat(), do_signal(), get_termio(), get_termios(), save_old(), sys_read(), sys_time(), sys_times(), sys_uname(), sys_waitpid(), and tty_ioctl().

void write_verify ( unsigned long address )

Definition at line 261 of file memory.c.

References un_wp_page().

Referenced by verify_area().

Variable Documentation

long last_pid = 0

Definition at line 22 of file fork.c.

Referenced by copy_process(), and find_empty_process().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/mktime.c File Reference

mktime.c File Reference

#include <time.h>

Go to the source code of this file.

Defines

#define | MINUTE 60
#define | HOUR (60*MINUTE)
#define | DAY (24*HOUR)
#define | YEAR (365*DAY)

Functions

long | kernel_mktime (struct tm *tm)

Variables

static int | month [12]

Define Documentation

#define DAY (24*HOUR)

Definition at line 22 of file mktime.c.

Referenced by kernel_mktime().

#define HOUR (60*MINUTE)

Definition at line 21 of file mktime.c.

Referenced by kernel_mktime().

#define MINUTE 60

Definition at line 20 of file mktime.c.

Referenced by kernel_mktime().

#define YEAR (365*DAY)

Definition at line 23 of file mktime.c.

Referenced by kernel_mktime().

Function Documentation

long kernel_mktime ( struct tm * tm )

Definition at line 41 of file mktime.c.

References DAY, HOUR, MINUTE, month, and YEAR.

Variable Documentation

int month[12] [static]

Initial value:

 {
    0,
    DAY*(31),
    DAY*(31+29),
    DAY*(31+29+31),
    DAY*(31+29+31+30),
    DAY*(31+29+31+30+31),
    DAY*(31+29+31+30+31+30),
    DAY*(31+29+31+30+31+30+31),
    DAY*(31+29+31+30+31+30+31+31),
    DAY*(31+29+31+30+31+30+31+31+30),
    DAY*(31+29+31+30+31+30+31+31+30+31),
    DAY*(31+29+31+30+31+30+31+31+30+31+30)
}

Definition at line 26 of file mktime.c.

Referenced by kernel_mktime().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/panic.c File Reference

panic.c File Reference

#include <linux/kernel.h>
#include <linux/sched.h>

Go to the source code of this file.

Defines

#define | PANIC

Functions

void | sys_sync (void)
volatile void | panic (const char *s)

Define Documentation

#define PANIC

Definition at line 11 of file panic.c.

Function Documentation

volatile void panic ( const char * s )

Definition at line 18 of file panic.c.

References current, printk(), sys_sync(), and task.

void sys_sync ( void )

Definition at line 47 of file buffer.c.

References buffer_head::b_dirt, ll_rw_block(), NR_BUFFERS, start_buffer, sync_inodes(), wait_on_buffer(), and WRITE.

Referenced by panic().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/printk.c File Reference

printk.c File Reference

#include <stdarg.h>
#include <stddef.h>
#include <linux/kernel.h>

Go to the source code of this file.

Functions

int | vsprintf (char *buf, const char *fmt, va_list args)
int | printk (const char *fmt,...)

Variables

static char | buf [1024]

Function Documentation

int printk | ( | const char * | fmt,
 |  |  | ...
 | ) |

Definition at line 21 of file printk.c.

References buf, va_end, va_start, and vsprintf().

Referenced by calc_mem(), copy_mem(), die(), do_execve(), do_int3(), drive_busy(), empty_dir(), floppy_deselect(), free_block(), free_inode(), get_empty_inode(), iget(), invalidate_inodes(), ll_rw_block(), malloc(), math_emulate(), mount_root(), oom(), output_byte(), panic(), put_page(), put_super(), rd_load(), reset_controller(), reset_floppy(), result(), rw_interrupt(), show_task(), sys_read(), sys_rmdir(), sys_setup(), sys_umount(), sys_unlink(), sys_write(), tell_father(), unexpected_hd_interrupt(), and unlock_buffer().

int vsprintf | ( | char * | buf,
 |  | const char * | fmt,
 |  | va_list | args
 | ) |

Definition at line 94 of file vsprintf.c.

References is_digit, LEFT, number(), PLUS, SIGN, skip_atoi(), SMALL, SPACE, SPECIAL, str, strlen(), va_arg, and ZEROPAD.

Referenced by printf(), and printk().

Variable Documentation

char buf[1024] [static]

Definition at line 17 of file printk.c.

Referenced by printk().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/sched.c File Reference

sched.c File Reference

#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/sys.h>
#include <linux/fdreg.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/segment.h>
#include <signal.h>

Go to the source code of this file.

Defines

#define | _S(nr) (1<<((nr)-1))
#define | _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
#define | LATCH (1193180/HZ)
#define | TIME_REQUESTS 64

Functions

void | show_task (int nr, struct task_struct *p)
void | show_stat (void)
void | mem_use (void)
int | timer_interrupt (void)
int | system_call (void)
void | math_state_restore ()
void | schedule (void)
int | sys_pause (void)
void | sleep_on (struct task_struct **p)
void | interruptible_sleep_on (struct task_struct **p)
void | wake_up (struct task_struct **p)
int | ticks_to_floppy_on (unsigned int nr)
void | floppy_on (unsigned int nr)
void | floppy_off (unsigned int nr)
void | do_floppy_timer (void)
void | add_timer (long jiffies, void(*fn)(void))
void | do_timer (long cpl)
int | sys_alarm (long seconds)
int | sys_getpid (void)
int | sys_getppid (void)
int | sys_getuid (void)
int | sys_geteuid (void)
int | sys_getgid (void)
int | sys_getegid (void)
int | sys_nice (long increment)
void | sched_init (void)

Variables

static union task_union | init_task = {INIT_TASK,}
long volatile | jiffies = 0
long | startup_time = 0
task_struct * current = &(init_task.task)
task_struct * | last_task_used_math = NULL
task_struct * | task [NR_TASKS] = {&(init_task.task), }
long | user_stack [PAGE_SIZE >>2]
struct {
long * a
short b
} stack_start
static struct task_struct * | wait_motor [4] = {NULL,NULL,NULL,NULL}
static int | mon_timer [4] = {0,0,0,0}
static int | moff_timer [4] = {0,0,0,0}
unsigned char | current_DOR = 0x0C
static struct timer_list | timer_list [TIME_REQUESTS]
static struct timer_list * | next_timer [TIME_REQUESTS]

Define Documentation

#define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))

Definition at line 24 of file sched.c.

Referenced by schedule().

#define _S ( nr ) (1<<((nr)-1))

Definition at line 23 of file sched.c.

#define LATCH (1193180/HZ)

Definition at line 46 of file sched.c.

Referenced by sched_init().

#define TIME_REQUESTS 64

Definition at line 264 of file sched.c.

Referenced by add_timer().

Function Documentation

void add_timer | ( | long | jiffies,
 |  | void(*)(void) | fn
 | ) |

Definition at line 272 of file sched.c.

References cli, timer_list::fn, timer_list::jiffies, jiffies, timer_list::next, next_timer, panic(), sti, and TIME_REQUESTS.

Referenced by do_fd_request(), and floppy_on_interrupt().

void do_floppy_timer ( void )

Definition at line 245 of file sched.c.

References current_DOR, FD_DOR, moff_timer, mon_timer, outb, wait_motor, and wake_up().

Referenced by do_timer().

void do_timer ( long cpl )

Definition at line 305 of file sched.c.

References beepcount, task_struct::counter, current, current_DOR, do_floppy_timer(), timer_list::fn, timer_list::jiffies, timer_list::next, next_timer, NULL, schedule(), task_struct::stime, sysbeepstop(), and task_struct::utime.

void floppy_off ( unsigned int nr )

Definition at line 240 of file sched.c.

References HZ, and moff_timer.

void floppy_on ( unsigned int nr )

Definition at line 232 of file sched.c.

References cli, sleep_on(), sti, ticks_to_floppy_on(), and wait_motor.

void interruptible_sleep_on ( struct task_struct ** p )

Definition at line 167 of file sched.c.

References current, init_task, NULL, panic(), schedule(), task_struct::state, task_union::task, and TASK_INTERRUPTIBLE.

Referenced by floppy_change(), sleep_if_empty(), and sleep_if_full().

void math_state_restore ( )

Definition at line 77 of file sched.c.

References current, tss_struct::i387, last_task_used_math, task_struct::tss, and task_struct::used_math.

void mem_use ( void )

void sched_init ( void )

Definition at line 385 of file sched.c.

References desc_struct::a, desc_struct::b, FIRST_LDT_ENTRY, FIRST_TSS_ENTRY, gdt, inb_p, init_task, LATCH, task_struct::ldt, lldt, ltr, NR_TASKS, NULL, outb, outb_p, panic(), set_intr_gate, set_ldt_desc, set_system_gate, set_tss_desc, system_call(), task, task_union::task, timer_interrupt(), and task_struct::tss.

Referenced by main().

void schedule ( void )

Definition at line 104 of file sched.c.

References _BLOCKABLE, task_struct::alarm, task_struct::counter, FIRST_TASK, jiffies, LAST_TASK, NR_TASKS, task_struct::priority, SIGALRM, task_struct::signal, task_struct::state, switch_to, task, TASK_INTERRUPTIBLE, and TASK_RUNNING.

Referenced by do_exit(), do_timer(), interruptible_sleep_on(), release(), sleep_on(), sys_pause(), sys_waitpid(), and tty_write().

void show_stat ( void )

Definition at line 37 of file sched.c.

References NR_TASKS, show_task(), and task.

void show_task | ( | int | nr,
 |  | struct task_struct * | p
 | ) |

Definition at line 26 of file sched.c.

References printk().

Referenced by show_stat().

void sleep_on ( struct task_struct ** p )

Definition at line 151 of file sched.c.

References current, init_task, panic(), schedule(), task_struct::state, task_union::task, and TASK_UNINTERRUPTIBLE.

Referenced by floppy_on(), getblk(), lock_buffer(), lock_inode(), lock_super(), make_request(), read_pipe(), wait_on_buffer(), wait_on_inode(), wait_on_super(), and write_pipe().

int sys_alarm ( long seconds )

Definition at line 338 of file sched.c.

References task_struct::alarm, current, HZ, and jiffies.

int sys_getegid ( void )

Definition at line 373 of file sched.c.

References current, and task_struct::egid.

int sys_geteuid ( void )

Definition at line 363 of file sched.c.

References current, and task_struct::euid.

int sys_getgid ( void )

Definition at line 368 of file sched.c.

References current, and task_struct::gid.

int sys_getpid ( void )

Definition at line 348 of file sched.c.

References current, and task_struct::pid.

int sys_getppid ( void )

Definition at line 353 of file sched.c.

References current, and task_struct::father.

int sys_getuid ( void )

Definition at line 358 of file sched.c.

References current, and task_struct::uid.

int sys_nice ( long increment )

Definition at line 378 of file sched.c.

References current, and task_struct::priority.

int sys_pause ( void )

Definition at line 144 of file sched.c.

References current, schedule(), task_struct::state, and TASK_INTERRUPTIBLE.

int system_call ( void )

Referenced by sched_init().

int ticks_to_floppy_on ( unsigned int nr )

Definition at line 206 of file sched.c.

References cli, current_DOR, FD_DOR, HZ, moff_timer, mon_timer, outb, panic(), selected, and sti.

int timer_interrupt ( void )

Referenced by sched_init().

void wake_up ( struct task_struct ** p )

Definition at line 188 of file sched.c.

References NULL, and task_struct::state.

Referenced by brelse(), copy_to_cooked(), do_floppy_timer(), floppy_deselect(), free_super(), iput(), read_pipe(), unlock_buffer(), unlock_inode(), and write_pipe().

Variable Documentation

long* a

Definition at line 70 of file sched.c.

Referenced by con_init().

short b

Definition at line 71 of file sched.c.

Referenced by bread_page(), buffer_init(), tty_read(), and tty_write().

struct task_struct* current = &(init_task.task)

Definition at line 62 of file sched.c.

Referenced by change_ldt(), copy_mem(), copy_process(), die(), do_coprocessor_error(), do_execve(), do_exit(), do_no_page(), do_signal(), do_timer(), dupfd(), find_entry(), get_dir(), interruptible_sleep_on(), kill_session(), math_emulate(), math_state_restore(), mount_root(), new_inode(), open_namei(), panic(), permission(), rw_tty(), send_sig(), share_page(), sleep_if_empty(), sleep_if_full(), sleep_on(), sys_access(), sys_alarm(), sys_brk(), sys_chdir(), sys_chmod(), sys_chroot(), sys_close(), sys_fcntl(), sys_fstat(), sys_getegid(), sys_geteuid(), sys_getgid(), sys_getpgrp(), sys_getpid(), sys_getppid(), sys_getuid(), sys_ioctl(), sys_kill(), sys_lseek(), sys_mkdir(), sys_nice(), sys_open(), sys_pause(), sys_pipe(), sys_rmdir(), sys_setpgid(), sys_setregid(), sys_setreuid(), sys_setsid(), sys_sgetmask(), sys_sigaction(), sys_signal(), sys_ssetmask(), sys_times(), sys_umask(), sys_unlink(), sys_waitpid(), tell_father(), try_to_share(), tty_ioctl(), tty_read(), tty_write(), verify_area(), and write_pipe().

unsigned char current_DOR = 0x0C

Definition at line 204 of file sched.c.

Referenced by do_floppy_timer(), do_timer(), floppy_change(), floppy_deselect(), floppy_on_interrupt(), reset_floppy(), and ticks_to_floppy_on().

union task_union init_task = {INIT_TASK,} [static]

Definition at line 58 of file sched.c.

Referenced by interruptible_sleep_on(), sched_init(), and sleep_on().

long volatile jiffies = 0

Definition at line 60 of file sched.c.

Referenced by add_timer(), copy_process(), schedule(), sys_alarm(), sys_stime(), sys_times(), and tty_read().

struct task_struct* last_task_used_math = NULL

Definition at line 63 of file sched.c.

Referenced by copy_process(), do_coprocessor_error(), do_execve(), do_exit(), math_error(), and math_state_restore().

int moff_timer[4] = {0,0,0,0} [static]

Definition at line 203 of file sched.c.

Referenced by do_floppy_timer(), floppy_off(), and ticks_to_floppy_on().

int mon_timer[4] = {0,0,0,0} [static]

Definition at line 202 of file sched.c.

Referenced by do_floppy_timer(), and ticks_to_floppy_on().

struct timer_list * next_timer[TIME_REQUESTS] [static]

Referenced by add_timer(), and do_timer().

struct { ... } stack_start

long startup_time = 0

Definition at line 61 of file sched.c.

Referenced by sys_stime().

struct task_struct* task[NR_TASKS] = {&(init_task.task), }

Definition at line 65 of file sched.c.

Referenced by copy_process(), do_exit(), find_empty_process(), kill_session(), panic(), release(), sched_init(), schedule(), show_stat(), sys_kill(), sys_setpgid(), tell_father(), and tty_intr().

struct timer_list timer_list[TIME_REQUESTS] [static]

long user_stack[PAGE_SIZE >>2]

Definition at line 67 of file sched.c.

struct task_struct* wait_motor[4] = {NULL,NULL,NULL,NULL} [static]

Definition at line 201 of file sched.c.

Referenced by do_floppy_timer(), and floppy_on().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/signal.c File Reference

signal.c File Reference

#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <signal.h>

Go to the source code of this file.

Functions

volatile void | do_exit (int error_code)
int | sys_sgetmask ()
int | sys_ssetmask (int newmask)
static void | save_old (char *from, char *to)
static void | get_new (char *from, char *to)
int | sys_signal (int signum, long handler, long restorer)
int | sys_sigaction (int signum, const struct sigaction *action, struct sigaction *oldaction)
void | do_signal (long signr, long eax, long ebx, long ecx, long edx, long fs, long es, long ds, long eip, long cs, long eflags, unsigned long *esp, long ss)

Function Documentation

volatile void do_exit ( int error_code )

void do_signal | ( | long | signr,
 |  | long | eax,
 |  | long | ebx,
 |  | long | ecx,
 |  | long | edx,
 |  | long | fs,
 |  | long | es,
 |  | long | ds,
 |  | long | eip,
 |  | long | cs,
 |  | long | eflags,
 |  | unsigned long * | esp,
 |  | long | ss
 | ) |

Definition at line 82 of file signal.c.

References task_struct::blocked, current, do_exit(), NULL, put_fs_long(), sigaction::sa_flags, sigaction::sa_handler, sigaction::sa_mask, SA_NOMASK, SA_ONESHOT, sigaction::sa_restorer, task_struct::sigaction, SIGCHLD, and verify_area().

static void get_new | ( | char * | from,
 |  | char * | to
 | ) | [inline, static]

Definition at line 40 of file signal.c.

References get_fs_byte().

Referenced by sys_sigaction().

static void save_old | ( | char * | from,
 |  | char * | to
 | ) | [inline, static]

Definition at line 28 of file signal.c.

References put_fs_byte(), sigaction(), and verify_area().

Referenced by sys_sigaction().

int sys_sgetmask ( )

Definition at line 15 of file signal.c.

References task_struct::blocked, and current.

int sys_sigaction | ( | int | signum,
 |  | const struct sigaction * | action,
 |  | struct sigaction * | oldaction
 | ) |

Definition at line 63 of file signal.c.

References current, get_new(), sigaction::sa_flags, sigaction::sa_mask, SA_NOMASK, save_old(), task_struct::sigaction, and SIGKILL.

int sys_signal | ( | int | signum,
 |  | long | handler,
 |  | long | restorer
 | ) |

Definition at line 48 of file signal.c.

References current, sigaction::sa_flags, sigaction::sa_handler, sigaction::sa_mask, SA_NOMASK, SA_ONESHOT, sigaction::sa_restorer, task_struct::sigaction, and SIGKILL.

int sys_ssetmask ( int newmask )

Definition at line 20 of file signal.c.

References task_struct::blocked, current, and SIGKILL.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/sys.c File Reference

sys.c File Reference

#include <errno.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <sys/times.h>
#include <sys/utsname.h>

Go to the source code of this file.

Functions

int | sys_ftime ()
int | sys_break ()
int | sys_ptrace ()
int | sys_stty ()
int | sys_gtty ()
int | sys_rename ()
int | sys_prof ()
int | sys_setregid (int rgid, int egid)
int | sys_setgid (int gid)
int | sys_acct ()
int | sys_phys ()
int | sys_lock ()
int | sys_mpx ()
int | sys_ulimit ()
int | sys_time (long *tloc)
int | sys_setreuid (int ruid, int euid)
int | sys_setuid (int uid)
int | sys_stime (long *tptr)
int | sys_times (struct tms *tbuf)
int | sys_brk (unsigned long end_data_seg)
int | sys_setpgid (int pid, int pgid)
int | sys_getpgrp (void)
int | sys_setsid (void)
int | sys_uname (struct utsname *name)
int | sys_umask (int mask)

Function Documentation

int sys_acct ( )

Definition at line 77 of file sys.c.

References ENOSYS.

int sys_break ( )

Definition at line 21 of file sys.c.

References ENOSYS.

int sys_brk ( unsigned long end_data_seg )

Definition at line 168 of file sys.c.

References task_struct::brk, current, and task_struct::end_code.

int sys_ftime ( )

Definition at line 16 of file sys.c.

References ENOSYS.

int sys_getpgrp ( void )

Definition at line 201 of file sys.c.

References current, and task_struct::pgrp.

int sys_gtty ( )

Definition at line 36 of file sys.c.

References ENOSYS.

int sys_lock ( )

Definition at line 87 of file sys.c.

References ENOSYS.

int sys_mpx ( )

Definition at line 92 of file sys.c.

References ENOSYS.

int sys_phys ( )

Definition at line 82 of file sys.c.

References ENOSYS.

int sys_prof ( )

Definition at line 46 of file sys.c.

References ENOSYS.

int sys_ptrace ( )

Definition at line 26 of file sys.c.

References ENOSYS.

int sys_rename ( )

Definition at line 41 of file sys.c.

References ENOSYS.

int sys_setgid ( int gid )

Definition at line 72 of file sys.c.

References sys_setregid().

int sys_setpgid | ( | int | pid,
 |  | int | pgid
 | ) |

Definition at line 181 of file sys.c.

References current, EPERM, ESRCH, NR_TASKS, task_struct::pgrp, task_struct::pid, task_struct::session, and task.

int sys_setregid | ( | int | rgid,
 |  | int | egid
 | ) |

Definition at line 51 of file sys.c.

References current, task_struct::egid, EPERM, task_struct::gid, task_struct::sgid, and suser.

int sys_setreuid | ( | int | ruid,
 |  | int | euid
 | ) |

Definition at line 118 of file sys.c.

References current, EPERM, task_struct::euid, suser, and task_struct::uid.

int sys_setsid ( void )

Definition at line 206 of file sys.c.

References current, EPERM, task_struct::leader, task_struct::pgrp, task_struct::pid, task_struct::session, suser, and task_struct::tty.

int sys_setuid ( int uid )

Definition at line 143 of file sys.c.

References sys_setreuid().

int sys_stime ( long * tptr )

Definition at line 148 of file sys.c.

References EPERM, get_fs_long(), HZ, jiffies, startup_time, and suser.

int sys_stty ( )

Definition at line 31 of file sys.c.

References ENOSYS.

int sys_time ( long * tloc )

Definition at line 102 of file sys.c.

References CURRENT_TIME, put_fs_long(), and verify_area().

int sys_times ( struct tms * tbuf )

Definition at line 156 of file sys.c.

References task_struct::cstime, current, task_struct::cutime, jiffies, put_fs_long(), task_struct::stime, task_struct::utime, and verify_area().

int sys_ulimit ( )

Definition at line 97 of file sys.c.

References ENOSYS.

int sys_umask ( int mask )

Definition at line 230 of file sys.c.

References current, and task_struct::umask.

int sys_uname ( struct utsname * name )

Definition at line 216 of file sys.c.

References ERROR, put_fs_byte(), and verify_area().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/traps.c File Reference

traps.c File Reference

#include <string.h>
#include <linux/head.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <asm/io.h>

Go to the source code of this file.

Defines

#define | get_seg_byte(seg, addr)
#define | get_seg_long(seg, addr)
#define | _fs()

Functions

int | do_exit (long code)
void | page_exception (void)
void | divide_error (void)
void | debug (void)
void | nmi (void)
void | int3 (void)
void | overflow (void)
void | bounds (void)
void | invalid_op (void)
void | device_not_available (void)
void | double_fault (void)
void | coprocessor_segment_overrun (void)
void | invalid_TSS (void)
void | segment_not_present (void)
void | stack_segment (void)
void | general_protection (void)
void | page_fault (void)
void | coprocessor_error (void)
void | reserved (void)
void | parallel_interrupt (void)
void | irq13 (void)
static void | die (char *str, long esp_ptr, long nr)
void | do_double_fault (long esp, long error_code)
void | do_general_protection (long esp, long error_code)
void | do_divide_error (long esp, long error_code)
void | do_int3 (long *esp, long error_code, long fs, long es, long ds, long ebp, long esi, long edi, long edx, long ecx, long ebx, long eax)
void | do_nmi (long esp, long error_code)
void | do_debug (long esp, long error_code)
void | do_overflow (long esp, long error_code)
void | do_bounds (long esp, long error_code)
void | do_invalid_op (long esp, long error_code)
void | do_device_not_available (long esp, long error_code)
void | do_coprocessor_segment_overrun (long esp, long error_code)
void | do_invalid_TSS (long esp, long error_code)
void | do_segment_not_present (long esp, long error_code)
void | do_stack_segment (long esp, long error_code)
void | do_coprocessor_error (long esp, long error_code)
void | do_reserved (long esp, long error_code)
void | trap_init (void)

Define Documentation

#define _fs ( )

Value:

({ \
register unsigned short __res; \
__asm__("mov %%fs,%%ax":"=a" (__res):); \
__res;})

Definition at line 34 of file traps.c.

Referenced by die().

#define get_seg_byte | ( | seg,
 |  | addr | )

Value:

({ \
register char __res; \
__asm__("push %%fs;mov %%ax,%%fs;movb %%fs:%2,%%al;pop %%fs" \
    :"=a" (__res):"0" (seg),"m" (*(addr))); \
__res;})

Definition at line 22 of file traps.c.

Referenced by die().

#define get_seg_long | ( | seg,
 |  | addr | )

Value:

({ \
register unsigned long __res; \
__asm__("push %%fs;mov %%ax,%%fs;movl %%fs:%2,%%eax;pop %%fs" \
    :"=a" (__res):"0" (seg),"m" (*(addr))); \
__res;})

Definition at line 28 of file traps.c.

Referenced by die().

Function Documentation

void bounds ( void )

Referenced by trap_init().

void coprocessor_error ( void )

Referenced by trap_init().

void coprocessor_segment_overrun ( void )

Referenced by trap_init().

void debug ( void )

Referenced by trap_init().

void device_not_available ( void )

Referenced by trap_init().

static void die | ( | char * | str,
 |  | long | esp_ptr,
 |  | long | nr
 | ) | [static]

Definition at line 63 of file traps.c.

References _fs, current, do_exit(), get_base, get_limit, get_seg_byte, get_seg_long, task_struct::ldt, task_struct::pid, printk(), and str.

Referenced by do_bounds(), do_coprocessor_error(), do_coprocessor_segment_overrun(), do_debug(), do_device_not_available(), do_divide_error(), do_double_fault(), do_general_protection(), do_invalid_op(), do_invalid_TSS(), do_nmi(), do_overflow(), do_reserved(), do_segment_not_present(), do_stack_segment(), main(), and usage().

void divide_error ( void )

Referenced by trap_init().

void do_bounds | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 134 of file traps.c.

References die().

void do_coprocessor_error | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 169 of file traps.c.

References current, die(), and last_task_used_math.

void do_coprocessor_segment_overrun | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 149 of file traps.c.

References die().

void do_debug | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 124 of file traps.c.

References die().

void do_device_not_available | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 144 of file traps.c.

References die().

void do_divide_error | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 97 of file traps.c.

References die().

void do_double_fault | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 87 of file traps.c.

References die().

int do_exit ( long code )

Definition at line 102 of file exit.c.

void do_general_protection | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 92 of file traps.c.

References die().

void do_int3 | ( | long * | esp,
 |  | long | error_code,
 |  | long | fs,
 |  | long | es,
 |  | long | ds,
 |  | long | ebp,
 |  | long | esi,
 |  | long | edi,
 |  | long | edx,
 |  | long | ecx,
 |  | long | ebx,
 |  | long | eax
 | ) |

Definition at line 102 of file traps.c.

References printk().

void do_invalid_op | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 139 of file traps.c.

References die().

void do_invalid_TSS | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 154 of file traps.c.

References die().

void do_nmi | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 119 of file traps.c.

References die().

void do_overflow | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 129 of file traps.c.

References die().

void do_reserved | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 176 of file traps.c.

References die().

void do_segment_not_present | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 159 of file traps.c.

References die().

void do_stack_segment | ( | long | esp,
 |  | long | error_code
 | ) |

Definition at line 164 of file traps.c.

References die().

void double_fault ( void )

Referenced by trap_init().

void general_protection ( void )

Referenced by trap_init().

void int3 ( void )

Referenced by trap_init().

void invalid_op ( void )

Referenced by trap_init().

void invalid_TSS ( void )

Referenced by trap_init().

void irq13 ( void )

Referenced by trap_init().

void nmi ( void )

Referenced by trap_init().

void overflow ( void )

Referenced by trap_init().

void page_exception ( void )

void page_fault ( void )

Referenced by trap_init().

void parallel_interrupt ( void )

Referenced by trap_init().

void reserved ( void )

Referenced by trap_init().

void segment_not_present ( void )

Referenced by trap_init().

void stack_segment ( void )

Referenced by trap_init().

void trap_init ( void )

Definition at line 181 of file traps.c.

References bounds(), coprocessor_error(), coprocessor_segment_overrun(), debug(), device_not_available(), divide_error(), double_fault(), general_protection(), inb_p, int3(), invalid_op(), invalid_TSS(), irq13(), nmi(), outb, outb_p, overflow(), page_fault(), parallel_interrupt(), reserved(), segment_not_present(), set_system_gate, set_trap_gate, and stack_segment().

Referenced by main().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/vsprintf.c File Reference

vsprintf.c File Reference

#include <stdarg.h>
#include <string.h>

Go to the source code of this file.

Defines

#define | is_digit(c) ((c) >= '0' && (c) <= '9')
#define | ZEROPAD 1
#define | SIGN 2
#define | PLUS 4
#define | SPACE 8
#define | LEFT 16
#define | SPECIAL 32
#define | SMALL 64
#define | do_div(n, base)

Functions

static int | skip_atoi (const char **s)
static char * | number (char *str, int num, int base, int size, int precision, int type)
int | vsprintf (char *buf, const char *fmt, va_list args)

Define Documentation

#define do_div | ( | n,
 |  | base | )

Value:

({ \
int __res; \
__asm__("divl %4":"=a" (n),"=d" (__res):"0" (n),"1" (0),"r" (base)); \
__res; })

Definition at line 35 of file vsprintf.c.

Referenced by number().

#define is_digit ( c ) ((c) >= '0' && (c) <= '9')

Definition at line 16 of file vsprintf.c.

Referenced by skip_atoi(), and vsprintf().

#define LEFT 16

Definition at line 31 of file vsprintf.c.

#define PLUS 4

Definition at line 29 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SIGN 2

Definition at line 28 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SMALL 64

Definition at line 33 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SPACE 8

Definition at line 30 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define SPECIAL 32

Definition at line 32 of file vsprintf.c.

Referenced by number(), and vsprintf().

#define ZEROPAD 1

Definition at line 27 of file vsprintf.c.

Referenced by number(), and vsprintf().

Function Documentation

static char* number | ( | char * | str,
 |  | int | num,
 |  | int | base,
 |  | int | size,
 |  | int | precision,
 |  | int | type
 | ) | [static]

Definition at line 40 of file vsprintf.c.

References do_div, LEFT, PLUS, SIGN, SMALL, SPACE, SPECIAL, str, and ZEROPAD.

Referenced by vsprintf().

static int skip_atoi ( const char ** s ) [static]

Definition at line 18 of file vsprintf.c.

References is_digit.

Referenced by vsprintf().

int vsprintf | ( | char * | buf,
 |  | const char * | fmt,
 |  | va_list | args
 | ) |

Definition at line 94 of file vsprintf.c.

References is_digit, LEFT, number(), PLUS, SIGN, skip_atoi(), SMALL, SPACE, SPECIAL, str, strlen(), va_arg, and ZEROPAD.

Referenced by printf(), and printk().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/blk.h File Reference

blk.h File Reference

Go to the source code of this file.

Defines

#define | NR_BLK_DEV 7
#define | NR_REQUEST 32
#define | IN_ORDER(s1, s2)

Variables

blk_dev_struct | blk_dev [NR_BLK_DEV]
request | request [NR_REQUEST]
task_struct * wait_for_request

Define Documentation

#define IN_ORDER | ( | s1,
 |  | s2 | )

Value:

((s1)->cmd<(s2)->cmd || ((s1)->cmd==(s2)->cmd && \
((s1)->dev < (s2)->dev || ((s1)->dev == (s2)->dev && \
(s1)->sector < (s2)->sector))))

Definition at line 40 of file blk.h.

Referenced by add_request().

#define NR_BLK_DEV 7

Definition at line 4 of file blk.h.

Referenced by ll_rw_block().

#define NR_REQUEST 32

Definition at line 15 of file blk.h.

Referenced by blk_dev_init(), and make_request().

Variable Documentation

struct blk_dev_struct blk_dev[NR_BLK_DEV]

Definition at line 32 of file ll_rw_blk.c.

Referenced by floppy_init(), hd_init(), ll_rw_block(), make_request(), and rd_init().

struct request request[NR_REQUEST]

Definition at line 21 of file ll_rw_blk.c.

Referenced by add_request(), blk_dev_init(), and make_request().

struct task_struct* wait_for_request

Definition at line 26 of file ll_rw_blk.c.

Referenced by make_request().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/floppy.c File Reference

floppy.c File Reference

#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/fdreg.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/segment.h>
#include "blk.h"

Go to the source code of this file.

Defines

#define | MAJOR_NR 2
#define | immoutb_p(val, port) __asm__("outb %0,%1\n\tjmp 1f\n1:\tjmp 1f\n1:"::"a" ((char) (val)),"i" (port))
#define | TYPE(x) ((x)>>2)
#define | DRIVE(x) ((x)&0x03)
#define | MAX_ERRORS 8
#define | MAX_REPLIES 7
#define | ST0 (reply_buffer[0])
#define | ST1 (reply_buffer[1])
#define | ST2 (reply_buffer[2])
#define | ST3 (reply_buffer[3])
#define | copy_buffer(from, to)

Functions

void | floppy_interrupt (void)
void | floppy_deselect (unsigned int nr)
int | floppy_change (unsigned int nr)
static void | setup_DMA (void)
static void | output_byte (char byte)
static int | result (void)
static void | bad_flp_intr (void)
static void | rw_interrupt (void)
void | setup_rw_floppy (void)
static void | seek_interrupt (void)
static void | transfer (void)
static void | recal_interrupt (void)
void | unexpected_floppy_interrupt (void)
static void | recalibrate_floppy (void)
static void | reset_interrupt (void)
static void | reset_floppy (void)
static void | floppy_on_interrupt (void)
void | do_fd_request (void)
void | floppy_init (void)

Variables

static int | recalibrate = 0
static int | reset = 0
static int | seek = 0
unsigned char | current_DOR
static unsigned char | reply_buffer [MAX_REPLIES]
static struct floppy_struct | floppy_type []
char | tmp_floppy_area [1024]
static int | cur_spec1 = -1
static int | cur_rate = -1
static struct floppy_struct * | floppy = floppy_type
static unsigned char | current_drive = 0
static unsigned char | sector = 0
static unsigned char | head = 0
static unsigned char | track = 0
static unsigned char | seek_track = 0
static unsigned char | current_track = 255
static unsigned char | command = 0
unsigned char | selected = 0
task_struct * | wait_on_floppy_select = NULL

Define Documentation

#define copy_buffer | ( | from,
 |  | to | )

Value:

__asm__("cld ; rep ; movsl" \
    ::"c" (BLOCK_SIZE/4),"S" ((long)(from)),"D" ((long)(to)) \
    )

Definition at line 155 of file floppy.c.

Referenced by rw_interrupt(), and setup_DMA().

#define DRIVE ( x ) ((x)&0x03)

Definition at line 54 of file floppy.c.

#define immoutb_p | ( | val,
 |  | port | ) | __asm__("outb %0,%1\n\tjmp 1f\n1:\tjmp 1f\n1:"::"a" ((char) (val)),"i" (port))

Definition at line 50 of file floppy.c.

Referenced by setup_DMA().

#define MAJOR_NR 2

Definition at line 41 of file floppy.c.

Referenced by floppy_init(), hd_init(), and rd_init().

#define MAX_ERRORS 8

Definition at line 60 of file floppy.c.

Referenced by bad_flp_intr(), and bad_rw_intr().

#define MAX_REPLIES 7

Definition at line 65 of file floppy.c.

Referenced by result().

#define ST0 (reply_buffer[0])

Definition at line 67 of file floppy.c.

Referenced by recal_interrupt(), rw_interrupt(), seek_interrupt(), and unexpected_floppy_interrupt().

#define ST1 (reply_buffer[1])

Definition at line 68 of file floppy.c.

Referenced by rw_interrupt(), and seek_interrupt().

#define ST2 (reply_buffer[2])

Definition at line 69 of file floppy.c.

Referenced by rw_interrupt().

#define ST3 (reply_buffer[3])

Definition at line 70 of file floppy.c.

#define TYPE ( x ) ((x)>>2)

Definition at line 53 of file floppy.c.

Function Documentation

static void bad_flp_intr ( void ) [static]

Definition at line 233 of file floppy.c.

References current_drive, floppy_deselect(), MAX_ERRORS, recalibrate, and reset.

Referenced by rw_interrupt(), and seek_interrupt().

void do_fd_request ( void )

Definition at line 417 of file floppy.c.

References add_timer(), command, current_drive, current_track, FD_READ, FD_WRITE, floppy, floppy_on_interrupt(), floppy_type, floppy_struct::head, head, MINOR, panic(), READ, recalibrate, recalibrate_floppy(), reset, reset_floppy(), floppy_struct::sect, sector, seek, seek_track, floppy_struct::size, floppy_struct::stretch, ticks_to_floppy_on(), track, and WRITE.

Referenced by recal_interrupt(), recalibrate_floppy(), reset_interrupt(), rw_interrupt(), seek_interrupt(), setup_rw_floppy(), and transfer().

int floppy_change ( unsigned int nr )

Definition at line 139 of file floppy.c.

References current_DOR, FD_DIR, floppy_off(), floppy_on(), inb, interruptible_sleep_on(), selected, and wait_on_floppy_select.

Referenced by check_disk_change().

void floppy_deselect ( unsigned int nr )

Definition at line 125 of file floppy.c.

References current_DOR, printk(), selected, wait_on_floppy_select, and wake_up().

Referenced by bad_flp_intr(), and rw_interrupt().

void floppy_init ( void )

Definition at line 457 of file floppy.c.

References blk_dev, floppy_interrupt(), inb_p, MAJOR_NR, outb, blk_dev_struct::request_fn, and set_trap_gate.

Referenced by main().

void floppy_interrupt ( void )

Referenced by floppy_init().

static void floppy_on_interrupt ( void ) [static]

Definition at line 404 of file floppy.c.

References add_timer(), current_DOR, current_drive, FD_DOR, outb, selected, and transfer().

Referenced by do_fd_request().

static void output_byte ( char byte ) [static]

Definition at line 194 of file floppy.c.

References FD_DATA, FD_STATUS, inb_p, outb, printk(), reset, STATUS_DIR, and STATUS_READY.

Referenced by recal_interrupt(), recalibrate_floppy(), reset_interrupt(), seek_interrupt(), setup_rw_floppy(), transfer(), and unexpected_floppy_interrupt().

static void recal_interrupt ( void ) [static]

Definition at line 343 of file floppy.c.

References do_fd_request(), FD_SENSEI, output_byte(), recalibrate, reset, result(), and ST0.

Referenced by recalibrate_floppy().

static void recalibrate_floppy ( void ) [static]

Definition at line 362 of file floppy.c.

References current_drive, current_track, do_fd_request(), FD_RECALIBRATE, head, output_byte(), recal_interrupt(), recalibrate, and reset.

Referenced by do_fd_request().

static void reset_floppy ( void ) [static]

Definition at line 386 of file floppy.c.

References cli, cur_rate, cur_spec1, current_DOR, FD_DOR, outb, outb_p, printk(), recalibrate, reset, reset_interrupt(), and sti.

Referenced by do_fd_request().

static void reset_interrupt ( void ) [static]

Definition at line 373 of file floppy.c.

References cur_spec1, do_fd_request(), FD_SENSEI, FD_SPECIFY, output_byte(), and result().

Referenced by reset_floppy().

static int result ( void ) [static]

Definition at line 212 of file floppy.c.

References FD_DATA, FD_STATUS, inb_p, MAX_REPLIES, printk(), reply_buffer, reset, STATUS_BUSY, STATUS_DIR, and STATUS_READY.

Referenced by recal_interrupt(), reset_interrupt(), rw_interrupt(), seek_interrupt(), and unexpected_floppy_interrupt().

static void rw_interrupt ( void ) [static]

Definition at line 250 of file floppy.c.

References bad_flp_intr(), command, copy_buffer, current_drive, do_fd_request(), FD_READ, floppy_deselect(), printk(), result(), ST0, ST1, ST2, and tmp_floppy_area.

Referenced by setup_rw_floppy().

static void seek_interrupt ( void ) [static]

Definition at line 291 of file floppy.c.

References bad_flp_intr(), current_track, do_fd_request(), FD_SENSEI, output_byte(), result(), seek_track, setup_rw_floppy(), ST0, and ST1.

Referenced by transfer().

static void setup_DMA ( void ) [static]

Definition at line 160 of file floppy.c.

References cli, command, copy_buffer, FD_READ, FD_WRITE, immoutb_p, sti, and tmp_floppy_area.

Referenced by setup_rw_floppy().

void setup_rw_floppy ( void ) [inline]

Definition at line 269 of file floppy.c.

References command, current_drive, do_fd_request(), floppy, floppy_struct::gap, head, output_byte(), reset, rw_interrupt(), floppy_struct::sect, sector, setup_DMA(), and track.

Referenced by seek_interrupt(), and transfer().

static void transfer ( void ) [static]

Definition at line 309 of file floppy.c.

References cur_rate, cur_spec1, current_drive, do_fd_request(), FD_DCR, FD_RECALIBRATE, FD_SEEK, FD_SPECIFY, floppy, head, outb_p, output_byte(), floppy_struct::rate, reset, seek, seek_interrupt(), seek_track, setup_rw_floppy(), and floppy_struct::spec1.

Referenced by floppy_on_interrupt().

void unexpected_floppy_interrupt ( void )

Definition at line 353 of file floppy.c.

References FD_SENSEI, output_byte(), recalibrate, reset, result(), and ST0.

Variable Documentation

unsigned char command = 0 [static]

Definition at line 121 of file floppy.c.

Referenced by do_fd_request(), rw_interrupt(), setup_DMA(), and setup_rw_floppy().

int cur_rate = -1 [static]

Definition at line 113 of file floppy.c.

Referenced by reset_floppy(), and transfer().

int cur_spec1 = -1 [static]

Definition at line 112 of file floppy.c.

Referenced by reset_floppy(), reset_interrupt(), and transfer().

unsigned char current_DOR

Definition at line 204 of file sched.c.

Referenced by do_floppy_timer(), do_timer(), floppy_change(), floppy_deselect(), floppy_on_interrupt(), reset_floppy(), and ticks_to_floppy_on().

unsigned char current_drive = 0 [static]

Definition at line 115 of file floppy.c.

Referenced by bad_flp_intr(), do_fd_request(), floppy_on_interrupt(), recalibrate_floppy(), rw_interrupt(), setup_rw_floppy(), and transfer().

unsigned char current_track = 255 [static]

Definition at line 120 of file floppy.c.

Referenced by do_fd_request(), recalibrate_floppy(), and seek_interrupt().

struct floppy_struct* floppy = floppy_type [static]

Definition at line 114 of file floppy.c.

Referenced by do_fd_request(), setup_rw_floppy(), and transfer().

struct floppy_struct floppy_type[] [static]

Referenced by do_fd_request().

unsigned char head = 0 [static]

Definition at line 117 of file floppy.c.

Referenced by do_fd_request(), recalibrate_floppy(), setup_rw_floppy(), and transfer().

int recalibrate = 0 [static]

Definition at line 44 of file floppy.c.

Referenced by bad_flp_intr(), do_fd_request(), recal_interrupt(), recalibrate_floppy(), reset_floppy(), and unexpected_floppy_interrupt().

unsigned char reply_buffer[MAX_REPLIES] [static]

Definition at line 66 of file floppy.c.

Referenced by result().

int reset = 0 [static]

Definition at line 45 of file floppy.c.

Referenced by bad_flp_intr(), do_fd_request(), output_byte(), recal_interrupt(), recalibrate_floppy(), reset_floppy(), result(), setup_rw_floppy(), transfer(), and unexpected_floppy_interrupt().

unsigned char sector = 0 [static]

Definition at line 116 of file floppy.c.

Referenced by do_fd_request(), and setup_rw_floppy().

int seek = 0 [static]

Definition at line 46 of file floppy.c.

Referenced by do_fd_request(), and transfer().

unsigned char seek_track = 0 [static]

Definition at line 119 of file floppy.c.

Referenced by do_fd_request(), seek_interrupt(), and transfer().

unsigned char selected = 0

Definition at line 122 of file floppy.c.

Referenced by floppy_change(), floppy_deselect(), floppy_on_interrupt(), and ticks_to_floppy_on().

char tmp_floppy_area[1024]

Referenced by rw_interrupt(), and setup_DMA().

unsigned char track = 0 [static]

Definition at line 118 of file floppy.c.

Referenced by do_fd_request(), and setup_rw_floppy().

struct task_struct* wait_on_floppy_select = NULL

Definition at line 123 of file floppy.c.

Referenced by floppy_change(), and floppy_deselect().

Generated on Sun Mar 6 10:56:08 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/hd.c File Reference

hd.c File Reference

#include <linux/config.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/hdreg.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/segment.h>
#include "blk.h"

Go to the source code of this file.

Defines

#define | MAJOR_NR 3
#define | CMOS_READ(addr)
#define | MAX_ERRORS 7
#define | MAX_HD 2
#define | port_read(port, buf, nr) __asm__("cld;rep;insw"::"d" (port),"D" (buf),"c" (nr))
#define | port_write(port, buf, nr) __asm__("cld;rep;outsw"::"d" (port),"S" (buf),"c" (nr))

Functions

static void | recal_intr (void)
void | hd_interrupt (void)
void | rd_load (void)
int | sys_setup (void *BIOS)
static int | controller_ready (void)
static int | win_result (void)
static void | hd_out (unsigned int drive, unsigned int nsect, unsigned int sect, unsigned int head, unsigned int cyl, unsigned int cmd, void(*intr_addr)(void))
static int | drive_busy (void)
static void | reset_controller (void)
static void | reset_hd (int nr)
void | unexpected_hd_interrupt (void)
static void | bad_rw_intr (void)
static void | read_intr (void)
static void | write_intr (void)
void | do_hd_request (void)
void | hd_init (void)

Variables

static int | recalibrate = 1
static int | reset = 1
hd_i_struct | hd_info [] = { {0,0,0,0,0,0},{0,0,0,0,0,0} }
static int | NR_HD = 0
static struct hd_struct * | MAX_HD

Define Documentation

#define CMOS_READ ( addr )

Value:

({ \
outb_p(0x80|addr,0x70); \
inb_p(0x71); \
})

Definition at line 28 of file hd.c.

#define MAJOR_NR 3

Definition at line 25 of file hd.c.

#define MAX_ERRORS 7

Definition at line 34 of file hd.c.

#define MAX_HD 2

Definition at line 35 of file hd.c.

#define port_read | ( | port,
 |  | buf,
 |  | nr | ) | __asm__("cld;rep;insw"::"d" (port),"D" (buf),"c" (nr))

Definition at line 61 of file hd.c.

Referenced by read_intr().

#define port_write | ( | port,
 |  | buf,
 |  | nr | ) | __asm__("cld;rep;outsw"::"d" (port),"S" (buf),"c" (nr))

Definition at line 64 of file hd.c.

Referenced by do_hd_request(), and write_intr().

Function Documentation

static void bad_rw_intr ( void ) [static]

Definition at line 242 of file hd.c.

References MAX_ERRORS, and reset.

Referenced by do_hd_request(), read_intr(), recal_intr(), and write_intr().

static int controller_ready ( void ) [static]

Definition at line 161 of file hd.c.

References HD_STATUS, and inb_p.

Referenced by hd_out().

void do_hd_request ( void )

Definition at line 294 of file hd.c.

References bad_rw_intr(), DRQ_STAT, HD_DATA, hd_info, hd_out(), HD_STATUS, inb_p, MINOR, NR_HD, panic(), port_write, READ, read_intr(), recal_intr(), recalibrate, reset, reset_hd(), partition::sector, partition::start_sect, WIN_READ, WIN_RESTORE, WIN_WRITE, WRITE, and write_intr().

Referenced by read_intr(), recal_intr(), and write_intr().

static int drive_busy ( void ) [static]

Definition at line 202 of file hd.c.

References BUSY_STAT, HD_STATUS, inb, inb_p, printk(), READY_STAT, and SEEK_STAT.

Referenced by reset_controller().

void hd_init ( void )

Definition at line 343 of file hd.c.

References blk_dev, hd_interrupt(), inb_p, MAJOR_NR, outb, outb_p, blk_dev_struct::request_fn, and set_intr_gate.

Referenced by main().

void hd_interrupt ( void )

Referenced by hd_init().

static void hd_out | ( | unsigned int | drive,
 |  | unsigned int | nsect,
 |  | unsigned int | sect,
 |  | unsigned int | head,
 |  | unsigned int | cyl,
 |  | unsigned int | cmd,
 |  | void(*)(void) | intr_addr
 | ) | [static]

Definition at line 180 of file hd.c.

References controller_ready(), HD_CMD, HD_DATA, hd_info, outb, outb_p, and panic().

Referenced by do_hd_request(), and reset_hd().

void rd_load ( void )

Definition at line 71 of file ramdisk.c.

References buffer_head::b_data, BLOCK_SIZE, BLOCK_SIZE_BITS, bread(), breada(), brelse(), MAJOR, memcpy, printk(), rd_length, rd_start, ROOT_DEV, super_block::s_log_zone_size, super_block::s_magic, super_block::s_nzones, and SUPER_MAGIC.

Referenced by sys_setup().

static void read_intr ( void ) [static]

Definition at line 250 of file hd.c.

References bad_rw_intr(), do_hd_request(), HD_DATA, port_read, read_intr(), partition::sector, and win_result().

Referenced by do_hd_request(), and read_intr().

static void recal_intr ( void ) [static]

Definition at line 287 of file hd.c.

References bad_rw_intr(), do_hd_request(), and win_result().

Referenced by do_hd_request(), and reset_hd().

static void reset_controller ( void ) [static]

Definition at line 217 of file hd.c.

References drive_busy(), HD_CMD, HD_ERROR, hd_info, inb, nop, outb, and printk().

Referenced by reset_hd().

static void reset_hd ( int nr ) [static]

Definition at line 230 of file hd.c.

References hd_info, hd_out(), recal_intr(), reset_controller(), and WIN_SPECIFY.

Referenced by do_hd_request().

int sys_setup ( void * BIOS )

Definition at line 71 of file hd.c.

References buffer_head::b_data, bread(), brelse(), CMOS_READ, hd_i_struct::ctl, hd_i_struct::cyl, hd_info, hd_i_struct::head, hd_i_struct::lzone, mount_root(), NR_HD, partition::nr_sects, panic(), printk(), rd_load(), hd_i_struct::sect, partition::start_sect, and hd_i_struct::wpcom.

void unexpected_hd_interrupt ( void )

Definition at line 237 of file hd.c.

References printk().

static int win_result ( void ) [static]

Definition at line 169 of file hd.c.

References BUSY_STAT, ERR_STAT, HD_ERROR, HD_STATUS, inb, inb_p, READY_STAT, SEEK_STAT, and WRERR_STAT.

Referenced by read_intr(), recal_intr(), and write_intr().

static void write_intr ( void ) [static]

Definition at line 269 of file hd.c.

References bad_rw_intr(), do_hd_request(), HD_DATA, port_write, partition::sector, win_result(), and write_intr().

Referenced by do_hd_request(), and write_intr().

Variable Documentation

struct hd_i_struct hd_info[] = { {0,0,0,0,0,0},{0,0,0,0,0,0} }

Definition at line 52 of file hd.c.

Referenced by do_hd_request(), hd_out(), reset_controller(), reset_hd(), and sys_setup().

struct hd_struct* MAX_HD [static]

int NR_HD = 0 [static]

Definition at line 53 of file hd.c.

Referenced by do_hd_request(), and sys_setup().

int recalibrate = 1 [static]

Definition at line 39 of file hd.c.

Referenced by do_hd_request().

int reset = 1 [static]

Definition at line 40 of file hd.c.

Referenced by bad_rw_intr(), and do_hd_request().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/ll_rw_blk.c File Reference

ll_rw_blk.c File Reference

#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include "blk.h"

Go to the source code of this file.

Functions

static void | lock_buffer (struct buffer_head *bh)
static void | unlock_buffer (struct buffer_head *bh)
static void | add_request (struct blk_dev_struct *dev, struct request *req)
static void | make_request (int major, int rw, struct buffer_head *bh)
void | ll_rw_block (int rw, struct buffer_head *bh)
void | blk_dev_init (void)

Variables

request | request [NR_REQUEST]
task_struct * | wait_for_request = NULL
blk_dev_struct | blk_dev [NR_BLK_DEV]

Function Documentation

static void add_request | ( | struct blk_dev_struct * | dev,
 |  | struct request * | req
 | ) | [static]

Definition at line 64 of file ll_rw_blk.c.

References buffer_head::b_dirt, request::bh, cli, IN_ORDER, request::next, NULL, request, and sti.

Referenced by make_request().

void blk_dev_init ( void )

Definition at line 157 of file ll_rw_blk.c.

References request::dev, request::next, NR_REQUEST, NULL, and request.

Referenced by main().

void ll_rw_block | ( | int | rw,
 |  | struct buffer_head * | bh
 | ) |

Definition at line 145 of file ll_rw_blk.c.

References blk_dev, MAJOR, make_request(), NR_BLK_DEV, printk(), and blk_dev_struct::request_fn.

Referenced by bread(), bread_page(), breada(), sync_dev(), and sys_sync().

static void lock_buffer ( struct buffer_head * bh ) [inline, static]

Definition at line 42 of file ll_rw_blk.c.

References cli, sleep_on(), and sti.

Referenced by make_request().

static void make_request | ( | int | major,
 |  | int | rw,
 |  | struct buffer_head * | bh
 | ) | [static]

Definition at line 88 of file ll_rw_blk.c.

References add_request(), request::bh, blk_dev, request::buffer, request::cmd, request::dev, request::errors, lock_buffer(), request::next, NR_REQUEST, request::nr_sectors, NULL, panic(), READ, READA, request, request::sector, sleep_on(), unlock_buffer(), wait_for_request, request::waiting, WRITE, and WRITEA.

Referenced by ll_rw_block().

static void unlock_buffer ( struct buffer_head * bh ) [inline, static]

Definition at line 51 of file ll_rw_blk.c.

References printk(), and wake_up().

Referenced by make_request().

Variable Documentation

struct blk_dev_struct blk_dev[NR_BLK_DEV]

Initial value:

 {
    { NULL, NULL },
    { NULL, NULL },
    { NULL, NULL },
    { NULL, NULL },
    { NULL, NULL },
    { NULL, NULL },
    { NULL, NULL }
}

Definition at line 32 of file ll_rw_blk.c.

Referenced by floppy_init(), hd_init(), ll_rw_block(), make_request(), and rd_init().

struct request request[NR_REQUEST]

Definition at line 21 of file ll_rw_blk.c.

Referenced by add_request(), blk_dev_init(), and make_request().

struct task_struct* wait_for_request = NULL

Definition at line 26 of file ll_rw_blk.c.

Referenced by make_request().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/ramdisk.c File Reference

ramdisk.c File Reference

#include <string.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <asm/system.h>
#include <asm/segment.h>
#include <asm/memory.h>
#include "blk.h"

Go to the source code of this file.

Defines

#define | MAJOR_NR 1

Functions

void | do_rd_request (void)
long | rd_init (long mem_start, int length)
void | rd_load (void)

Variables

char * | rd_start
int | rd_length = 0

Define Documentation

#define MAJOR_NR 1

Definition at line 17 of file ramdisk.c.

Function Documentation

void do_rd_request ( void )

Definition at line 23 of file ramdisk.c.

References memcpy, MINOR, panic(), rd_length, rd_start, READ, and WRITE.

long rd_init | ( | long | mem_start,
 |  | int | length
 | ) |

Definition at line 52 of file ramdisk.c.

References blk_dev, MAJOR_NR, rd_length, rd_start, and blk_dev_struct::request_fn.

Referenced by main().

void rd_load ( void )

Definition at line 71 of file ramdisk.c.

References buffer_head::b_data, BLOCK_SIZE, BLOCK_SIZE_BITS, bread(), breada(), brelse(), MAJOR, memcpy, printk(), rd_length, rd_start, ROOT_DEV, super_block::s_log_zone_size, super_block::s_magic, super_block::s_nzones, and SUPER_MAGIC.

Referenced by sys_setup().

Variable Documentation

int rd_length = 0

Definition at line 21 of file ramdisk.c.

Referenced by do_rd_request(), rd_init(), and rd_load().

char* rd_start

Definition at line 20 of file ramdisk.c.

Referenced by do_rd_request(), rd_init(), and rd_load().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/console.c File Reference

console.c File Reference

#include <linux/sched.h>
#include <linux/tty.h>
#include <asm/io.h>
#include <asm/system.h>

Go to the source code of this file.

Defines

#define | ORIG_X (*(unsigned char *)0x90000)
#define | ORIG_Y (*(unsigned char *)0x90001)
#define | ORIG_VIDEO_PAGE (*(unsigned short *)0x90004)
#define | ORIG_VIDEO_MODE ((*(unsigned short *)0x90006) & 0xff)
#define | ORIG_VIDEO_COLS (((*(unsigned short *)0x90006) & 0xff00) >> 8)
#define | ORIG_VIDEO_LINES (25)
#define | ORIG_VIDEO_EGA_AX (*(unsigned short *)0x90008)
#define | ORIG_VIDEO_EGA_BX (*(unsigned short *)0x9000a)
#define | ORIG_VIDEO_EGA_CX (*(unsigned short *)0x9000c)
#define | VIDEO_TYPE_MDA 0x10
#define | VIDEO_TYPE_CGA 0x11
#define | VIDEO_TYPE_EGAM 0x20
#define | VIDEO_TYPE_EGAC 0x21
#define | NPAR 16
#define | RESPONSE "\033[?1;2c"

Functions

void | keyboard_interrupt (void)
static void | sysbeep (void)
static void | gotoxy (unsigned int new_x, unsigned int new_y)
static void | set_origin (void)
static void | scrup (void)
static void | scrdown (void)
static void | lf (void)
static void | ri (void)
static void | cr (void)
static void | del (void)
static void | csi_J (int par)
static void | csi_K (int par)
void | csi_m (void)
static void | set_cursor (void)
static void | respond (struct tty_struct *tty)
static void | insert_char (void)
static void | insert_line (void)
static void | delete_char (void)
static void | delete_line (void)
static void | csi_at (unsigned int nr)
static void | csi_L (unsigned int nr)
static void | csi_P (unsigned int nr)
static void | csi_M (unsigned int nr)
static void | save_cur (void)
static void | restore_cur (void)
void | con_write (struct tty_struct *tty)
void | con_init (void)
void | sysbeepstop (void)

Variables

static unsigned char | video_type
static unsigned long | video_num_columns
static unsigned long | video_size_row
static unsigned long | video_num_lines
static unsigned char | video_page
static unsigned long | video_mem_start
static unsigned long | video_mem_end
static unsigned short | video_port_reg
static unsigned short | video_port_val
static unsigned short | video_erase_char
static unsigned long | origin
static unsigned long | scr_end
static unsigned long | pos
static unsigned long | x
static unsigned long | y
static unsigned long | top
static unsigned long | bottom
static unsigned long | state = 0
static unsigned long | npar
static unsigned long | par [NPAR]
static unsigned long | ques = 0
static unsigned char | attr = 0x07
static int | saved_x = 0
static int | saved_y = 0
int | beepcount = 0

Define Documentation

#define NPAR 16

Definition at line 54 of file console.c.

Referenced by con_write().

#define ORIG_VIDEO_COLS (((*(unsigned short *)0x90006) & 0xff00) >> 8)

Definition at line 43 of file console.c.

Referenced by con_init().

#define ORIG_VIDEO_EGA_AX (*(unsigned short *)0x90008)

Definition at line 45 of file console.c.

#define ORIG_VIDEO_EGA_BX (*(unsigned short *)0x9000a)

Definition at line 46 of file console.c.

Referenced by con_init().

#define ORIG_VIDEO_EGA_CX (*(unsigned short *)0x9000c)

Definition at line 47 of file console.c.

#define ORIG_VIDEO_LINES (25)

Definition at line 44 of file console.c.

Referenced by con_init().

#define ORIG_VIDEO_MODE ((*(unsigned short *)0x90006) & 0xff)

Definition at line 42 of file console.c.

Referenced by con_init().

#define ORIG_VIDEO_PAGE (*(unsigned short *)0x90004)

Definition at line 41 of file console.c.

Referenced by con_init().

#define ORIG_X (*(unsigned char *)0x90000)

Definition at line 39 of file console.c.

Referenced by con_init().

#define ORIG_Y (*(unsigned char *)0x90001)

Definition at line 40 of file console.c.

Referenced by con_init().

#define RESPONSE "\033[?1;2c"

Definition at line 85 of file console.c.

Referenced by respond().

#define VIDEO_TYPE_CGA 0x11

Definition at line 50 of file console.c.

Referenced by con_init().

#define VIDEO_TYPE_EGAC 0x21

Definition at line 52 of file console.c.

Referenced by con_init(), scrdown(), and scrup().

#define VIDEO_TYPE_EGAM 0x20

Definition at line 51 of file console.c.

Referenced by con_init(), scrdown(), and scrup().

#define VIDEO_TYPE_MDA 0x10

Definition at line 49 of file console.c.

Referenced by con_init().

Function Documentation

void con_init ( void )

Definition at line 617 of file console.c.

References a, bottom, gotoxy(), inb_p, keyboard_interrupt(), ORIG_VIDEO_COLS, ORIG_VIDEO_EGA_BX, ORIG_VIDEO_LINES, ORIG_VIDEO_MODE, ORIG_VIDEO_PAGE, ORIG_X, ORIG_Y, origin, outb, outb_p, scr_end, set_trap_gate, top, video_erase_char, video_mem_end, video_mem_start, video_num_columns, video_num_lines, video_page, video_port_reg, video_port_val, video_size_row, video_type, VIDEO_TYPE_CGA, VIDEO_TYPE_EGAC, VIDEO_TYPE_EGAM, and VIDEO_TYPE_MDA.

Referenced by tty_init().

void con_write ( struct tty_struct * tty )

Definition at line 445 of file console.c.

References bottom, CHARS, cr(), csi_at(), csi_J(), csi_K(), csi_L(), csi_m(), csi_M(), csi_P(), del(), ERASE_CHAR, GETCH, gotoxy(), lf(), NPAR, npar, par, pos, ques, respond(), restore_cur(), ri(), save_cur(), set_cursor(), state, sysbeep(), top, video_num_columns, video_num_lines, video_size_row, x, and y.

static void cr ( void ) [static]

Definition at line 224 of file console.c.

References pos, and x.

Referenced by con_write().

static void csi_at ( unsigned int nr ) [static]

Definition at line 391 of file console.c.

References insert_char(), and video_num_columns.

Referenced by con_write().

static void csi_J ( int par ) [static]

Definition at line 239 of file console.c.

References origin, par, pos, scr_end, video_erase_char, video_num_columns, and video_num_lines.

Referenced by con_write().

static void csi_K ( int par ) [static]

Definition at line 268 of file console.c.

References par, pos, video_erase_char, video_num_columns, and x.

Referenced by con_write().

static void csi_L ( unsigned int nr ) [static]

Definition at line 401 of file console.c.

References insert_line(), and video_num_lines.

Referenced by con_write().

static void csi_M ( unsigned int nr ) [static]

Definition at line 421 of file console.c.

References delete_line(), and video_num_lines.

Referenced by con_write().

void csi_m ( void )

Definition at line 299 of file console.c.

References attr, npar, and par.

Referenced by con_write().

static void csi_P ( unsigned int nr ) [static]

Definition at line 411 of file console.c.

References delete_char(), and video_num_columns.

Referenced by con_write().

static void del ( void ) [static]

Definition at line 230 of file console.c.

References pos, video_erase_char, and x.

Referenced by con_write().

static void delete_char ( void ) [static]

Definition at line 363 of file console.c.

References pos, video_erase_char, video_num_columns, and x.

Referenced by csi_P().

static void delete_line ( void ) [static]

Definition at line 378 of file console.c.

References bottom, scrup(), top, video_num_lines, and y.

Referenced by csi_M().

static void gotoxy | ( | unsigned int | new_x,
 |  | unsigned int | new_y
 | ) | [inline, static]

Definition at line 88 of file console.c.

References origin, pos, video_num_columns, video_num_lines, video_size_row, x, and y.

Referenced by con_init(), con_write(), and restore_cur().

static void insert_char ( void ) [static]

Definition at line 336 of file console.c.

References pos, video_erase_char, video_num_columns, and x.

Referenced by csi_at().

static void insert_line ( void ) [static]

Definition at line 350 of file console.c.

References bottom, scrdown(), top, video_num_lines, and y.

Referenced by csi_L().

void keyboard_interrupt ( void )

Referenced by con_init().

static void lf ( void ) [static]

Definition at line 204 of file console.c.

References bottom, pos, scrup(), video_size_row, and y.

Referenced by con_write().

static void respond ( struct tty_struct * tty ) [static]

Definition at line 323 of file console.c.

References cli, copy_to_cooked(), PUTCH, RESPONSE, and sti.

Referenced by con_write().

static void restore_cur ( void ) [static]

Definition at line 440 of file console.c.

References gotoxy(), saved_x, and saved_y.

Referenced by con_write().

static void ri ( void ) [static]

Definition at line 214 of file console.c.

References pos, scrdown(), top, video_size_row, and y.

Referenced by con_write().

static void save_cur ( void ) [static]

Definition at line 434 of file console.c.

References saved_x, saved_y, x, and y.

Referenced by con_write().

static void scrdown ( void ) [static]

Definition at line 170 of file console.c.

References bottom, origin, top, video_erase_char, video_num_columns, video_size_row, video_type, VIDEO_TYPE_EGAC, and VIDEO_TYPE_EGAM.

Referenced by insert_line(), and ri().

static void scrup ( void ) [static]

Definition at line 107 of file console.c.

References bottom, origin, pos, scr_end, set_origin(), top, video_erase_char, video_mem_end, video_mem_start, video_num_columns, video_num_lines, video_size_row, video_type, VIDEO_TYPE_EGAC, and VIDEO_TYPE_EGAM.

Referenced by delete_line(), and lf().

static void set_cursor ( void ) [inline, static]

Definition at line 313 of file console.c.

References cli, outb_p, pos, sti, video_mem_start, video_port_reg, and video_port_val.

Referenced by con_write().

static void set_origin ( void ) [inline, static]

Definition at line 97 of file console.c.

References cli, origin, outb_p, sti, video_mem_start, video_port_reg, and video_port_val.

Referenced by scrup().

static void sysbeep ( void ) [static]

Definition at line 699 of file console.c.

References beepcount, HZ, inb_p, outb, and outb_p.

Referenced by con_write().

void sysbeepstop ( void )

Definition at line 691 of file console.c.

References inb_p, and outb.

Referenced by do_timer().

Variable Documentation

unsigned char attr = 0x07 [static]

Definition at line 77 of file console.c.

Referenced by csi_m().

int beepcount = 0

Definition at line 697 of file console.c.

Referenced by do_timer(), and sysbeep().

unsigned long bottom [static]

Definition at line 73 of file console.c.

Referenced by con_init(), con_write(), delete_line(), insert_line(), lf(), scrdown(), and scrup().

unsigned long npar [static]

Definition at line 75 of file console.c.

Referenced by con_write(), and csi_m().

unsigned long origin [static]

Definition at line 69 of file console.c.

Referenced by con_init(), csi_J(), gotoxy(), scrdown(), scrup(), and set_origin().

unsigned long par[NPAR] [static]

Definition at line 75 of file console.c.

Referenced by con_write(), csi_J(), csi_K(), and csi_m().

unsigned long pos [static]

Definition at line 71 of file console.c.

Referenced by con_write(), cr(), csi_J(), csi_K(), del(), delete_char(), gotoxy(), insert_char(), lf(), ri(), scrup(), and set_cursor().

unsigned long ques = 0 [static]

Definition at line 76 of file console.c.

Referenced by con_write().

int saved_x = 0 [static]

Definition at line 431 of file console.c.

Referenced by restore_cur(), and save_cur().

int saved_y = 0 [static]

Definition at line 432 of file console.c.

Referenced by restore_cur(), and save_cur().

unsigned long scr_end [static]

Definition at line 70 of file console.c.

Referenced by con_init(), csi_J(), and scrup().

unsigned long state = 0 [static]

Definition at line 74 of file console.c.

Referenced by con_write().

unsigned long top [static]

Definition at line 73 of file console.c.

Referenced by con_init(), con_write(), delete_line(), insert_line(), ri(), scrdown(), and scrup().

unsigned short video_erase_char [static]

Definition at line 67 of file console.c.

Referenced by con_init(), csi_J(), csi_K(), del(), delete_char(), insert_char(), scrdown(), and scrup().

unsigned long video_mem_end [static]

Definition at line 64 of file console.c.

Referenced by con_init(), and scrup().

unsigned long video_mem_start [static]

Definition at line 63 of file console.c.

Referenced by con_init(), scrup(), set_cursor(), and set_origin().

unsigned long video_num_columns [static]

Definition at line 59 of file console.c.

Referenced by con_init(), con_write(), csi_at(), csi_J(), csi_K(), csi_P(), delete_char(), gotoxy(), insert_char(), scrdown(), and scrup().

unsigned long video_num_lines [static]

Definition at line 61 of file console.c.

Referenced by con_init(), con_write(), csi_J(), csi_L(), csi_M(), delete_line(), gotoxy(), insert_line(), and scrup().

unsigned char video_page [static]

Definition at line 62 of file console.c.

Referenced by con_init().

unsigned short video_port_reg [static]

Definition at line 65 of file console.c.

Referenced by con_init(), set_cursor(), and set_origin().

unsigned short video_port_val [static]

Definition at line 66 of file console.c.

Referenced by con_init(), set_cursor(), and set_origin().

unsigned long video_size_row [static]

Definition at line 60 of file console.c.

Referenced by con_init(), con_write(), gotoxy(), lf(), ri(), scrdown(), and scrup().

unsigned char video_type [static]

Definition at line 58 of file console.c.

Referenced by con_init(), scrdown(), and scrup().

unsigned long x [static]

Definition at line 72 of file console.c.

Referenced by con_write(), cr(), csi_K(), del(), delete_char(), gotoxy(), insert_char(), and save_cur().

unsigned long y [static]

Definition at line 72 of file console.c.

Referenced by con_write(), delete_line(), gotoxy(), insert_line(), lf(), ri(), and save_cur().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/serial.c File Reference

serial.c File Reference

#include <linux/tty.h>
#include <linux/sched.h>
#include <asm/system.h>
#include <asm/io.h>

Go to the source code of this file.

Defines

#define | WAKEUP_CHARS (TTY_BUF_SIZE/4)

Functions

void | rs1_interrupt (void)
void | rs2_interrupt (void)
static void | init (int port)
void | rs_init (void)
void | rs_write (struct tty_struct *tty)

Define Documentation

#define WAKEUP_CHARS (TTY_BUF_SIZE/4)

Definition at line 21 of file serial.c.

Function Documentation

static void init ( int port ) [static]

Definition at line 26 of file serial.c.

References inb, and outb_p.

void rs1_interrupt ( void )

Referenced by rs_init().

void rs2_interrupt ( void )

Referenced by rs_init().

void rs_init ( void )

Definition at line 37 of file serial.c.

References inb_p, init(), outb, rs1_interrupt(), rs2_interrupt(), set_intr_gate, and tty_table.

Referenced by tty_init().

void rs_write ( struct tty_struct * tty )

Definition at line 53 of file serial.c.

References cli, EMPTY, inb_p, outb, and sti.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/tty_io.c File Reference

tty_io.c File Reference

#include <ctype.h>
#include <errno.h>
#include <signal.h>
#include <linux/sched.h>
#include <linux/tty.h>
#include <asm/segment.h>
#include <asm/system.h>

Go to the source code of this file.

Defines

#define | ALRMMASK (1<<(SIGALRM-1))
#define | KILLMASK (1<<(SIGKILL-1))
#define | INTMASK (1<<(SIGINT-1))
#define | QUITMASK (1<<(SIGQUIT-1))
#define | TSTPMASK (1<<(SIGTSTP-1))
#define | _L_FLAG(tty, f) ((tty)->termios.c_lflag & f)
#define | _I_FLAG(tty, f) ((tty)->termios.c_iflag & f)
#define | _O_FLAG(tty, f) ((tty)->termios.c_oflag & f)
#define | L_CANON(tty) _L_FLAG((tty),ICANON)
#define | L_ISIG(tty) _L_FLAG((tty),ISIG)
#define | L_ECHO(tty) _L_FLAG((tty),ECHO)
#define | L_ECHOE(tty) _L_FLAG((tty),ECHOE)
#define | L_ECHOK(tty) _L_FLAG((tty),ECHOK)
#define | L_ECHOCTL(tty) _L_FLAG((tty),ECHOCTL)
#define | L_ECHOKE(tty) _L_FLAG((tty),ECHOKE)
#define | I_UCLC(tty) _I_FLAG((tty),IUCLC)
#define | I_NLCR(tty) _I_FLAG((tty),INLCR)
#define | I_CRNL(tty) _I_FLAG((tty),ICRNL)
#define | I_NOCR(tty) _I_FLAG((tty),IGNCR)
#define | O_POST(tty) _O_FLAG((tty),OPOST)
#define | O_NLCR(tty) _O_FLAG((tty),ONLCR)
#define | O_CRNL(tty) _O_FLAG((tty),OCRNL)
#define | O_NLRET(tty) _O_FLAG((tty),ONLRET)
#define | O_LCUC(tty) _O_FLAG((tty),OLCUC)

Functions

void | tty_init (void)
void | tty_intr (struct tty_struct *tty, int mask)
static void | sleep_if_empty (struct tty_queue *queue)
static void | sleep_if_full (struct tty_queue *queue)
void | wait_for_keypress (void)
void | copy_to_cooked (struct tty_struct *tty)
int | tty_read (unsigned channel, char *buf, int nr)
int | tty_write (unsigned channel, char *buf, int nr)
void | do_tty_interrupt (int tty)
void | chr_dev_init (void)

Variables

tty_struct tty_table []
tty_queue * table_list []

Define Documentation

#define _I_FLAG | ( | tty,
 |  | f | ) | ((tty)->termios.c_iflag & f)

Definition at line 29 of file tty_io.c.

#define _L_FLAG | ( | tty,
 |  | f | ) | ((tty)->termios.c_lflag & f)

Definition at line 28 of file tty_io.c.

#define _O_FLAG | ( | tty,
 |  | f | ) | ((tty)->termios.c_oflag & f)

Definition at line 30 of file tty_io.c.

#define ALRMMASK (1<<(SIGALRM-1))

Definition at line 17 of file tty_io.c.

Referenced by tty_read().

#define I_CRNL ( tty ) _I_FLAG((tty),ICRNL)

Definition at line 42 of file tty_io.c.

Referenced by copy_to_cooked().

#define I_NLCR ( tty ) _I_FLAG((tty),INLCR)

Definition at line 41 of file tty_io.c.

Referenced by copy_to_cooked().

#define I_NOCR ( tty ) _I_FLAG((tty),IGNCR)

Definition at line 43 of file tty_io.c.

Referenced by copy_to_cooked().

#define I_UCLC ( tty ) _I_FLAG((tty),IUCLC)

Definition at line 40 of file tty_io.c.

Referenced by copy_to_cooked().

#define INTMASK (1<<(SIGINT-1))

Definition at line 19 of file tty_io.c.

Referenced by copy_to_cooked().

#define KILLMASK (1<<(SIGKILL-1))

Definition at line 18 of file tty_io.c.

#define L_CANON ( tty ) _L_FLAG((tty),ICANON)

Definition at line 32 of file tty_io.c.

Referenced by copy_to_cooked(), and tty_read().

#define L_ECHO ( tty ) _L_FLAG((tty),ECHO)

Definition at line 34 of file tty_io.c.

Referenced by copy_to_cooked().

#define L_ECHOCTL ( tty ) _L_FLAG((tty),ECHOCTL)

Definition at line 37 of file tty_io.c.

Referenced by copy_to_cooked().

#define L_ECHOE ( tty ) _L_FLAG((tty),ECHOE)

Definition at line 35 of file tty_io.c.

#define L_ECHOK ( tty ) _L_FLAG((tty),ECHOK)

Definition at line 36 of file tty_io.c.

#define L_ECHOKE ( tty ) _L_FLAG((tty),ECHOKE)

Definition at line 38 of file tty_io.c.

#define L_ISIG ( tty ) _L_FLAG((tty),ISIG)

Definition at line 33 of file tty_io.c.

Referenced by copy_to_cooked().

#define O_CRNL ( tty ) _O_FLAG((tty),OCRNL)

Definition at line 47 of file tty_io.c.

Referenced by tty_write().

#define O_LCUC ( tty ) _O_FLAG((tty),OLCUC)

Definition at line 49 of file tty_io.c.

Referenced by tty_write().

#define O_NLCR ( tty ) _O_FLAG((tty),ONLCR)

Definition at line 46 of file tty_io.c.

Referenced by tty_write().

#define O_NLRET ( tty ) _O_FLAG((tty),ONLRET)

Definition at line 48 of file tty_io.c.

Referenced by tty_write().

#define O_POST ( tty ) _O_FLAG((tty),OPOST)

Definition at line 45 of file tty_io.c.

Referenced by tty_write().

#define QUITMASK (1<<(SIGQUIT-1))

Definition at line 20 of file tty_io.c.

Referenced by copy_to_cooked().

#define TSTPMASK (1<<(SIGTSTP-1))

Definition at line 21 of file tty_io.c.

Function Documentation

void chr_dev_init ( void )

Definition at line 348 of file tty_io.c.

Referenced by main().

void copy_to_cooked ( struct tty_struct * tty )

Definition at line 145 of file tty_io.c.

References DEC, EMPTY, EOF_CHAR, ERASE_CHAR, FULL, GETCH, I_CRNL, I_NLCR, I_NOCR, I_UCLC, INTMASK, INTR_CHAR, KILL_CHAR, L_CANON, L_ECHO, L_ECHOCTL, L_ISIG, LAST, PUTCH, QUIT_CHAR, QUITMASK, START_CHAR, STOP_CHAR, tolower, tty_intr(), and wake_up().

Referenced by do_tty_interrupt(), and respond().

void do_tty_interrupt ( int tty )

Definition at line 343 of file tty_io.c.

References copy_to_cooked(), and tty_table.

static void sleep_if_empty ( struct tty_queue * queue ) [static]

Definition at line 122 of file tty_io.c.

References cli, current, EMPTY, interruptible_sleep_on(), task_struct::signal, and sti.

Referenced by tty_read(), and wait_for_keypress().

static void sleep_if_full ( struct tty_queue * queue ) [static]

Definition at line 130 of file tty_io.c.

References cli, current, FULL, interruptible_sleep_on(), LEFT, task_struct::signal, and sti.

Referenced by tty_write().

void tty_init ( void )

Definition at line 105 of file tty_io.c.

References con_init(), and rs_init().

Referenced by main().

void tty_intr | ( | struct tty_struct * | tty,
 |  | int | mask
 | ) |

Definition at line 111 of file tty_io.c.

References NR_TASKS, task_struct::pgrp, task_struct::signal, and task.

Referenced by copy_to_cooked().

int tty_read | ( | unsigned | channel,
 |  | char * | buf,
 |  | int | nr
 | ) |

Definition at line 230 of file tty_io.c.

References task_struct::alarm, ALRMMASK, b, termios::c_cc, current, tty_queue::data, EINTR, EMPTY, EOF_CHAR, GETCH, jiffies, L_CANON, LEFT, put_fs_byte(), tty_struct::secondary, task_struct::signal, sleep_if_empty(), tty_struct::termios, time(), tty_table, VMIN, and VTIME.

int tty_write | ( | unsigned | channel,
 |  | char * | buf,
 |  | int | nr
 | ) |

Definition at line 291 of file tty_io.c.

References b, current, FULL, get_fs_byte(), O_CRNL, O_LCUC, O_NLCR, O_NLRET, O_POST, PUTCH, schedule(), task_struct::signal, sleep_if_full(), toupper, tty_table, tty_struct::write, and tty_struct::write_q.

void wait_for_keypress ( void )

Definition at line 140 of file tty_io.c.

References sleep_if_empty(), and tty_table.

Referenced by mount_root().

Variable Documentation

struct tty_queue* table_list[]

Initial value:

{
    &tty_table[0].read_q, &tty_table[0].write_q,
    &tty_table[1].read_q, &tty_table[1].write_q,
    &tty_table[2].read_q, &tty_table[2].write_q
    }

Definition at line 99 of file tty_io.c.

struct tty_struct tty_table[]

Definition at line 51 of file tty_io.c.

Referenced by do_exit(), do_tty_interrupt(), rs_init(), sys_open(), tty_ioctl(), tty_read(), tty_write(), and wait_for_keypress().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/tty_ioctl.c File Reference

tty_ioctl.c File Reference

#include <errno.h>
#include <termios.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/tty.h>
#include <asm/io.h>
#include <asm/segment.h>
#include <asm/system.h>

Go to the source code of this file.

Functions

static void | change_speed (struct tty_struct *tty)
static void | flush (struct tty_queue *queue)
static void | wait_until_sent (struct tty_struct *tty)
static void | send_break (struct tty_struct *tty)
static int | get_termios (struct tty_struct *tty, struct termios *termios)
static int | set_termios (struct tty_struct *tty, struct termios *termios)
static int | get_termio (struct tty_struct *tty, struct termio *termio)
static int | set_termio (struct tty_struct *tty, struct termio *termio)
int | tty_ioctl (int dev, int cmd, int arg)

Variables

static unsigned short | quotient []

Function Documentation

static void change_speed ( struct tty_struct * tty ) [static]

Definition at line 24 of file tty_ioctl.c.

References CBAUD, cli, outb, outb_p, quotient, and sti.

Referenced by set_termio(), and set_termios().

static void flush ( struct tty_queue * queue ) [static]

Definition at line 39 of file tty_ioctl.c.

References cli, and sti.

Referenced by tty_ioctl().

static int get_termio | ( | struct tty_struct * | tty,
 |  | struct termio * | termio
 | ) | [static]

Definition at line 76 of file tty_ioctl.c.

References termio::c_cc, termio::c_cflag, termio::c_iflag, termio::c_lflag, termio::c_line, termio::c_oflag, NCC, put_fs_byte(), and verify_area().

Referenced by tty_ioctl().

static int get_termios | ( | struct tty_struct * | tty,
 |  | struct termios * | termios
 | ) | [static]

Definition at line 56 of file tty_ioctl.c.

References put_fs_byte(), and verify_area().

Referenced by tty_ioctl().

static void send_break ( struct tty_struct * tty ) [static]

Definition at line 51 of file tty_ioctl.c.

Referenced by tty_ioctl().

static int set_termio | ( | struct tty_struct * | tty,
 |  | struct termio * | termio
 | ) | [static]

Definition at line 97 of file tty_ioctl.c.

References termio::c_cc, termio::c_cflag, termio::c_iflag, termio::c_lflag, termio::c_line, termio::c_oflag, change_speed(), get_fs_byte(), and NCC.

Referenced by tty_ioctl().

static int set_termios | ( | struct tty_struct * | tty,
 |  | struct termios * | termios
 | ) | [static]

Definition at line 66 of file tty_ioctl.c.

References change_speed(), and get_fs_byte().

Referenced by tty_ioctl().

int tty_ioctl | ( | int | dev,
 |  | int | cmd,
 |  | int | arg
 | ) |

Definition at line 115 of file tty_ioctl.c.

References CHARS, current, EINVAL, flush(), get_fs_long(), get_termio(), get_termios(), MAJOR, MINOR, panic(), tty_struct::pgrp, put_fs_long(), tty_struct::read_q, tty_struct::secondary, send_break(), set_termio(), set_termios(), TCFLSH, TCGETA, TCGETS, TCSBRK, TCSETA, TCSETAF, TCSETAW, TCSETS, TCSETSF, TCSETSW, TCXONC, TIOCEXCL, TIOCGPGRP, TIOCGSOFTCAR, TIOCGWINSZ, TIOCINQ, TIOCMBIC, TIOCMBIS, TIOCMGET, TIOCMSET, TIOCNXCL, TIOCOUTQ, TIOCSCTTY, TIOCSPGRP, TIOCSSOFTCAR, TIOCSTI, TIOCSWINSZ, task_struct::tty, tty_table, verify_area(), wait_until_sent(), and tty_struct::write_q.

static void wait_until_sent ( struct tty_struct * tty ) [static]

Definition at line 46 of file tty_ioctl.c.

Referenced by tty_ioctl().

Variable Documentation

unsigned short quotient[] [static]

Initial value:

 {
    0, 2304, 1536, 1047, 857,
    768, 576, 384, 192, 96,
    64, 48, 24, 12, 6, 3
}

Definition at line 18 of file tty_ioctl.c.

Referenced by change_speed().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/math/math_emulate.c File Reference

math_emulate.c File Reference

#include <signal.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>

Go to the source code of this file.

Functions

void | math_emulate (long edi, long esi, long ebp, long sys_call_ret, long eax, long ebx, long ecx, long edx, unsigned short fs, unsigned short es, unsigned short ds, unsigned long eip, unsigned short cs, unsigned long eflags, unsigned short ss, unsigned long esp)
void | math_error (void)

Function Documentation

void math_emulate | ( | long | edi,
 |  | long | esi,
 |  | long | ebp,
 |  | long | sys_call_ret,
 |  | long | eax,
 |  | long | ebx,
 |  | long | ecx,
 |  | long | edx,
 |  | unsigned short | fs,
 |  | unsigned short | es,
 |  | unsigned short | ds,
 |  | unsigned long | eip,
 |  | unsigned short | cs,
 |  | unsigned long | eflags,
 |  | unsigned short | ss,
 |  | unsigned long | esp
 | ) |

Definition at line 18 of file math_emulate.c.

References current, get_fs_byte(), panic(), printk(), SIGFPE, and task_struct::signal.

void math_error ( void )

Definition at line 37 of file math_emulate.c.

References last_task_used_math, SIGFPE, and task_struct::signal.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/_exit.c File Reference

_exit.c File Reference

#include <unistd.h>

Go to the source code of this file.

Defines

#define | __LIBRARY__

Functions

volatile void | _exit (int exit_code)

Define Documentation

#define __LIBRARY__

Definition at line 7 of file _exit.c.

Function Documentation

volatile void _exit ( int exit_code )

Definition at line 10 of file _exit.c.

Referenced by init().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/close.c File Reference

close.c File Reference

#include <unistd.h>

Go to the source code of this file.

Defines

#define __LIBRARY__

Define Documentation

#define __LIBRARY__

Definition at line 7 of file close.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/ctype.c File Reference

ctype.c File Reference

#include <ctype.h>

Go to the source code of this file.

Variables

char | _ctmp
unsigned char | _ctype []

Variable Documentation

char _ctmp

Definition at line 9 of file ctype.c.

unsigned char _ctype[]

Initial value:

 {0x00,
_C,_C,_C,_C,_C,_C,_C,_C,
_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,
_C,_C,_C,_C,_C,_C,_C,_C,
_C,_C,_C,_C,_C,_C,_C,_C,
_S|_SP,_P,_P,_P,_P,_P,_P,_P,
_P,_P,_P,_P,_P,_P,_P,_P,
_D,_D,_D,_D,_D,_D,_D,_D,
_D,_D,_P,_P,_P,_P,_P,_P,
_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,
_U,_U,_U,_U,_U,_U,_U,_U,
_U,_U,_U,_U,_U,_U,_U,_U,
_U,_U,_U,_P,_P,_P,_P,_P,
_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,
_L,_L,_L,_L,_L,_L,_L,_L,
_L,_L,_L,_L,_L,_L,_L,_L,
_L,_L,_L,_P,_P,_P,_P,_C,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

Definition at line 10 of file ctype.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/dup.c File Reference

dup.c File Reference

#include <unistd.h>

Go to the source code of this file.

Defines

#define __LIBRARY__

Define Documentation

#define __LIBRARY__

Definition at line 7 of file dup.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/errno.c File Reference

errno.c File Reference

Go to the source code of this file.

Variables

int errno

Variable Documentation

int errno

Definition at line 7 of file errno.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/execve.c File Reference

execve.c File Reference

#include <unistd.h>

Go to the source code of this file.

Defines

#define __LIBRARY__

Define Documentation

#define __LIBRARY__

Definition at line 7 of file execve.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/malloc.c File Reference

malloc.c File Reference

#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/system.h>

Go to the source code of this file.

Functions

static void | init_bucket_desc ()
void * | malloc (unsigned int len)
void | free_s (void *obj, int size)

Variables

_bucket_dir bucket_dir []
bucket_desc * | free_bucket_desc = (struct bucket_desc *) 0

Function Documentation

void free_s | ( | void * | obj,
 |  | int | size
 | ) |

Definition at line 182 of file malloc.c.

References bucket_dir, _bucket_dir::chain, cli, free_bucket_desc, free_page(), bucket_desc::freeptr, bucket_desc::next, bucket_desc::page, panic(), bucket_desc::refcnt, _bucket_dir::size, and sti.

static void init_bucket_desc ( ) [inline, static]

Definition at line 97 of file malloc.c.

References free_bucket_desc, get_free_page(), bucket_desc::next, PAGE_SIZE, and panic().

Referenced by malloc().

void* malloc ( unsigned int len )

Definition at line 117 of file malloc.c.

References bucket_dir, bucket_desc::bucket_size, _bucket_dir::chain, cli, free_bucket_desc, bucket_desc::freeptr, get_free_page(), init_bucket_desc(), bucket_desc::next, bucket_desc::page, PAGE_SIZE, panic(), printk(), bucket_desc::refcnt, _bucket_dir::size, and sti.

Variable Documentation

struct _bucket_dir bucket_dir[]

Initial value:

 {
    { 16,   (struct bucket_desc *) 0},
    { 32,   (struct bucket_desc *) 0},
    { 64,   (struct bucket_desc *) 0},
    { 128,  (struct bucket_desc *) 0},
    { 256,  (struct bucket_desc *) 0},
    { 512,  (struct bucket_desc *) 0},
    { 1024, (struct bucket_desc *) 0},
    { 2048, (struct bucket_desc *) 0},
    { 4096, (struct bucket_desc *) 0},
    { 0,    (struct bucket_desc *) 0}}

Definition at line 77 of file malloc.c.

Referenced by free_s(), and malloc().

struct bucket_desc* free_bucket_desc = (struct bucket_desc *) 0

Definition at line 92 of file malloc.c.

Referenced by free_s(), init_bucket_desc(), and malloc().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/open.c File Reference

open.c File Reference

#include <unistd.h>
#include <stdarg.h>

Go to the source code of this file.

Defines

#define | __LIBRARY__

Functions

int | open (const char *filename, int flag,...)

Define Documentation

#define __LIBRARY__

Definition at line 7 of file open.c.

Function Documentation

int open | ( | const char * | filename,
 |  | int | flag,
 |  |  | ...
 | ) |

Definition at line 11 of file open.c.

References errno, va_arg, and va_start.

Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/setsid.c File Reference

setsid.c File Reference

#include <unistd.h>

Go to the source code of this file.

Defines

#define __LIBRARY__

Define Documentation

#define __LIBRARY__

Definition at line 7 of file setsid.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/string.c File Reference

string.c File Reference

#include <string.h>

Go to the source code of this file.

Defines

#define | extern
#define | inline
#define | __LIBRARY__

Define Documentation

#define __LIBRARY__

Definition at line 13 of file string.c.

#define extern

Definition at line 11 of file string.c.

#define inline

Definition at line 12 of file string.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/wait.c File Reference

wait.c File Reference

#include <unistd.h>
#include <sys/wait.h>

Go to the source code of this file.

Defines

#define __LIBRARY__

Functions

_syscall3 (pid_t, waitpid, pid_t, pid, int *, wait_stat, int, options)

Define Documentation

#define __LIBRARY__

Definition at line 7 of file wait.c.

Function Documentation

_syscall3 | ( | pid_t | ,
 |  | waitpid | ,
 |  | pid_t | ,
 |  | pid | ,
 |  | int * | ,
 |  | wait_stat | ,
 |  | int | ,
 |  | options |
 | ) |

Definition at line 11 of file wait.c.

References waitpid().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/write.c File Reference

write.c File Reference

#include <unistd.h>

Go to the source code of this file.

Defines

#define __LIBRARY__

Define Documentation

#define __LIBRARY__

Definition at line 7 of file write.c.

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/mm/memory.c File Reference

memory.c File Reference

#include <signal.h>
#include <asm/system.h>
#include <linux/sched.h>
#include <linux/head.h>
#include <linux/kernel.h>

Go to the source code of this file.

Defines

#define | invalidate() __asm__("movl %%eax,%%cr3"::"a" (0))
#define | LOW_MEM 0x100000
#define | PAGING_MEMORY (15*1024*1024)
#define | PAGING_PAGES (PAGING_MEMORY>>12)
#define | MAP_NR(addr) (((addr)-LOW_MEM)>>12)
#define | USED 100
#define | CODE_SPACE(addr)
#define | copy_page(from, to) __asm__("cld ; rep ; movsl"::"S" (from),"D" (to),"c" (1024))

Functions

volatile void | do_exit (long code)
static volatile void | oom (void)
unsigned long | get_free_page (void)
void | free_page (unsigned long addr)
int | free_page_tables (unsigned long from, unsigned long size)
int | copy_page_tables (unsigned long from, unsigned long to, long size)
unsigned long | put_page (unsigned long page, unsigned long address)
void | un_wp_page (unsigned long *table_entry)
void | do_wp_page (unsigned long error_code, unsigned long address)
void | write_verify (unsigned long address)
void | get_empty_page (unsigned long address)
static int | try_to_share (unsigned long address, struct task_struct *p)
static int | share_page (unsigned long address)
void | do_no_page (unsigned long error_code, unsigned long address)
void | mem_init (long start_mem, long end_mem)
void | calc_mem (void)

Variables

static long | HIGH_MEMORY = 0
static unsigned char | mem_map [PAGING_PAGES] = {0,}

Define Documentation

#define CODE_SPACE ( addr )

Value:

((((addr)+4095)&~4095) < \
current->start_code + current->end_code)

Definition at line 49 of file memory.c.

Referenced by do_wp_page().

#define copy_page | ( | from,
 |  | to | ) | __asm__("cld ; rep ; movsl"::"S" (from),"D" (to),"c" (1024))

Definition at line 54 of file memory.c.

Referenced by un_wp_page().

#define invalidate ( ) __asm__("movl %%eax,%%cr3"::"a" (0))

Definition at line 39 of file memory.c.

Referenced by copy_page_tables(), free_page_tables(), try_to_share(), and un_wp_page().

#define LOW_MEM 0x100000

Definition at line 43 of file memory.c.

Referenced by copy_page_tables(), free_page(), get_free_page(), put_page(), try_to_share(), and un_wp_page().

#define MAP_NR ( addr ) (((addr)-LOW_MEM)>>12)

Definition at line 46 of file memory.c.

Referenced by mem_init(), and un_wp_page().

#define PAGING_MEMORY (15*1024*1024)

Definition at line 44 of file memory.c.

#define PAGING_PAGES (PAGING_MEMORY>>12)

Definition at line 45 of file memory.c.

Referenced by calc_mem(), get_free_page(), and mem_init().

#define USED 100

Definition at line 47 of file memory.c.

Referenced by mem_init().

Function Documentation

void calc_mem ( void )

Definition at line 414 of file memory.c.

References free, mem_map, PAGING_PAGES, pg_dir, and printk().

int copy_page_tables | ( | unsigned long | from,
 |  | unsigned long | to,
 |  | long | size
 | ) |

Definition at line 150 of file memory.c.

References get_free_page(), invalidate, LOW_MEM, mem_map, and panic().

Referenced by copy_mem().

volatile void do_exit ( long code )

Definition at line 102 of file exit.c.

References current, task_struct::executable, task_struct::exit_code, task_struct::father, task_struct::filp, free_page_tables(), get_base, get_limit, iput(), kill_session(), last_task_used_math, task_struct::ldt, task_struct::leader, NR_OPEN, NR_TASKS, NULL, tty_struct::pgrp, task_struct::pid, task_struct::pwd, task_struct::root, schedule(), send_sig(), SIGCHLD, task_struct::state, sys_close(), task, TASK_ZOMBIE, tell_father(), task_struct::tty, and tty_table.

Referenced by die(), do_signal(), do_wp_page(), oom(), and sys_exit().

void do_no_page | ( | unsigned long | error_code,
 |  | unsigned long | address
 | ) |

Definition at line 366 of file memory.c.

References BLOCK_SIZE, bmap(), bread_page(), current, task_struct::end_data, task_struct::executable, free_page(), get_empty_page(), get_free_page(), m_inode::i_dev, oom(), put_page(), share_page(), and task_struct::start_code.

void do_wp_page | ( | unsigned long | error_code,
 |  | unsigned long | address
 | ) |

Definition at line 247 of file memory.c.

References CODE_SPACE, do_exit(), SIGSEGV, and un_wp_page().

void free_page ( unsigned long addr )

Definition at line 89 of file memory.c.

References HIGH_MEMORY, LOW_MEM, mem_map, and panic().

Referenced by copy_process(), do_execve(), do_no_page(), free_page_tables(), free_s(), get_empty_page(), iput(), and release().

int free_page_tables | ( | unsigned long | from,
 |  | unsigned long | size
 | ) |

Definition at line 105 of file memory.c.

References free_page(), invalidate, and panic().

Referenced by copy_mem(), do_execve(), and do_exit().

void get_empty_page ( unsigned long address )

Definition at line 274 of file memory.c.

References free_page(), get_free_page(), oom(), and put_page().

Referenced by do_no_page().

unsigned long get_free_page ( void )

Definition at line 63 of file memory.c.

References LOW_MEM, mem_map, and PAGING_PAGES.

Referenced by copy_page_tables(), copy_process(), copy_strings(), do_no_page(), get_empty_page(), get_pipe_inode(), init_bucket_desc(), malloc(), put_page(), try_to_share(), and un_wp_page().

void mem_init | ( | long | start_mem,
 |  | long | end_mem
 | ) |

Definition at line 400 of file memory.c.

References HIGH_MEMORY, MAP_NR, mem_map, PAGING_PAGES, and USED.

Referenced by main().

static volatile void oom ( void ) [inline, static]

Definition at line 33 of file memory.c.

References do_exit(), printk(), and SIGSEGV.

Referenced by do_no_page(), get_empty_page(), try_to_share(), and un_wp_page().

unsigned long put_page | ( | unsigned long | page,
 |  | unsigned long | address
 | ) |

Definition at line 197 of file memory.c.

References get_free_page(), HIGH_MEMORY, LOW_MEM, mem_map, and printk().

Referenced by change_ldt(), do_no_page(), and get_empty_page().

static int share_page ( unsigned long address ) [static]

Definition at line 345 of file memory.c.

References current, task_struct::executable, FIRST_TASK, m_inode::i_count, LAST_TASK, and try_to_share().

Referenced by do_no_page().

static int try_to_share | ( | unsigned long | address,
 |  | struct task_struct * | p
 | ) | [static]

Definition at line 292 of file memory.c.

References current, get_free_page(), HIGH_MEMORY, invalidate, LOW_MEM, mem_map, oom(), panic(), and task_struct::start_code.

Referenced by share_page().

void un_wp_page ( unsigned long * table_entry )

Definition at line 221 of file memory.c.

References copy_page, get_free_page(), invalidate, LOW_MEM, MAP_NR, mem_map, and oom().

Referenced by do_wp_page(), and write_verify().

void write_verify ( unsigned long address )

Definition at line 261 of file memory.c.

References un_wp_page().

Referenced by verify_area().

Variable Documentation

long HIGH_MEMORY = 0 [static]

Definition at line 52 of file memory.c.

Referenced by free_page(), mem_init(), put_page(), and try_to_share().

unsigned char mem_map[PAGING_PAGES] = {0,} [static]

Definition at line 57 of file memory.c.

Referenced by calc_mem(), copy_page_tables(), free_page(), get_free_page(), mem_init(), put_page(), try_to_share(), and un_wp_page().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/tools/build.c File Reference

build.c File Reference

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/fs.h>
#include <unistd.h>
#include <fcntl.h>

Go to the source code of this file.

Defines

#define | MINIX_HEADER 32
#define | GCC_HEADER 1024
#define | SYS_SIZE 0x3000
#define | DEFAULT_MAJOR_ROOT 2
#define | DEFAULT_MINOR_ROOT 0x1d
#define | SETUP_SECTS 4
#define | STRINGIFY(x) #x

Functions

void | die (char *str)
void | usage (void)
int | main (int argc, char **argv)

Define Documentation

#define DEFAULT_MAJOR_ROOT 2

Definition at line 37 of file build.c.

Referenced by main().

#define DEFAULT_MINOR_ROOT 0x1d

Definition at line 38 of file build.c.

Referenced by main().

#define GCC_HEADER 1024

Definition at line 33 of file build.c.

#define MINIX_HEADER 32

Definition at line 32 of file build.c.

Referenced by main().

#define SETUP_SECTS 4

Definition at line 42 of file build.c.

Referenced by main().

#define STRINGIFY ( x ) #x

Definition at line 44 of file build.c.

Referenced by main().

#define SYS_SIZE 0x3000

Definition at line 35 of file build.c.

Referenced by main().

Function Documentation

void die ( char * str )

Definition at line 46 of file build.c.

References exit(), and str.

int main | ( | int | argc,
 |  | char ** | argv
 | ) |

Definition at line 57 of file build.c.

References close(), DEFAULT_MAJOR_ROOT, DEFAULT_MINOR_ROOT, die(), MAJOR, MINIX_HEADER, MINOR, O_RDONLY, open(), read(), SETUP_SECTS, stat::st_rdev, stat(), strcmp(), STRINGIFY, SYS_SIZE, usage(), and write().

void usage ( void )

Definition at line 52 of file build.c.

References die().

Referenced by main().

Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Data Structures

Here are the data structures with brief descriptions:
_bucket_dir
blk_dev_struct
bucket_desc
buffer_head
d_inode
d_super_block
desc_struct
dir_entry
div_t
drive_info
exec
file
flock
floppy_struct
hd_i_struct
hd_struct
i387_struct
ldiv_t
m_inode
nlist
partition
relocation_info
request
sigaction
stat
super_block
task_struct
task_union
termio
termios
timer_list
tm
tms
tss_struct
tty_queue
tty_struct
ustat
utimbuf
utsname
winsize
Generated on Sun Mar 6 10:56:09 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: _bucket_dir Struct Reference

_bucket_dir Struct Reference

Data Fields

int size
bucket_desc * chain

Field Documentation

struct bucket_desc* _bucket_dir::chain

Definition at line 62 of file malloc.c.

Referenced by free_s(), and malloc().

int _bucket_dir::size

Definition at line 61 of file malloc.c.

Referenced by free_s(), and malloc().

The documentation for this struct was generated from the following file:
  • K:/Linux/lib/malloc.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: blk_dev_struct Struct Reference

blk_dev_struct Struct Reference

#include <blk.h>

Data Fields

void(* request_fn )(void)
request * current_request

Field Documentation

struct request* blk_dev_struct::current_request

Definition at line 47 of file blk.h.

void(* blk_dev_struct::request_fn)(void)

Referenced by floppy_init(), hd_init(), ll_rw_block(), and rd_init().

The documentation for this struct was generated from the following file:
  • K:/Linux/kernel/blk_drv/blk.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: bucket_desc Struct Reference

bucket_desc Struct Reference

Data Fields

void * | page
bucket_desc * next
void * | freeptr
unsigned short | refcnt
unsigned short | bucket_size

Field Documentation

unsigned short bucket_desc::bucket_size

Definition at line 57 of file malloc.c.

Referenced by malloc().

void* bucket_desc::freeptr

Definition at line 55 of file malloc.c.

Referenced by free_s(), and malloc().

struct bucket_desc* bucket_desc::next

Definition at line 54 of file malloc.c.

Referenced by free_s(), init_bucket_desc(), and malloc().

void* bucket_desc::page

Definition at line 53 of file malloc.c.

Referenced by free_s(), and malloc().

unsigned short bucket_desc::refcnt

Definition at line 56 of file malloc.c.

Referenced by free_s(), and malloc().

The documentation for this struct was generated from the following file:
  • K:/Linux/lib/malloc.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: buffer_head Struct Reference

buffer_head Struct Reference

#include <fs.h>

Data Fields

char * | b_data
unsigned long | b_blocknr
unsigned short | b_dev
unsigned char | b_uptodate
unsigned char | b_dirt
unsigned char | b_count
unsigned char | b_lock
task_struct * b_wait
buffer_head * b_prev
buffer_head * b_next
buffer_head * b_prev_free
buffer_head * b_next_free

Field Documentation

unsigned long buffer_head::b_blocknr

Definition at line 70 of file fs.h.

Referenced by find_buffer(), get_hash_table(), and getblk().

unsigned char buffer_head::b_count

Definition at line 74 of file fs.h.

Referenced by breada(), buffer_init(), free_block(), get_hash_table(), getblk(), and new_block().

char* buffer_head::b_data

Definition at line 69 of file fs.h.

Referenced by _bmap(), add_entry(), block_read(), block_write(), buffer_init(), do_execve(), empty_dir(), file_read(), file_write(), find_entry(), free_block(), free_dind(), free_ind(), free_inode(), mount_root(), new_block(), new_inode(), rd_load(), read_inode(), read_super(), sys_mkdir(), sys_setup(), and write_inode().

unsigned short buffer_head::b_dev

Definition at line 71 of file fs.h.

Referenced by buffer_init(), find_buffer(), get_hash_table(), getblk(), invalidate_buffers(), and sync_dev().

unsigned char buffer_head::b_dirt

Definition at line 73 of file fs.h.

Referenced by _bmap(), add_entry(), add_request(), block_write(), buffer_init(), file_write(), free_block(), free_inode(), getblk(), invalidate_buffers(), new_block(), new_inode(), open_namei(), sync_dev(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), sys_sync(), sys_unlink(), and write_inode().

unsigned char buffer_head::b_lock

Definition at line 75 of file fs.h.

Referenced by buffer_init().

struct buffer_head* buffer_head::b_next

Definition at line 78 of file fs.h.

Referenced by buffer_init(), find_buffer(), insert_into_queues(), and remove_from_queues().

struct buffer_head* buffer_head::b_next_free

Definition at line 80 of file fs.h.

Referenced by buffer_init(), getblk(), insert_into_queues(), and remove_from_queues().

struct buffer_head* buffer_head::b_prev

Definition at line 77 of file fs.h.

Referenced by buffer_init(), insert_into_queues(), and remove_from_queues().

struct buffer_head* buffer_head::b_prev_free

Definition at line 79 of file fs.h.

Referenced by buffer_init(), insert_into_queues(), and remove_from_queues().

unsigned char buffer_head::b_uptodate

Definition at line 72 of file fs.h.

Referenced by bread(), breada(), buffer_init(), free_block(), getblk(), invalidate_buffers(), and new_block().

struct task_struct* buffer_head::b_wait

Definition at line 76 of file fs.h.

Referenced by buffer_init().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: d_inode Struct Reference

d_inode Struct Reference

#include <fs.h>

Data Fields

unsigned short | i_mode
unsigned short | i_uid
unsigned long | i_size
unsigned long | i_time
unsigned char | i_gid
unsigned char | i_nlinks
unsigned short | i_zone [9]

Field Documentation

unsigned char d_inode::i_gid

Definition at line 88 of file fs.h.

unsigned short d_inode::i_mode

Definition at line 84 of file fs.h.

unsigned char d_inode::i_nlinks

Definition at line 89 of file fs.h.

unsigned long d_inode::i_size

Definition at line 86 of file fs.h.

unsigned long d_inode::i_time

Definition at line 87 of file fs.h.

unsigned short d_inode::i_uid

Definition at line 85 of file fs.h.

unsigned short d_inode::i_zone[9]

Definition at line 90 of file fs.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: d_super_block Struct Reference

d_super_block Struct Reference

#include <fs.h>

Data Fields

unsigned short | s_ninodes
unsigned short | s_nzones
unsigned short | s_imap_blocks
unsigned short | s_zmap_blocks
unsigned short | s_firstdatazone
unsigned short | s_log_zone_size
unsigned long | s_max_size
unsigned short | s_magic

Field Documentation

unsigned short d_super_block::s_firstdatazone

Definition at line 151 of file fs.h.

unsigned short d_super_block::s_imap_blocks

Definition at line 149 of file fs.h.

unsigned short d_super_block::s_log_zone_size

Definition at line 152 of file fs.h.

unsigned short d_super_block::s_magic

Definition at line 154 of file fs.h.

unsigned long d_super_block::s_max_size

Definition at line 153 of file fs.h.

unsigned short d_super_block::s_ninodes

Definition at line 147 of file fs.h.

unsigned short d_super_block::s_nzones

Definition at line 148 of file fs.h.

unsigned short d_super_block::s_zmap_blocks

Definition at line 150 of file fs.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: desc_struct Struct Reference

desc_struct Struct Reference

#include <head.h>

Data Fields

unsigned long | a
unsigned long | b

Field Documentation

unsigned long desc_struct::a

Definition at line 5 of file head.h.

Referenced by sched_init().

unsigned long desc_struct::b

Definition at line 5 of file head.h.

Referenced by sched_init().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/head.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: dir_entry Struct Reference

dir_entry Struct Reference

#include <fs.h>

Data Fields

unsigned short | inode
char | name [NAME_LEN]

Field Documentation

unsigned short dir_entry::inode

Definition at line 158 of file fs.h.

Referenced by add_entry(), empty_dir(), get_dir(), namei(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_unlink().

char dir_entry::name[NAME_LEN]

Definition at line 159 of file fs.h.

Referenced by add_entry(), and sys_mkdir().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: div_t Struct Reference

div_t Struct Reference

#include <types.h>

Data Fields

int | quot
int | rem

Field Documentation

int div_t::quot

Definition at line 36 of file types.h.

int div_t::rem

Definition at line 36 of file types.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/sys/types.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: drive_info Struct Reference

drive_info Struct Reference

Data Fields

char dummy [32]

Field Documentation

char drive_info::dummy[32]

Definition at line 102 of file main.c.

The documentation for this struct was generated from the following file:
  • K:/Linux/init/main.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: exec Struct Reference

exec Struct Reference

#include <a.out.h>

Data Fields

unsigned long | a_magic
unsigned | a_text
unsigned | a_data
unsigned | a_bss
unsigned | a_syms
unsigned | a_entry
unsigned | a_trsize
unsigned | a_drsize

Field Documentation

unsigned exec::a_bss

Definition at line 10 of file a.out.h.

Referenced by do_execve().

unsigned exec::a_data

Definition at line 9 of file a.out.h.

Referenced by do_execve().

unsigned exec::a_drsize

Definition at line 14 of file a.out.h.

Referenced by do_execve().

unsigned exec::a_entry

Definition at line 12 of file a.out.h.

Referenced by do_execve().

unsigned long exec::a_magic

Definition at line 7 of file a.out.h.

unsigned exec::a_syms

Definition at line 11 of file a.out.h.

Referenced by do_execve().

unsigned exec::a_text

Definition at line 8 of file a.out.h.

Referenced by do_execve().

unsigned exec::a_trsize

Definition at line 13 of file a.out.h.

Referenced by do_execve().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/a.out.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: file Struct Reference

file Struct Reference

#include <fs.h>

Data Fields

unsigned short | f_mode
unsigned short | f_flags
unsigned short | f_count
m_inode * f_inode
off_t f_pos

Field Documentation

unsigned short file::f_count

Definition at line 119 of file fs.h.

Referenced by copy_process(), mount_root(), sys_close(), sys_open(), and sys_pipe().

unsigned short file::f_flags

Definition at line 118 of file fs.h.

Referenced by sys_fcntl(), and sys_open().

struct m_inode* file::f_inode

Definition at line 120 of file fs.h.

Referenced by sys_close(), sys_fstat(), sys_ioctl(), sys_lseek(), sys_open(), sys_pipe(), sys_read(), and sys_write().

unsigned short file::f_mode

Definition at line 117 of file fs.h.

Referenced by sys_open(), sys_pipe(), sys_read(), and sys_write().

off_t file::f_pos

Definition at line 121 of file fs.h.

Referenced by sys_lseek(), sys_open(), sys_pipe(), sys_read(), and sys_write().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: flock Struct Reference

flock Struct Reference

#include <fcntl.h>

Data Fields

short | l_type
short | l_whence
off_t l_start
off_t l_len
pid_t l_pid

Field Documentation

off_t flock::l_len

Definition at line 47 of file fcntl.h.

pid_t flock::l_pid

Definition at line 48 of file fcntl.h.

off_t flock::l_start

Definition at line 46 of file fcntl.h.

short flock::l_type

Definition at line 44 of file fcntl.h.

short flock::l_whence

Definition at line 45 of file fcntl.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/fcntl.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: floppy_struct Struct Reference

floppy_struct Struct Reference

Data Fields

unsigned int | size
unsigned int | sect
unsigned int | head
unsigned int | track
unsigned int | stretch
unsigned char | gap
unsigned char | rate
unsigned char | spec1

Field Documentation

unsigned char floppy_struct::gap

Definition at line 84 of file floppy.c.

Referenced by setup_rw_floppy().

unsigned int floppy_struct::head

Definition at line 83 of file floppy.c.

Referenced by do_fd_request().

unsigned char floppy_struct::rate

Definition at line 84 of file floppy.c.

Referenced by transfer().

unsigned int floppy_struct::sect

Definition at line 83 of file floppy.c.

Referenced by do_fd_request(), and setup_rw_floppy().

unsigned int floppy_struct::size

Definition at line 83 of file floppy.c.

Referenced by do_fd_request().

unsigned char floppy_struct::spec1

Definition at line 84 of file floppy.c.

Referenced by transfer().

unsigned int floppy_struct::stretch

Definition at line 83 of file floppy.c.

Referenced by do_fd_request().

unsigned int floppy_struct::track

Definition at line 83 of file floppy.c.

The documentation for this struct was generated from the following file:
  • K:/Linux/kernel/blk_drv/floppy.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: hd_i_struct Struct Reference

hd_i_struct Struct Reference

Data Fields

int | head
int | sect
int | cyl
int | wpcom
int | lzone
int | ctl

Field Documentation

int hd_i_struct::ctl

Definition at line 46 of file hd.c.

Referenced by sys_setup().

int hd_i_struct::cyl

Definition at line 46 of file hd.c.

Referenced by sys_setup().

int hd_i_struct::head

Definition at line 46 of file hd.c.

Referenced by sys_setup().

int hd_i_struct::lzone

Definition at line 46 of file hd.c.

Referenced by sys_setup().

int hd_i_struct::sect

Definition at line 46 of file hd.c.

Referenced by sys_setup().

int hd_i_struct::wpcom

Definition at line 46 of file hd.c.

Referenced by sys_setup().

The documentation for this struct was generated from the following file:
  • K:/Linux/kernel/blk_drv/hd.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: hd_struct Struct Reference

hd_struct Struct Reference

Data Fields

long | start_sect
long | nr_sects

Field Documentation

long hd_struct::nr_sects

Definition at line 58 of file hd.c.

long hd_struct::start_sect

Definition at line 57 of file hd.c.

The documentation for this struct was generated from the following file:
  • K:/Linux/kernel/blk_drv/hd.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: i387_struct Struct Reference

i387_struct Struct Reference

#include <sched.h>

Data Fields

long | cwd
long | swd
long | twd
long | fip
long | fcs
long | foo
long | fos
long | st_space [20]

Field Documentation

long i387_struct::cwd

Definition at line 43 of file sched.h.

long i387_struct::fcs

Definition at line 47 of file sched.h.

long i387_struct::fip

Definition at line 46 of file sched.h.

long i387_struct::foo

Definition at line 48 of file sched.h.

long i387_struct::fos

Definition at line 49 of file sched.h.

long i387_struct::st_space[20]

Definition at line 50 of file sched.h.

long i387_struct::swd

Definition at line 44 of file sched.h.

long i387_struct::twd

Definition at line 45 of file sched.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/sched.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: ldiv_t Struct Reference

ldiv_t Struct Reference

#include <types.h>

Data Fields

long | quot
long | rem

Field Documentation

long ldiv_t::quot

Definition at line 37 of file types.h.

long ldiv_t::rem

Definition at line 37 of file types.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/sys/types.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: m_inode Struct Reference

m_inode Struct Reference

#include <fs.h>

Data Fields

unsigned short | i_mode
unsigned short | i_uid
unsigned long | i_size
unsigned long | i_mtime
unsigned char | i_gid
unsigned char | i_nlinks
unsigned short | i_zone [9]
task_struct * i_wait
unsigned long | i_atime
unsigned long | i_ctime
unsigned short | i_dev
unsigned short | i_num
unsigned short | i_count
unsigned char | i_lock
unsigned char | i_dirt
unsigned char | i_pipe
unsigned char | i_mount
unsigned char | i_seek
unsigned char | i_update

Field Documentation

unsigned long m_inode::i_atime

Definition at line 103 of file fs.h.

Referenced by namei(), new_inode(), open_namei(), sys_mkdir(), sys_mknod(), and sys_utime().

unsigned short m_inode::i_count

Definition at line 107 of file fs.h.

Referenced by copy_process(), find_entry(), get_dir(), get_empty_inode(), get_pipe_inode(), iget(), invalidate_inodes(), mount_root(), new_inode(), share_page(), sys_mount(), sys_rmdir(), and sys_umount().

unsigned long m_inode::i_ctime

Definition at line 104 of file fs.h.

Referenced by _bmap(), new_inode(), sys_link(), sys_rmdir(), and sys_unlink().

unsigned short m_inode::i_dev

Definition at line 105 of file fs.h.

Referenced by do_execve(), do_no_page(), get_dir(), iget(), invalidate_inodes(), namei(), new_inode(), open_namei(), sys_link(), sys_lseek(), sys_mkdir(), sys_mknod(), sys_rmdir(), sys_umount(), and sys_unlink().

unsigned char m_inode::i_dirt

Definition at line 109 of file fs.h.

Referenced by _bmap(), get_empty_inode(), invalidate_inodes(), namei(), new_inode(), open_namei(), sync_inodes(), sys_chmod(), sys_chown(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), sys_rmdir(), sys_unlink(), and sys_utime().

unsigned char m_inode::i_gid

Definition at line 98 of file fs.h.

Referenced by do_execve(), new_inode(), sys_access(), and sys_chown().

unsigned char m_inode::i_lock

Definition at line 108 of file fs.h.

Referenced by get_empty_inode(), lock_inode(), and unlock_inode().

unsigned short m_inode::i_mode

Definition at line 94 of file fs.h.

Referenced by do_execve(), get_dir(), open_namei(), sys_access(), sys_chdir(), sys_chmod(), sys_chroot(), sys_ioctl(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), sys_open(), sys_read(), sys_rmdir(), sys_umount(), sys_unlink(), and sys_write().

unsigned char m_inode::i_mount

Definition at line 111 of file fs.h.

Referenced by iget(), sys_mount(), and sys_umount().

unsigned long m_inode::i_mtime

Definition at line 97 of file fs.h.

Referenced by new_inode(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_utime().

unsigned char m_inode::i_nlinks

Definition at line 99 of file fs.h.

Referenced by new_inode(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_rmdir(), and sys_unlink().

unsigned short m_inode::i_num

Definition at line 106 of file fs.h.

Referenced by iget(), new_inode(), open_namei(), sys_link(), sys_mkdir(), sys_mknod(), sys_mount(), and sys_unlink().

unsigned char m_inode::i_pipe

Definition at line 110 of file fs.h.

Referenced by get_pipe_inode(), sync_inodes(), sys_lseek(), sys_read(), and sys_write().

unsigned char m_inode::i_seek

Definition at line 112 of file fs.h.

unsigned long m_inode::i_size

Definition at line 96 of file fs.h.

Referenced by do_execve(), empty_dir(), get_pipe_inode(), sys_lseek(), sys_mkdir(), and sys_read().

unsigned short m_inode::i_uid

Definition at line 95 of file fs.h.

Referenced by do_execve(), new_inode(), open_namei(), sys_access(), sys_chmod(), sys_chown(), sys_rmdir(), and sys_unlink().

unsigned char m_inode::i_update

Definition at line 113 of file fs.h.

struct task_struct* m_inode::i_wait

Definition at line 102 of file fs.h.

unsigned short m_inode::i_zone[9]

Definition at line 100 of file fs.h.

Referenced by _bmap(), do_execve(), sys_ioctl(), sys_mkdir(), sys_mknod(), sys_mount(), sys_open(), sys_read(), sys_umount(), and sys_write().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: nlist Struct Reference

nlist Struct Reference

#include <a.out.h>

Data Fields

union {
char * n_name
nlist * n_next
long n_strx
} n_un
unsigned char | n_type
char | n_other
short | n_desc
unsigned long | n_value

Field Documentation

short nlist::n_desc

Definition at line 119 of file a.out.h.

char* nlist::n_name

Definition at line 113 of file a.out.h.

struct nlist* nlist::n_next

Definition at line 114 of file a.out.h.

char nlist::n_other

Definition at line 118 of file a.out.h.

long nlist::n_strx

Definition at line 115 of file a.out.h.

unsigned char nlist::n_type

Definition at line 117 of file a.out.h.

union { ... } nlist::n_un

unsigned long nlist::n_value

Definition at line 120 of file a.out.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/a.out.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: partition Struct Reference

partition Struct Reference

#include <hdreg.h>

Data Fields

unsigned char | boot_ind
unsigned char | head
unsigned char | sector
unsigned char | cyl
unsigned char | sys_ind
unsigned char | end_head
unsigned char | end_sector
unsigned char | end_cyl
unsigned int | start_sect
unsigned int | nr_sects

Field Documentation

unsigned char partition::boot_ind

Definition at line 53 of file hdreg.h.

unsigned char partition::cyl

Definition at line 56 of file hdreg.h.

unsigned char partition::end_cyl

Definition at line 60 of file hdreg.h.

unsigned char partition::end_head

Definition at line 58 of file hdreg.h.

unsigned char partition::end_sector

Definition at line 59 of file hdreg.h.

unsigned char partition::head

Definition at line 54 of file hdreg.h.

unsigned int partition::nr_sects

Definition at line 62 of file hdreg.h.

Referenced by sys_setup().

unsigned char partition::sector

Definition at line 55 of file hdreg.h.

Referenced by do_hd_request(), read_intr(), and write_intr().

unsigned int partition::start_sect

Definition at line 61 of file hdreg.h.

Referenced by do_hd_request(), and sys_setup().

unsigned char partition::sys_ind

Definition at line 57 of file hdreg.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/hdreg.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: relocation_info Struct Reference

relocation_info Struct Reference

#include <a.out.h>

Data Fields

int | r_address
unsigned int | r_symbolnum:24
unsigned int | r_pcrel:1
unsigned int | r_length:2
unsigned int | r_extern:1
unsigned int | r_pad:4

Field Documentation

int relocation_info::r_address

Definition at line 196 of file a.out.h.

unsigned int relocation_info::r_extern

Definition at line 212 of file a.out.h.

unsigned int relocation_info::r_length

Definition at line 205 of file a.out.h.

unsigned int relocation_info::r_pad

Definition at line 215 of file a.out.h.

unsigned int relocation_info::r_pcrel

Definition at line 202 of file a.out.h.

unsigned int relocation_info::r_symbolnum

Definition at line 198 of file a.out.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/a.out.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: request Struct Reference

request Struct Reference

#include <blk.h>

Data Fields

int | dev
int | cmd
int | errors
unsigned long | sector
unsigned long | nr_sectors
char * | buffer
task_struct * waiting
buffer_head * bh
request * next

Field Documentation

struct buffer_head* request::bh

Definition at line 31 of file blk.h.

Referenced by add_request(), and make_request().

char* request::buffer

Definition at line 29 of file blk.h.

Referenced by make_request().

int request::cmd

Definition at line 25 of file blk.h.

Referenced by make_request().

int request::dev

Definition at line 24 of file blk.h.

Referenced by blk_dev_init(), and make_request().

int request::errors

Definition at line 26 of file blk.h.

Referenced by make_request().

struct request* request::next

Definition at line 32 of file blk.h.

Referenced by add_request(), blk_dev_init(), and make_request().

unsigned long request::nr_sectors

Definition at line 28 of file blk.h.

Referenced by make_request().

unsigned long request::sector

Definition at line 27 of file blk.h.

Referenced by make_request().

struct task_struct* request::waiting

Definition at line 30 of file blk.h.

Referenced by make_request().

The documentation for this struct was generated from the following file:
  • K:/Linux/kernel/blk_drv/blk.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: sigaction Struct Reference

sigaction Struct Reference

#include <signal.h>

Data Fields

void(* | sa_handler )(int)
sigset_t sa_mask
int | sa_flags
void(* | sa_restorer )(void)

Field Documentation

int sigaction::sa_flags

Definition at line 51 of file signal.h.

Referenced by do_signal(), sys_sigaction(), and sys_signal().

void(* sigaction::sa_handler)(int)

Referenced by do_execve(), do_signal(), and sys_signal().

sigset_t sigaction::sa_mask

Definition at line 50 of file signal.h.

Referenced by do_signal(), sys_sigaction(), and sys_signal().

void(* sigaction::sa_restorer)(void)

Referenced by do_signal(), and sys_signal().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/signal.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: stat Struct Reference

stat Struct Reference

#include <stat.h>

Data Fields

dev_t st_dev
ino_t st_ino
umode_t st_mode
nlink_t st_nlink
uid_t st_uid
gid_t st_gid
dev_t st_rdev
off_t st_size
time_t st_atime
time_t st_mtime
time_t st_ctime

Field Documentation

time_t stat::st_atime

Definition at line 15 of file stat.h.

Referenced by cp_stat().

time_t stat::st_ctime

Definition at line 17 of file stat.h.

Referenced by cp_stat().

dev_t stat::st_dev

Definition at line 7 of file stat.h.

Referenced by cp_stat().

gid_t stat::st_gid

Definition at line 12 of file stat.h.

Referenced by cp_stat().

ino_t stat::st_ino

Definition at line 8 of file stat.h.

Referenced by cp_stat().

umode_t stat::st_mode

Definition at line 9 of file stat.h.

Referenced by cp_stat().

time_t stat::st_mtime

Definition at line 16 of file stat.h.

Referenced by cp_stat().

nlink_t stat::st_nlink

Definition at line 10 of file stat.h.

Referenced by cp_stat().

dev_t stat::st_rdev

Definition at line 13 of file stat.h.

Referenced by cp_stat(), and main().

off_t stat::st_size

Definition at line 14 of file stat.h.

Referenced by cp_stat().

uid_t stat::st_uid

Definition at line 11 of file stat.h.

Referenced by cp_stat().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/sys/stat.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: super_block Struct Reference

super_block Struct Reference

#include <fs.h>

Data Fields

unsigned short | s_ninodes
unsigned short | s_nzones
unsigned short | s_imap_blocks
unsigned short | s_zmap_blocks
unsigned short | s_firstdatazone
unsigned short | s_log_zone_size
unsigned long | s_max_size
unsigned short | s_magic
buffer_head * | s_imap [8]
buffer_head * | s_zmap [8]
unsigned short | s_dev
m_inode * s_isup
m_inode * s_imount
unsigned long | s_time
task_struct * s_wait
unsigned char | s_lock
unsigned char | s_rd_only
unsigned char | s_dirt

Field Documentation

unsigned short super_block::s_dev

Definition at line 136 of file fs.h.

Referenced by get_super(), mount_root(), put_super(), and read_super().

unsigned char super_block::s_dirt

Definition at line 143 of file fs.h.

Referenced by read_super().

unsigned short super_block::s_firstdatazone

Definition at line 129 of file fs.h.

Referenced by free_block(), and new_block().

struct buffer_head* super_block::s_imap[8]

Definition at line 134 of file fs.h.

Referenced by free_inode(), mount_root(), new_inode(), put_super(), and read_super().

unsigned short super_block::s_imap_blocks

Definition at line 127 of file fs.h.

Referenced by read_inode(), read_super(), and write_inode().

struct m_inode* super_block::s_imount

Definition at line 138 of file fs.h.

Referenced by find_entry(), mount_root(), put_super(), read_super(), sys_mount(), and sys_umount().

struct m_inode* super_block::s_isup

Definition at line 137 of file fs.h.

Referenced by mount_root(), read_super(), and sys_umount().

unsigned char super_block::s_lock

Definition at line 141 of file fs.h.

Referenced by free_super(), lock_super(), and mount_root().

unsigned short super_block::s_log_zone_size

Definition at line 130 of file fs.h.

Referenced by rd_load().

unsigned short super_block::s_magic

Definition at line 132 of file fs.h.

Referenced by rd_load(), and read_super().

unsigned long super_block::s_max_size

Definition at line 131 of file fs.h.

unsigned short super_block::s_ninodes

Definition at line 125 of file fs.h.

Referenced by free_inode(), mount_root(), and new_inode().

unsigned short super_block::s_nzones

Definition at line 126 of file fs.h.

Referenced by free_block(), mount_root(), new_block(), and rd_load().

unsigned char super_block::s_rd_only

Definition at line 142 of file fs.h.

Referenced by read_super().

unsigned long super_block::s_time

Definition at line 139 of file fs.h.

Referenced by read_super().

struct task_struct* super_block::s_wait

Definition at line 140 of file fs.h.

Referenced by mount_root().

struct buffer_head* super_block::s_zmap[8]

Definition at line 135 of file fs.h.

Referenced by free_block(), mount_root(), new_block(), put_super(), and read_super().

unsigned short super_block::s_zmap_blocks

Definition at line 128 of file fs.h.

Referenced by read_inode(), read_super(), and write_inode().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/fs.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: task_struct Struct Reference

task_struct Struct Reference

#include <sched.h>

Data Fields

long | state
long | counter
long | priority
long | signal
sigaction | sigaction [32]
long | blocked
int | exit_code
unsigned long | start_code
unsigned long | end_code
unsigned long | end_data
unsigned long | brk
unsigned long | start_stack
long | pid
long | father
long | pgrp
long | session
long | leader
unsigned short | uid
unsigned short | euid
unsigned short | suid
unsigned short | gid
unsigned short | egid
unsigned short | sgid
long | alarm
long | utime
long | stime
long | cutime
long | cstime
long | start_time
unsigned short | used_math
int | tty
unsigned short | umask
m_inode * pwd
m_inode * root
m_inode * executable
unsigned long | close_on_exec
file * | filp [NR_OPEN]
desc_struct | ldt [3]
tss_struct tss

Field Documentation

long task_struct::alarm

Definition at line 94 of file sched.h.

Referenced by copy_process(), schedule(), sys_alarm(), and tty_read().

long task_struct::blocked

Definition at line 87 of file sched.h.

Referenced by do_signal(), sys_sgetmask(), and sys_ssetmask().

unsigned long task_struct::brk

Definition at line 90 of file sched.h.

Referenced by do_execve(), and sys_brk().

unsigned long task_struct::close_on_exec

Definition at line 103 of file sched.h.

Referenced by do_execve(), dupfd(), sys_close(), sys_fcntl(), and sys_open().

long task_struct::counter

Definition at line 83 of file sched.h.

Referenced by copy_process(), do_timer(), and schedule().

long task_struct::cstime

Definition at line 95 of file sched.h.

Referenced by copy_process(), sys_times(), and sys_waitpid().

long task_struct::cutime

Definition at line 95 of file sched.h.

Referenced by copy_process(), sys_times(), and sys_waitpid().

unsigned short task_struct::egid

Definition at line 93 of file sched.h.

Referenced by do_execve(), new_inode(), permission(), sys_getegid(), and sys_setregid().

unsigned long task_struct::end_code

Definition at line 90 of file sched.h.

Referenced by do_execve(), and sys_brk().

unsigned long task_struct::end_data

Definition at line 90 of file sched.h.

Referenced by do_execve(), and do_no_page().

unsigned short task_struct::euid

Definition at line 92 of file sched.h.

Referenced by do_execve(), new_inode(), open_namei(), permission(), send_sig(), sys_chmod(), sys_geteuid(), sys_rmdir(), sys_setreuid(), and sys_unlink().

struct m_inode* task_struct::executable

Definition at line 102 of file sched.h.

Referenced by copy_process(), do_execve(), do_exit(), do_no_page(), and share_page().

int task_struct::exit_code

Definition at line 89 of file sched.h.

Referenced by do_exit(), and sys_waitpid().

long task_struct::father

Definition at line 91 of file sched.h.

Referenced by copy_process(), do_exit(), and sys_getppid().

struct file* task_struct::filp[NR_OPEN]

Definition at line 104 of file sched.h.

Referenced by copy_process(), do_exit(), dupfd(), sys_close(), sys_fcntl(), sys_fstat(), sys_ioctl(), sys_lseek(), sys_open(), and sys_pipe().

unsigned short task_struct::gid

Definition at line 93 of file sched.h.

Referenced by sys_access(), sys_getgid(), and sys_setregid().

struct desc_struct task_struct::ldt[3]

Definition at line 106 of file sched.h.

Referenced by change_ldt(), copy_mem(), copy_process(), die(), do_execve(), do_exit(), sched_init(), and verify_area().

long task_struct::leader

Definition at line 91 of file sched.h.

Referenced by copy_process(), do_exit(), sys_open(), and sys_setsid().

long task_struct::pgrp

Definition at line 91 of file sched.h.

Referenced by sys_getpgrp(), sys_kill(), sys_open(), sys_setpgid(), sys_setsid(), sys_waitpid(), and tty_intr().

long task_struct::pid

Definition at line 91 of file sched.h.

Referenced by copy_process(), die(), do_exit(), sys_getpid(), sys_kill(), sys_setpgid(), sys_setsid(), and sys_waitpid().

long task_struct::priority

Definition at line 84 of file sched.h.

Referenced by copy_process(), schedule(), and sys_nice().

struct m_inode* task_struct::pwd

Definition at line 100 of file sched.h.

Referenced by copy_process(), do_exit(), get_dir(), mount_root(), and sys_chdir().

struct m_inode* task_struct::root

Definition at line 101 of file sched.h.

Referenced by copy_process(), do_exit(), find_entry(), get_dir(), mount_root(), and sys_chroot().

long task_struct::session

Definition at line 91 of file sched.h.

Referenced by kill_session(), sys_setpgid(), and sys_setsid().

unsigned short task_struct::sgid

Definition at line 93 of file sched.h.

Referenced by sys_setregid().

struct sigaction task_struct::sigaction[32]

Definition at line 86 of file sched.h.

Referenced by do_execve(), do_signal(), sys_sigaction(), and sys_signal().

long task_struct::signal

Definition at line 85 of file sched.h.

Referenced by copy_process(), kill_session(), math_emulate(), math_error(), schedule(), send_sig(), sleep_if_empty(), sleep_if_full(), sys_waitpid(), tell_father(), tty_intr(), tty_read(), tty_write(), and write_pipe().

unsigned long task_struct::start_code

Definition at line 90 of file sched.h.

Referenced by do_no_page(), and try_to_share().

unsigned long task_struct::start_stack

Definition at line 90 of file sched.h.

Referenced by do_execve().

long task_struct::start_time

Definition at line 95 of file sched.h.

Referenced by copy_process().

long task_struct::state

Definition at line 82 of file sched.h.

Referenced by copy_process(), do_exit(), interruptible_sleep_on(), schedule(), sleep_on(), sys_pause(), sys_waitpid(), and wake_up().

long task_struct::stime

Definition at line 95 of file sched.h.

Referenced by copy_process(), do_timer(), sys_times(), and sys_waitpid().

unsigned short task_struct::suid

Definition at line 92 of file sched.h.

struct tss_struct task_struct::tss

Definition at line 108 of file sched.h.

Referenced by copy_process(), math_state_restore(), and sched_init().

int task_struct::tty

Definition at line 98 of file sched.h.

Referenced by do_exit(), rw_tty(), sys_open(), sys_setsid(), and tty_ioctl().

unsigned short task_struct::uid

Definition at line 92 of file sched.h.

Referenced by sys_access(), sys_getuid(), and sys_setreuid().

unsigned short task_struct::umask

Definition at line 99 of file sched.h.

Referenced by open_namei(), sys_mkdir(), sys_open(), and sys_umask().

unsigned short task_struct::used_math

Definition at line 96 of file sched.h.

Referenced by do_execve(), and math_state_restore().

long task_struct::utime

Definition at line 95 of file sched.h.

Referenced by copy_process(), do_timer(), sys_times(), and sys_waitpid().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/sched.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: task_union Union Reference

task_union Union Reference

Data Fields

task_struct task
char stack [PAGE_SIZE]

Field Documentation

char task_union::stack[PAGE_SIZE]

Definition at line 55 of file sched.c.

struct task_struct task_union::task

Definition at line 54 of file sched.c.

Referenced by interruptible_sleep_on(), sched_init(), and sleep_on().

The documentation for this union was generated from the following file:
  • K:/Linux/kernel/sched.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: termio Struct Reference

termio Struct Reference

#include <termios.h>

Data Fields

unsigned short | c_iflag
unsigned short | c_oflag
unsigned short | c_cflag
unsigned short | c_lflag
unsigned char | c_line
unsigned char | c_cc [NCC]

Field Documentation

unsigned char termio::c_cc[NCC]

Definition at line 50 of file termios.h.

Referenced by get_termio(), and set_termio().

unsigned short termio::c_cflag

Definition at line 47 of file termios.h.

Referenced by get_termio(), and set_termio().

unsigned short termio::c_iflag

Definition at line 45 of file termios.h.

Referenced by get_termio(), and set_termio().

unsigned short termio::c_lflag

Definition at line 48 of file termios.h.

Referenced by get_termio(), and set_termio().

unsigned char termio::c_line

Definition at line 49 of file termios.h.

Referenced by get_termio(), and set_termio().

unsigned short termio::c_oflag

Definition at line 46 of file termios.h.

Referenced by get_termio(), and set_termio().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/termios.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: termios Struct Reference

termios Struct Reference

#include <termios.h>

Data Fields

unsigned long | c_iflag
unsigned long | c_oflag
unsigned long | c_cflag
unsigned long | c_lflag
unsigned char | c_line
unsigned char | c_cc [NCCS]

Field Documentation

unsigned char termios::c_cc[NCCS]

Definition at line 60 of file termios.h.

Referenced by tty_read().

unsigned long termios::c_cflag

Definition at line 57 of file termios.h.

unsigned long termios::c_iflag

Definition at line 55 of file termios.h.

unsigned long termios::c_lflag

Definition at line 58 of file termios.h.

unsigned char termios::c_line

Definition at line 59 of file termios.h.

unsigned long termios::c_oflag

Definition at line 56 of file termios.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/termios.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: timer_list Struct Reference

timer_list Struct Reference

Data Fields

long | jiffies
void(* | fn )()
timer_list * next

Field Documentation

void(* timer_list::fn)()

Referenced by add_timer(), and do_timer().

long timer_list::jiffies

Definition at line 267 of file sched.c.

Referenced by add_timer(), and do_timer().

struct timer_list* timer_list::next

Definition at line 269 of file sched.c.

Referenced by add_timer(), and do_timer().

The documentation for this struct was generated from the following file:
  • K:/Linux/kernel/sched.c
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: tm Struct Reference

tm Struct Reference

#include <time.h>

Data Fields

int | tm_sec
int | tm_min
int | tm_hour
int | tm_mday
int | tm_mon
int | tm_year
int | tm_wday
int | tm_yday
int | tm_isdst

Field Documentation

int tm::tm_hour

Definition at line 21 of file time.h.

int tm::tm_isdst

Definition at line 27 of file time.h.

int tm::tm_mday

Definition at line 22 of file time.h.

int tm::tm_min

Definition at line 20 of file time.h.

int tm::tm_mon

Definition at line 23 of file time.h.

int tm::tm_sec

Definition at line 19 of file time.h.

int tm::tm_wday

Definition at line 25 of file time.h.

int tm::tm_yday

Definition at line 26 of file time.h.

int tm::tm_year

Definition at line 24 of file time.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/time.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: tms Struct Reference

tms Struct Reference

#include <times.h>

Data Fields

time_t tms_utime
time_t tms_stime
time_t tms_cutime
time_t tms_cstime

Field Documentation

time_t tms::tms_cstime

Definition at line 10 of file times.h.

time_t tms::tms_cutime

Definition at line 9 of file times.h.

time_t tms::tms_stime

Definition at line 8 of file times.h.

time_t tms::tms_utime

Definition at line 7 of file times.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/sys/times.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: tss_struct Struct Reference

tss_struct Struct Reference

#include <sched.h>

Data Fields

long | back_link
long | esp0
long | ss0
long | esp1
long | ss1
long | esp2
long | ss2
long | cr3
long | eip
long | eflags
long | eax
long | ecx
long | edx
long | ebx
long | esp
long | ebp
long | esi
long | edi
long | es
long | cs
long | ss
long | ds
long | fs
long | gs
long | ldt
long | trace_bitmap
i387_struct i387

Field Documentation

long tss_struct::back_link

Definition at line 54 of file sched.h.

Referenced by copy_process().

long tss_struct::cr3

Definition at line 61 of file sched.h.

long tss_struct::cs

Definition at line 70 of file sched.h.

Referenced by copy_process().

long tss_struct::ds

Definition at line 72 of file sched.h.

Referenced by copy_process().

long tss_struct::eax

Definition at line 64 of file sched.h.

Referenced by copy_process().

long tss_struct::ebp

Definition at line 66 of file sched.h.

Referenced by copy_process().

long tss_struct::ebx

Definition at line 64 of file sched.h.

Referenced by copy_process().

long tss_struct::ecx

Definition at line 64 of file sched.h.

Referenced by copy_process().

long tss_struct::edi

Definition at line 68 of file sched.h.

Referenced by copy_process().

long tss_struct::edx

Definition at line 64 of file sched.h.

Referenced by copy_process().

long tss_struct::eflags

Definition at line 63 of file sched.h.

Referenced by copy_process().

long tss_struct::eip

Definition at line 62 of file sched.h.

Referenced by copy_process().

long tss_struct::es

Definition at line 69 of file sched.h.

Referenced by copy_process().

long tss_struct::esi

Definition at line 67 of file sched.h.

Referenced by copy_process().

long tss_struct::esp

Definition at line 65 of file sched.h.

Referenced by copy_process().

long tss_struct::esp0

Definition at line 55 of file sched.h.

Referenced by copy_process().

long tss_struct::esp1

Definition at line 57 of file sched.h.

long tss_struct::esp2

Definition at line 59 of file sched.h.

long tss_struct::fs

Definition at line 73 of file sched.h.

Referenced by copy_process().

long tss_struct::gs

Definition at line 74 of file sched.h.

Referenced by copy_process().

struct i387_struct tss_struct::i387

Definition at line 77 of file sched.h.

Referenced by copy_process(), and math_state_restore().

long tss_struct::ldt

Definition at line 75 of file sched.h.

Referenced by copy_process().

long tss_struct::ss

Definition at line 71 of file sched.h.

Referenced by copy_process().

long tss_struct::ss0

Definition at line 56 of file sched.h.

Referenced by copy_process().

long tss_struct::ss1

Definition at line 58 of file sched.h.

long tss_struct::ss2

Definition at line 60 of file sched.h.

long tss_struct::trace_bitmap

Definition at line 76 of file sched.h.

Referenced by copy_process().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/sched.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: tty_queue Struct Reference

tty_queue Struct Reference

#include <tty.h>

Data Fields

unsigned long | data
unsigned long | head
unsigned long | tail
task_struct * proc_list
char | buf [TTY_BUF_SIZE]

Field Documentation

char tty_queue::buf[TTY_BUF_SIZE]

Definition at line 21 of file tty.h.

unsigned long tty_queue::data

Definition at line 17 of file tty.h.

Referenced by tty_read().

unsigned long tty_queue::head

Definition at line 18 of file tty.h.

struct task_struct* tty_queue::proc_list

Definition at line 20 of file tty.h.

unsigned long tty_queue::tail

Definition at line 19 of file tty.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/tty.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: tty_struct Struct Reference

tty_struct Struct Reference

#include <tty.h>

Data Fields

termios termios
int | pgrp
int | stopped
void(* | write )(struct tty_struct *tty)
tty_queue read_q
tty_queue write_q
tty_queue secondary

Field Documentation

int tty_struct::pgrp

Definition at line 47 of file tty.h.

Referenced by do_exit(), sys_open(), and tty_ioctl().

struct tty_queue tty_struct::read_q

Definition at line 50 of file tty.h.

Referenced by tty_ioctl().

struct tty_queue tty_struct::secondary

Definition at line 52 of file tty.h.

Referenced by tty_ioctl(), and tty_read().

int tty_struct::stopped

Definition at line 48 of file tty.h.

struct termios tty_struct::termios

Definition at line 46 of file tty.h.

Referenced by tty_read().

void(* tty_struct::write)(struct tty_struct *tty)

Referenced by tty_write().

struct tty_queue tty_struct::write_q

Definition at line 51 of file tty.h.

Referenced by tty_ioctl(), and tty_write().

The documentation for this struct was generated from the following file:
  • K:/Linux/include/linux/tty.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: ustat Struct Reference

ustat Struct Reference

#include <types.h>

Data Fields

daddr_t f_tfree
ino_t f_tinode
char | f_fname [6]
char | f_fpack [6]

Field Documentation

char ustat::f_fname[6]

Definition at line 42 of file types.h.

char ustat::f_fpack[6]

Definition at line 43 of file types.h.

daddr_t ustat::f_tfree

Definition at line 40 of file types.h.

ino_t ustat::f_tinode

Definition at line 41 of file types.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/sys/types.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: utimbuf Struct Reference

utimbuf Struct Reference

#include <utime.h>

Data Fields

time_t actime
time_t modtime

Field Documentation

time_t utimbuf::actime

Definition at line 7 of file utime.h.

time_t utimbuf::modtime

Definition at line 8 of file utime.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/utime.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: utsname Struct Reference

utsname Struct Reference

#include <utsname.h>

Data Fields

char | sysname [9]
char | nodename [9]
char | release [9]
char | version [9]
char | machine [9]

Field Documentation

char utsname::machine[9]

Definition at line 11 of file utsname.h.

char utsname::nodename[9]

Definition at line 8 of file utsname.h.

char utsname::release[9]

Definition at line 9 of file utsname.h.

char utsname::sysname[9]

Definition at line 7 of file utsname.h.

char utsname::version[9]

Definition at line 10 of file utsname.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/sys/utsname.h
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: winsize Struct Reference

winsize Struct Reference

#include <termios.h>

Data Fields

unsigned short | ws_row
unsigned short | ws_col
unsigned short | ws_xpixel
unsigned short | ws_ypixel

Field Documentation

unsigned short winsize::ws_col

Definition at line 38 of file termios.h.

unsigned short winsize::ws_row

Definition at line 37 of file termios.h.

unsigned short winsize::ws_xpixel

Definition at line 39 of file termios.h.

unsigned short winsize::ws_ypixel

Definition at line 40 of file termios.h.

The documentation for this struct was generated from the following file:
  • K:/Linux/include/termios.h
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Data Fields

Here is a list of all struct and union fields with links to the structures/unions they belong to:

- a -

  • a : desc_struct
  • a_bss : exec
  • a_data : exec
  • a_drsize : exec
  • a_entry : exec
  • a_magic : exec
  • a_syms : exec
  • a_text : exec
  • a_trsize : exec
  • actime : utimbuf
  • alarm : task_struct

- b -

  • b : desc_struct
  • b_blocknr : buffer_head
  • b_count : buffer_head
  • b_data : buffer_head
  • b_dev : buffer_head
  • b_dirt : buffer_head
  • b_lock : buffer_head
  • b_next : buffer_head
  • b_next_free : buffer_head
  • b_prev : buffer_head
  • b_prev_free : buffer_head
  • b_uptodate : buffer_head
  • b_wait : buffer_head
  • back_link : tss_struct
  • bh : request
  • blocked : task_struct
  • boot_ind : partition
  • brk : task_struct
  • bucket_size : bucket_desc
  • buf : tty_queue
  • buffer : request

- c -

  • c_cc : termios, termio
  • c_cflag : termios, termio
  • c_iflag : termios, termio
  • c_lflag : termios, termio
  • c_line : termios, termio
  • c_oflag : termios, termio
  • chain : _bucket_dir
  • close_on_exec : task_struct
  • cmd : request
  • counter : task_struct
  • cr3 : tss_struct
  • cs : tss_struct
  • cstime : task_struct
  • ctl : hd_i_struct
  • current_request : blk_dev_struct
  • cutime : task_struct
  • cwd : i387_struct
  • cyl : hd_i_struct, partition

- d -

  • data : tty_queue
  • dev : request
  • ds : tss_struct
  • dummy : drive_info

- e -

  • eax : tss_struct
  • ebp : tss_struct
  • ebx : tss_struct
  • ecx : tss_struct
  • edi : tss_struct
  • edx : tss_struct
  • eflags : tss_struct
  • egid : task_struct
  • eip : tss_struct
  • end_code : task_struct
  • end_cyl : partition
  • end_data : task_struct
  • end_head : partition
  • end_sector : partition
  • errors : request
  • es : tss_struct
  • esi : tss_struct
  • esp : tss_struct
  • esp0 : tss_struct
  • esp1 : tss_struct
  • esp2 : tss_struct
  • euid : task_struct
  • executable : task_struct
  • exit_code : task_struct

- f -

  • f_count : file
  • f_flags : file
  • f_fname : ustat
  • f_fpack : ustat
  • f_inode : file
  • f_mode : file
  • f_pos : file
  • f_tfree : ustat
  • f_tinode : ustat
  • father : task_struct
  • fcs : i387_struct
  • filp : task_struct
  • fip : i387_struct
  • fn : timer_list
  • foo : i387_struct
  • fos : i387_struct
  • freeptr : bucket_desc
  • fs : tss_struct

- g -

  • gap : floppy_struct
  • gid : task_struct
  • gs : tss_struct

- h -

  • head : hd_i_struct, floppy_struct, tty_queue, partition

- i -

  • i387 : tss_struct
  • i_atime : m_inode
  • i_count : m_inode
  • i_ctime : m_inode
  • i_dev : m_inode
  • i_dirt : m_inode
  • i_gid : m_inode, d_inode
  • i_lock : m_inode
  • i_mode : m_inode, d_inode
  • i_mount : m_inode
  • i_mtime : m_inode
  • i_nlinks : m_inode, d_inode
  • i_num : m_inode
  • i_pipe : m_inode
  • i_seek : m_inode
  • i_size : m_inode, d_inode
  • i_time : d_inode
  • i_uid : m_inode, d_inode
  • i_update : m_inode
  • i_wait : m_inode
  • i_zone : m_inode, d_inode
  • inode : dir_entry

- j -

  • jiffies : timer_list

- l -

  • l_len : flock
  • l_pid : flock
  • l_start : flock
  • l_type : flock
  • l_whence : flock
  • ldt : task_struct, tss_struct
  • leader : task_struct
  • lzone : hd_i_struct

- m -

  • machine : utsname
  • modtime : utimbuf

- n -

  • n_desc : nlist
  • n_name : nlist
  • n_next : nlist
  • n_other : nlist
  • n_strx : nlist
  • n_type : nlist
  • n_un : nlist
  • n_value : nlist
  • name : dir_entry
  • next : bucket_desc, timer_list, request
  • nodename : utsname
  • nr_sectors : request
  • nr_sects : hd_struct, partition

- p -

  • page : bucket_desc
  • pgrp : tty_struct, task_struct
  • pid : task_struct
  • priority : task_struct
  • proc_list : tty_queue
  • pwd : task_struct

- q -

  • quot : ldiv_t, div_t

- r -

  • r_address : relocation_info
  • r_extern : relocation_info
  • r_length : relocation_info
  • r_pad : relocation_info
  • r_pcrel : relocation_info
  • r_symbolnum : relocation_info
  • rate : floppy_struct
  • read_q : tty_struct
  • refcnt : bucket_desc
  • release : utsname
  • rem : ldiv_t, div_t
  • request_fn : blk_dev_struct
  • root : task_struct

- s -

  • s_dev : super_block
  • s_dirt : super_block
  • s_firstdatazone : d_super_block, super_block
  • s_imap : super_block
  • s_imap_blocks : d_super_block, super_block
  • s_imount : super_block
  • s_isup : super_block
  • s_lock : super_block
  • s_log_zone_size : d_super_block, super_block
  • s_magic : d_super_block, super_block
  • s_max_size : d_super_block, super_block
  • s_ninodes : d_super_block, super_block
  • s_nzones : d_super_block, super_block
  • s_rd_only : super_block
  • s_time : super_block
  • s_wait : super_block
  • s_zmap : super_block
  • s_zmap_blocks : d_super_block, super_block
  • sa_flags : sigaction
  • sa_handler : sigaction
  • sa_mask : sigaction
  • sa_restorer : sigaction
  • secondary : tty_struct
  • sect : hd_i_struct, floppy_struct
  • sector : request, partition
  • session : task_struct
  • sgid : task_struct
  • sigaction : task_struct
  • signal : task_struct
  • size : _bucket_dir, floppy_struct
  • spec1 : floppy_struct
  • ss : tss_struct
  • ss0 : tss_struct
  • ss1 : tss_struct
  • ss2 : tss_struct
  • st_atime : stat
  • st_ctime : stat
  • st_dev : stat
  • st_gid : stat
  • st_ino : stat
  • st_mode : stat
  • st_mtime : stat
  • st_nlink : stat
  • st_rdev : stat
  • st_size : stat
  • st_space : i387_struct
  • st_uid : stat
  • stack : task_union
  • start_code : task_struct
  • start_sect : hd_struct, partition
  • start_stack : task_struct
  • start_time : task_struct
  • state : task_struct
  • stime : task_struct
  • stopped : tty_struct
  • stretch : floppy_struct
  • suid : task_struct
  • swd : i387_struct
  • sys_ind : partition
  • sysname : utsname

- t -

  • tail : tty_queue
  • task : task_union
  • termios : tty_struct
  • tm_hour : tm
  • tm_isdst : tm
  • tm_mday : tm
  • tm_min : tm
  • tm_mon : tm
  • tm_sec : tm
  • tm_wday : tm
  • tm_yday : tm
  • tm_year : tm
  • tms_cstime : tms
  • tms_cutime : tms
  • tms_stime : tms
  • tms_utime : tms
  • trace_bitmap : tss_struct
  • track : floppy_struct
  • tss : task_struct
  • tty : task_struct
  • twd : i387_struct

- u -

  • uid : task_struct
  • umask : task_struct
  • used_math : task_struct
  • utime : task_struct

- v -

  • version : utsname

- w -

  • waiting : request
  • wpcom : hd_i_struct
  • write : tty_struct
  • write_q : tty_struct
  • ws_col : winsize
  • ws_row : winsize
  • ws_xpixel : winsize
  • ws_ypixel : winsize
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Directory Hierarchy

Linux Source v0.11 Directories

This directory hierarchy is sorted roughly, but not completely, alphabetically:
  • K:
    • Linux
      • fs
      • include
        • asm
        • linux
        • sys
      • init
      • kernel
        • blk_drv
        • chr_drv
        • math
      • lib
      • mm
      • tools
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/ Directory Reference

K:

K: Directory Reference

Directories

directory Linux
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/ Directory Reference

Linux Directory Reference

Directories

directory | fs
directory | include
directory | init
directory | kernel
directory | lib
directory | mm
directory | tools
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/ Directory Reference

fs Directory Reference

Files

file | bitmap.c [code]
file | block_dev.c [code]
file | buffer.c [code]
file | char_dev.c [code]
file | exec.c [code]
file | fcntl.c [code]
file | file_dev.c [code]
file | file_table.c [code]
file | inode.c [code]
file | ioctl.c [code]
file | namei.c [code]
file | open.c [code]
file | pipe.c [code]
file | read_write.c [code]
file | stat.c [code]
file | super.c [code]
file | truncate.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/ Directory Reference

include Directory Reference

Directories

directory | asm
directory | linux
directory | sys

Files

file | a.out.h [code]
file | const.h [code]
file | ctype.h [code]
file | errno.h [code]
file | fcntl.h [code]
file | signal.h [code]
file | stdarg.h [code]
file | stddef.h [code]
file | string.h [code]
file | termios.h [code]
file | time.h [code]
file | unistd.h [code]
file | utime.h [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/ Directory Reference

asm Directory Reference

Files

file | io.h [code]
file | memory.h [code]
file | segment.h [code]
file | system.h [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/ Directory Reference

linux Directory Reference

Files

file | config.h [code]
file | fdreg.h [code]
file | fs.h [code]
file | hdreg.h [code]
file | head.h [code]
file | kernel.h [code]
file | mm.h [code]
file | sched.h [code]
file | sys.h [code]
file | tty.h [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/ Directory Reference

sys Directory Reference

Files

file | stat.h [code]
file | times.h [code]
file | types.h [code]
file | utsname.h [code]
file | wait.h [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/init/ Directory Reference

init Directory Reference

Files

file main.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/ Directory Reference

kernel Directory Reference

Directories

directory | blk_drv
directory | chr_drv
directory | math

Files

file | exit.c [code]
file | fork.c [code]
file | mktime.c [code]
file | panic.c [code]
file | printk.c [code]
file | sched.c [code]
file | signal.c [code]
file | sys.c [code]
file | traps.c [code]
file | vsprintf.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/ Directory Reference

blk_drv Directory Reference

Files

file | blk.h [code]
file | floppy.c [code]
file | hd.c [code]
file | ll_rw_blk.c [code]
file | ramdisk.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/ Directory Reference

chr_drv Directory Reference

Files

file | console.c [code]
file | serial.c [code]
file | tty_io.c [code]
file | tty_ioctl.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/math/ Directory Reference

math Directory Reference

Files

file math_emulate.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/ Directory Reference

lib Directory Reference

Files

file | _exit.c [code]
file | close.c [code]
file | ctype.c [code]
file | dup.c [code]
file | errno.c [code]
file | execve.c [code]
file | malloc.c [code]
file | open.c [code]
file | setsid.c [code]
file | string.c [code]
file | wait.c [code]
file | write.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/mm/ Directory Reference

mm Directory Reference

Files

file memory.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/tools/ Directory Reference

tools Directory Reference

Files

file build.c [code]
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Globals

Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:

- _ -

  • ___strtok : string.h
  • __GNU_EXEC_MACROS__ : a.out.h
  • __LIBRARY__ : write.c, wait.c, string.c, setsid.c, open.c, execve.c, dup.c, close.c, _exit.c, main.c
  • __va_rounded_size : stdarg.h
  • _BLOCKABLE : sched.c
  • _bmap() : inode.c
  • _C : ctype.h
  • _ctmp : ctype.c, ctype.h
  • _ctype : ctype.c, ctype.h
  • _D : ctype.h
  • _exit() : _exit.c, unistd.h
  • _fs : traps.c
  • _get_base() : sched.h
  • _hashfn : buffer.c
  • _HIGH : wait.h
  • _I_FLAG : tty_io.c
  • _L : ctype.h
  • _L_FLAG : tty_io.c
  • _LDT : sched.h
  • _LOW : wait.h
  • _N_BADMAG : a.out.h
  • _N_HDROFF : a.out.h
  • _N_SEGMENT_ROUND : a.out.h
  • _N_TXTENDADDR : a.out.h
  • _NSIG : signal.h
  • _O_FLAG : tty_io.c
  • _P : ctype.h
  • _PC_CHOWN_RESTRICTED : unistd.h
  • _PC_LINK_MAX : unistd.h
  • _PC_MAX_CANON : unistd.h
  • _PC_MAX_INPUT : unistd.h
  • _PC_NAME_MAX : unistd.h
  • _PC_NO_TRUNC : unistd.h
  • _PC_PATH_MAX : unistd.h
  • _PC_PIPE_BUF : unistd.h
  • _PC_VDISABLE : unistd.h
  • _POSIX_CHOWN_RESTRICTED : unistd.h
  • _POSIX_NO_TRUNC : unistd.h
  • _POSIX_VDISABLE : unistd.h
  • _POSIX_VERSION : unistd.h
  • _S : sched.c, ctype.h
  • _SC_ARG_MAX : unistd.h
  • _SC_CHILD_MAX : unistd.h
  • _SC_CLOCKS_PER_SEC : unistd.h
  • _SC_JOB_CONTROL : unistd.h
  • _SC_NGROUPS_MAX : unistd.h
  • _SC_OPEN_MAX : unistd.h
  • _SC_SAVED_IDS : unistd.h
  • _SC_VERSION : unistd.h
  • _set_base : sched.h
  • _set_gate : system.h
  • _set_limit : sched.h
  • _set_seg_desc : system.h
  • _set_tssldt_desc : system.h
  • _SP : ctype.h
  • _syscall0() : main.c
  • _syscall3() : wait.c
  • _TSS : sched.h
  • _U : ctype.h
  • _X : ctype.h

- a -

  • a : sched.c
  • ABRT_ERR : hdreg.h
  • ACC_MODE : namei.c
  • access() : unistd.h
  • acct() : unistd.h
  • add_entry() : namei.c
  • add_request() : ll_rw_blk.c
  • add_timer() : sched.c, sched.h
  • alarm() : unistd.h
  • ALRMMASK : tty_io.c
  • argv : main.c
  • argv_rc : main.c
  • asctime() : time.h
  • attr : console.c

- b -

  • b : sched.c
  • B0 : termios.h
  • B110 : termios.h
  • B1200 : termios.h
  • B134 : termios.h
  • B150 : termios.h
  • B1800 : termios.h
  • B19200 : termios.h
  • B200 : termios.h
  • B2400 : termios.h
  • B300 : termios.h
  • B38400 : termios.h
  • B4800 : termios.h
  • B50 : termios.h
  • B600 : termios.h
  • B75 : termios.h
  • B9600 : termios.h
  • bad_flp_intr() : floppy.c
  • bad_rw_intr() : hd.c
  • BADNESS : buffer.c
  • BBD_ERR : hdreg.h
  • BCD_TO_BIN : main.c
  • beepcount : console.c
  • blk_dev : ll_rw_blk.c, blk.h
  • blk_dev_init() : ll_rw_blk.c
  • block_read() : read_write.c, block_dev.c
  • BLOCK_SIZE : fs.h
  • BLOCK_SIZE_BITS : fs.h
  • block_write() : read_write.c, block_dev.c
  • bmap() : fs.h, inode.c
  • bottom : console.c
  • bounds() : traps.c
  • bread() : fs.h, buffer.c
  • bread_page() : fs.h, buffer.c
  • breada() : fs.h, buffer.c
  • brelse() : fs.h, buffer.c
  • brk() : unistd.h
  • BRKINT : termios.h
  • BS0 : termios.h
  • BS1 : termios.h
  • BSDLY : termios.h
  • bucket_dir : malloc.c
  • buf : printk.c
  • buffer_block : fs.h
  • BUFFER_END : const.h
  • buffer_init() : fs.h, buffer.c
  • buffer_memory_end : main.c
  • buffer_wait : buffer.c
  • BUSY_STAT : hdreg.h

- c -

  • calc_mem() : memory.c
  • CBAUD : termios.h
  • cfgetispeed() : termios.h
  • cfgetospeed() : termios.h
  • cfsetispeed() : termios.h
  • cfsetospeed() : termios.h
  • change_ldt() : exec.c
  • change_speed() : tty_ioctl.c
  • CHARS : tty.h
  • chdir() : unistd.h
  • check_disk_change() : fs.h, buffer.c
  • chmod() : unistd.h, stat.h
  • chown() : unistd.h
  • chr_dev_init() : tty_io.c
  • chroot() : unistd.h
  • CIBAUD : termios.h
  • clear_bit : bitmap.c
  • clear_block : bitmap.c
  • cli : system.h
  • CLOCAL : termios.h
  • clock() : time.h
  • clock_t : time.h
  • CLOCKS_PER_SEC : time.h
  • close() : unistd.h
  • CMOS_READ : hd.c, main.c
  • CODE_SPACE : memory.c
  • command : floppy.c
  • con_init() : console.c, tty.h
  • con_write() : console.c, tty.h
  • controller_ready() : hd.c
  • coprocessor_error() : traps.c
  • coprocessor_segment_overrun() : traps.c
  • copy_buffer : floppy.c
  • copy_mem() : fork.c
  • copy_page : memory.c
  • copy_page_tables() : memory.c, sched.h
  • copy_process() : fork.c
  • copy_strings() : exec.c
  • copy_to_cooked() : tty_io.c, tty.h
  • COPYBLK : buffer.c
  • count() : exec.c
  • cp_stat() : stat.c
  • CPARENB : termios.h
  • CPARODD : termios.h
  • cr() : console.c
  • CR0 : termios.h
  • CR1 : termios.h
  • CR2 : termios.h
  • CR3 : termios.h
  • CRDLY : termios.h
  • CREAD : termios.h
  • creat() : unistd.h, fcntl.h
  • create_block() : fs.h, inode.c
  • create_tables() : exec.c
  • CRTSCTS : termios.h
  • crw_ptr : char_dev.c
  • crw_table : char_dev.c
  • CS5 : termios.h
  • CS6 : termios.h
  • CS7 : termios.h
  • CS8 : termios.h
  • csi_at() : console.c
  • csi_J() : console.c
  • csi_K() : console.c
  • csi_L() : console.c
  • csi_m() : console.c
  • csi_M() : console.c
  • csi_P() : console.c
  • CSIZE : termios.h
  • CSTOPB : termios.h
  • ctime() : time.h
  • cur_rate : floppy.c
  • cur_spec1 : floppy.c
  • current : sched.c, sched.h
  • current_DOR : sched.c, floppy.c
  • current_drive : floppy.c
  • CURRENT_TIME : sched.h
  • current_track : floppy.c

- d -

  • daddr_t : types.h
  • DAY : mktime.c
  • debug() : traps.c
  • DEC : tty.h
  • DEFAULT_MAJOR_ROOT : build.c
  • DEFAULT_MINOR_ROOT : build.c
  • del() : console.c
  • delete_char() : console.c
  • delete_line() : console.c
  • desc_table : head.h
  • dev_t : types.h
  • device_not_available() : traps.c
  • die() : build.c, traps.c
  • difftime() : time.h
  • DIR_ENTRIES_PER_BLOCK : fs.h
  • dir_namei() : namei.c
  • divide_error() : traps.c
  • DMA_READ : fdreg.h
  • DMA_WRITE : fdreg.h
  • do_bounds() : traps.c
  • do_coprocessor_error() : traps.c
  • do_coprocessor_segment_overrun() : traps.c
  • do_debug() : traps.c
  • do_device_not_available() : traps.c
  • do_div : vsprintf.c
  • do_divide_error() : traps.c
  • do_double_fault() : traps.c
  • do_execve() : exec.c
  • do_exit() : memory.c, traps.c, signal.c, exit.c
  • do_fd_request() : floppy.c
  • do_floppy_timer() : sched.c
  • do_general_protection() : traps.c
  • do_hd_request() : hd.c
  • do_int3() : traps.c
  • do_invalid_op() : traps.c
  • do_invalid_TSS() : traps.c
  • do_nmi() : traps.c
  • do_no_page() : memory.c
  • do_overflow() : traps.c
  • do_rd_request() : ramdisk.c
  • do_reserved() : traps.c
  • do_segment_not_present() : traps.c
  • do_signal() : signal.c
  • do_stack_segment() : traps.c
  • do_timer() : sched.c
  • do_tty_interrupt() : tty_io.c
  • do_wp_page() : memory.c
  • double_fault() : traps.c
  • DRIVE : floppy.c
  • drive_busy() : hd.c
  • DRIVE_INFO : main.c
  • drive_info : main.c
  • DRQ_STAT : hdreg.h
  • dup() : unistd.h
  • dup2() : unistd.h
  • dupfd() : fcntl.c

- e -

  • E2BIG : errno.h
  • EACCES : errno.h
  • EAGAIN : errno.h
  • EBADF : errno.h
  • EBUSY : errno.h
  • ECC_ERR : hdreg.h
  • ECC_STAT : hdreg.h
  • ECHILD : errno.h
  • ECHO : termios.h
  • ECHOCTL : termios.h
  • ECHOE : termios.h
  • ECHOK : termios.h
  • ECHOKE : termios.h
  • ECHONL : termios.h
  • ECHOPRT : termios.h
  • EDEADLK : errno.h
  • EDOM : errno.h
  • EEXIST : errno.h
  • EFAULT : errno.h
  • EFBIG : errno.h
  • EINTR : errno.h
  • EINVAL : errno.h
  • EIO : errno.h
  • EISDIR : errno.h
  • EMFILE : errno.h
  • EMLINK : errno.h
  • EMPTY : tty.h
  • empty_dir() : namei.c
  • ENAMETOOLONG : errno.h
  • end : buffer.c
  • ENFILE : errno.h
  • ENODEV : errno.h
  • ENOENT : errno.h
  • ENOEXEC : errno.h
  • ENOLCK : errno.h
  • ENOMEM : errno.h
  • ENOSPC : errno.h
  • ENOSYS : errno.h
  • ENOTBLK : errno.h
  • ENOTDIR : errno.h
  • ENOTEMPTY : errno.h
  • ENOTTY : errno.h
  • envp : main.c
  • envp_rc : main.c
  • ENXIO : errno.h
  • EOF_CHAR : tty.h
  • EPERM : errno.h
  • EPIPE : errno.h
  • ERANGE : errno.h
  • ERASE_CHAR : tty.h
  • EROFS : errno.h
  • ERR_STAT : hdreg.h
  • errno : errno.c, unistd.h, errno.h
  • ERROR : errno.h
  • ESPIPE : errno.h
  • ESRCH : errno.h
  • ETXTBSY : errno.h
  • EXDEV : errno.h
  • execl() : unistd.h
  • execle() : unistd.h
  • execlp() : unistd.h
  • execv() : unistd.h
  • execve() : unistd.h
  • execvp() : unistd.h
  • exit() : unistd.h
  • EXT_MEM_K : main.c
  • EXTA : termios.h
  • EXTB : termios.h
  • extern : string.c

- f -

  • F_DUPFD : fcntl.h
  • F_GETFD : fcntl.h
  • F_GETFL : fcntl.h
  • F_GETLK : fcntl.h
  • F_OK : unistd.h
  • F_RDLCK : fcntl.h
  • F_SETFD : fcntl.h
  • F_SETFL : fcntl.h
  • F_SETLK : fcntl.h
  • F_SETLKW : fcntl.h
  • F_UNLCK : fcntl.h
  • F_WRLCK : fcntl.h
  • fcntl() : unistd.h, fcntl.h
  • FD_CLOEXEC : fcntl.h
  • FD_DATA : fdreg.h
  • FD_DCR : fdreg.h
  • FD_DIR : fdreg.h
  • FD_DOR : fdreg.h
  • FD_READ : fdreg.h
  • FD_RECALIBRATE : fdreg.h
  • FD_SEEK : fdreg.h
  • FD_SENSEI : fdreg.h
  • FD_SPECIFY : fdreg.h
  • FD_STATUS : fdreg.h
  • FD_WRITE : fdreg.h
  • FF0 : termios.h
  • FF1 : termios.h
  • FFDLY : termios.h
  • file_read() : read_write.c, file_dev.c
  • file_table : fs.h, file_table.c
  • file_write() : read_write.c, file_dev.c
  • find_buffer() : buffer.c
  • find_empty_process() : fork.c
  • find_entry() : namei.c
  • find_first_zero : bitmap.c
  • FIRST_LDT_ENTRY : sched.h
  • FIRST_TASK : sched.h
  • FIRST_TSS_ENTRY : sched.h
  • floppy : floppy.c
  • floppy_change() : floppy.c, fs.h
  • floppy_deselect() : floppy.c, fdreg.h
  • floppy_init() : floppy.c
  • floppy_interrupt() : floppy.c
  • floppy_off() : sched.c, fs.h, fdreg.h
  • floppy_on() : sched.c, fs.h, fdreg.h
  • floppy_on_interrupt() : floppy.c
  • floppy_select() : fdreg.h
  • floppy_type : floppy.c
  • flush() : tty_ioctl.c
  • FLUSHO : termios.h
  • fn_ptr : sched.h
  • fork() : unistd.h
  • free : kernel.h
  • free_block() : fs.h, bitmap.c
  • free_bucket_desc : malloc.c
  • free_dind() : truncate.c
  • free_ind() : truncate.c
  • free_inode() : fs.h, bitmap.c
  • free_list : buffer.c
  • free_page() : memory.c, mm.h
  • free_page_tables() : memory.c, sched.h
  • free_s() : malloc.c, kernel.h
  • free_super() : super.c
  • fstat() : unistd.h, stat.h
  • FULL : tty.h

- g -

  • GCC_HEADER : build.c
  • gdt : head.h
  • GDT_CODE : head.h
  • GDT_DATA : head.h
  • GDT_NUL : head.h
  • GDT_TMP : head.h
  • general_protection() : traps.c
  • get_base : sched.h
  • get_dir() : namei.c
  • get_ds() : segment.h
  • get_empty_inode() : fs.h, inode.c
  • get_empty_page() : memory.c
  • get_free_page() : memory.c, mm.h
  • get_fs() : segment.h
  • get_fs_byte() : segment.h
  • get_fs_long() : segment.h
  • get_fs_word() : segment.h
  • get_hash_table() : fs.h, buffer.c
  • get_limit : sched.h
  • get_new() : signal.c
  • get_pipe_inode() : fs.h, inode.c
  • get_seg_byte : traps.c
  • get_seg_long : traps.c
  • get_super() : fs.h, super.c
  • get_termio() : tty_ioctl.c
  • get_termios() : tty_ioctl.c
  • getblk() : fs.h, buffer.c
  • GETCH : tty.h
  • getegid() : unistd.h
  • geteuid() : unistd.h
  • getgid() : unistd.h
  • getpgrp() : unistd.h
  • getpid() : unistd.h
  • getppid() : unistd.h
  • getuid() : unistd.h
  • gid_t : types.h
  • gmtime() : time.h
  • gotoxy() : console.c

- h -

  • hash : buffer.c
  • hash_table : buffer.c
  • HD_CMD : hdreg.h
  • HD_COMMAND : hdreg.h
  • HD_CURRENT : hdreg.h
  • HD_DATA : hdreg.h
  • HD_ERROR : hdreg.h
  • HD_HCYL : hdreg.h
  • hd_info : hd.c
  • hd_init() : hd.c
  • hd_interrupt() : hd.c
  • HD_LCYL : hdreg.h
  • HD_NSECTOR : hdreg.h
  • hd_out() : hd.c
  • HD_PRECOMP : hdreg.h
  • HD_SECTOR : hdreg.h
  • HD_STATUS : hdreg.h
  • head : floppy.c
  • HIGH_MEMORY : memory.c
  • HOUR : mktime.c
  • HUPCL : termios.h
  • HZ : sched.h

- i -

  • I_BLOCK_SPECIAL : const.h
  • I_CHAR_SPECIAL : const.h
  • I_CRNL : tty_io.c
  • I_DIRECTORY : const.h
  • I_MAP_SLOTS : fs.h
  • I_NAMED_PIPE : const.h
  • I_NLCR : tty_io.c
  • I_NOCR : tty_io.c
  • I_REGULAR : const.h
  • I_SET_GID_BIT : const.h
  • I_SET_UID_BIT : const.h
  • I_TYPE : const.h
  • I_UCLC : tty_io.c
  • ICANON : termios.h
  • ICRNL : termios.h
  • ID_ERR : hdreg.h
  • idt : head.h
  • IEXTEN : termios.h
  • iget() : fs.h, inode.c
  • IGNBRK : termios.h
  • IGNCR : termios.h
  • IGNPAR : termios.h
  • IMAXBEL : termios.h
  • immoutb_p : floppy.c
  • IN_ORDER : blk.h
  • inb : io.h
  • inb_p : io.h
  • INC : tty.h
  • INC_PIPE : fs.h
  • INDEX_STAT : hdreg.h
  • init() : serial.c, main.c
  • init_bucket_desc() : malloc.c
  • INIT_C_CC : tty.h
  • INIT_TASK : sched.h
  • init_task : sched.c
  • INLCR : termios.h
  • inline : string.c
  • ino_t : types.h
  • inode_table : fs.h, inode.c
  • INODES_PER_BLOCK : fs.h
  • INPCK : termios.h
  • insert_char() : console.c
  • insert_into_queues() : buffer.c
  • insert_line() : console.c
  • int3() : traps.c
  • interruptible_sleep_on() : sched.c, sched.h
  • INTMASK : tty_io.c
  • INTR_CHAR : tty.h
  • invalid_op() : traps.c
  • invalid_TSS() : traps.c
  • invalidate : memory.c
  • invalidate_buffers() : buffer.c
  • invalidate_inodes() : inode.c, buffer.c
  • ioctl() : unistd.h
  • ioctl_ptr : ioctl.c
  • ioctl_table : ioctl.c
  • iput() : fs.h, inode.c
  • iret : system.h
  • irq13() : traps.c
  • is_digit : vsprintf.c
  • IS_SEEKABLE : fs.h
  • isalnum : ctype.h
  • isalpha : ctype.h
  • isascii : ctype.h
  • iscntrl : ctype.h
  • isdigit : ctype.h
  • isgraph : ctype.h
  • ISIG : termios.h
  • islower : ctype.h
  • isprint : ctype.h
  • ispunct : ctype.h
  • isspace : ctype.h
  • ISTRIP : termios.h
  • isupper : ctype.h
  • isxdigit : ctype.h
  • IUCLC : termios.h
  • IXANY : termios.h
  • IXOFF : termios.h
  • IXON : termios.h

- j -

  • jiffies : sched.c, sched.h

- k -

  • KBD_US : config.h
  • kernel_mktime() : mktime.c
  • keyboard_interrupt() : console.c
  • kill() : unistd.h, signal.h
  • KILL_CHAR : tty.h
  • kill_session() : exit.c
  • KILLMASK : tty_io.c

- l -

  • L_CANON : tty_io.c
  • L_ECHO : tty_io.c
  • L_ECHOCTL : tty_io.c
  • L_ECHOE : tty_io.c
  • L_ECHOK : tty_io.c
  • L_ECHOKE : tty_io.c
  • L_ISIG : tty_io.c
  • LAST : tty.h
  • last_pid : fork.c
  • LAST_TASK : sched.h
  • last_task_used_math : sched.c, sched.h
  • LATCH : sched.c
  • LDT_CODE : head.h
  • LDT_DATA : head.h
  • LDT_NUL : head.h
  • LEFT : vsprintf.c, tty.h
  • lf() : console.c
  • link() : unistd.h
  • ll_rw_block() : ll_rw_blk.c, fs.h
  • lldt : sched.h
  • localtime() : time.h
  • lock_buffer() : ll_rw_blk.c
  • lock_inode() : inode.c
  • lock_super() : super.c
  • LOW_MEM : memory.c
  • lseek() : unistd.h
  • ltr : sched.h

- m -

  • main() : build.c, main.c
  • main_memory_start : main.c
  • MAJOR : fs.h
  • MAJOR_NR : ramdisk.c, hd.c, floppy.c
  • make_request() : ll_rw_blk.c
  • malloc() : malloc.c, kernel.h
  • MAP_NR : memory.c
  • MARK_ERR : hdreg.h
  • match() : namei.c
  • math_emulate() : math_emulate.c
  • math_error() : math_emulate.c
  • math_state_restore() : sched.c
  • MAX : file_dev.c
  • MAX_ARG_PAGES : exec.c
  • MAX_ERRORS : hd.c, floppy.c
  • MAX_HD : hd.c
  • MAX_REPLIES : floppy.c
  • MAY_EXEC : namei.c
  • MAY_READ : namei.c
  • MAY_WRITE : namei.c
  • mem_init() : memory.c
  • mem_map : memory.c
  • mem_use() : sched.c
  • memchr() : string.h
  • memcmp() : string.h
  • memcpy : string.h, memory.h
  • memmove() : string.h
  • memory_end : main.c
  • memset() : string.h
  • MIN : file_dev.c
  • MINIX_HEADER : build.c
  • MINOR : fs.h
  • MINUTE : mktime.c
  • mkdir() : stat.h
  • mkfifo() : stat.h
  • mknod() : unistd.h
  • mktime() : time.h
  • mode_t : types.h
  • moff_timer : sched.c
  • mon_timer : sched.c
  • month : mktime.c
  • mount() : unistd.h
  • mount_root() : fs.h, super.c
  • move_to_user_mode : system.h

- n -

  • N_ABS : a.out.h
  • N_BADMAG : a.out.h
  • N_BSS : a.out.h
  • N_BSSADDR : a.out.h
  • N_COMM : a.out.h
  • N_DATA : a.out.h
  • N_DATADDR : a.out.h
  • N_DATOFF : a.out.h
  • N_DRELOFF : a.out.h
  • N_EXT : a.out.h
  • N_FN : a.out.h
  • N_INDR : a.out.h
  • N_MAGIC : a.out.h
  • N_SETA : a.out.h
  • N_SETB : a.out.h
  • N_SETD : a.out.h
  • N_SETT : a.out.h
  • N_SETV : a.out.h
  • N_STAB : a.out.h
  • N_STROFF : a.out.h
  • N_SYMOFF : a.out.h
  • N_TEXT : a.out.h
  • N_TRELOFF : a.out.h
  • N_TXTADDR : a.out.h
  • N_TXTOFF : a.out.h
  • N_TYPE : a.out.h
  • N_UNDF : a.out.h
  • NAME_LEN : fs.h
  • namei() : fs.h, namei.c
  • NCC : termios.h
  • NCCS : termios.h
  • new_block() : fs.h, bitmap.c
  • new_inode() : fs.h, bitmap.c
  • next_timer : sched.c
  • nice() : unistd.h
  • NL0 : termios.h
  • NL1 : termios.h
  • NLDLY : termios.h
  • nlink_t : types.h
  • NMAGIC : a.out.h
  • nmi() : traps.c
  • NOFLSH : termios.h
  • nop : system.h
  • NPAR : console.c
  • npar : console.c
  • NR_BLK_DEV : blk.h
  • nr_buffers : fs.h
  • NR_BUFFERS : buffer.c, fs.h
  • NR_FILE : fs.h
  • NR_HASH : fs.h
  • NR_HD : hd.c
  • NR_INODE : fs.h
  • NR_OPEN : fs.h
  • NR_REQUEST : blk.h
  • NR_SUPER : fs.h
  • NR_TASKS : sched.h
  • NRDEVS : ioctl.c, char_dev.c
  • NSIG : signal.h
  • NULL : unistd.h, types.h, string.h, stddef.h, sched.h, fs.h
  • number() : vsprintf.c

- o -

  • O_ACCMODE : fcntl.h
  • O_APPEND : fcntl.h
  • O_CREAT : fcntl.h
  • O_CRNL : tty_io.c
  • O_EXCL : fcntl.h
  • O_LCUC : tty_io.c
  • O_NDELAY : fcntl.h
  • O_NLCR : tty_io.c
  • O_NLRET : tty_io.c
  • O_NOCTTY : fcntl.h
  • O_NONBLOCK : fcntl.h
  • O_POST : tty_io.c
  • O_RDONLY : fcntl.h
  • O_RDWR : fcntl.h
  • O_TRUNC : fcntl.h
  • O_WRONLY : fcntl.h
  • OCRNL : termios.h
  • OFDEL : termios.h
  • off_t : types.h
  • offsetof : stddef.h
  • OFILL : termios.h
  • OLCUC : termios.h
  • OMAGIC : a.out.h
  • ONLCR : termios.h
  • ONLRET : termios.h
  • ONOCR : termios.h
  • oom() : memory.c
  • open() : open.c, unistd.h, fcntl.h
  • open_namei() : fs.h, namei.c
  • OPOST : termios.h
  • ORIG_ROOT_DEV : main.c
  • ORIG_VIDEO_COLS : console.c
  • ORIG_VIDEO_EGA_AX : console.c
  • ORIG_VIDEO_EGA_BX : console.c
  • ORIG_VIDEO_EGA_CX : console.c
  • ORIG_VIDEO_LINES : console.c
  • ORIG_VIDEO_MODE : console.c
  • ORIG_VIDEO_PAGE : console.c
  • ORIG_X : console.c
  • ORIG_Y : console.c
  • origin : console.c
  • outb : io.h
  • outb_p : io.h
  • output_byte() : floppy.c
  • overflow() : traps.c

- p -

  • PAGE_ALIGN : sched.h
  • page_exception() : traps.c
  • page_fault() : traps.c
  • PAGE_SIZE : mm.h, a.out.h
  • PAGING_MEMORY : memory.c
  • PAGING_PAGES : memory.c
  • PANIC : panic.c
  • panic() : panic.c, sched.h, kernel.h
  • par : console.c
  • parallel_interrupt() : traps.c
  • PARENB : termios.h
  • PARMRK : termios.h
  • PARODD : termios.h
  • pause() : unistd.h
  • PENDIN : termios.h
  • permission() : namei.c
  • pg_dir : head.h
  • pid_t : types.h
  • pipe() : unistd.h
  • PIPE_EMPTY : fs.h
  • PIPE_FULL : fs.h
  • PIPE_HEAD : fs.h
  • PIPE_SIZE : fs.h
  • PIPE_TAIL : fs.h
  • PLUS : vsprintf.c
  • port_read : hd.c
  • port_write : hd.c
  • pos : console.c
  • printf() : main.c, kernel.h
  • printk() : printk.c, kernel.h
  • ptrdiff_t : types.h, stddef.h
  • put_fs_byte() : segment.h
  • put_fs_long() : segment.h
  • put_fs_word() : segment.h
  • put_page() : memory.c, mm.h
  • put_super() : super.c, buffer.c
  • PUTCH : tty.h

- q -

  • ques : console.c
  • QUIT_CHAR : tty.h
  • QUITMASK : tty_io.c
  • quotient : tty_ioctl.c

- r -

  • R_OK : unistd.h
  • raise() : signal.h
  • rd_init() : ramdisk.c
  • rd_length : ramdisk.c
  • rd_load() : ramdisk.c, hd.c
  • rd_start : ramdisk.c
  • read() : unistd.h
  • READ : fs.h
  • read_inode() : inode.c
  • read_intr() : hd.c
  • read_pipe() : read_write.c, pipe.c
  • read_super() : super.c
  • READA : fs.h
  • READY_STAT : hdreg.h
  • recal_interrupt() : floppy.c
  • recal_intr() : hd.c
  • recalibrate : hd.c, floppy.c
  • recalibrate_floppy() : floppy.c
  • release() : exit.c
  • remove_from_queues() : buffer.c
  • reply_buffer : floppy.c
  • request : ll_rw_blk.c, blk.h
  • reserved() : traps.c
  • reset : hd.c, floppy.c
  • reset_controller() : hd.c
  • reset_floppy() : floppy.c
  • reset_hd() : hd.c
  • reset_interrupt() : floppy.c
  • respond() : console.c
  • RESPONSE : console.c
  • restore_cur() : console.c
  • result() : floppy.c
  • ri() : console.c
  • ROOT_DEV : fs.h, super.c
  • ROOT_INO : fs.h
  • rs1_interrupt() : serial.c
  • rs2_interrupt() : serial.c
  • rs_init() : serial.c, tty.h
  • rs_write() : serial.c, tty.h
  • rw_char() : read_write.c, char_dev.c
  • rw_interrupt() : floppy.c
  • rw_kmem() : char_dev.c
  • rw_mem() : char_dev.c
  • rw_memory() : char_dev.c
  • rw_port() : char_dev.c
  • rw_ram() : char_dev.c
  • rw_tty() : char_dev.c
  • rw_ttyx() : char_dev.c

- s -

  • S_IFBLK : stat.h
  • S_IFCHR : stat.h
  • S_IFDIR : stat.h
  • S_IFIFO : stat.h
  • S_IFMT : stat.h
  • S_IFREG : stat.h
  • S_IRGRP : stat.h
  • S_IROTH : stat.h
  • S_IRUSR : stat.h
  • S_IRWXG : stat.h
  • S_IRWXO : stat.h
  • S_IRWXU : stat.h
  • S_ISBLK : stat.h
  • S_ISCHR : stat.h
  • S_ISDIR : stat.h
  • S_ISFIFO : stat.h
  • S_ISGID : stat.h
  • S_ISREG : stat.h
  • S_ISUID : stat.h
  • S_ISVTX : stat.h
  • S_IWGRP : stat.h
  • S_IWOTH : stat.h
  • S_IWUSR : stat.h
  • S_IXGRP : stat.h
  • S_IXOTH : stat.h
  • S_IXUSR : stat.h
  • SA_NOCLDSTOP : signal.h
  • SA_NOMASK : signal.h
  • SA_ONESHOT : signal.h
  • save_cur() : console.c
  • save_old() : signal.c
  • saved_x : console.c
  • saved_y : console.c
  • sbrk() : unistd.h
  • sched_init() : sched.c, sched.h
  • schedule() : sched.c, sched.h
  • scr_end : console.c
  • scrdown() : console.c
  • scrup() : console.c
  • sector : floppy.c
  • seek : floppy.c
  • SEEK_CUR : unistd.h
  • SEEK_END : unistd.h
  • seek_interrupt() : floppy.c
  • SEEK_SET : unistd.h
  • SEEK_STAT : hdreg.h
  • seek_track : floppy.c
  • segment_not_present() : traps.c
  • SEGMENT_SIZE : a.out.h
  • selected : floppy.c
  • send_break() : tty_ioctl.c
  • send_sig() : exit.c
  • set_base : sched.h
  • set_bit : super.c, bitmap.c
  • set_cursor() : console.c
  • set_fs() : segment.h
  • set_intr_gate : system.h
  • set_ldt_desc : system.h
  • set_limit : sched.h
  • set_origin() : console.c
  • set_system_gate : system.h
  • set_termio() : tty_ioctl.c
  • set_termios() : tty_ioctl.c
  • set_trap_gate : system.h
  • set_tss_desc : system.h
  • setgid() : unistd.h
  • setpgid() : unistd.h
  • setpgrp() : unistd.h
  • setsid() : unistd.h
  • setuid() : unistd.h
  • setup_DMA() : floppy.c
  • setup_rw_floppy() : floppy.c
  • SETUP_SECTS : build.c
  • share_page() : memory.c
  • show_stat() : sched.c
  • show_task() : sched.c
  • sig_atomic_t : signal.h
  • SIG_BLOCK : signal.h
  • SIG_DFL : signal.h
  • SIG_IGN : signal.h
  • SIG_SETMASK : signal.h
  • SIG_UNBLOCK : signal.h
  • SIGABRT : signal.h
  • sigaction() : signal.h
  • sigaddset() : signal.h
  • SIGALRM : signal.h
  • SIGCHLD : signal.h
  • SIGCONT : signal.h
  • sigdelset() : signal.h
  • sigemptyset() : signal.h
  • sigfillset() : signal.h
  • SIGFPE : signal.h
  • SIGHUP : signal.h
  • SIGILL : signal.h
  • SIGINT : signal.h
  • SIGIOT : signal.h
  • sigismember() : signal.h
  • SIGKILL : signal.h
  • SIGN : vsprintf.c
  • signal : unistd.h, signal.h
  • sigpending() : signal.h
  • SIGPIPE : signal.h
  • sigprocmask() : signal.h
  • SIGQUIT : signal.h
  • SIGSEGV : signal.h
  • sigset_t : signal.h
  • SIGSTKFLT : signal.h
  • SIGSTOP : signal.h
  • sigsuspend() : signal.h
  • SIGTERM : signal.h
  • SIGTRAP : signal.h
  • SIGTSTP : signal.h
  • SIGTTIN : signal.h
  • SIGTTOU : signal.h
  • SIGUNUSED : signal.h
  • SIGUSR1 : signal.h
  • SIGUSR2 : signal.h
  • size_t : time.h, types.h, string.h, stddef.h
  • skip_atoi() : vsprintf.c
  • sleep_if_empty() : tty_io.c
  • sleep_if_full() : tty_io.c
  • sleep_on() : sched.c, sched.h
  • SMALL : vsprintf.c
  • SPACE : vsprintf.c
  • SPECIAL : vsprintf.c
  • speed_t : termios.h
  • ST0 : floppy.c
  • ST0_DS : fdreg.h
  • ST0_ECE : fdreg.h
  • ST0_HA : fdreg.h
  • ST0_INTR : fdreg.h
  • ST0_NR : fdreg.h
  • ST0_SE : fdreg.h
  • ST1 : floppy.c
  • ST1_CRC : fdreg.h
  • ST1_EOC : fdreg.h
  • ST1_MAM : fdreg.h
  • ST1_ND : fdreg.h
  • ST1_OR : fdreg.h
  • ST1_WP : fdreg.h
  • ST2 : floppy.c
  • ST2_BC : fdreg.h
  • ST2_CM : fdreg.h
  • ST2_CRC : fdreg.h
  • ST2_MAM : fdreg.h
  • ST2_SEH : fdreg.h
  • ST2_SNS : fdreg.h
  • ST2_WC : fdreg.h
  • ST3 : floppy.c
  • ST3_HA : fdreg.h
  • ST3_TZ : fdreg.h
  • ST3_WP : fdreg.h
  • stack_segment() : traps.c
  • stack_start : sched.c
  • start_buffer : fs.h, buffer.c
  • START_CHAR : tty.h
  • startup_time : sched.c, sched.h
  • stat() : unistd.h, stat.h
  • state : console.c
  • STATUS_BUSY : fdreg.h
  • STATUS_BUSYMASK : fdreg.h
  • STATUS_DIR : fdreg.h
  • STATUS_DMA : fdreg.h
  • STATUS_READY : fdreg.h
  • STDERR_FILENO : unistd.h
  • STDIN_FILENO : unistd.h
  • STDOUT_FILENO : unistd.h
  • sti : system.h
  • stime() : unistd.h
  • STOP_CHAR : tty.h
  • str : sched.h
  • strcat() : string.h
  • strchr() : string.h
  • strcmp() : string.h
  • strcpy() : string.h
  • strcspn() : string.h
  • strerror() : string.h
  • strftime() : time.h
  • STRINGIFY : build.c
  • strlen() : string.h
  • strncat() : string.h
  • strncmp() : string.h
  • strncpy() : string.h
  • strpbrk() : string.h
  • strrchr() : string.h
  • strspn() : string.h
  • strstr() : string.h
  • strtok() : string.h
  • super_block : fs.h, super.c
  • SUPER_MAGIC : fs.h
  • suser : kernel.h
  • SUSPEND_CHAR : tty.h
  • switch_to : sched.h
  • sync() : unistd.h
  • sync_dev() : fs.h, super.c, buffer.c
  • sync_inodes() : fs.h, inode.c
  • sys_access() : sys.h, open.c
  • sys_acct() : sys.c, sys.h
  • sys_alarm() : sched.c, sys.h
  • sys_break() : sys.c, sys.h
  • sys_brk() : sys.c, sys.h
  • sys_call_table : sys.h
  • sys_chdir() : sys.h, open.c
  • sys_chmod() : sys.h, open.c
  • sys_chown() : sys.h, open.c
  • sys_chroot() : sys.h, open.c
  • sys_close() : exit.c, sys.h, open.c, fcntl.c, exec.c
  • sys_creat() : sys.h, open.c
  • sys_dup() : sys.h, fcntl.c
  • sys_dup2() : sys.h, fcntl.c
  • sys_execve() : sys.h
  • sys_exit() : exit.c, sys.h, exec.c
  • sys_fcntl() : sys.h, fcntl.c
  • sys_fork() : sys.h
  • sys_fstat() : sys.h, stat.c
  • sys_ftime() : sys.c, sys.h
  • sys_getegid() : sched.c, sys.h
  • sys_geteuid() : sched.c, sys.h
  • sys_getgid() : sched.c, sys.h
  • sys_getpgrp() : sys.c, sys.h
  • sys_getpid() : sched.c, sys.h
  • sys_getppid() : sched.c, sys.h
  • sys_getuid() : sched.c, sys.h
  • sys_gtty() : sys.c, sys.h
  • sys_ioctl() : sys.h, ioctl.c
  • sys_kill() : exit.c, sys.h
  • sys_link() : sys.h, namei.c
  • sys_lock() : sys.c, sys.h
  • sys_lseek() : sys.h, read_write.c
  • sys_mkdir() : sys.h, namei.c
  • sys_mknod() : sys.h, namei.c
  • sys_mount() : sys.h, super.c
  • sys_mpx() : sys.c, sys.h
  • sys_nice() : sched.c, sys.h
  • sys_open() : sys.h, open.c
  • sys_pause() : sched.c, exit.c, sys.h
  • sys_phys() : sys.c, sys.h
  • sys_pipe() : sys.h, pipe.c
  • sys_prof() : sys.c, sys.h
  • sys_ptrace() : sys.c, sys.h
  • sys_read() : sys.h, read_write.c
  • sys_rename() : sys.c, sys.h
  • sys_rmdir() : sys.h, namei.c
  • sys_setgid() : sys.c, sys.h
  • sys_setpgid() : sys.c, sys.h
  • sys_setregid() : sys.c, sys.h
  • sys_setreuid() : sys.c, sys.h
  • sys_setsid() : sys.c, sys.h
  • sys_setuid() : sys.c, sys.h
  • sys_setup() : hd.c, sys.h
  • sys_sgetmask() : signal.c, sys.h
  • sys_sigaction() : signal.c, sys.h
  • sys_signal() : signal.c, sys.h
  • SYS_SIZE : build.c
  • sys_ssetmask() : signal.c, sys.h
  • sys_stat() : sys.h, stat.c
  • sys_stime() : sys.c, sys.h
  • sys_stty() : sys.c, sys.h
  • sys_sync() : panic.c, sys.h, buffer.c
  • sys_time() : sys.c, sys.h
  • sys_times() : sys.c, sys.h
  • sys_ulimit() : sys.c, sys.h
  • sys_umask() : sys.c, sys.h
  • sys_umount() : sys.h, super.c
  • sys_uname() : sys.c, sys.h
  • sys_unlink() : sys.h, namei.c
  • sys_ustat() : sys.h, open.c
  • sys_utime() : sys.h, open.c
  • sys_waitpid() : exit.c, sys.h
  • sys_write() : sys.h, read_write.c
  • sysbeep() : console.c
  • sysbeepstop() : console.c
  • system_call() : sched.c

- t -

  • TAB0 : termios.h
  • TAB1 : termios.h
  • TAB2 : termios.h
  • TAB3 : termios.h
  • TABDLY : termios.h
  • table_list : tty_io.c
  • task : sched.c, sched.h
  • TASK_INTERRUPTIBLE : sched.h
  • TASK_RUNNING : sched.h
  • TASK_STOPPED : sched.h
  • TASK_UNINTERRUPTIBLE : sched.h
  • TASK_ZOMBIE : sched.h
  • tcdrain() : termios.h
  • tcflow() : termios.h
  • TCFLSH : termios.h
  • tcflush() : termios.h
  • TCGETA : termios.h
  • tcgetattr() : termios.h
  • TCGETS : termios.h
  • TCIFLUSH : termios.h
  • TCIOFF : termios.h
  • TCIOFLUSH : termios.h
  • TCION : termios.h
  • TCOFLUSH : termios.h
  • TCOOFF : termios.h
  • TCOON : termios.h
  • TCSADRAIN : termios.h
  • TCSAFLUSH : termios.h
  • TCSANOW : termios.h
  • TCSBRK : termios.h
  • tcsendbreak() : termios.h
  • TCSETA : termios.h
  • TCSETAF : termios.h
  • tcsetattr() : termios.h
  • TCSETAW : termios.h
  • TCSETS : termios.h
  • TCSETSF : termios.h
  • TCSETSW : termios.h
  • TCXONC : termios.h
  • tell_father() : exit.c
  • ticks_to_floppy_on() : sched.c, fs.h, fdreg.h
  • time() : unistd.h, time.h
  • TIME_REQUESTS : sched.c
  • time_t : time.h, types.h
  • timer_interrupt() : sched.c
  • timer_list : sched.c
  • times() : unistd.h, times.h
  • TIOCEXCL : termios.h
  • TIOCGPGRP : termios.h
  • TIOCGSOFTCAR : termios.h
  • TIOCGWINSZ : termios.h
  • TIOCINQ : termios.h
  • TIOCM_CAR : termios.h
  • TIOCM_CD : termios.h
  • TIOCM_CTS : termios.h
  • TIOCM_DSR : termios.h
  • TIOCM_DTR : termios.h
  • TIOCM_LE : termios.h
  • TIOCM_RI : termios.h
  • TIOCM_RNG : termios.h
  • TIOCM_RTS : termios.h
  • TIOCM_SR : termios.h
  • TIOCM_ST : termios.h
  • TIOCMBIC : termios.h
  • TIOCMBIS : termios.h
  • TIOCMGET : termios.h
  • TIOCMSET : termios.h
  • TIOCNXCL : termios.h
  • TIOCOUTQ : termios.h
  • TIOCSCTTY : termios.h
  • TIOCSPGRP : termios.h
  • TIOCSSOFTCAR : termios.h
  • TIOCSTI : termios.h
  • TIOCSWINSZ : termios.h
  • tmp_floppy_area : floppy.c
  • toascii : ctype.h
  • tolower : ctype.h
  • top : console.c
  • TOSTOP : termios.h
  • toupper : ctype.h
  • track : floppy.c
  • transfer() : floppy.c
  • trap_init() : traps.c, sched.h
  • TRK0_ERR : hdreg.h
  • truncate() : fs.h, truncate.c
  • try_to_share() : memory.c
  • TSTPMASK : tty_io.c
  • TTY_BUF_SIZE : termios.h, tty.h
  • tty_init() : tty_io.c, tty.h
  • tty_intr() : tty_io.c
  • tty_ioctl() : tty_ioctl.c, ioctl.c
  • tty_read() : tty_io.c, tty.h, char_dev.c
  • tty_table : tty_io.c, tty.h
  • tty_write() : tty_io.c, tty.h, sched.h, kernel.h, char_dev.c
  • TYPE : floppy.c
  • tzset() : time.h

- u -

  • u_char : types.h
  • uid_t : types.h
  • ulimit() : unistd.h
  • umask() : unistd.h, stat.h
  • umode_t : types.h
  • umount() : unistd.h
  • un_wp_page() : memory.c
  • uname() : unistd.h, utsname.h
  • unexpected_floppy_interrupt() : floppy.c
  • unexpected_hd_interrupt() : hd.c
  • unlink() : unistd.h
  • unlock_buffer() : ll_rw_blk.c
  • unlock_inode() : inode.c
  • usage() : build.c
  • USED : memory.c
  • user_stack : sched.c
  • ushort : types.h
  • ustat() : unistd.h
  • utime() : utime.h, unistd.h

- v -

  • va_arg : stdarg.h
  • va_end : stdarg.h
  • va_list : stdarg.h
  • va_start : stdarg.h
  • VDISCARD : termios.h
  • VEOF : termios.h
  • VEOL : termios.h
  • VEOL2 : termios.h
  • VERASE : termios.h
  • verify_area() : fork.c, kernel.h
  • video_erase_char : console.c
  • video_mem_end : console.c
  • video_mem_start : console.c
  • video_num_columns : console.c
  • video_num_lines : console.c
  • video_page : console.c
  • video_port_reg : console.c
  • video_port_val : console.c
  • video_size_row : console.c
  • video_type : console.c
  • VIDEO_TYPE_CGA : console.c
  • VIDEO_TYPE_EGAC : console.c
  • VIDEO_TYPE_EGAM : console.c
  • VIDEO_TYPE_MDA : console.c
  • VINTR : termios.h
  • VKILL : termios.h
  • VLNEXT : termios.h
  • VMIN : termios.h
  • VQUIT : termios.h
  • VREPRINT : termios.h
  • vsprintf() : vsprintf.c, printk.c
  • VSTART : termios.h
  • VSTOP : termios.h
  • VSUSP : termios.h
  • VSWTC : termios.h
  • VT0 : termios.h
  • VT1 : termios.h
  • VTDLY : termios.h
  • VTIME : termios.h
  • VWERASE : termios.h

- w -

  • W_OK : unistd.h
  • wait() : unistd.h, wait.h
  • wait_for_keypress() : tty_io.c, super.c
  • wait_for_request : ll_rw_blk.c, blk.h
  • wait_motor : sched.c
  • wait_on() : fs.h
  • wait_on_buffer() : buffer.c
  • wait_on_floppy_select : floppy.c
  • wait_on_inode() : inode.c
  • wait_on_super() : super.c
  • wait_until_sent() : tty_ioctl.c
  • waitpid() : unistd.h, wait.h
  • wake_up() : sched.c, sched.h
  • WAKEUP_CHARS : serial.c
  • WEXITSTATUS : wait.h
  • WIFEXITED : wait.h
  • WIFSIGNALED : wait.h
  • WIFSTOPPED : wait.h
  • WIN_DIAGNOSE : hdreg.h
  • WIN_FORMAT : hdreg.h
  • WIN_INIT : hdreg.h
  • WIN_READ : hdreg.h
  • WIN_RESTORE : hdreg.h
  • win_result() : hd.c
  • WIN_SEEK : hdreg.h
  • WIN_SPECIFY : hdreg.h
  • WIN_VERIFY : hdreg.h
  • WIN_WRITE : hdreg.h
  • WNOHANG : wait.h
  • WRERR_STAT : hdreg.h
  • WRITE : fs.h
  • write() : unistd.h
  • write_inode() : inode.c
  • write_intr() : hd.c
  • write_pipe() : read_write.c, pipe.c
  • write_verify() : memory.c, fork.c
  • WRITEA : fs.h
  • WSTOPSIG : wait.h
  • WTERMSIG : wait.h
  • WUNTRACED : wait.h

- x -

  • x : console.c
  • X_OK : unistd.h
  • XCASE : termios.h
  • XTABS : termios.h

- y -

  • y : console.c
  • YEAR : mktime.c

- z -

  • Z_MAP_SLOTS : fs.h
  • ZEROPAD : vsprintf.c
  • ZMAGIC : a.out.h
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/_exit.c Source File

_exit.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/_exit.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009
00010 volatile void _exit(int exit_code)
00011 {
00012     __asm__("int $0x80"::"a" (__NR_exit),"b" (exit_code));
00013 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/a.out.h Source File

a.out.h

Go to the documentation of this file.
00001 #ifndef _A_OUT_H
00002 #define _A_OUT_H
00003
00004 #define __GNU_EXEC_MACROS__
00005
00006 struct exec {
00007   unsigned long a_magic;    /* Use macros N_MAGIC, etc for access */
00008   unsigned a_text;      /* length of text, in bytes */
00009   unsigned a_data;      /* length of data, in bytes */
00010   unsigned a_bss;       /* length of uninitialized data area for file, in bytes */
00011   unsigned a_syms;      /* length of symbol table data in file, in bytes */
00012   unsigned a_entry;     /* start address */
00013   unsigned a_trsize;        /* length of relocation info for text, in bytes */
00014   unsigned a_drsize;        /* length of relocation info for data, in bytes */
00015 };
00016
00017 #ifndef N_MAGIC
00018 #define N_MAGIC(exec) ((exec).a_magic)
00019 #endif
00020
00021 #ifndef OMAGIC
00022 /* Code indicating object file or impure executable.  */
00023 #define OMAGIC 0407
00024 /* Code indicating pure executable.  */
00025 #define NMAGIC 0410
00026 /* Code indicating demand-paged executable.  */
00027 #define ZMAGIC 0413
00028 #endif /* not OMAGIC */
00029
00030 #ifndef N_BADMAG
00031 #define N_BADMAG(x)                 \
00032  (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC      \
00033   && N_MAGIC(x) != ZMAGIC)
00034 #endif
00035
00036 #define _N_BADMAG(x)                    \
00037  (N_MAGIC(x) != OMAGIC && N_MAGIC(x) != NMAGIC      \
00038   && N_MAGIC(x) != ZMAGIC)
00039
00040 #define _N_HDROFF(x) (SEGMENT_SIZE - sizeof (struct exec))
00041
00042 #ifndef N_TXTOFF
00043 #define N_TXTOFF(x) \
00044  (N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : sizeof (struct exec))
00045 #endif
00046
00047 #ifndef N_DATOFF
00048 #define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
00049 #endif
00050
00051 #ifndef N_TRELOFF
00052 #define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
00053 #endif
00054
00055 #ifndef N_DRELOFF
00056 #define N_DRELOFF(x) (N_TRELOFF(x) + (x).a_trsize)
00057 #endif
00058
00059 #ifndef N_SYMOFF
00060 #define N_SYMOFF(x) (N_DRELOFF(x) + (x).a_drsize)
00061 #endif
00062
00063 #ifndef N_STROFF
00064 #define N_STROFF(x) (N_SYMOFF(x) + (x).a_syms)
00065 #endif
00066
00067 /* Address of text segment in memory after it is loaded.  */
00068 #ifndef N_TXTADDR
00069 #define N_TXTADDR(x) 0
00070 #endif
00071
00072 /* Address of data segment in memory after it is loaded.
00073    Note that it is up to you to define SEGMENT_SIZE
00074    on machines not listed here.  */
00075 #if defined(vax) || defined(hp300) || defined(pyr)
00076 #define SEGMENT_SIZE PAGE_SIZE
00077 #endif
00078 #ifdef  hp300
00079 #define PAGE_SIZE   4096
00080 #endif
00081 #ifdef  sony
00082 #define SEGMENT_SIZE    0x2000
00083 #endif  /* Sony.  */
00084 #ifdef is68k
00085 #define SEGMENT_SIZE 0x20000
00086 #endif
00087 #if defined(m68k) && defined(PORTAR)
00088 #define PAGE_SIZE 0x400
00089 #define SEGMENT_SIZE PAGE_SIZE
00090 #endif
00091
00092 #define PAGE_SIZE 4096
00093 #define SEGMENT_SIZE 1024
00094
00095 #define _N_SEGMENT_ROUND(x) (((x) + SEGMENT_SIZE - 1) & ~(SEGMENT_SIZE - 1))
00096
00097 #define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
00098
00099 #ifndef N_DATADDR
00100 #define N_DATADDR(x) \
00101     (N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
00102      : (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
00103 #endif
00104
00105 /* Address of bss segment in memory after it is loaded.  */
00106 #ifndef N_BSSADDR
00107 #define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
00108 #endif
00109
00110 #ifndef N_NLIST_DECLARED
00111 struct nlist {
00112   union {
00113     char *n_name;
00114     struct nlist *n_next;
00115     long n_strx;
00116   } n_un;
00117   unsigned char n_type;
00118   char n_other;
00119   short n_desc;
00120   unsigned long n_value;
00121 };
00122 #endif
00123
00124 #ifndef N_UNDF
00125 #define N_UNDF 0
00126 #endif
00127 #ifndef N_ABS
00128 #define N_ABS 2
00129 #endif
00130 #ifndef N_TEXT
00131 #define N_TEXT 4
00132 #endif
00133 #ifndef N_DATA
00134 #define N_DATA 6
00135 #endif
00136 #ifndef N_BSS
00137 #define N_BSS 8
00138 #endif
00139 #ifndef N_COMM
00140 #define N_COMM 18
00141 #endif
00142 #ifndef N_FN
00143 #define N_FN 15
00144 #endif
00145
00146 #ifndef N_EXT
00147 #define N_EXT 1
00148 #endif
00149 #ifndef N_TYPE
00150 #define N_TYPE 036
00151 #endif
00152 #ifndef N_STAB
00153 #define N_STAB 0340
00154 #endif
00155
00156 /* The following type indicates the definition of a symbol as being
00157    an indirect reference to another symbol.  The other symbol
00158    appears as an undefined reference, immediately following this symbol.
00159
00160    Indirection is asymmetrical.  The other symbol's value will be used
00161    to satisfy requests for the indirect symbol, but not vice versa.
00162    If the other symbol does not have a definition, libraries will
00163    be searched to find a definition.  */
00164 #define N_INDR 0xa
00165
00166 /* The following symbols refer to set elements.
00167    All the N_SET[ATDB] symbols with the same name form one set.
00168    Space is allocated for the set in the text section, and each set
00169    element's value is stored into one word of the space.
00170    The first word of the space is the length of the set (number of elements).
00171
00172    The address of the set is made into an N_SETV symbol
00173    whose name is the same as the name of the set.
00174    This symbol acts like a N_DATA global symbol
00175    in that it can satisfy undefined external references.  */
00176
00177 /* These appear as input to LD, in a .o file.  */
00178 #define N_SETA  0x14        /* Absolute set element symbol */
00179 #define N_SETT  0x16        /* Text set element symbol */
00180 #define N_SETD  0x18        /* Data set element symbol */
00181 #define N_SETB  0x1A        /* Bss set element symbol */
00182
00183 /* This is output from LD.  */
00184 #define N_SETV  0x1C        /* Pointer to set vector in data area.  */
00185
00186 #ifndef N_RELOCATION_INFO_DECLARED
00187
00188 /* This structure describes a single relocation to be performed.
00189    The text-relocation section of the file is a vector of these structures,
00190    all of which apply to the text section.
00191    Likewise, the data-relocation section applies to the data section.  */
00192
00193 struct relocation_info
00194 {
00195   /* Address (within segment) to be relocated.  */
00196   int r_address;
00197   /* The meaning of r_symbolnum depends on r_extern.  */
00198   unsigned int r_symbolnum:24;
00199   /* Nonzero means value is a pc-relative offset
00200      and it should be relocated for changes in its own address
00201      as well as for changes in the symbol or section specified.  */
00202   unsigned int r_pcrel:1;
00203   /* Length (as exponent of 2) of the field to be relocated.
00204      Thus, a value of 2 indicates 1<<2 bytes.  */
00205   unsigned int r_length:2;
00206   /* 1 => relocate with value of symbol.
00207           r_symbolnum is the index of the symbol
00208       in file's the symbol table.
00209      0 => relocate with the address of a segment.
00210           r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
00211       (the N_EXT bit may be set also, but signifies nothing).  */
00212   unsigned int r_extern:1;
00213   /* Four bits that aren't used, but when writing an object file
00214      it is desirable to clear them.  */
00215   unsigned int r_pad:4;
00216 };
00217 #endif /* no N_RELOCATION_INFO_DECLARED.  */
00218
00219
00220 #endif /* __A_OUT_GNU_H__ */
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/bitmap.c Source File

bitmap.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/bitmap.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /* bitmap.c contains the code that handles the inode and block bitmaps */
00008 #include <string.h>
00009
00010 #include <linux/sched.h>
00011 #include <linux/kernel.h>
00012
00013 #define clear_block(addr) \
00014 __asm__ __volatile__ ("cld\n\t" \
00015     "rep\n\t" \
00016     "stosl" \
00017     ::"a" (0),"c" (BLOCK_SIZE/4),"D" ((long) (addr)))
00018
00019 #define set_bit(nr,addr) ({\
00020 register int res ; \
00021 __asm__ __volatile__("btsl %2,%3\n\tsetb %%al": \
00022 "=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
00023 res;})
00024
00025 #define clear_bit(nr,addr) ({\
00026 register int res ; \
00027 __asm__ __volatile__("btrl %2,%3\n\tsetnb %%al": \
00028 "=a" (res):"0" (0),"r" (nr),"m" (*(addr))); \
00029 res;})
00030
00031 #define find_first_zero(addr) ({ \
00032 int __res; \
00033 __asm__ __volatile__ ("cld\n" \
00034     "1:\tlodsl\n\t" \
00035     "notl %%eax\n\t" \
00036     "bsfl %%eax,%%edx\n\t" \
00037     "je 2f\n\t" \
00038     "addl %%edx,%%ecx\n\t" \
00039     "jmp 3f\n" \
00040     "2:\taddl $32,%%ecx\n\t" \
00041     "cmpl $8192,%%ecx\n\t" \
00042     "jl 1b\n" \
00043     "3:" \
00044     :"=c" (__res):"c" (0),"S" (addr)); \
00045 __res;})
00046
00047 void free_block(int dev, int block)
00048 {
00049     struct super_block * sb;
00050     struct buffer_head * bh;
00051
00052     if (!(sb = get_super(dev)))
00053         panic("trying to free block on nonexistent device");
00054     if (block < sb->s_firstdatazone || block >= sb->s_nzones)
00055         panic("trying to free block not in datazone");
00056     bh = get_hash_table(dev,block);
00057     if (bh) {
00058         if (bh->b_count != 1) {
00059             printk("trying to free block (%04x:%d), count=%d\n",
00060                 dev,block,bh->b_count);
00061             return;
00062         }
00063         bh->b_dirt=0;
00064         bh->b_uptodate=0;
00065         brelse(bh);
00066     }
00067     block -= sb->s_firstdatazone - 1 ;
00068     if (clear_bit(block&8191,sb->s_zmap[block/8192]->b_data)) {
00069         printk("block (%04x:%d) ",dev,block+sb->s_firstdatazone-1);
00070         panic("free_block: bit already cleared");
00071     }
00072     sb->s_zmap[block/8192]->b_dirt = 1;
00073 }
00074
00075 int new_block(int dev)
00076 {
00077     struct buffer_head * bh;
00078     struct super_block * sb;
00079     int i,j;
00080
00081     if (!(sb = get_super(dev)))
00082         panic("trying to get new block from nonexistant device");
00083     j = 8192;
00084     for (i=0 ; i<8 ; i++)
00085         if ((bh=sb->s_zmap[i]))
00086             if ((j=find_first_zero(bh->b_data))<8192)
00087                 break;
00088     if (i>=8 || !bh || j>=8192)
00089         return 0;
00090     if (set_bit(j,bh->b_data))
00091         panic("new_block: bit already set");
00092     bh->b_dirt = 1;
00093     j += i*8192 + sb->s_firstdatazone-1;
00094     if (j >= sb->s_nzones)
00095         return 0;
00096     if (!(bh=getblk(dev,j)))
00097         panic("new_block: cannot get block");
00098     if (bh->b_count != 1)
00099         panic("new block: count is != 1");
00100     clear_block(bh->b_data);
00101     bh->b_uptodate = 1;
00102     bh->b_dirt = 1;
00103     brelse(bh);
00104     return j;
00105 }
00106
00107 void free_inode(struct m_inode * inode)
00108 {
00109     struct super_block * sb;
00110     struct buffer_head * bh;
00111
00112     if (!inode)
00113         return;
00114     if (!inode->i_dev) {
00115         memset(inode,0,sizeof(*inode));
00116         return;
00117     }
00118     if (inode->i_count>1) {
00119         printk("trying to free inode with count=%d\n",inode->i_count);
00120         panic("free_inode");
00121     }
00122     if (inode->i_nlinks)
00123         panic("trying to free inode with links");
00124     if (!(sb = get_super(inode->i_dev)))
00125         panic("trying to free inode on nonexistent device");
00126     if (inode->i_num < 1 || inode->i_num > sb->s_ninodes)
00127         panic("trying to free inode 0 or nonexistant inode");
00128     if (!(bh=sb->s_imap[inode->i_num>>13]))
00129         panic("nonexistent imap in superblock");
00130     if (clear_bit(inode->i_num&8191,bh->b_data))
00131         printk("free_inode: bit already cleared.\n\r");
00132     bh->b_dirt = 1;
00133     memset(inode,0,sizeof(*inode));
00134 }
00135
00136 struct m_inode * new_inode(int dev)
00137 {
00138     struct m_inode * inode;
00139     struct super_block * sb;
00140     struct buffer_head * bh;
00141     int i,j;
00142
00143     if (!(inode=get_empty_inode()))
00144         return NULL;
00145     if (!(sb = get_super(dev)))
00146         panic("new_inode with unknown device");
00147     j = 8192;
00148     for (i=0 ; i<8 ; i++)
00149         if ((bh=sb->s_imap[i]))
00150             if ((j=find_first_zero(bh->b_data))<8192)
00151                 break;
00152     if (!bh || j >= 8192 || j+i*8192 > sb->s_ninodes) {
00153         iput(inode);
00154         return NULL;
00155     }
00156     if (set_bit(j,bh->b_data))
00157         panic("new_inode: bit already set");
00158     bh->b_dirt = 1;
00159     inode->i_count=1;
00160     inode->i_nlinks=1;
00161     inode->i_dev=dev;
00162     inode->i_uid=current->euid;
00163     inode->i_gid=current->egid;
00164     inode->i_dirt=1;
00165     inode->i_num = j + i*8192;
00166     inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
00167     return inode;
00168 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/blk.h Source File

blk.h

Go to the documentation of this file.
00001 #ifndef _BLK_H
00002 #define _BLK_H
00003
00004 #define NR_BLK_DEV  7
00005 /*
00006  * NR_REQUEST is the number of entries in the request-queue.
00007  * NOTE that writes may use only the low 2/3 of these: reads
00008  * take precedence.
00009  *
00010  * 32 seems to be a reasonable number: enough to get some benefit
00011  * from the elevator-mechanism, but not so much as to lock a lot of
00012  * buffers when they are in the queue. 64 seems to be too many (easily
00013  * long pauses in reading when heavy writing/syncing is going on)
00014  */
00015 #define NR_REQUEST  32
00016
00017 /*
00018  * Ok, this is an expanded form so that we can use the same
00019  * request for paging requests when that is implemented. In
00020  * paging, 'bh' is NULL, and 'waiting' is used to wait for
00021  * read/write completion.
00022  */
00023 struct request {
00024     int dev;        /* -1 if no request */
00025     int cmd;        /* READ or WRITE */
00026     int errors;
00027     unsigned long sector;
00028     unsigned long nr_sectors;
00029     char * buffer;
00030     struct task_struct * waiting;
00031     struct buffer_head * bh;
00032     struct request * next;
00033 };
00034
00035 /*
00036  * This is used in the elevator algorithm: Note that
00037  * reads always go before writes. This is natural: reads
00038  * are much more time-critical than writes.
00039  */
00040 #define IN_ORDER(s1,s2) \
00041 ((s1)->cmd<(s2)->cmd || ((s1)->cmd==(s2)->cmd && \
00042 ((s1)->dev < (s2)->dev || ((s1)->dev == (s2)->dev && \
00043 (s1)->sector < (s2)->sector))))
00044
00045 struct blk_dev_struct {
00046     void (*request_fn)(void);
00047     struct request * current_request;
00048 };
00049
00050 extern struct blk_dev_struct blk_dev[NR_BLK_DEV];
00051 extern struct request request[NR_REQUEST];
00052 extern struct task_struct * wait_for_request;
00053
00054 #ifdef MAJOR_NR
00055
00056 /*
00057  * Add entries as needed. Currently the only block devices
00058  * supported are hard-disks and floppies.
00059  */
00060
00061 #if (MAJOR_NR == 1)
00062 /* ram disk */
00063 #define DEVICE_NAME "ramdisk"
00064 #define DEVICE_REQUEST do_rd_request
00065 #define DEVICE_NR(device) ((device) & 7)
00066 #define DEVICE_ON(device)
00067 #define DEVICE_OFF(device)
00068
00069 #elif (MAJOR_NR == 2)
00070 /* floppy */
00071 #define DEVICE_NAME "floppy"
00072 #define DEVICE_INTR do_floppy
00073 #define DEVICE_REQUEST do_fd_request
00074 #define DEVICE_NR(device) ((device) & 3)
00075 #define DEVICE_ON(device) floppy_on(DEVICE_NR(device))
00076 #define DEVICE_OFF(device) floppy_off(DEVICE_NR(device))
00077
00078 #elif (MAJOR_NR == 3)
00079 /* harddisk */
00080 #define DEVICE_NAME "harddisk"
00081 #define DEVICE_INTR do_hd
00082 #define DEVICE_REQUEST do_hd_request
00083 #define DEVICE_NR(device) (MINOR(device)/5)
00084 #define DEVICE_ON(device)
00085 #define DEVICE_OFF(device)
00086
00087 #elif
00088 /* unknown blk device */
00089 #error "unknown blk device"
00090
00091 #endif
00092
00093 #define CURRENT (blk_dev[MAJOR_NR].current_request)
00094 #define CURRENT_DEV DEVICE_NR(CURRENT->dev)
00095
00096 #ifdef DEVICE_INTR
00097 void (*DEVICE_INTR)(void) = NULL;
00098 #endif
00099 static void (DEVICE_REQUEST)(void);
00100
00101 static inline void unlock_buffer(struct buffer_head * bh)
00102 {
00103     if (!bh->b_lock)
00104         printk(DEVICE_NAME ": free buffer being unlocked\n");
00105     bh->b_lock=0;
00106     wake_up(&bh->b_wait);
00107 }
00108
00109 static inline void end_request(int uptodate)
00110 {
00111     DEVICE_OFF(CURRENT->dev);
00112     if (CURRENT->bh) {
00113         CURRENT->bh->b_uptodate = uptodate;
00114         unlock_buffer(CURRENT->bh);
00115     }
00116     if (!uptodate) {
00117         printk(DEVICE_NAME " I/O error\n\r");
00118         printk("dev %04x, block %d\n\r",CURRENT->dev,
00119             CURRENT->bh->b_blocknr);
00120     }
00121     wake_up(&CURRENT->waiting);
00122     wake_up(&wait_for_request);
00123     CURRENT->dev = -1;
00124     CURRENT = CURRENT->next;
00125 }
00126
00127 #define INIT_REQUEST \
00128 repeat: \
00129     if (!CURRENT) \
00130         return; \
00131     if (MAJOR(CURRENT->dev) != MAJOR_NR) \
00132         panic(DEVICE_NAME ": request list destroyed"); \
00133     if (CURRENT->bh) { \
00134         if (!CURRENT->bh->b_lock) \
00135             panic(DEVICE_NAME ": block not locked"); \
00136     }
00137
00138 #endif
00139
00140 #endif
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/block_dev.c Source File

block_dev.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/block_dev.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008
00009 #include <linux/sched.h>
00010 #include <linux/kernel.h>
00011 #include <asm/segment.h>
00012 #include <asm/system.h>
00013
00014 int block_write(int dev, long * pos, char * buf, int count)
00015 {
00016     int block = *pos >> BLOCK_SIZE_BITS;
00017     int offset = *pos & (BLOCK_SIZE-1);
00018     int chars;
00019     int written = 0;
00020     struct buffer_head * bh;
00021     register char * p;
00022
00023     while (count>0) {
00024         chars = BLOCK_SIZE - offset;
00025         if (chars > count)
00026             chars=count;
00027         if (chars == BLOCK_SIZE)
00028             bh = getblk(dev,block);
00029         else
00030             bh = breada(dev,block,block+1,block+2,-1);
00031         block++;
00032         if (!bh)
00033             return written?written:-EIO;
00034         p = offset + bh->b_data;
00035         offset = 0;
00036         *pos += chars;
00037         written += chars;
00038         count -= chars;
00039         while (chars-->0)
00040             *(p++) = get_fs_byte(buf++);
00041         bh->b_dirt = 1;
00042         brelse(bh);
00043     }
00044     return written;
00045 }
00046
00047 int block_read(int dev, unsigned long * pos, char * buf, int count)
00048 {
00049     int block = *pos >> BLOCK_SIZE_BITS;
00050     int offset = *pos & (BLOCK_SIZE-1);
00051     int chars;
00052     int read = 0;
00053     struct buffer_head * bh;
00054     register char * p;
00055
00056     while (count>0) {
00057         chars = BLOCK_SIZE-offset;
00058         if (chars > count)
00059             chars = count;
00060         if (!(bh = breada(dev,block,block+1,block+2,-1)))
00061             return read?read:-EIO;
00062         block++;
00063         p = offset + bh->b_data;
00064         offset = 0;
00065         *pos += chars;
00066         read += chars;
00067         count -= chars;
00068         while (chars-->0)
00069             put_fs_byte(*(p++),buf++);
00070         brelse(bh);
00071     }
00072     return read;
00073 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/buffer.c Source File

buffer.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/buffer.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  *  'buffer.c' implements the buffer-cache functions. Race-conditions have
00009  * been avoided by NEVER letting a interrupt change a buffer (except for the
00010  * data, of course), but instead letting the caller do it. NOTE! As interrupts
00011  * can wake up a caller, some cli-sti sequences are needed to check for
00012  * sleep-on-calls. These should be extremely quick, though (I hope).
00013  */
00014
00015 /*
00016  * NOTE! There is one discordant note here: checking floppies for
00017  * disk change. This is where it fits best, I think, as it should
00018  * invalidate changed floppy-disk-caches.
00019  */
00020
00021 #include <stdarg.h>
00022
00023 #include <linux/config.h>
00024 #include <linux/sched.h>
00025 #include <linux/kernel.h>
00026 #include <asm/system.h>
00027 #include <asm/io.h>
00028
00029 extern int end;
00030 extern void put_super(int);
00031 extern void invalidate_inodes(int);
00032
00033 struct buffer_head * start_buffer = (struct buffer_head *) &end;
00034 struct buffer_head * hash_table[NR_HASH];
00035 static struct buffer_head * free_list;
00036 static struct task_struct * buffer_wait = NULL;
00037 int NR_BUFFERS = 0;
00038
00039 static inline void wait_on_buffer(struct buffer_head * bh)
00040 {
00041     cli();
00042     while (bh->b_lock)
00043         sleep_on(&bh->b_wait);
00044     sti();
00045 }
00046
00047 int sys_sync(void)
00048 {
00049     int i;
00050     struct buffer_head * bh;
00051
00052     sync_inodes();      /* write out inodes into buffers */
00053     bh = start_buffer;
00054     for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
00055         wait_on_buffer(bh);
00056         if (bh->b_dirt)
00057             ll_rw_block(WRITE,bh);
00058     }
00059     return 0;
00060 }
00061
00062 int sync_dev(int dev)
00063 {
00064     int i;
00065     struct buffer_head * bh;
00066
00067     bh = start_buffer;
00068     for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
00069         if (bh->b_dev != dev)
00070             continue;
00071         wait_on_buffer(bh);
00072         if (bh->b_dev == dev && bh->b_dirt)
00073             ll_rw_block(WRITE,bh);
00074     }
00075     sync_inodes();
00076     bh = start_buffer;
00077     for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
00078         if (bh->b_dev != dev)
00079             continue;
00080         wait_on_buffer(bh);
00081         if (bh->b_dev == dev && bh->b_dirt)
00082             ll_rw_block(WRITE,bh);
00083     }
00084     return 0;
00085 }
00086
00087 void inline invalidate_buffers(int dev)
00088 {
00089     int i;
00090     struct buffer_head * bh;
00091
00092     bh = start_buffer;
00093     for (i=0 ; i<NR_BUFFERS ; i++,bh++) {
00094         if (bh->b_dev != dev)
00095             continue;
00096         wait_on_buffer(bh);
00097         if (bh->b_dev == dev)
00098             bh->b_uptodate = bh->b_dirt = 0;
00099     }
00100 }
00101
00102 /*
00103  * This routine checks whether a floppy has been changed, and
00104  * invalidates all buffer-cache-entries in that case. This
00105  * is a relatively slow routine, so we have to try to minimize using
00106  * it. Thus it is called only upon a 'mount' or 'open'. This
00107  * is the best way of combining speed and utility, I think.
00108  * People changing diskettes in the middle of an operation deserve
00109  * to loose :-)
00110  *
00111  * NOTE! Although currently this is only for floppies, the idea is
00112  * that any additional removable block-device will use this routine,
00113  * and that mount/open needn't know that floppies/whatever are
00114  * special.
00115  */
00116 void check_disk_change(int dev)
00117 {
00118     int i;
00119
00120     if (MAJOR(dev) != 2)
00121         return;
00122     if (!floppy_change(dev & 0x03))
00123         return;
00124     for (i=0 ; i<NR_SUPER ; i++)
00125         if (super_block[i].s_dev == dev)
00126             put_super(super_block[i].s_dev);
00127     invalidate_inodes(dev);
00128     invalidate_buffers(dev);
00129 }
00130
00131 #define _hashfn(dev,block) (((unsigned)(dev^block))%NR_HASH)
00132 #define hash(dev,block) hash_table[_hashfn(dev,block)]
00133
00134 static inline void remove_from_queues(struct buffer_head * bh)
00135 {
00136 /* remove from hash-queue */
00137     if (bh->b_next)
00138         bh->b_next->b_prev = bh->b_prev;
00139     if (bh->b_prev)
00140         bh->b_prev->b_next = bh->b_next;
00141     if (hash(bh->b_dev,bh->b_blocknr) == bh)
00142         hash(bh->b_dev,bh->b_blocknr) = bh->b_next;
00143 /* remove from free list */
00144     if (!(bh->b_prev_free) || !(bh->b_next_free))
00145         panic("Free block list corrupted");
00146     bh->b_prev_free->b_next_free = bh->b_next_free;
00147     bh->b_next_free->b_prev_free = bh->b_prev_free;
00148     if (free_list == bh)
00149         free_list = bh->b_next_free;
00150 }
00151
00152 static inline void insert_into_queues(struct buffer_head * bh)
00153 {
00154 /* put at end of free list */
00155     bh->b_next_free = free_list;
00156     bh->b_prev_free = free_list->b_prev_free;
00157     free_list->b_prev_free->b_next_free = bh;
00158     free_list->b_prev_free = bh;
00159 /* put the buffer in new hash-queue if it has a device */
00160     bh->b_prev = NULL;
00161     bh->b_next = NULL;
00162     if (!bh->b_dev)
00163         return;
00164     bh->b_next = hash(bh->b_dev,bh->b_blocknr);
00165     hash(bh->b_dev,bh->b_blocknr) = bh;
00166     bh->b_next->b_prev = bh;
00167 }
00168
00169 static struct buffer_head * find_buffer(int dev, int block)
00170 {
00171     struct buffer_head * tmp;
00172
00173     for (tmp = hash(dev,block) ; tmp != NULL ; tmp = tmp->b_next)
00174         if (tmp->b_dev==dev && tmp->b_blocknr==block)
00175             return tmp;
00176     return NULL;
00177 }
00178
00179 /*
00180  * Why like this, I hear you say... The reason is race-conditions.
00181  * As we don't lock buffers (unless we are readint them, that is),
00182  * something might happen to it while we sleep (ie a read-error
00183  * will force it bad). This shouldn't really happen currently, but
00184  * the code is ready.
00185  */
00186 struct buffer_head * get_hash_table(int dev, int block)
00187 {
00188     struct buffer_head * bh;
00189
00190     for (;;) {
00191         if (!(bh=find_buffer(dev,block)))
00192             return NULL;
00193         bh->b_count++;
00194         wait_on_buffer(bh);
00195         if (bh->b_dev == dev && bh->b_blocknr == block)
00196             return bh;
00197         bh->b_count--;
00198     }
00199 }
00200
00201 /*
00202  * Ok, this is getblk, and it isn't very clear, again to hinder
00203  * race-conditions. Most of the code is seldom used, (ie repeating),
00204  * so it should be much more efficient than it looks.
00205  *
00206  * The algoritm is changed: hopefully better, and an elusive bug removed.
00207  */
00208 #define BADNESS(bh) (((bh)->b_dirt<<1)+(bh)->b_lock)
00209 struct buffer_head * getblk(int dev,int block)
00210 {
00211     struct buffer_head * tmp, * bh;
00212
00213 repeat:
00214     if ((bh = get_hash_table(dev,block)))
00215         return bh;
00216     tmp = free_list;
00217     do {
00218         if (tmp->b_count)
00219             continue;
00220         if (!bh || BADNESS(tmp)<BADNESS(bh)) {
00221             bh = tmp;
00222             if (!BADNESS(tmp))
00223                 break;
00224         }
00225 /* and repeat until we find something good */
00226     } while ((tmp = tmp->b_next_free) != free_list);
00227     if (!bh) {
00228         sleep_on(&buffer_wait);
00229         goto repeat;
00230     }
00231     wait_on_buffer(bh);
00232     if (bh->b_count)
00233         goto repeat;
00234     while (bh->b_dirt) {
00235         sync_dev(bh->b_dev);
00236         wait_on_buffer(bh);
00237         if (bh->b_count)
00238             goto repeat;
00239     }
00240 /* NOTE!! While we slept waiting for this block, somebody else might */
00241 /* already have added "this" block to the cache. check it */
00242     if (find_buffer(dev,block))
00243         goto repeat;
00244 /* OK, FINALLY we know that this buffer is the only one of it's kind, */
00245 /* and that it's unused (b_count=0), unlocked (b_lock=0), and clean */
00246     bh->b_count=1;
00247     bh->b_dirt=0;
00248     bh->b_uptodate=0;
00249     remove_from_queues(bh);
00250     bh->b_dev=dev;
00251     bh->b_blocknr=block;
00252     insert_into_queues(bh);
00253     return bh;
00254 }
00255
00256 void brelse(struct buffer_head * buf)
00257 {
00258     if (!buf)
00259         return;
00260     wait_on_buffer(buf);
00261     if (!(buf->b_count--))
00262         panic("Trying to free free buffer");
00263     wake_up(&buffer_wait);
00264 }
00265
00266 /*
00267  * bread() reads a specified block and returns the buffer that contains
00268  * it. It returns NULL if the block was unreadable.
00269  */
00270 struct buffer_head * bread(int dev,int block)
00271 {
00272     struct buffer_head * bh;
00273
00274     if (!(bh=getblk(dev,block)))
00275         panic("bread: getblk returned NULL\n");
00276     if (bh->b_uptodate)
00277         return bh;
00278     ll_rw_block(READ,bh);
00279     wait_on_buffer(bh);
00280     if (bh->b_uptodate)
00281         return bh;
00282     brelse(bh);
00283     return NULL;
00284 }
00285
00286 #define COPYBLK(from,to) \
00287 __asm__("cld\n\t" \
00288     "rep\n\t" \
00289     "movsl\n\t" \
00290     ::"c" (BLOCK_SIZE/4),"S" (from),"D" (to) \
00291     )
00292
00293 /*
00294  * bread_page reads four buffers into memory at the desired address. It's
00295  * a function of its own, as there is some speed to be got by reading them
00296  * all at the same time, not waiting for one to be read, and then another
00297  * etc.
00298  */
00299 void bread_page(unsigned long address,int dev,int b[4])
00300 {
00301     struct buffer_head * bh[4];
00302     int i;
00303
00304     for (i=0 ; i<4 ; i++)
00305         if (b[i]) {
00306             if ((bh[i] = getblk(dev,b[i])))
00307                 if (!bh[i]->b_uptodate)
00308                     ll_rw_block(READ,bh[i]);
00309         } else
00310             bh[i] = NULL;
00311     for (i=0 ; i<4 ; i++,address += BLOCK_SIZE)
00312         if (bh[i]) {
00313             wait_on_buffer(bh[i]);
00314             if (bh[i]->b_uptodate)
00315                 COPYBLK((unsigned long) bh[i]->b_data,address);
00316             brelse(bh[i]);
00317         }
00318 }
00319
00320 /*
00321  * Ok, breada can be used as bread, but additionally to mark other
00322  * blocks for reading as well. End the argument list with a negative
00323  * number.
00324  */
00325 struct buffer_head * breada(int dev,int first, ...)
00326 {
00327     va_list args;
00328     struct buffer_head * bh, *tmp;
00329
00330     va_start(args,first);
00331     if (!(bh=getblk(dev,first)))
00332         panic("bread: getblk returned NULL\n");
00333     if (!bh->b_uptodate)
00334         ll_rw_block(READ,bh);
00335     while ((first=va_arg(args,int))>=0) {
00336         tmp=getblk(dev,first);
00337         if (tmp) {
00338             if (!tmp->b_uptodate)
00339                 ll_rw_block(READA,bh);
00340             tmp->b_count--;
00341         }
00342     }
00343     va_end(args);
00344     wait_on_buffer(bh);
00345     if (bh->b_uptodate)
00346         return bh;
00347     brelse(bh);
00348     return (NULL);
00349 }
00350
00351 void buffer_init(long buffer_end)
00352 {
00353     struct buffer_head * h = start_buffer;
00354     void * b;
00355     int i;
00356
00357     if (buffer_end == 1<<20)
00358         b = (void *) (640*1024);
00359     else
00360         b = (void *) buffer_end;
00361     while ( (b -= BLOCK_SIZE) >= ((void *) (h+1)) ) {
00362         h->b_dev = 0;
00363         h->b_dirt = 0;
00364         h->b_count = 0;
00365         h->b_lock = 0;
00366         h->b_uptodate = 0;
00367         h->b_wait = NULL;
00368         h->b_next = NULL;
00369         h->b_prev = NULL;
00370         h->b_data = (char *) b;
00371         h->b_prev_free = h-1;
00372         h->b_next_free = h+1;
00373         h++;
00374         NR_BUFFERS++;
00375         if (b == (void *) 0x100000)
00376             b = (void *) 0xA0000;
00377     }
00378     h--;
00379     free_list = start_buffer;
00380     free_list->b_prev_free = h;
00381     h->b_next_free = free_list;
00382     for (i=0;i<NR_HASH;i++)
00383         hash_table[i]=NULL;
00384 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/tools/build.c Source File

build.c

Go to the documentation of this file.
00001 /*
00002  *  linux/tools/build.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * This file builds a disk-image from three different files:
00009  *
00010  * - bootsect: max 510 bytes of 8086 machine code, loads the rest
00011  * - setup: max 4 sectors of 8086 machine code, sets up system parm
00012  * - system: 80386 code for actual system
00013  *
00014  * It does some checking that all files are of the correct type, and
00015  * just writes the result to stdout, removing headers and padding to
00016  * the right amount. It also writes some system data to stderr.
00017  */
00018
00019 /*
00020  * Changes by tytso to allow root device specification
00021  */
00022
00023 #include <stdio.h>  /* fprintf */
00024 #include <string.h>
00025 #include <stdlib.h> /* contains exit */
00026 #include <sys/types.h>  /* unistd.h needs this */
00027 #include <sys/stat.h>
00028 #include <linux/fs.h>
00029 #include <unistd.h> /* contains read/write */
00030 #include <fcntl.h>
00031
00032 #define MINIX_HEADER 32
00033 #define GCC_HEADER 1024
00034
00035 #define SYS_SIZE 0x3000
00036
00037 #define DEFAULT_MAJOR_ROOT 2
00038 #define DEFAULT_MINOR_ROOT 0x1d
00039
00040 /* max nr of sectors of setup: don't change unless you also change
00041  * bootsect etc */
00042 #define SETUP_SECTS 4
00043
00044 #define STRINGIFY(x) #x
00045
00046 void die(char * str)
00047 {
00048     fprintf(stderr,"%s\n",str);
00049     exit(1);
00050 }
00051
00052 void usage(void)
00053 {
00054     die("Usage: build bootsect setup system [rootdev] [> image]");
00055 }
00056
00057 int main(int argc, char ** argv)
00058 {
00059     int i,c,id;
00060     char buf[1024];
00061     char major_root, minor_root;
00062     struct stat sb;
00063
00064     if ((argc != 4) && (argc != 5))
00065         usage();
00066     if (argc == 5) {
00067         if (strcmp(argv[4], "FLOPPY")) {
00068             if (stat(argv[4], &sb)) {
00069                 perror(argv[4]);
00070                 die("Couldn't stat root device.");
00071             }
00072             major_root = MAJOR(sb.st_rdev);
00073             minor_root = MINOR(sb.st_rdev);
00074         } else {
00075             major_root = 0;
00076             minor_root = 0;
00077         }
00078     } else {
00079         major_root = DEFAULT_MAJOR_ROOT;
00080         minor_root = DEFAULT_MINOR_ROOT;
00081     }
00082     fprintf(stderr, "Root device is (%d, %d)\n", major_root, minor_root);
00083     if ((major_root != 2) && (major_root != 3) &&
00084         (major_root != 0)) {
00085         fprintf(stderr, "Illegal root device (major = %d)\n",
00086             major_root);
00087         die("Bad root device --- major #");
00088     }
00089     for (i=0;i<sizeof buf; i++) buf[i]=0;
00090     if ((id=open(argv[1],O_RDONLY,0))<0)
00091         die("Unable to open 'boot'");
00092     if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
00093         die("Unable to read header of 'boot'");
00094     if (((long *) buf)[0]!=0x04100301)
00095         die("Non-Minix header of 'boot'");
00096     if (((long *) buf)[1]!=MINIX_HEADER)
00097         die("Non-Minix header of 'boot'");
00098     if (((long *) buf)[3]!=0)
00099         die("Illegal data segment in 'boot'");
00100     if (((long *) buf)[4]!=0)
00101         die("Illegal bss in 'boot'");
00102     if (((long *) buf)[5] != 0)
00103         die("Non-Minix header of 'boot'");
00104     if (((long *) buf)[7] != 0)
00105         die("Illegal symbol table in 'boot'");
00106     i=read(id,buf,sizeof buf);
00107     fprintf(stderr,"Boot sector %d bytes.\n",i);
00108     if (i != 512)
00109         die("Boot block must be exactly 512 bytes");
00110     if ((*(unsigned short *)(buf+510)) != 0xAA55)
00111         die("Boot block hasn't got boot flag (0xAA55)");
00112     buf[508] = (char) minor_root;
00113     buf[509] = (char) major_root;
00114     i=write(1,buf,512);
00115     if (i!=512)
00116         die("Write call failed");
00117     close (id);
00118
00119     if ((id=open(argv[2],O_RDONLY,0))<0)
00120         die("Unable to open 'setup'");
00121     if (read(id,buf,MINIX_HEADER) != MINIX_HEADER)
00122         die("Unable to read header of 'setup'");
00123     if (((long *) buf)[0]!=0x04100301)
00124         die("Non-Minix header of 'setup'");
00125     if (((long *) buf)[1]!=MINIX_HEADER)
00126         die("Non-Minix header of 'setup'");
00127     if (((long *) buf)[3]!=0)
00128         die("Illegal data segment in 'setup'");
00129     if (((long *) buf)[4]!=0)
00130         die("Illegal bss in 'setup'");
00131     if (((long *) buf)[5] != 0)
00132         die("Non-Minix header of 'setup'");
00133     if (((long *) buf)[7] != 0)
00134         die("Illegal symbol table in 'setup'");
00135     for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
00136         if (write(1,buf,c)!=c)
00137             die("Write call failed");
00138     close (id);
00139     if (i > SETUP_SECTS*512)
00140         die("Setup exceeds " STRINGIFY(SETUP_SECTS)
00141             " sectors - rewrite build/boot/setup");
00142     fprintf(stderr,"Setup is %d bytes.\n",i);
00143     for (c=0 ; c<sizeof(buf) ; c++)
00144         buf[c] = '\0';
00145     while (i<SETUP_SECTS*512) {
00146         c = SETUP_SECTS*512-i;
00147         if (c > sizeof(buf))
00148             c = sizeof(buf);
00149         if (write(1,buf,c) != c)
00150             die("Write call failed");
00151         i += c;
00152     }
00153
00154     if ((id=open(argv[3],O_RDONLY,0))<0)
00155         die("Unable to open 'system'");
00156 //  if (read(id,buf,GCC_HEADER) != GCC_HEADER)
00157 //      die("Unable to read header of 'system'");
00158 //  if (((long *) buf)[5] != 0)
00159 //      die("Non-GCC header of 'system'");
00160     for (i=0 ; (c=read(id,buf,sizeof buf))>0 ; i+=c )
00161         if (write(1,buf,c)!=c)
00162             die("Write call failed");
00163     close(id);
00164     fprintf(stderr,"System is %d bytes.\n",i);
00165     if (i > SYS_SIZE*16)
00166         die("System is too big");
00167     return(0);
00168 }
Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/char_dev.c Source File

char_dev.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/char_dev.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008 #include <sys/types.h>
00009
00010 #include <linux/sched.h>
00011 #include <linux/kernel.h>
00012
00013 #include <asm/segment.h>
00014 #include <asm/io.h>
00015
00016 extern int tty_read(unsigned minor,char * buf,int count);
00017 extern int tty_write(unsigned minor,char * buf,int count);
00018
00019 typedef int (*crw_ptr)(int rw,unsigned minor,char * buf,int count,off_t * pos);
00020
00021 static int rw_ttyx(int rw,unsigned minor,char * buf,int count,off_t * pos)
00022 {
00023     return ((rw==READ)?tty_read(minor,buf,count):
00024         tty_write(minor,buf,count));
00025 }
00026
00027 static int rw_tty(int rw,unsigned minor,char * buf,int count, off_t * pos)
00028 {
00029     if (current->tty<0)
00030         return -EPERM;
00031     return rw_ttyx(rw,current->tty,buf,count,pos);
00032 }
00033
00034 static int rw_ram(int rw,char * buf, int count, off_t *pos)
00035 {
00036     return -EIO;
00037 }
00038
00039 static int rw_mem(int rw,char * buf, int count, off_t * pos)
00040 {
00041     return -EIO;
00042 }
00043
00044 static int rw_kmem(int rw,char * buf, int count, off_t * pos)
00045 {
00046     return -EIO;
00047 }
00048
00049 static int rw_port(int rw,char * buf, int count, off_t * pos)
00050 {
00051     int i=*pos;
00052
00053     while (count-->0 && i<65536) {
00054         if (rw==READ)
00055             put_fs_byte(inb(i),buf++);
00056         else
00057             outb(get_fs_byte(buf++),i);
00058         i++;
00059     }
00060     i -= *pos;
00061     *pos += i;
00062     return i;
00063 }
00064
00065 static int rw_memory(int rw, unsigned minor, char * buf, int count, off_t * pos)
00066 {
00067     switch(minor) {
00068         case 0:
00069             return rw_ram(rw,buf,count,pos);
00070         case 1:
00071             return rw_mem(rw,buf,count,pos);
00072         case 2:
00073             return rw_kmem(rw,buf,count,pos);
00074         case 3:
00075             return (rw==READ)?0:count;  /* rw_null */
00076         case 4:
00077             return rw_port(rw,buf,count,pos);
00078         default:
00079             return -EIO;
00080     }
00081 }
00082
00083 #define NRDEVS ((sizeof (crw_table))/(sizeof (crw_ptr)))
00084
00085 static crw_ptr crw_table[]={
00086     NULL,       /* nodev */
00087     rw_memory,  /* /dev/mem etc */
00088     NULL,       /* /dev/fd */
00089     NULL,       /* /dev/hd */
00090     rw_ttyx,    /* /dev/ttyx */
00091     rw_tty,     /* /dev/tty */
00092     NULL,       /* /dev/lp */
00093     NULL};      /* unnamed pipes */
00094
00095 int rw_char(int rw,int dev, char * buf, int count, off_t * pos)
00096 {
00097     crw_ptr call_addr;
00098
00099     if (MAJOR(dev)>=NRDEVS)
00100         return -ENODEV;
00101     if (!(call_addr=crw_table[MAJOR(dev)]))
00102         return -ENODEV;
00103     return call_addr(rw,MINOR(dev),buf,count,pos);
00104 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/close.c Source File

close.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/close.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009
00010 _syscall1(int,close,int,fd)
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/config.h Source File

config.h

Go to the documentation of this file.
00001 #ifndef _CONFIG_H
00002 #define _CONFIG_H
00003
00004 /*
00005  * The root-device is no longer hard-coded. You can change the default
00006  * root-device by changing the line ROOT_DEV = XXX in boot/bootsect.s
00007  */
00008
00009 /*
00010  * define your keyboard here -
00011  * KBD_FINNISH for Finnish keyboards
00012  * KBD_US for US-type
00013  * KBD_GR for German keyboards
00014  * KBD_FR for Frech keyboard
00015  */
00016 #define KBD_US
00017 /*#define KBD_GR */
00018 /*#define KBD_FR */
00019 /*#define KBD_FINNISH */
00020
00021 /*
00022  * Normally, Linux can get the drive parameters from the BIOS at
00023  * startup, but if this for some unfathomable reason fails, you'd
00024  * be left stranded. For this case, you can define HD_TYPE, which
00025  * contains all necessary info on your harddisk.
00026  *
00027  * The HD_TYPE macro should look like this:
00028  *
00029  * #define HD_TYPE { head, sect, cyl, wpcom, lzone, ctl}
00030  *
00031  * In case of two harddisks, the info should be sepatated by
00032  * commas:
00033  *
00034  * #define HD_TYPE { h,s,c,wpcom,lz,ctl },{ h,s,c,wpcom,lz,ctl }
00035  */
00036 /*
00037  This is an example, two drives, first is type 2, second is type 3:
00038
00039 #define HD_TYPE { 4,17,615,300,615,8 }, { 6,17,615,300,615,0 }
00040
00041  NOTE: ctl is 0 for all drives with heads<=8, and ctl=8 for drives
00042  with more than 8 heads.
00043
00044  If you want the BIOS to tell what kind of drive you have, just
00045  leave HD_TYPE undefined. This is the normal thing to do.
00046 */
00047
00048 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/console.c Source File

console.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/console.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  *  console.c
00009  *
00010  * This module implements the console io functions
00011  *  'void con_init(void)'
00012  *  'void con_write(struct tty_queue * queue)'
00013  * Hopefully this will be a rather complete VT102 implementation.
00014  *
00015  * Beeping thanks to John T Kohl.
00016  */
00017
00018 /*
00019  *  NOTE!!! We sometimes disable and enable interrupts for a short while
00020  * (to put a word in video IO), but this will work even for keyboard
00021  * interrupts. We know interrupts aren't enabled when getting a keyboard
00022  * interrupt, as we use trap-gates. Hopefully all is well.
00023  */
00024
00025 /*
00026  * Code to check for different video-cards mostly by Galen Hunt,
00027  * <g-hunt@ee.utah.edu>
00028  */
00029
00030 #include <linux/sched.h>
00031 #include <linux/tty.h>
00032 #include <asm/io.h>
00033 #include <asm/system.h>
00034
00035 /*
00036  * These are set up by the setup-routine at boot-time:
00037  */
00038
00039 #define ORIG_X          (*(unsigned char *)0x90000)
00040 #define ORIG_Y          (*(unsigned char *)0x90001)
00041 #define ORIG_VIDEO_PAGE     (*(unsigned short *)0x90004)
00042 #define ORIG_VIDEO_MODE     ((*(unsigned short *)0x90006) & 0xff)
00043 #define ORIG_VIDEO_COLS     (((*(unsigned short *)0x90006) & 0xff00) >> 8)
00044 #define ORIG_VIDEO_LINES    (25)
00045 #define ORIG_VIDEO_EGA_AX   (*(unsigned short *)0x90008)
00046 #define ORIG_VIDEO_EGA_BX   (*(unsigned short *)0x9000a)
00047 #define ORIG_VIDEO_EGA_CX   (*(unsigned short *)0x9000c)
00048
00049 #define VIDEO_TYPE_MDA      0x10    /* Monochrome Text Display  */
00050 #define VIDEO_TYPE_CGA      0x11    /* CGA Display          */
00051 #define VIDEO_TYPE_EGAM     0x20    /* EGA/VGA in Monochrome Mode   */
00052 #define VIDEO_TYPE_EGAC     0x21    /* EGA/VGA in Color Mode    */
00053
00054 #define NPAR 16
00055
00056 extern void keyboard_interrupt(void);
00057
00058 static unsigned char    video_type;     /* Type of display being used   */
00059 static unsigned long    video_num_columns;  /* Number of text columns   */
00060 static unsigned long    video_size_row;     /* Bytes per row        */
00061 static unsigned long    video_num_lines;    /* Number of test lines     */
00062 static unsigned char    video_page;     /* Initial video page       */
00063 static unsigned long    video_mem_start;    /* Start of video RAM       */
00064 static unsigned long    video_mem_end;      /* End of video RAM (sort of)   */
00065 static unsigned short   video_port_reg;     /* Video register select port   */
00066 static unsigned short   video_port_val;     /* Video register value port    */
00067 static unsigned short   video_erase_char;   /* Char+Attrib to erase with    */
00068
00069 static unsigned long    origin;     /* Used for EGA/VGA fast scroll */
00070 static unsigned long    scr_end;    /* Used for EGA/VGA fast scroll */
00071 static unsigned long    pos;
00072 static unsigned long    x,y;
00073 static unsigned long    top,bottom;
00074 static unsigned long    state=0;
00075 static unsigned long    npar,par[NPAR];
00076 static unsigned long    ques=0;
00077 static unsigned char    attr=0x07;
00078
00079 static void sysbeep(void);
00080
00081 /*
00082  * this is what the terminal answers to a ESC-Z or csi0c
00083  * query (= vt100 response).
00084  */
00085 #define RESPONSE "\033[?1;2c"
00086
00087 /* NOTE! gotoxy thinks x==video_num_columns is ok */
00088 static inline void gotoxy(unsigned int new_x,unsigned int new_y)
00089 {
00090     if (new_x > video_num_columns || new_y >= video_num_lines)
00091         return;
00092     x=new_x;
00093     y=new_y;
00094     pos=origin + y*video_size_row + (x<<1);
00095 }
00096
00097 static inline void set_origin(void)
00098 {
00099     cli();
00100     outb_p(12, video_port_reg);
00101     outb_p(0xff&((origin-video_mem_start)>>9), video_port_val);
00102     outb_p(13, video_port_reg);
00103     outb_p(0xff&((origin-video_mem_start)>>1), video_port_val);
00104     sti();
00105 }
00106
00107 static void scrup(void)
00108 {
00109     if (video_type == VIDEO_TYPE_EGAC || video_type == VIDEO_TYPE_EGAM)
00110     {
00111         if (!top && bottom == video_num_lines) {
00112             origin += video_size_row;
00113             pos += video_size_row;
00114             scr_end += video_size_row;
00115             if (scr_end > video_mem_end) {
00116                 __asm__("cld\n\t"
00117                     "rep\n\t"
00118                     "movsl\n\t"
00119                     "movl video_num_columns,%1\n\t"
00120                     "rep\n\t"
00121                     "stosw"
00122                     ::"a" (video_erase_char),
00123                     "c" ((video_num_lines-1)*video_num_columns>>1),
00124                     "D" (video_mem_start),
00125                     "S" (origin)
00126                     );
00127                 scr_end -= origin-video_mem_start;
00128                 pos -= origin-video_mem_start;
00129                 origin = video_mem_start;
00130             } else {
00131                 __asm__("cld\n\t"
00132                     "rep\n\t"
00133                     "stosw"
00134                     ::"a" (video_erase_char),
00135                     "c" (video_num_columns),
00136                     "D" (scr_end-video_size_row)
00137                     );
00138             }
00139             set_origin();
00140         } else {
00141             __asm__("cld\n\t"
00142                 "rep\n\t"
00143                 "movsl\n\t"
00144                 "movl video_num_columns,%%ecx\n\t"
00145                 "rep\n\t"
00146                 "stosw"
00147                 ::"a" (video_erase_char),
00148                 "c" ((bottom-top-1)*video_num_columns>>1),
00149                 "D" (origin+video_size_row*top),
00150                 "S" (origin+video_size_row*(top+1))
00151                 );
00152         }
00153     }
00154     else        /* Not EGA/VGA */
00155     {
00156         __asm__("cld\n\t"
00157             "rep\n\t"
00158             "movsl\n\t"
00159             "movl video_num_columns,%%ecx\n\t"
00160             "rep\n\t"
00161             "stosw"
00162             ::"a" (video_erase_char),
00163             "c" ((bottom-top-1)*video_num_columns>>1),
00164             "D" (origin+video_size_row*top),
00165             "S" (origin+video_size_row*(top+1))
00166             );
00167     }
00168 }
00169
00170 static void scrdown(void)
00171 {
00172     if (video_type == VIDEO_TYPE_EGAC || video_type == VIDEO_TYPE_EGAM)
00173     {
00174         __asm__("std\n\t"
00175             "rep\n\t"
00176             "movsl\n\t"
00177             "addl $2,%%edi\n\t" /* %edi has been decremented by 4 */
00178             "movl video_num_columns,%%ecx\n\t"
00179             "rep\n\t"
00180             "stosw"
00181             ::"a" (video_erase_char),
00182             "c" ((bottom-top-1)*video_num_columns>>1),
00183             "D" (origin+video_size_row*bottom-4),
00184             "S" (origin+video_size_row*(bottom-1)-4)
00185             );
00186     }
00187     else        /* Not EGA/VGA */
00188     {
00189         __asm__("std\n\t"
00190             "rep\n\t"
00191             "movsl\n\t"
00192             "addl $2,%%edi\n\t" /* %edi has been decremented by 4 */
00193             "movl video_num_columns,%%ecx\n\t"
00194             "rep\n\t"
00195             "stosw"
00196             ::"a" (video_erase_char),
00197             "c" ((bottom-top-1)*video_num_columns>>1),
00198             "D" (origin+video_size_row*bottom-4),
00199             "S" (origin+video_size_row*(bottom-1)-4)
00200             );
00201     }
00202 }
00203
00204 static void lf(void)
00205 {
00206     if (y+1<bottom) {
00207         y++;
00208         pos += video_size_row;
00209         return;
00210     }
00211     scrup();
00212 }
00213
00214 static void ri(void)
00215 {
00216     if (y>top) {
00217         y--;
00218         pos -= video_size_row;
00219         return;
00220     }
00221     scrdown();
00222 }
00223
00224 static void cr(void)
00225 {
00226     pos -= x<<1;
00227     x=0;
00228 }
00229
00230 static void del(void)
00231 {
00232     if (x) {
00233         pos -= 2;
00234         x--;
00235         *(unsigned short *)pos = video_erase_char;
00236     }
00237 }
00238
00239 static void csi_J(int par)
00240 {
00241     long count;
00242     long start;
00243
00244     switch (par) {
00245         case 0: /* erase from cursor to end of display */
00246             count = (scr_end-pos)>>1;
00247             start = pos;
00248             break;
00249         case 1: /* erase from start to cursor */
00250             count = (pos-origin)>>1;
00251             start = origin;
00252             break;
00253         case 2: /* erase whole display */
00254             count = video_num_columns * video_num_lines;
00255             start = origin;
00256             break;
00257         default:
00258             return;
00259     }
00260     __asm__("cld\n\t"
00261         "rep\n\t"
00262         "stosw\n\t"
00263         ::"c" (count),
00264         "D" (start),"a" (video_erase_char)
00265         );
00266 }
00267
00268 static void csi_K(int par)
00269 {
00270     long count;
00271     long start;
00272
00273     switch (par) {
00274         case 0: /* erase from cursor to end of line */
00275             if (x>=video_num_columns)
00276                 return;
00277             count = video_num_columns-x;
00278             start = pos;
00279             break;
00280         case 1: /* erase from start of line to cursor */
00281             start = pos - (x<<1);
00282             count = (x<video_num_columns)?x:video_num_columns;
00283             break;
00284         case 2: /* erase whole line */
00285             start = pos - (x<<1);
00286             count = video_num_columns;
00287             break;
00288         default:
00289             return;
00290     }
00291     __asm__("cld\n\t"
00292         "rep\n\t"
00293         "stosw\n\t"
00294         ::"c" (count),
00295         "D" (start),"a" (video_erase_char)
00296         );
00297 }
00298
00299 void csi_m(void)
00300 {
00301     int i;
00302
00303     for (i=0;i<=npar;i++)
00304         switch (par[i]) {
00305             case 0:attr=0x07;break;
00306             case 1:attr=0x0f;break;
00307             case 4:attr=0x0f;break;
00308             case 7:attr=0x70;break;
00309             case 27:attr=0x07;break;
00310         }
00311 }
00312
00313 static inline void set_cursor(void)
00314 {
00315     cli();
00316     outb_p(14, video_port_reg);
00317     outb_p(0xff&((pos-video_mem_start)>>9), video_port_val);
00318     outb_p(15, video_port_reg);
00319     outb_p(0xff&((pos-video_mem_start)>>1), video_port_val);
00320     sti();
00321 }
00322
00323 static void respond(struct tty_struct * tty)
00324 {
00325     char * p = RESPONSE;
00326
00327     cli();
00328     while (*p) {
00329         PUTCH(*p,tty->read_q);
00330         p++;
00331     }
00332     sti();
00333     copy_to_cooked(tty);
00334 }
00335
00336 static void insert_char(void)
00337 {
00338     int i=x;
00339     unsigned short tmp, old = video_erase_char;
00340     unsigned short * p = (unsigned short *) pos;
00341
00342     while (i++<video_num_columns) {
00343         tmp=*p;
00344         *p=old;
00345         old=tmp;
00346         p++;
00347     }
00348 }
00349
00350 static void insert_line(void)
00351 {
00352     int oldtop,oldbottom;
00353
00354     oldtop=top;
00355     oldbottom=bottom;
00356     top=y;
00357     bottom = video_num_lines;
00358     scrdown();
00359     top=oldtop;
00360     bottom=oldbottom;
00361 }
00362
00363 static void delete_char(void)
00364 {
00365     int i;
00366     unsigned short * p = (unsigned short *) pos;
00367
00368     if (x>=video_num_columns)
00369         return;
00370     i = x;
00371     while (++i < video_num_columns) {
00372         *p = *(p+1);
00373         p++;
00374     }
00375     *p = video_erase_char;
00376 }
00377
00378 static void delete_line(void)
00379 {
00380     int oldtop,oldbottom;
00381
00382     oldtop=top;
00383     oldbottom=bottom;
00384     top=y;
00385     bottom = video_num_lines;
00386     scrup();
00387     top=oldtop;
00388     bottom=oldbottom;
00389 }
00390
00391 static void csi_at(unsigned int nr)
00392 {
00393     if (nr > video_num_columns)
00394         nr = video_num_columns;
00395     else if (!nr)
00396         nr = 1;
00397     while (nr--)
00398         insert_char();
00399 }
00400
00401 static void csi_L(unsigned int nr)
00402 {
00403     if (nr > video_num_lines)
00404         nr = video_num_lines;
00405     else if (!nr)
00406         nr = 1;
00407     while (nr--)
00408         insert_line();
00409 }
00410
00411 static void csi_P(unsigned int nr)
00412 {
00413     if (nr > video_num_columns)
00414         nr = video_num_columns;
00415     else if (!nr)
00416         nr = 1;
00417     while (nr--)
00418         delete_char();
00419 }
00420
00421 static void csi_M(unsigned int nr)
00422 {
00423     if (nr > video_num_lines)
00424         nr = video_num_lines;
00425     else if (!nr)
00426         nr=1;
00427     while (nr--)
00428         delete_line();
00429 }
00430
00431 static int saved_x=0;
00432 static int saved_y=0;
00433
00434 static void save_cur(void)
00435 {
00436     saved_x=x;
00437     saved_y=y;
00438 }
00439
00440 static void restore_cur(void)
00441 {
00442     gotoxy(saved_x, saved_y);
00443 }
00444
00445 void con_write(struct tty_struct * tty)
00446 {
00447     int nr;
00448     char c;
00449
00450     nr = CHARS(tty->write_q);
00451     while (nr--) {
00452         GETCH(tty->write_q,c);
00453         switch(state) {
00454             case 0:
00455                 if (c>31 && c<127) {
00456                     if (x>=video_num_columns) {
00457                         x -= video_num_columns;
00458                         pos -= video_size_row;
00459                         lf();
00460                     }
00461                     __asm__("movb attr,%%ah\n\t"
00462                         "movw %%ax,%1\n\t"
00463                         ::"a" (c),"m" (*(short *)pos)
00464                         );
00465                     pos += 2;
00466                     x++;
00467                 } else if (c==27)
00468                     state=1;
00469                 else if (c==10 || c==11 || c==12)
00470                     lf();
00471                 else if (c==13)
00472                     cr();
00473                 else if (c==ERASE_CHAR(tty))
00474                     del();
00475                 else if (c==8) {
00476                     if (x) {
00477                         x--;
00478                         pos -= 2;
00479                     }
00480                 } else if (c==9) {
00481                     c=8-(x&7);
00482                     x += c;
00483                     pos += c<<1;
00484                     if (x>video_num_columns) {
00485                         x -= video_num_columns;
00486                         pos -= video_size_row;
00487                         lf();
00488                     }
00489                     c=9;
00490                 } else if (c==7)
00491                     sysbeep();
00492                 break;
00493             case 1:
00494                 state=0;
00495                 if (c=='[')
00496                     state=2;
00497                 else if (c=='E')
00498                     gotoxy(0,y+1);
00499                 else if (c=='M')
00500                     ri();
00501                 else if (c=='D')
00502                     lf();
00503                 else if (c=='Z')
00504                     respond(tty);
00505                 else if (x=='7')
00506                     save_cur();
00507                 else if (x=='8')
00508                     restore_cur();
00509                 break;
00510             case 2:
00511                 for(npar=0;npar<NPAR;npar++)
00512                     par[npar]=0;
00513                 npar=0;
00514                 state=3;
00515                 if ((ques=(c=='?')))
00516                     break;
00517             case 3:
00518                 if (c==';' && npar<NPAR-1) {
00519                     npar++;
00520                     break;
00521                 } else if (c>='0' && c<='9') {
00522                     par[npar]=10*par[npar]+c-'0';
00523                     break;
00524                 } else state=4;
00525             case 4:
00526                 state=0;
00527                 switch(c) {
00528                     case 'G': case '`':
00529                         if (par[0]) par[0]--;
00530                         gotoxy(par[0],y);
00531                         break;
00532                     case 'A':
00533                         if (!par[0]) par[0]++;
00534                         gotoxy(x,y-par[0]);
00535                         break;
00536                     case 'B': case 'e':
00537                         if (!par[0]) par[0]++;
00538                         gotoxy(x,y+par[0]);
00539                         break;
00540                     case 'C': case 'a':
00541                         if (!par[0]) par[0]++;
00542                         gotoxy(x+par[0],y);
00543                         break;
00544                     case 'D':
00545                         if (!par[0]) par[0]++;
00546                         gotoxy(x-par[0],y);
00547                         break;
00548                     case 'E':
00549                         if (!par[0]) par[0]++;
00550                         gotoxy(0,y+par[0]);
00551                         break;
00552                     case 'F':
00553                         if (!par[0]) par[0]++;
00554                         gotoxy(0,y-par[0]);
00555                         break;
00556                     case 'd':
00557                         if (par[0]) par[0]--;
00558                         gotoxy(x,par[0]);
00559                         break;
00560                     case 'H': case 'f':
00561                         if (par[0]) par[0]--;
00562                         if (par[1]) par[1]--;
00563                         gotoxy(par[1],par[0]);
00564                         break;
00565                     case 'J':
00566                         csi_J(par[0]);
00567                         break;
00568                     case 'K':
00569                         csi_K(par[0]);
00570                         break;
00571                     case 'L':
00572                         csi_L(par[0]);
00573                         break;
00574                     case 'M':
00575                         csi_M(par[0]);
00576                         break;
00577                     case 'P':
00578                         csi_P(par[0]);
00579                         break;
00580                     case '@':
00581                         csi_at(par[0]);
00582                         break;
00583                     case 'm':
00584                         csi_m();
00585                         break;
00586                     case 'r':
00587                         if (par[0]) par[0]--;
00588                         if (!par[1]) par[1] = video_num_lines;
00589                         if (par[0] < par[1] &&
00590                             par[1] <= video_num_lines) {
00591                             top=par[0];
00592                             bottom=par[1];
00593                         }
00594                         break;
00595                     case 's':
00596                         save_cur();
00597                         break;
00598                     case 'u':
00599                         restore_cur();
00600                         break;
00601                 }
00602         }
00603     }
00604     set_cursor();
00605 }
00606
00607 /*
00608  *  void con_init(void);
00609  *
00610  * This routine initalizes console interrupts, and does nothing
00611  * else. If you want the screen to clear, call tty_write with
00612  * the appropriate escape-sequece.
00613  *
00614  * Reads the information preserved by setup.s to determine the current display
00615  * type and sets everything accordingly.
00616  */
00617 void con_init(void)
00618 {
00619     register unsigned char a;
00620     char *display_desc = "????";
00621     char *display_ptr;
00622
00623     video_num_columns = ORIG_VIDEO_COLS;
00624     video_size_row = video_num_columns * 2;
00625     video_num_lines = ORIG_VIDEO_LINES;
00626     video_page = ORIG_VIDEO_PAGE;
00627     video_erase_char = 0x0720;
00628
00629     if (ORIG_VIDEO_MODE == 7)           /* Is this a monochrome display? */
00630     {
00631         video_mem_start = 0xb0000;
00632         video_port_reg = 0x3b4;
00633         video_port_val = 0x3b5;
00634         if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
00635         {
00636             video_type = VIDEO_TYPE_EGAM;
00637             video_mem_end = 0xb8000;
00638             display_desc = "EGAm";
00639         }
00640         else
00641         {
00642             video_type = VIDEO_TYPE_MDA;
00643             video_mem_end   = 0xb2000;
00644             display_desc = "*MDA";
00645         }
00646     }
00647     else                                /* If not, it is color. */
00648     {
00649         video_mem_start = 0xb8000;
00650         video_port_reg  = 0x3d4;
00651         video_port_val  = 0x3d5;
00652         if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10)
00653         {
00654             video_type = VIDEO_TYPE_EGAC;
00655             video_mem_end = 0xbc000;
00656             display_desc = "EGAc";
00657         }
00658         else
00659         {
00660             video_type = VIDEO_TYPE_CGA;
00661             video_mem_end = 0xba000;
00662             display_desc = "*CGA";
00663         }
00664     }
00665
00666     /* Let the user known what kind of display driver we are using */
00667
00668     display_ptr = ((char *)video_mem_start) + video_size_row - 8;
00669     while (*display_desc)
00670     {
00671         *display_ptr++ = *display_desc++;
00672         display_ptr++;
00673     }
00674
00675     /* Initialize the variables used for scrolling (mostly EGA/VGA) */
00676
00677     origin  = video_mem_start;
00678     scr_end = video_mem_start + video_num_lines * video_size_row;
00679     top = 0;
00680     bottom  = video_num_lines;
00681
00682     gotoxy(ORIG_X,ORIG_Y);
00683     set_trap_gate(0x21,&keyboard_interrupt);
00684     outb_p(inb_p(0x21)&0xfd,0x21);
00685     a=inb_p(0x61);
00686     outb_p(a|0x80,0x61);
00687     outb(a,0x61);
00688 }
00689 /* from bsd-net-2: */
00690
00691 void sysbeepstop(void)
00692 {
00693     /* disable counter 2 */
00694     outb(inb_p(0x61)&0xFC, 0x61);
00695 }
00696
00697 int beepcount = 0;
00698
00699 static void sysbeep(void)
00700 {
00701     /* enable counter 2 */
00702     outb_p(inb_p(0x61)|3, 0x61);
00703     /* set command for counter 2, 2 byte write */
00704     outb_p(0xB6, 0x43);
00705     /* send 0x637 for 750 HZ */
00706     outb_p(0x37, 0x42);
00707     outb(0x06, 0x42);
00708     /* 1/8 second */
00709     beepcount = HZ/8;
00710 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/const.h Source File

const.h

Go to the documentation of this file.
00001 #ifndef _CONST_H
00002 #define _CONST_H
00003
00004 #define BUFFER_END 0x200000
00005
00006 #define I_TYPE          0170000
00007 #define I_DIRECTORY 0040000
00008 #define I_REGULAR       0100000
00009 #define I_BLOCK_SPECIAL 0060000
00010 #define I_CHAR_SPECIAL  0020000
00011 #define I_NAMED_PIPE    0010000
00012 #define I_SET_UID_BIT   0004000
00013 #define I_SET_GID_BIT   0002000
00014
00015 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/ctype.c Source File

ctype.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/ctype.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <ctype.h>
00008
00009 char _ctmp;
00010 unsigned char _ctype[] = {0x00,         /* EOF */
00011 _C,_C,_C,_C,_C,_C,_C,_C,            /* 0-7 */
00012 _C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,     /* 8-15 */
00013 _C,_C,_C,_C,_C,_C,_C,_C,            /* 16-23 */
00014 _C,_C,_C,_C,_C,_C,_C,_C,            /* 24-31 */
00015 _S|_SP,_P,_P,_P,_P,_P,_P,_P,            /* 32-39 */
00016 _P,_P,_P,_P,_P,_P,_P,_P,            /* 40-47 */
00017 _D,_D,_D,_D,_D,_D,_D,_D,            /* 48-55 */
00018 _D,_D,_P,_P,_P,_P,_P,_P,            /* 56-63 */
00019 _P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,  /* 64-71 */
00020 _U,_U,_U,_U,_U,_U,_U,_U,            /* 72-79 */
00021 _U,_U,_U,_U,_U,_U,_U,_U,            /* 80-87 */
00022 _U,_U,_U,_P,_P,_P,_P,_P,            /* 88-95 */
00023 _P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,  /* 96-103 */
00024 _L,_L,_L,_L,_L,_L,_L,_L,            /* 104-111 */
00025 _L,_L,_L,_L,_L,_L,_L,_L,            /* 112-119 */
00026 _L,_L,_L,_P,_P,_P,_P,_C,            /* 120-127 */
00027 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 128-143 */
00028 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 144-159 */
00029 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 160-175 */
00030 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 176-191 */
00031 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 192-207 */
00032 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 208-223 */
00033 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,        /* 224-239 */
00034 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};       /* 240-255 */
00035
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/ctype.h Source File

ctype.h

Go to the documentation of this file.
00001 #ifndef _CTYPE_H
00002 #define _CTYPE_H
00003
00004 #define _U  0x01    /* upper */
00005 #define _L  0x02    /* lower */
00006 #define _D  0x04    /* digit */
00007 #define _C  0x08    /* cntrl */
00008 #define _P  0x10    /* punct */
00009 #define _S  0x20    /* white space (space/lf/tab) */
00010 #define _X  0x40    /* hex digit */
00011 #define _SP 0x80    /* hard space (0x20) */
00012
00013 extern unsigned char _ctype[];
00014 extern char _ctmp;
00015
00016 #define isalnum(c) ((_ctype+1)[c]&(_U|_L|_D))
00017 #define isalpha(c) ((_ctype+1)[c]&(_U|_L))
00018 #define iscntrl(c) ((_ctype+1)[c]&(_C))
00019 #define isdigit(c) ((_ctype+1)[c]&(_D))
00020 #define isgraph(c) ((_ctype+1)[c]&(_P|_U|_L|_D))
00021 #define islower(c) ((_ctype+1)[c]&(_L))
00022 #define isprint(c) ((_ctype+1)[c]&(_P|_U|_L|_D|_SP))
00023 #define ispunct(c) ((_ctype+1)[c]&(_P))
00024 #define isspace(c) ((_ctype+1)[c]&(_S))
00025 #define isupper(c) ((_ctype+1)[c]&(_U))
00026 #define isxdigit(c) ((_ctype+1)[c]&(_D|_X))
00027
00028 #define isascii(c) (((unsigned) c)<=0x7f)
00029 #define toascii(c) (((unsigned) c)&0x7f)
00030
00031 #define tolower(c) (_ctmp=c,isupper(_ctmp)?_ctmp-('A'-'a'):_ctmp)
00032 #define toupper(c) (_ctmp=c,islower(_ctmp)?_ctmp-('a'-'A'):_ctmp)
00033
00034 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/dup.c Source File

dup.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/dup.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009
00010 _syscall1(int,dup,int,fd)
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/errno.c Source File

errno.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/errno.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 int errno;
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/errno.h Source File

errno.h

Go to the documentation of this file.
00001 #ifndef _ERRNO_H
00002 #define _ERRNO_H
00003
00004 /*
00005  * ok, as I hadn't got any other source of information about
00006  * possible error numbers, I was forced to use the same numbers
00007  * as minix.
00008  * Hopefully these are posix or something. I wouldn't know (and posix
00009  * isn't telling me - they want $$$ for their f***ing standard).
00010  *
00011  * We don't use the _SIGN cludge of minix, so kernel returns must
00012  * see to the sign by themselves.
00013  *
00014  * NOTE! Remember to change strerror() if you change this file!
00015  */
00016
00017 extern int errno;
00018
00019 #define ERROR       99
00020 #define EPERM        1
00021 #define ENOENT       2
00022 #define ESRCH        3
00023 #define EINTR        4
00024 #define EIO      5
00025 #define ENXIO        6
00026 #define E2BIG        7
00027 #define ENOEXEC      8
00028 #define EBADF        9
00029 #define ECHILD      10
00030 #define EAGAIN      11
00031 #define ENOMEM      12
00032 #define EACCES      13
00033 #define EFAULT      14
00034 #define ENOTBLK     15
00035 #define EBUSY       16
00036 #define EEXIST      17
00037 #define EXDEV       18
00038 #define ENODEV      19
00039 #define ENOTDIR     20
00040 #define EISDIR      21
00041 #define EINVAL      22
00042 #define ENFILE      23
00043 #define EMFILE      24
00044 #define ENOTTY      25
00045 #define ETXTBSY     26
00046 #define EFBIG       27
00047 #define ENOSPC      28
00048 #define ESPIPE      29
00049 #define EROFS       30
00050 #define EMLINK      31
00051 #define EPIPE       32
00052 #define EDOM        33
00053 #define ERANGE      34
00054 #define EDEADLK     35
00055 #define ENAMETOOLONG    36
00056 #define ENOLCK      37
00057 #define ENOSYS      38
00058 #define ENOTEMPTY   39
00059
00060 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/exec.c Source File

exec.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/exec.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * #!-checking implemented by tytso.
00009  */
00010
00011 /*
00012  * Demand-loading implemented 01.12.91 - no need to read anything but
00013  * the header into memory. The inode of the executable is put into
00014  * "current->executable", and page faults do the actual loading. Clean.
00015  *
00016  * Once more I can proudly say that linux stood up to being changed: it
00017  * was less than 2 hours work to get demand-loading completely implemented.
00018  */
00019
00020 #include <errno.h>
00021 #include <string.h>
00022 #include <sys/stat.h>
00023 #include <a.out.h>
00024
00025 #include <linux/fs.h>
00026 #include <linux/sched.h>
00027 #include <linux/kernel.h>
00028 #include <linux/mm.h>
00029 #include <asm/segment.h>
00030
00031 extern int sys_exit(int exit_code);
00032 extern int sys_close(int fd);
00033
00034 /*
00035  * MAX_ARG_PAGES defines the number of pages allocated for arguments
00036  * and envelope for the new program. 32 should suffice, this gives
00037  * a maximum env+arg of 128kB !
00038  */
00039 #define MAX_ARG_PAGES 32
00040
00041 /*
00042  * create_tables() parses the env- and arg-strings in new user
00043  * memory and creates the pointer tables from them, and puts their
00044  * addresses on the "stack", returning the new stack pointer value.
00045  */
00046 static unsigned long * create_tables(char * p,int argc,int envc)
00047 {
00048     unsigned long *argv,*envp;
00049     unsigned long * sp;
00050
00051     sp = (unsigned long *) (0xfffffffc & (unsigned long) p);
00052     sp -= envc+1;
00053     envp = sp;
00054     sp -= argc+1;
00055     argv = sp;
00056     put_fs_long((unsigned long)envp,--sp);
00057     put_fs_long((unsigned long)argv,--sp);
00058     put_fs_long((unsigned long)argc,--sp);
00059     while (argc-->0) {
00060         put_fs_long((unsigned long) p,argv++);
00061         while (get_fs_byte(p++)) /* nothing */ ;
00062     }
00063     put_fs_long(0,argv);
00064     while (envc-->0) {
00065         put_fs_long((unsigned long) p,envp++);
00066         while (get_fs_byte(p++)) /* nothing */ ;
00067     }
00068     put_fs_long(0,envp);
00069     return sp;
00070 }
00071
00072 /*
00073  * count() counts the number of arguments/envelopes
00074  */
00075 static int count(char ** argv)
00076 {
00077     int i=0;
00078     char ** tmp;
00079
00080     if ((tmp = argv))
00081         while (get_fs_long((unsigned long *) (tmp++)))
00082             i++;
00083
00084     return i;
00085 }
00086
00087 /*
00088  * 'copy_string()' copies argument/envelope strings from user
00089  * memory to free pages in kernel mem. These are in a format ready
00090  * to be put directly into the top of new user memory.
00091  *
00092  * Modified by TYT, 11/24/91 to add the from_kmem argument, which specifies
00093  * whether the string and the string array are from user or kernel segments:
00094  *
00095  * from_kmem     argv *        argv **
00096  *    0          user space    user space
00097  *    1          kernel space  user space
00098  *    2          kernel space  kernel space
00099  *
00100  * We do this by playing games with the fs segment register.  Since it
00101  * it is expensive to load a segment register, we try to avoid calling
00102  * set_fs() unless we absolutely have to.
00103  */
00104 static unsigned long copy_strings(int argc,char ** argv,unsigned long *page,
00105         unsigned long p, int from_kmem)
00106 {
00107     char *tmp, *pag=NULL;
00108     int len, offset = 0;
00109     unsigned long old_fs, new_fs;
00110
00111     if (!p)
00112         return 0;   /* bullet-proofing */
00113     new_fs = get_ds();
00114     old_fs = get_fs();
00115     if (from_kmem==2)
00116         set_fs(new_fs);
00117     while (argc-- > 0) {
00118         if (from_kmem == 1)
00119             set_fs(new_fs);
00120         if (!(tmp = (char *)get_fs_long(((unsigned long *)argv)+argc)))
00121             panic("argc is wrong");
00122         if (from_kmem == 1)
00123             set_fs(old_fs);
00124         len=0;      /* remember zero-padding */
00125         do {
00126             len++;
00127         } while (get_fs_byte(tmp++));
00128         if (p-len < 0) {    /* this shouldn't happen - 128kB */
00129             set_fs(old_fs);
00130             return 0;
00131         }
00132         while (len) {
00133             --p; --tmp; --len;
00134             if (--offset < 0) {
00135                 offset = p % PAGE_SIZE;
00136                 if (from_kmem==2)
00137                     set_fs(old_fs);
00138                 if (!(pag = (char *) page[p/PAGE_SIZE]) &&
00139                     !(pag = (char *) page[p/PAGE_SIZE] =
00140                       (unsigned long *) get_free_page()))
00141                     return 0;
00142                 if (from_kmem==2)
00143                     set_fs(new_fs);
00144
00145             }
00146             *(pag + offset) = get_fs_byte(tmp);
00147         }
00148     }
00149     if (from_kmem==2)
00150         set_fs(old_fs);
00151     return p;
00152 }
00153
00154 static unsigned long change_ldt(unsigned long text_size,unsigned long * page)
00155 {
00156     unsigned long code_limit,data_limit,code_base,data_base;
00157     int i;
00158
00159     code_limit = text_size+PAGE_SIZE -1;
00160     code_limit &= 0xFFFFF000;
00161     data_limit = 0x4000000;
00162     code_base = get_base(current->ldt[1]);
00163     data_base = code_base;
00164     set_base(current->ldt[1],code_base);
00165     set_limit(current->ldt[1],code_limit);
00166     set_base(current->ldt[2],data_base);
00167     set_limit(current->ldt[2],data_limit);
00168 /* make sure fs points to the NEW data segment */
00169     __asm__("pushl $0x17\n\tpop %%fs"::);
00170     data_base += data_limit;
00171     for (i=MAX_ARG_PAGES-1 ; i>=0 ; i--) {
00172         data_base -= PAGE_SIZE;
00173         if (page[i])
00174             put_page(page[i],data_base);
00175     }
00176     return data_limit;
00177 }
00178
00179 /*
00180  * 'do_execve()' executes a new program.
00181  */
00182 int do_execve(unsigned long * eip,long tmp,char * filename,
00183     char ** argv, char ** envp)
00184 {
00185     struct m_inode * inode;
00186     struct buffer_head * bh;
00187     struct exec ex;
00188     unsigned long page[MAX_ARG_PAGES];
00189     int i,argc,envc;
00190     int e_uid, e_gid;
00191     int retval;
00192     int sh_bang = 0;
00193     unsigned long p=PAGE_SIZE*MAX_ARG_PAGES-4;
00194
00195     if ((0xffff & eip[1]) != 0x000f)
00196         panic("execve called from supervisor mode");
00197     for (i=0 ; i<MAX_ARG_PAGES ; i++)   /* clear page-table */
00198         page[i]=0;
00199     if (!(inode=namei(filename)))       /* get executables inode */
00200         return -ENOENT;
00201     argc = count(argv);
00202     envc = count(envp);
00203
00204 restart_interp:
00205     if (!S_ISREG(inode->i_mode)) {  /* must be regular file */
00206         retval = -EACCES;
00207         goto exec_error2;
00208     }
00209     i = inode->i_mode;
00210     e_uid = (i & S_ISUID) ? inode->i_uid : current->euid;
00211     e_gid = (i & S_ISGID) ? inode->i_gid : current->egid;
00212     if (current->euid == inode->i_uid)
00213         i >>= 6;
00214     else if (current->egid == inode->i_gid)
00215         i >>= 3;
00216     if (!(i & 1) &&
00217         !((inode->i_mode & 0111) && suser())) {
00218         retval = -ENOEXEC;
00219         goto exec_error2;
00220     }
00221     if (!(bh = bread(inode->i_dev,inode->i_zone[0]))) {
00222         retval = -EACCES;
00223         goto exec_error2;
00224     }
00225     ex = *((struct exec *) bh->b_data); /* read exec-header */
00226     if ((bh->b_data[0] == '#') && (bh->b_data[1] == '!') && (!sh_bang)) {
00227         /*
00228          * This section does the #! interpretation.
00229          * Sorta complicated, but hopefully it will work.  -TYT
00230          */
00231
00232         char buf[1023], *cp, *interp, *i_name, *i_arg;
00233         unsigned long old_fs;
00234
00235         strncpy(buf, bh->b_data+2, 1022);
00236         brelse(bh);
00237         iput(inode);
00238         buf[1022] = '\0';
00239         if ((cp = strchr(buf, '\n'))) {
00240             *cp = '\0';
00241             for (cp = buf; (*cp == ' ') || (*cp == '\t'); cp++);
00242         }
00243         if (!cp || *cp == '\0') {
00244             retval = -ENOEXEC; /* No interpreter name found */
00245             goto exec_error1;
00246         }
00247         interp = i_name = cp;
00248         i_arg = 0;
00249         for ( ; *cp && (*cp != ' ') && (*cp != '\t'); cp++) {
00250             if (*cp == '/')
00251                 i_name = cp+1;
00252         }
00253         if (*cp) {
00254             *cp++ = '\0';
00255             i_arg = cp;
00256         }
00257         /*
00258          * OK, we've parsed out the interpreter name and
00259          * (optional) argument.
00260          */
00261         if (sh_bang++ == 0) {
00262             p = copy_strings(envc, envp, page, p, 0);
00263             p = copy_strings(--argc, argv+1, page, p, 0);
00264         }
00265         /*
00266          * Splice in (1) the interpreter's name for argv[0]
00267          *           (2) (optional) argument to interpreter
00268          *           (3) filename of shell script
00269          *
00270          * This is done in reverse order, because of how the
00271          * user environment and arguments are stored.
00272          */
00273         p = copy_strings(1, &filename, page, p, 1);
00274         argc++;
00275         if (i_arg) {
00276             p = copy_strings(1, &i_arg, page, p, 2);
00277             argc++;
00278         }
00279         p = copy_strings(1, &i_name, page, p, 2);
00280         argc++;
00281         if (!p) {
00282             retval = -ENOMEM;
00283             goto exec_error1;
00284         }
00285         /*
00286          * OK, now restart the process with the interpreter's inode.
00287          */
00288         old_fs = get_fs();
00289         set_fs(get_ds());
00290         if (!(inode=namei(interp))) { /* get executables inode */
00291             set_fs(old_fs);
00292             retval = -ENOENT;
00293             goto exec_error1;
00294         }
00295         set_fs(old_fs);
00296         goto restart_interp;
00297     }
00298     brelse(bh);
00299     if (N_MAGIC(ex) != ZMAGIC || ex.a_trsize || ex.a_drsize ||
00300         ex.a_text+ex.a_data+ex.a_bss>0x3000000 ||
00301         inode->i_size < ex.a_text+ex.a_data+ex.a_syms+N_TXTOFF(ex)) {
00302         retval = -ENOEXEC;
00303         goto exec_error2;
00304     }
00305     if (N_TXTOFF(ex) != BLOCK_SIZE) {
00306         printk("%s: N_TXTOFF != BLOCK_SIZE. See a.out.h.", filename);
00307         retval = -ENOEXEC;
00308         goto exec_error2;
00309     }
00310     if (!sh_bang) {
00311         p = copy_strings(envc,envp,page,p,0);
00312         p = copy_strings(argc,argv,page,p,0);
00313         if (!p) {
00314             retval = -ENOMEM;
00315             goto exec_error2;
00316         }
00317     }
00318 /* OK, This is the point of no return */
00319     if (current->executable)
00320         iput(current->executable);
00321     current->executable = inode;
00322     for (i=0 ; i<32 ; i++)
00323         current->sigaction[i].sa_handler = NULL;
00324     for (i=0 ; i<NR_OPEN ; i++)
00325         if ((current->close_on_exec>>i)&1)
00326             sys_close(i);
00327     current->close_on_exec = 0;
00328     free_page_tables(get_base(current->ldt[1]),get_limit(0x0f));
00329     free_page_tables(get_base(current->ldt[2]),get_limit(0x17));
00330     if (last_task_used_math == current)
00331         last_task_used_math = NULL;
00332     current->used_math = 0;
00333     p += change_ldt(ex.a_text,page)-MAX_ARG_PAGES*PAGE_SIZE;
00334     p = (unsigned long) create_tables((char *)p,argc,envc);
00335     current->brk = ex.a_bss +
00336         (current->end_data = ex.a_data +
00337         (current->end_code = ex.a_text));
00338     current->start_stack = p & 0xfffff000;
00339     current->euid = e_uid;
00340     current->egid = e_gid;
00341     i = ex.a_text+ex.a_data;
00342     while (i&0xfff)
00343         put_fs_byte(0,(char *) (i++));
00344     eip[0] = ex.a_entry;        /* eip, magic happens :-) */
00345     eip[3] = p;         /* stack pointer */
00346     return 0;
00347 exec_error2:
00348     iput(inode);
00349 exec_error1:
00350     for (i=0 ; i<MAX_ARG_PAGES ; i++)
00351         free_page(page[i]);
00352     return(retval);
00353 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/execve.c Source File

execve.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/execve.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009
00010 _syscall3(int,execve,const char *,file,char **,argv,char **,envp)
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/exit.c Source File

exit.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/exit.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008 #include <signal.h>
00009 #include <sys/wait.h>
00010
00011 #include <linux/sched.h>
00012 #include <linux/kernel.h>
00013 #include <linux/tty.h>
00014 #include <asm/segment.h>
00015
00016 int sys_pause(void);
00017 int sys_close(int fd);
00018
00019 void release(struct task_struct * p)
00020 {
00021     int i;
00022
00023     if (!p)
00024         return;
00025     for (i=1 ; i<NR_TASKS ; i++)
00026         if (task[i]==p) {
00027             task[i]=NULL;
00028             free_page((long)p);
00029             schedule();
00030             return;
00031         }
00032     panic("trying to release non-existent task");
00033 }
00034
00035 static inline int send_sig(long sig,struct task_struct * p,int priv)
00036 {
00037     if (!p || sig<1 || sig>32)
00038         return -EINVAL;
00039     if (priv || (current->euid==p->euid) || suser())
00040         p->signal |= (1<<(sig-1));
00041     else
00042         return -EPERM;
00043     return 0;
00044 }
00045
00046 static void kill_session(void)
00047 {
00048     struct task_struct **p = NR_TASKS + task;
00049
00050     while (--p > &FIRST_TASK) {
00051         if (*p && (*p)->session == current->session)
00052             (*p)->signal |= 1<<(SIGHUP-1);
00053     }
00054 }
00055
00056 /*
00057  * XXX need to check permissions needed to send signals to process
00058  * groups, etc. etc.  kill() permissions semantics are tricky!
00059  */
00060 int sys_kill(int pid,int sig)
00061 {
00062     struct task_struct **p = NR_TASKS + task;
00063     int err, retval = 0;
00064
00065     if (!pid) while (--p > &FIRST_TASK) {
00066         if (*p && (*p)->pgrp == current->pid)
00067             if ((err=send_sig(sig,*p,1)))
00068                 retval = err;
00069     } else if (pid>0) while (--p > &FIRST_TASK) {
00070         if (*p && (*p)->pid == pid)
00071             if ((err=send_sig(sig,*p,0)))
00072                 retval = err;
00073     } else if (pid == -1) while (--p > &FIRST_TASK) {
00074         if ((err = send_sig(sig,*p,0)))
00075             retval = err;
00076     } else while (--p > &FIRST_TASK)
00077         if (*p && (*p)->pgrp == -pid)
00078             if ((err = send_sig(sig,*p,0)))
00079                 retval = err;
00080     return retval;
00081 }
00082
00083 static void tell_father(int pid)
00084 {
00085     int i;
00086
00087     if (pid)
00088         for (i=0;i<NR_TASKS;i++) {
00089             if (!task[i])
00090                 continue;
00091             if (task[i]->pid != pid)
00092                 continue;
00093             task[i]->signal |= (1<<(SIGCHLD-1));
00094             return;
00095         }
00096 /* if we don't find any fathers, we just release ourselves */
00097 /* This is not really OK. Must change it to make father 1 */
00098     printk("BAD BAD - no father found\n\r");
00099     release(current);
00100 }
00101
00102 int do_exit(long code)
00103 {
00104     int i;
00105     free_page_tables(get_base(current->ldt[1]),get_limit(0x0f));
00106     free_page_tables(get_base(current->ldt[2]),get_limit(0x17));
00107     for (i=0 ; i<NR_TASKS ; i++)
00108         if (task[i] && task[i]->father == current->pid) {
00109             task[i]->father = 1;
00110             if (task[i]->state == TASK_ZOMBIE)
00111                 /* assumption task[1] is always init */
00112                 (void) send_sig(SIGCHLD, task[1], 1);
00113         }
00114     for (i=0 ; i<NR_OPEN ; i++)
00115         if (current->filp[i])
00116             sys_close(i);
00117     iput(current->pwd);
00118     current->pwd=NULL;
00119     iput(current->root);
00120     current->root=NULL;
00121     iput(current->executable);
00122     current->executable=NULL;
00123     if (current->leader && current->tty >= 0)
00124         tty_table[current->tty].pgrp = 0;
00125     if (last_task_used_math == current)
00126         last_task_used_math = NULL;
00127     if (current->leader)
00128         kill_session();
00129     current->state = TASK_ZOMBIE;
00130     current->exit_code = code;
00131     tell_father(current->father);
00132     schedule();
00133     return (-1);    /* just to suppress warnings */
00134 }
00135
00136 int sys_exit(int error_code)
00137 {
00138     return do_exit((error_code&0xff)<<8);
00139 }
00140
00141 int sys_waitpid(pid_t pid,unsigned long * stat_addr, int options)
00142 {
00143     int flag, code;
00144     struct task_struct ** p;
00145
00146     verify_area(stat_addr,4);
00147 repeat:
00148     flag=0;
00149     for(p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
00150         if (!*p || *p == current)
00151             continue;
00152         if ((*p)->father != current->pid)
00153             continue;
00154         if (pid>0) {
00155             if ((*p)->pid != pid)
00156                 continue;
00157         } else if (!pid) {
00158             if ((*p)->pgrp != current->pgrp)
00159                 continue;
00160         } else if (pid != -1) {
00161             if ((*p)->pgrp != -pid)
00162                 continue;
00163         }
00164         switch ((*p)->state) {
00165             case TASK_STOPPED:
00166                 if (!(options & WUNTRACED))
00167                     continue;
00168                 put_fs_long(0x7f,stat_addr);
00169                 return (*p)->pid;
00170             case TASK_ZOMBIE:
00171                 current->cutime += (*p)->utime;
00172                 current->cstime += (*p)->stime;
00173                 flag = (*p)->pid;
00174                 code = (*p)->exit_code;
00175                 release(*p);
00176                 put_fs_long(code,stat_addr);
00177                 return flag;
00178             default:
00179                 flag=1;
00180                 continue;
00181         }
00182     }
00183     if (flag) {
00184         if (options & WNOHANG)
00185             return 0;
00186         current->state=TASK_INTERRUPTIBLE;
00187         schedule();
00188         if (!(current->signal &= ~(1<<(SIGCHLD-1))))
00189             goto repeat;
00190         else
00191             return -EINTR;
00192     }
00193     return -ECHILD;
00194 }
00195
00196
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/fcntl.c Source File

fcntl.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/fcntl.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /* #include <string.h> */
00008 #include <errno.h>
00009 #include <linux/sched.h>
00010 #include <linux/kernel.h>
00011 #include <asm/segment.h>
00012
00013 #include <fcntl.h>
00014 #include <sys/stat.h>
00015
00016 extern int sys_close(int fd);
00017
00018 static int dupfd(unsigned int fd, unsigned int arg)
00019 {
00020     if (fd >= NR_OPEN || !current->filp[fd])
00021         return -EBADF;
00022     if (arg >= NR_OPEN)
00023         return -EINVAL;
00024     while (arg < NR_OPEN)
00025         if (current->filp[arg])
00026             arg++;
00027         else
00028             break;
00029     if (arg >= NR_OPEN)
00030         return -EMFILE;
00031     current->close_on_exec &= ~(1<<arg);
00032     (current->filp[arg] = current->filp[fd])->f_count++;
00033     return arg;
00034 }
00035
00036 int sys_dup2(unsigned int oldfd, unsigned int newfd)
00037 {
00038     sys_close(newfd);
00039     return dupfd(oldfd,newfd);
00040 }
00041
00042 int sys_dup(unsigned int fildes)
00043 {
00044     return dupfd(fildes,0);
00045 }
00046
00047 int sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg)
00048 {
00049     struct file * filp;
00050
00051     if (fd >= NR_OPEN || !(filp = current->filp[fd]))
00052         return -EBADF;
00053     switch (cmd) {
00054         case F_DUPFD:
00055             return dupfd(fd,arg);
00056         case F_GETFD:
00057             return (current->close_on_exec>>fd)&1;
00058         case F_SETFD:
00059             if (arg&1)
00060                 current->close_on_exec |= (1<<fd);
00061             else
00062                 current->close_on_exec &= ~(1<<fd);
00063             return 0;
00064         case F_GETFL:
00065             return filp->f_flags;
00066         case F_SETFL:
00067             filp->f_flags &= ~(O_APPEND | O_NONBLOCK);
00068             filp->f_flags |= arg & (O_APPEND | O_NONBLOCK);
00069             return 0;
00070         case F_GETLK:   case F_SETLK:   case F_SETLKW:
00071             return -1;
00072         default:
00073             return -1;
00074     }
00075 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/fcntl.h Source File

fcntl.h

Go to the documentation of this file.
00001 #ifndef _FCNTL_H
00002 #define _FCNTL_H
00003
00004 #include <sys/types.h>
00005
00006 /* open/fcntl - NOCTTY, NDELAY isn't implemented yet */
00007 #define O_ACCMODE   00003
00008 #define O_RDONLY       00
00009 #define O_WRONLY       01
00010 #define O_RDWR         02
00011 #define O_CREAT     00100   /* not fcntl */
00012 #define O_EXCL      00200   /* not fcntl */
00013 #define O_NOCTTY    00400   /* not fcntl */
00014 #define O_TRUNC     01000   /* not fcntl */
00015 #define O_APPEND    02000
00016 #define O_NONBLOCK  04000   /* not fcntl */
00017 #define O_NDELAY    O_NONBLOCK
00018
00019 /* Defines for fcntl-commands. Note that currently
00020  * locking isn't supported, and other things aren't really
00021  * tested.
00022  */
00023 #define F_DUPFD     0   /* dup */
00024 #define F_GETFD     1   /* get f_flags */
00025 #define F_SETFD     2   /* set f_flags */
00026 #define F_GETFL     3   /* more flags (cloexec) */
00027 #define F_SETFL     4
00028 #define F_GETLK     5   /* not implemented */
00029 #define F_SETLK     6
00030 #define F_SETLKW    7
00031
00032 /* for F_[GET|SET]FL */
00033 #define FD_CLOEXEC  1   /* actually anything with low bit set goes */
00034
00035 /* Ok, these are locking features, and aren't implemented at any
00036  * level. POSIX wants them.
00037  */
00038 #define F_RDLCK     0
00039 #define F_WRLCK     1
00040 #define F_UNLCK     2
00041
00042 /* Once again - not implemented, but ... */
00043 struct flock {
00044     short l_type;
00045     short l_whence;
00046     off_t l_start;
00047     off_t l_len;
00048     pid_t l_pid;
00049 };
00050
00051 extern int creat(const char * filename,mode_t mode);
00052 extern int fcntl(int fildes,int cmd, ...);
00053 extern int open(const char * filename, int flags, ...);
00054
00055 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/fdreg.h Source File

fdreg.h

Go to the documentation of this file.
00001 /*
00002  * This file contains some defines for the floppy disk controller.
00003  * Various sources. Mostly "IBM Microcomputers: A Programmers
00004  * Handbook", Sanches and Canton.
00005  */
00006 #ifndef _FDREG_H
00007 #define _FDREG_H
00008
00009 extern int ticks_to_floppy_on(unsigned int nr);
00010 extern void floppy_on(unsigned int nr);
00011 extern void floppy_off(unsigned int nr);
00012 extern void floppy_select(unsigned int nr);
00013 extern void floppy_deselect(unsigned int nr);
00014
00015 /* Fd controller regs. S&C, about page 340 */
00016 #define FD_STATUS   0x3f4
00017 #define FD_DATA     0x3f5
00018 #define FD_DOR      0x3f2       /* Digital Output Register */
00019 #define FD_DIR      0x3f7       /* Digital Input Register (read) */
00020 #define FD_DCR      0x3f7       /* Diskette Control Register (write)*/
00021
00022 /* Bits of main status register */
00023 #define STATUS_BUSYMASK 0x0F        /* drive busy mask */
00024 #define STATUS_BUSY 0x10        /* FDC busy */
00025 #define STATUS_DMA  0x20        /* 0- DMA mode */
00026 #define STATUS_DIR  0x40        /* 0- cpu->fdc */
00027 #define STATUS_READY    0x80        /* Data reg ready */
00028
00029 /* Bits of FD_ST0 */
00030 #define ST0_DS      0x03        /* drive select mask */
00031 #define ST0_HA      0x04        /* Head (Address) */
00032 #define ST0_NR      0x08        /* Not Ready */
00033 #define ST0_ECE     0x10        /* Equipment chech error */
00034 #define ST0_SE      0x20        /* Seek end */
00035 #define ST0_INTR    0xC0        /* Interrupt code mask */
00036
00037 /* Bits of FD_ST1 */
00038 #define ST1_MAM     0x01        /* Missing Address Mark */
00039 #define ST1_WP      0x02        /* Write Protect */
00040 #define ST1_ND      0x04        /* No Data - unreadable */
00041 #define ST1_OR      0x10        /* OverRun */
00042 #define ST1_CRC     0x20        /* CRC error in data or addr */
00043 #define ST1_EOC     0x80        /* End Of Cylinder */
00044
00045 /* Bits of FD_ST2 */
00046 #define ST2_MAM     0x01        /* Missing Addess Mark (again) */
00047 #define ST2_BC      0x02        /* Bad Cylinder */
00048 #define ST2_SNS     0x04        /* Scan Not Satisfied */
00049 #define ST2_SEH     0x08        /* Scan Equal Hit */
00050 #define ST2_WC      0x10        /* Wrong Cylinder */
00051 #define ST2_CRC     0x20        /* CRC error in data field */
00052 #define ST2_CM      0x40        /* Control Mark = deleted */
00053
00054 /* Bits of FD_ST3 */
00055 #define ST3_HA      0x04        /* Head (Address) */
00056 #define ST3_TZ      0x10        /* Track Zero signal (1=track 0) */
00057 #define ST3_WP      0x40        /* Write Protect */
00058
00059 /* Values for FD_COMMAND */
00060 #define FD_RECALIBRATE  0x07        /* move to track 0 */
00061 #define FD_SEEK     0x0F        /* seek track */
00062 #define FD_READ     0xE6        /* read with MT, MFM, SKip deleted */
00063 #define FD_WRITE    0xC5        /* write with MT, MFM */
00064 #define FD_SENSEI   0x08        /* Sense Interrupt Status */
00065 #define FD_SPECIFY  0x03        /* specify HUT etc */
00066
00067 /* DMA commands */
00068 #define DMA_READ    0x46
00069 #define DMA_WRITE   0x4A
00070
00071 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/file_dev.c Source File

file_dev.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/file_dev.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008 #include <fcntl.h>
00009
00010 #include <linux/sched.h>
00011 #include <linux/kernel.h>
00012 #include <asm/segment.h>
00013
00014 #define MIN(a,b) (((a)<(b))?(a):(b))
00015 #define MAX(a,b) (((a)>(b))?(a):(b))
00016
00017 int file_read(struct m_inode * inode, struct file * filp, char * buf, int count)
00018 {
00019     int left,chars,nr;
00020     struct buffer_head * bh;
00021
00022     if ((left=count)<=0)
00023         return 0;
00024     while (left) {
00025         if ((nr = bmap(inode,(filp->f_pos)/BLOCK_SIZE))) {
00026             if (!(bh=bread(inode->i_dev,nr)))
00027                 break;
00028         } else
00029             bh = NULL;
00030         nr = filp->f_pos % BLOCK_SIZE;
00031         chars = MIN( BLOCK_SIZE-nr , left );
00032         filp->f_pos += chars;
00033         left -= chars;
00034         if (bh) {
00035             char * p = nr + bh->b_data;
00036             while (chars-->0)
00037                 put_fs_byte(*(p++),buf++);
00038             brelse(bh);
00039         } else {
00040             while (chars-->0)
00041                 put_fs_byte(0,buf++);
00042         }
00043     }
00044     inode->i_atime = CURRENT_TIME;
00045     return (count-left)?(count-left):-ERROR;
00046 }
00047
00048 int file_write(struct m_inode * inode, struct file * filp, char * buf, int count)
00049 {
00050     off_t pos;
00051     int block,c;
00052     struct buffer_head * bh;
00053     char * p;
00054     int i=0;
00055
00056 /*
00057  * ok, append may not work when many processes are writing at the same time
00058  * but so what. That way leads to madness anyway.
00059  */
00060     if (filp->f_flags & O_APPEND)
00061         pos = inode->i_size;
00062     else
00063         pos = filp->f_pos;
00064     while (i<count) {
00065         if (!(block = create_block(inode,pos/BLOCK_SIZE)))
00066             break;
00067         if (!(bh=bread(inode->i_dev,block)))
00068             break;
00069         c = pos % BLOCK_SIZE;
00070         p = c + bh->b_data;
00071         bh->b_dirt = 1;
00072         c = BLOCK_SIZE-c;
00073         if (c > count-i) c = count-i;
00074         pos += c;
00075         if (pos > inode->i_size) {
00076             inode->i_size = pos;
00077             inode->i_dirt = 1;
00078         }
00079         i += c;
00080         while (c-->0)
00081             *(p++) = get_fs_byte(buf++);
00082         brelse(bh);
00083     }
00084     inode->i_mtime = CURRENT_TIME;
00085     if (!(filp->f_flags & O_APPEND)) {
00086         filp->f_pos = pos;
00087         inode->i_ctime = CURRENT_TIME;
00088     }
00089     return (i?i:-1);
00090 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/file_table.c Source File

file_table.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/file_table.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <linux/fs.h>
00008
00009 struct file file_table[NR_FILE];
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/floppy.c Source File

floppy.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/floppy.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * 02.12.91 - Changed to static variables to indicate need for reset
00009  * and recalibrate. This makes some things easier (output_byte reset
00010  * checking etc), and means less interrupt jumping in case of errors,
00011  * so the code is hopefully easier to understand.
00012  */
00013
00014 /*
00015  * This file is certainly a mess. I've tried my best to get it working,
00016  * but I don't like programming floppies, and I have only one anyway.
00017  * Urgel. I should check for more errors, and do more graceful error
00018  * recovery. Seems there are problems with several drives. I've tried to
00019  * correct them. No promises.
00020  */
00021
00022 /*
00023  * As with hd.c, all routines within this file can (and will) be called
00024  * by interrupts, so extreme caution is needed. A hardware interrupt
00025  * handler may not sleep, or a kernel panic will happen. Thus I cannot
00026  * call "floppy-on" directly, but have to set a special timer interrupt
00027  * etc.
00028  *
00029  * Also, I'm not certain this works on more than 1 floppy. Bugs may
00030  * abund.
00031  */
00032
00033 #include <linux/sched.h>
00034 #include <linux/fs.h>
00035 #include <linux/kernel.h>
00036 #include <linux/fdreg.h>
00037 #include <asm/system.h>
00038 #include <asm/io.h>
00039 #include <asm/segment.h>
00040
00041 #define MAJOR_NR 2
00042 #include "blk.h"
00043
00044 static int recalibrate = 0;
00045 static int reset = 0;
00046 static int seek = 0;
00047
00048 extern unsigned char current_DOR;
00049
00050 #define immoutb_p(val,port) \
00051 __asm__("outb %0,%1\n\tjmp 1f\n1:\tjmp 1f\n1:"::"a" ((char) (val)),"i" (port))
00052
00053 #define TYPE(x) ((x)>>2)
00054 #define DRIVE(x) ((x)&0x03)
00055 /*
00056  * Note that MAX_ERRORS=8 doesn't imply that we retry every bad read
00057  * max 8 times - some types of errors increase the errorcount by 2,
00058  * so we might actually retry only 5-6 times before giving up.
00059  */
00060 #define MAX_ERRORS 8
00061
00062 /*
00063  * globals used by 'result()'
00064  */
00065 #define MAX_REPLIES 7
00066 static unsigned char reply_buffer[MAX_REPLIES];
00067 #define ST0 (reply_buffer[0])
00068 #define ST1 (reply_buffer[1])
00069 #define ST2 (reply_buffer[2])
00070 #define ST3 (reply_buffer[3])
00071
00072 /*
00073  * This struct defines the different floppy types. Unlike minix
00074  * linux doesn't have a "search for right type"-type, as the code
00075  * for that is convoluted and weird. I've got enough problems with
00076  * this driver as it is.
00077  *
00078  * The 'stretch' tells if the tracks need to be boubled for some
00079  * types (ie 360kB diskette in 1.2MB drive etc). Others should
00080  * be self-explanatory.
00081  */
00082 static struct floppy_struct {
00083     unsigned int size, sect, head, track, stretch;
00084     unsigned char gap,rate,spec1;
00085 } floppy_type[] = {
00086     {    0, 0,0, 0,0,0x00,0x00,0x00 },  /* no testing */
00087     {  720, 9,2,40,0,0x2A,0x02,0xDF },  /* 360kB PC diskettes */
00088     { 2400,15,2,80,0,0x1B,0x00,0xDF },  /* 1.2 MB AT-diskettes */
00089     {  720, 9,2,40,1,0x2A,0x02,0xDF },  /* 360kB in 720kB drive */
00090     { 1440, 9,2,80,0,0x2A,0x02,0xDF },  /* 3.5" 720kB diskette */
00091     {  720, 9,2,40,1,0x23,0x01,0xDF },  /* 360kB in 1.2MB drive */
00092     { 1440, 9,2,80,0,0x23,0x01,0xDF },  /* 720kB in 1.2MB drive */
00093     { 2880,18,2,80,0,0x1B,0x00,0xCF },  /* 1.44MB diskette */
00094 };
00095 /*
00096  * Rate is 0 for 500kb/s, 2 for 300kbps, 1 for 250kbps
00097  * Spec1 is 0xSH, where S is stepping rate (F=1ms, E=2ms, D=3ms etc),
00098  * H is head unload time (1=16ms, 2=32ms, etc)
00099  *
00100  * Spec2 is (HLD<<1 | ND), where HLD is head load time (1=2ms, 2=4 ms etc)
00101  * and ND is set means no DMA. Hardcoded to 6 (HLD=6ms, use DMA).
00102  */
00103
00104 extern void floppy_interrupt(void);
00105 extern char tmp_floppy_area[1024];
00106
00107 /*
00108  * These are global variables, as that's the easiest way to give
00109  * information to interrupts. They are the data used for the current
00110  * request.
00111  */
00112 static int cur_spec1 = -1;
00113 static int cur_rate = -1;
00114 static struct floppy_struct * floppy = floppy_type;
00115 static unsigned char current_drive = 0;
00116 static unsigned char sector = 0;
00117 static unsigned char head = 0;
00118 static unsigned char track = 0;
00119 static unsigned char seek_track = 0;
00120 static unsigned char current_track = 255;
00121 static unsigned char command = 0;
00122 unsigned char selected = 0;
00123 struct task_struct * wait_on_floppy_select = NULL;
00124
00125 void floppy_deselect(unsigned int nr)
00126 {
00127     if (nr != (current_DOR & 3))
00128         printk("floppy_deselect: drive not selected\n\r");
00129     selected = 0;
00130     wake_up(&wait_on_floppy_select);
00131 }
00132
00133 /*
00134  * floppy-change is never called from an interrupt, so we can relax a bit
00135  * here, sleep etc. Note that floppy-on tries to set current_DOR to point
00136  * to the desired drive, but it will probably not survive the sleep if
00137  * several floppies are used at the same time: thus the loop.
00138  */
00139 int floppy_change(unsigned int nr)
00140 {
00141 repeat:
00142     floppy_on(nr);
00143     while ((current_DOR & 3) != nr && selected)
00144         interruptible_sleep_on(&wait_on_floppy_select);
00145     if ((current_DOR & 3) != nr)
00146         goto repeat;
00147     if (inb(FD_DIR) & 0x80) {
00148         floppy_off(nr);
00149         return 1;
00150     }
00151     floppy_off(nr);
00152     return 0;
00153 }
00154
00155 #define copy_buffer(from,to) \
00156 __asm__("cld ; rep ; movsl" \
00157     ::"c" (BLOCK_SIZE/4),"S" ((long)(from)),"D" ((long)(to)) \
00158     )
00159
00160 static void setup_DMA(void)
00161 {
00162     long addr = (long) CURRENT->buffer;
00163
00164     cli();
00165     if (addr >= 0x100000) {
00166         addr = (long) tmp_floppy_area;
00167         if (command == FD_WRITE)
00168             copy_buffer(CURRENT->buffer,tmp_floppy_area);
00169     }
00170 /* mask DMA 2 */
00171     immoutb_p(4|2,10);
00172 /* output command byte. I don't know why, but everyone (minix, */
00173 /* sanches & canton) output this twice, first to 12 then to 11 */
00174     __asm__("outb %%al,$12\n\tjmp 1f\n1:\tjmp 1f\n1:\t"
00175     "outb %%al,$11\n\tjmp 1f\n1:\tjmp 1f\n1:"::
00176     "a" ((char) ((command == FD_READ)?DMA_READ:DMA_WRITE)));
00177 /* 8 low bits of addr */
00178     immoutb_p(addr,4);
00179     addr >>= 8;
00180 /* bits 8-15 of addr */
00181     immoutb_p(addr,4);
00182     addr >>= 8;
00183 /* bits 16-19 of addr */
00184     immoutb_p(addr,0x81);
00185 /* low 8 bits of count-1 (1024-1=0x3ff) */
00186     immoutb_p(0xff,5);
00187 /* high 8 bits of count-1 */
00188     immoutb_p(3,5);
00189 /* activate DMA 2 */
00190     immoutb_p(0|2,10);
00191     sti();
00192 }
00193
00194 static void output_byte(char byte)
00195 {
00196     int counter;
00197     unsigned char status;
00198
00199     if (reset)
00200         return;
00201     for(counter = 0 ; counter < 10000 ; counter++) {
00202         status = inb_p(FD_STATUS) & (STATUS_READY | STATUS_DIR);
00203         if (status == STATUS_READY) {
00204             outb(byte,FD_DATA);
00205             return;
00206         }
00207     }
00208     reset = 1;
00209     printk("Unable to send byte to FDC\n\r");
00210 }
00211
00212 static int result(void)
00213 {
00214     int i = 0, counter, status;
00215
00216     if (reset)
00217         return -1;
00218     for (counter = 0 ; counter < 10000 ; counter++) {
00219         status = inb_p(FD_STATUS)&(STATUS_DIR|STATUS_READY|STATUS_BUSY);
00220         if (status == STATUS_READY)
00221             return i;
00222         if (status == (STATUS_DIR|STATUS_READY|STATUS_BUSY)) {
00223             if (i >= MAX_REPLIES)
00224                 break;
00225             reply_buffer[i++] = inb_p(FD_DATA);
00226         }
00227     }
00228     reset = 1;
00229     printk("Getstatus times out\n\r");
00230     return -1;
00231 }
00232
00233 static void bad_flp_intr(void)
00234 {
00235     CURRENT->errors++;
00236     if (CURRENT->errors > MAX_ERRORS) {
00237         floppy_deselect(current_drive);
00238         end_request(0);
00239     }
00240     if (CURRENT->errors > MAX_ERRORS/2)
00241         reset = 1;
00242     else
00243         recalibrate = 1;
00244 }
00245
00246 /*
00247  * Ok, this interrupt is called after a DMA read/write has succeeded,
00248  * so we check the results, and copy any buffers.
00249  */
00250 static void rw_interrupt(void)
00251 {
00252     if (result() != 7 || (ST0 & 0xf8) || (ST1 & 0xbf) || (ST2 & 0x73)) {
00253         if (ST1 & 0x02) {
00254             printk("Drive %d is write protected\n\r",current_drive);
00255             floppy_deselect(current_drive);
00256             end_request(0);
00257         } else
00258             bad_flp_intr();
00259         do_fd_request();
00260         return;
00261     }
00262     if (command == FD_READ && (unsigned long)(CURRENT->buffer) >= 0x100000)
00263         copy_buffer(tmp_floppy_area,CURRENT->buffer);
00264     floppy_deselect(current_drive);
00265     end_request(1);
00266     do_fd_request();
00267 }
00268
00269 inline void setup_rw_floppy(void)
00270 {
00271     setup_DMA();
00272     do_floppy = rw_interrupt;
00273     output_byte(command);
00274     output_byte(head<<2 | current_drive);
00275     output_byte(track);
00276     output_byte(head);
00277     output_byte(sector);
00278     output_byte(2);     /* sector size = 512 */
00279     output_byte(floppy->sect);
00280     output_byte(floppy->gap);
00281     output_byte(0xFF);  /* sector size (0xff when n!=0 ?) */
00282     if (reset)
00283         do_fd_request();
00284 }
00285
00286 /*
00287  * This is the routine called after every seek (or recalibrate) interrupt
00288  * from the floppy controller. Note that the "unexpected interrupt" routine
00289  * also does a recalibrate, but doesn't come here.
00290  */
00291 static void seek_interrupt(void)
00292 {
00293 /* sense drive status */
00294     output_byte(FD_SENSEI);
00295     if (result() != 2 || (ST0 & 0xF8) != 0x20 || ST1 != seek_track) {
00296         bad_flp_intr();
00297         do_fd_request();
00298         return;
00299     }
00300     current_track = ST1;
00301     setup_rw_floppy();
00302 }
00303
00304 /*
00305  * This routine is called when everything should be correctly set up
00306  * for the transfer (ie floppy motor is on and the correct floppy is
00307  * selected).
00308  */
00309 static void transfer(void)
00310 {
00311     if (cur_spec1 != floppy->spec1) {
00312         cur_spec1 = floppy->spec1;
00313         output_byte(FD_SPECIFY);
00314         output_byte(cur_spec1);     /* hut etc */
00315         output_byte(6);         /* Head load time =6ms, DMA */
00316     }
00317     if (cur_rate != floppy->rate)
00318         outb_p(cur_rate = floppy->rate,FD_DCR);
00319     if (reset) {
00320         do_fd_request();
00321         return;
00322     }
00323     if (!seek) {
00324         setup_rw_floppy();
00325         return;
00326     }
00327     do_floppy = seek_interrupt;
00328     if (seek_track) {
00329         output_byte(FD_SEEK);
00330         output_byte(head<<2 | current_drive);
00331         output_byte(seek_track);
00332     } else {
00333         output_byte(FD_RECALIBRATE);
00334         output_byte(head<<2 | current_drive);
00335     }
00336     if (reset)
00337         do_fd_request();
00338 }
00339
00340 /*
00341  * Special case - used after a unexpected interrupt (or reset)
00342  */
00343 static void recal_interrupt(void)
00344 {
00345     output_byte(FD_SENSEI);
00346     if (result()!=2 || (ST0 & 0xE0) == 0x60)
00347         reset = 1;
00348     else
00349         recalibrate = 0;
00350     do_fd_request();
00351 }
00352
00353 void unexpected_floppy_interrupt(void)
00354 {
00355     output_byte(FD_SENSEI);
00356     if (result()!=2 || (ST0 & 0xE0) == 0x60)
00357         reset = 1;
00358     else
00359         recalibrate = 1;
00360 }
00361
00362 static void recalibrate_floppy(void)
00363 {
00364     recalibrate = 0;
00365     current_track = 0;
00366     do_floppy = recal_interrupt;
00367     output_byte(FD_RECALIBRATE);
00368     output_byte(head<<2 | current_drive);
00369     if (reset)
00370         do_fd_request();
00371 }
00372
00373 static void reset_interrupt(void)
00374 {
00375     output_byte(FD_SENSEI);
00376     (void) result();
00377     output_byte(FD_SPECIFY);
00378     output_byte(cur_spec1);     /* hut etc */
00379     output_byte(6);         /* Head load time =6ms, DMA */
00380     do_fd_request();
00381 }
00382
00383 /*
00384  * reset is done by pulling bit 2 of DOR low for a while.
00385  */
00386 static void reset_floppy(void)
00387 {
00388     int i;
00389
00390     reset = 0;
00391     cur_spec1 = -1;
00392     cur_rate = -1;
00393     recalibrate = 1;
00394     printk("Reset-floppy called\n\r");
00395     cli();
00396     do_floppy = reset_interrupt;
00397     outb_p(current_DOR & ~0x04,FD_DOR);
00398     for (i=0 ; i<100 ; i++)
00399         __asm__("nop");
00400     outb(current_DOR,FD_DOR);
00401     sti();
00402 }
00403
00404 static void floppy_on_interrupt(void)
00405 {
00406 /* We cannot do a floppy-select, as that might sleep. We just force it */
00407     selected = 1;
00408     if (current_drive != (current_DOR & 3)) {
00409         current_DOR &= 0xFC;
00410         current_DOR |= current_drive;
00411         outb(current_DOR,FD_DOR);
00412         add_timer(2,&transfer);
00413     } else
00414         transfer();
00415 }
00416
00417 void do_fd_request(void)
00418 {
00419     unsigned int block;
00420
00421     seek = 0;
00422     if (reset) {
00423         reset_floppy();
00424         return;
00425     }
00426     if (recalibrate) {
00427         recalibrate_floppy();
00428         return;
00429     }
00430     INIT_REQUEST;
00431     floppy = (MINOR(CURRENT->dev)>>2) + floppy_type;
00432     if (current_drive != CURRENT_DEV)
00433         seek = 1;
00434     current_drive = CURRENT_DEV;
00435     block = CURRENT->sector;
00436     if (block+2 > floppy->size) {
00437         end_request(0);
00438         goto repeat;
00439     }
00440     sector = block % floppy->sect;
00441     block /= floppy->sect;
00442     head = block % floppy->head;
00443     track = block / floppy->head;
00444     seek_track = track << floppy->stretch;
00445     if (seek_track != current_track)
00446         seek = 1;
00447     sector++;
00448     if (CURRENT->cmd == READ)
00449         command = FD_READ;
00450     else if (CURRENT->cmd == WRITE)
00451         command = FD_WRITE;
00452     else
00453         panic("do_fd_request: unknown command");
00454     add_timer(ticks_to_floppy_on(current_drive),&floppy_on_interrupt);
00455 }
00456
00457 void floppy_init(void)
00458 {
00459     blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
00460     set_trap_gate(0x26,&floppy_interrupt);
00461     outb(inb_p(0x21)&~0x40,0x21);
00462 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/fork.c Source File

fork.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/fork.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  *  'fork.c' contains the help-routines for the 'fork' system call
00009  * (see also system_call.s), and some misc functions ('verify_area').
00010  * Fork is rather simple, once you get the hang of it, but the memory
00011  * management can be a bitch. See 'mm/mm.c': 'copy_page_tables()'
00012  */
00013 #include <errno.h>
00014
00015 #include <linux/sched.h>
00016 #include <linux/kernel.h>
00017 #include <asm/segment.h>
00018 #include <asm/system.h>
00019
00020 extern void write_verify(unsigned long address);
00021
00022 long last_pid=0;
00023
00024 void verify_area(void * addr,int size)
00025 {
00026     unsigned long start;
00027
00028     start = (unsigned long) addr;
00029     size += start & 0xfff;
00030     start &= 0xfffff000;
00031     start += get_base(current->ldt[2]);
00032     while (size>0) {
00033         size -= 4096;
00034         write_verify(start);
00035         start += 4096;
00036     }
00037 }
00038
00039 int copy_mem(int nr,struct task_struct * p)
00040 {
00041     unsigned long old_data_base,new_data_base,data_limit;
00042     unsigned long old_code_base,new_code_base,code_limit;
00043
00044     code_limit=get_limit(0x0f);
00045     data_limit=get_limit(0x17);
00046     old_code_base = get_base(current->ldt[1]);
00047     old_data_base = get_base(current->ldt[2]);
00048     if (old_data_base != old_code_base)
00049         panic("We don't support separate I&D");
00050     if (data_limit < code_limit)
00051         panic("Bad data_limit");
00052     new_data_base = new_code_base = nr * 0x4000000;
00053     p->start_code = new_code_base;
00054     set_base(p->ldt[1],new_code_base);
00055     set_base(p->ldt[2],new_data_base);
00056     if (copy_page_tables(old_data_base,new_data_base,data_limit)) {
00057         printk("free_page_tables: from copy_mem\n");
00058         free_page_tables(new_data_base,data_limit);
00059         return -ENOMEM;
00060     }
00061     return 0;
00062 }
00063
00064 /*
00065  *  Ok, this is the main fork-routine. It copies the system process
00066  * information (task[nr]) and sets up the necessary registers. It
00067  * also copies the data segment in it's entirety.
00068  */
00069 int copy_process(int nr,long ebp,long edi,long esi,long gs,long none,
00070         long ebx,long ecx,long edx,
00071         long fs,long es,long ds,
00072         long eip,long cs,long eflags,long esp,long ss)
00073 {
00074     struct task_struct *p;
00075     int i;
00076     struct file *f;
00077
00078     p = (struct task_struct *) get_free_page();
00079     if (!p)
00080         return -EAGAIN;
00081     task[nr] = p;
00082     *p = *current;  /* NOTE! this doesn't copy the supervisor stack */
00083     p->state = TASK_UNINTERRUPTIBLE;
00084     p->pid = last_pid;
00085     p->father = current->pid;
00086     p->counter = p->priority;
00087     p->signal = 0;
00088     p->alarm = 0;
00089     p->leader = 0;      /* process leadership doesn't inherit */
00090     p->utime = p->stime = 0;
00091     p->cutime = p->cstime = 0;
00092     p->start_time = jiffies;
00093     p->tss.back_link = 0;
00094     p->tss.esp0 = PAGE_SIZE + (long) p;
00095     p->tss.ss0 = 0x10;
00096     p->tss.eip = eip;
00097     p->tss.eflags = eflags;
00098     p->tss.eax = 0;
00099     p->tss.ecx = ecx;
00100     p->tss.edx = edx;
00101     p->tss.ebx = ebx;
00102     p->tss.esp = esp;
00103     p->tss.ebp = ebp;
00104     p->tss.esi = esi;
00105     p->tss.edi = edi;
00106     p->tss.es = es & 0xffff;
00107     p->tss.cs = cs & 0xffff;
00108     p->tss.ss = ss & 0xffff;
00109     p->tss.ds = ds & 0xffff;
00110     p->tss.fs = fs & 0xffff;
00111     p->tss.gs = gs & 0xffff;
00112     p->tss.ldt = _LDT(nr);
00113     p->tss.trace_bitmap = 0x80000000;
00114     if (last_task_used_math == current)
00115         __asm__("clts ; fnsave %0"::"m" (p->tss.i387));
00116     if (copy_mem(nr,p)) {
00117         task[nr] = NULL;
00118         free_page((long) p);
00119         return -EAGAIN;
00120     }
00121     for (i=0; i<NR_OPEN;i++)
00122         if ((f=p->filp[i]))
00123             f->f_count++;
00124     if (current->pwd)
00125         current->pwd->i_count++;
00126     if (current->root)
00127         current->root->i_count++;
00128     if (current->executable)
00129         current->executable->i_count++;
00130     set_tss_desc(gdt+(nr<<1)+FIRST_TSS_ENTRY,&(p->tss));
00131     set_ldt_desc(gdt+(nr<<1)+FIRST_LDT_ENTRY,&(p->ldt));
00132     p->state = TASK_RUNNING;    /* do this last, just in case */
00133     return last_pid;
00134 }
00135
00136 int find_empty_process(void)
00137 {
00138     int i;
00139
00140     repeat:
00141         if ((++last_pid)<0) last_pid=1;
00142         for(i=0 ; i<NR_TASKS ; i++)
00143             if (task[i] && task[i]->pid == last_pid) goto repeat;
00144     for(i=1 ; i<NR_TASKS ; i++)
00145         if (!task[i])
00146             return i;
00147     return -EAGAIN;
00148 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/open.c Source File

open.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/open.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /* #include <string.h> */
00008 #include <errno.h>
00009 #include <fcntl.h>
00010 #include <sys/types.h>
00011 #include <utime.h>
00012 #include <sys/stat.h>
00013
00014 #include <linux/sched.h>
00015 #include <linux/tty.h>
00016 #include <linux/kernel.h>
00017 #include <asm/segment.h>
00018
00019 int sys_ustat(int dev, struct ustat * ubuf)
00020 {
00021     return -ENOSYS;
00022 }
00023
00024 int sys_utime(char * filename, struct utimbuf * times)
00025 {
00026     struct m_inode * inode;
00027     long actime,modtime;
00028
00029     if (!(inode=namei(filename)))
00030         return -ENOENT;
00031     if (times) {
00032         actime = get_fs_long((unsigned long *) &times->actime);
00033         modtime = get_fs_long((unsigned long *) &times->modtime);
00034     } else
00035         actime = modtime = CURRENT_TIME;
00036     inode->i_atime = actime;
00037     inode->i_mtime = modtime;
00038     inode->i_dirt = 1;
00039     iput(inode);
00040     return 0;
00041 }
00042
00043 /*
00044  * XXX should we use the real or effective uid?  BSD uses the real uid,
00045  * so as to make this call useful to setuid programs.
00046  */
00047 int sys_access(const char * filename,int mode)
00048 {
00049     struct m_inode * inode;
00050     int res, i_mode;
00051
00052     mode &= 0007;
00053     if (!(inode=namei(filename)))
00054         return -EACCES;
00055     i_mode = res = inode->i_mode & 0777;
00056     iput(inode);
00057     if (current->uid == inode->i_uid)
00058         res >>= 6;
00059     else if (current->gid == inode->i_gid)
00060         res >>= 6;
00061     if ((res & 0007 & mode) == mode)
00062         return 0;
00063     /*
00064      * XXX we are doing this test last because we really should be
00065      * swapping the effective with the real user id (temporarily),
00066      * and then calling suser() routine.  If we do call the
00067      * suser() routine, it needs to be called last.
00068      */
00069     if ((!current->uid) &&
00070         (!(mode & 1) || (i_mode & 0111)))
00071         return 0;
00072     return -EACCES;
00073 }
00074
00075 int sys_chdir(const char * filename)
00076 {
00077     struct m_inode * inode;
00078
00079     if (!(inode = namei(filename)))
00080         return -ENOENT;
00081     if (!S_ISDIR(inode->i_mode)) {
00082         iput(inode);
00083         return -ENOTDIR;
00084     }
00085     iput(current->pwd);
00086     current->pwd = inode;
00087     return (0);
00088 }
00089
00090 int sys_chroot(const char * filename)
00091 {
00092     struct m_inode * inode;
00093
00094     if (!(inode=namei(filename)))
00095         return -ENOENT;
00096     if (!S_ISDIR(inode->i_mode)) {
00097         iput(inode);
00098         return -ENOTDIR;
00099     }
00100     iput(current->root);
00101     current->root = inode;
00102     return (0);
00103 }
00104
00105 int sys_chmod(const char * filename,int mode)
00106 {
00107     struct m_inode * inode;
00108
00109     if (!(inode=namei(filename)))
00110         return -ENOENT;
00111     if ((current->euid != inode->i_uid) && !suser()) {
00112         iput(inode);
00113         return -EACCES;
00114     }
00115     inode->i_mode = (mode & 07777) | (inode->i_mode & ~07777);
00116     inode->i_dirt = 1;
00117     iput(inode);
00118     return 0;
00119 }
00120
00121 int sys_chown(const char * filename,int uid,int gid)
00122 {
00123     struct m_inode * inode;
00124
00125     if (!(inode=namei(filename)))
00126         return -ENOENT;
00127     if (!suser()) {
00128         iput(inode);
00129         return -EACCES;
00130     }
00131     inode->i_uid=uid;
00132     inode->i_gid=gid;
00133     inode->i_dirt=1;
00134     iput(inode);
00135     return 0;
00136 }
00137
00138 int sys_open(const char * filename,int flag,int mode)
00139 {
00140     struct m_inode * inode;
00141     struct file * f;
00142     int i,fd;
00143
00144     mode &= 0777 & ~current->umask;
00145     for(fd=0 ; fd<NR_OPEN ; fd++)
00146         if (!current->filp[fd])
00147             break;
00148     if (fd>=NR_OPEN)
00149         return -EINVAL;
00150     current->close_on_exec &= ~(1<<fd);
00151     f=0+file_table;
00152     for (i=0 ; i<NR_FILE ; i++,f++)
00153         if (!f->f_count) break;
00154     if (i>=NR_FILE)
00155         return -EINVAL;
00156     (current->filp[fd]=f)->f_count++;
00157     if ((i=open_namei(filename,flag,mode,&inode))<0) {
00158         current->filp[fd]=NULL;
00159         f->f_count=0;
00160         return i;
00161     }
00162 /* ttys are somewhat special (ttyxx major==4, tty major==5) */
00163     if (S_ISCHR(inode->i_mode)) {
00164         if (MAJOR(inode->i_zone[0])==4) {
00165             if (current->leader && current->tty<0) {
00166                 current->tty = MINOR(inode->i_zone[0]);
00167                 tty_table[current->tty].pgrp = current->pgrp;
00168             }
00169         } else if (MAJOR(inode->i_zone[0])==5)
00170             if (current->tty<0) {
00171                 iput(inode);
00172                 current->filp[fd]=NULL;
00173                 f->f_count=0;
00174                 return -EPERM;
00175             }
00176     }
00177 /* Likewise with block-devices: check for floppy_change */
00178     if (S_ISBLK(inode->i_mode))
00179         check_disk_change(inode->i_zone[0]);
00180     f->f_mode = inode->i_mode;
00181     f->f_flags = flag;
00182     f->f_count = 1;
00183     f->f_inode = inode;
00184     f->f_pos = 0;
00185     return (fd);
00186 }
00187
00188 int sys_creat(const char * pathname, int mode)
00189 {
00190     return sys_open(pathname, O_CREAT | O_TRUNC, mode);
00191 }
00192
00193 int sys_close(unsigned int fd)
00194 {
00195     struct file * filp;
00196
00197     if (fd >= NR_OPEN)
00198         return -EINVAL;
00199     current->close_on_exec &= ~(1<<fd);
00200     if (!(filp = current->filp[fd]))
00201         return -EINVAL;
00202     current->filp[fd] = NULL;
00203     if (filp->f_count == 0)
00204         panic("Close: file count is 0");
00205     if (--filp->f_count)
00206         return (0);
00207     iput(filp->f_inode);
00208     return (0);
00209 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/fs.h Source File

fs.h

Go to the documentation of this file.
00001 /*
00002  * This file has definitions for some important file table
00003  * structures etc.
00004  */
00005
00006 #ifndef _FS_H
00007 #define _FS_H
00008
00009 #include <sys/types.h>
00010
00011 /* devices are as follows: (same as minix, so we can use the minix
00012  * file system. These are major numbers.)
00013  *
00014  * 0 - unused (nodev)
00015  * 1 - /dev/mem
00016  * 2 - /dev/fd
00017  * 3 - /dev/hd
00018  * 4 - /dev/ttyx
00019  * 5 - /dev/tty
00020  * 6 - /dev/lp
00021  * 7 - unnamed pipes
00022  */
00023
00024 #define IS_SEEKABLE(x) ((x)>=1 && (x)<=3)
00025
00026 #define READ 0
00027 #define WRITE 1
00028 #define READA 2     /* read-ahead - don't pause */
00029 #define WRITEA 3    /* "write-ahead" - silly, but somewhat useful */
00030
00031 void buffer_init(long buffer_end);
00032
00033 #define MAJOR(a) (((unsigned)(a))>>8)
00034 #define MINOR(a) ((a)&0xff)
00035
00036 #define NAME_LEN 14
00037 #define ROOT_INO 1
00038
00039 #define I_MAP_SLOTS 8
00040 #define Z_MAP_SLOTS 8
00041 #define SUPER_MAGIC 0x137F
00042
00043 #define NR_OPEN 20
00044 #define NR_INODE 32
00045 #define NR_FILE 64
00046 #define NR_SUPER 8
00047 #define NR_HASH 307
00048 #define NR_BUFFERS nr_buffers
00049 #define BLOCK_SIZE 1024
00050 #define BLOCK_SIZE_BITS 10
00051 #ifndef NULL
00052 #define NULL ((void *) 0)
00053 #endif
00054
00055 #define INODES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct d_inode)))
00056 #define DIR_ENTRIES_PER_BLOCK ((BLOCK_SIZE)/(sizeof (struct dir_entry)))
00057
00058 #define PIPE_HEAD(inode) ((inode).i_zone[0])
00059 #define PIPE_TAIL(inode) ((inode).i_zone[1])
00060 #define PIPE_SIZE(inode) ((PIPE_HEAD(inode)-PIPE_TAIL(inode))&(PAGE_SIZE-1))
00061 #define PIPE_EMPTY(inode) (PIPE_HEAD(inode)==PIPE_TAIL(inode))
00062 #define PIPE_FULL(inode) (PIPE_SIZE(inode)==(PAGE_SIZE-1))
00063 #define INC_PIPE(head) \
00064 __asm__("incl %0\n\tandl $4095,%0"::"m" (head))
00065
00066 typedef char buffer_block[BLOCK_SIZE];
00067
00068 struct buffer_head {
00069     char * b_data;          /* pointer to data block (1024 bytes) */
00070     unsigned long b_blocknr;    /* block number */
00071     unsigned short b_dev;       /* device (0 = free) */
00072     unsigned char b_uptodate;
00073     unsigned char b_dirt;       /* 0-clean,1-dirty */
00074     unsigned char b_count;      /* users using this block */
00075     unsigned char b_lock;       /* 0 - ok, 1 -locked */
00076     struct task_struct * b_wait;
00077     struct buffer_head * b_prev;
00078     struct buffer_head * b_next;
00079     struct buffer_head * b_prev_free;
00080     struct buffer_head * b_next_free;
00081 };
00082
00083 struct d_inode {
00084     unsigned short i_mode;
00085     unsigned short i_uid;
00086     unsigned long i_size;
00087     unsigned long i_time;
00088     unsigned char i_gid;
00089     unsigned char i_nlinks;
00090     unsigned short i_zone[9];
00091 };
00092
00093 struct m_inode {
00094     unsigned short i_mode;
00095     unsigned short i_uid;
00096     unsigned long i_size;
00097     unsigned long i_mtime;
00098     unsigned char i_gid;
00099     unsigned char i_nlinks;
00100     unsigned short i_zone[9];
00101 /* these are in memory also */
00102     struct task_struct * i_wait;
00103     unsigned long i_atime;
00104     unsigned long i_ctime;
00105     unsigned short i_dev;
00106     unsigned short i_num;
00107     unsigned short i_count;
00108     unsigned char i_lock;
00109     unsigned char i_dirt;
00110     unsigned char i_pipe;
00111     unsigned char i_mount;
00112     unsigned char i_seek;
00113     unsigned char i_update;
00114 };
00115
00116 struct file {
00117     unsigned short f_mode;
00118     unsigned short f_flags;
00119     unsigned short f_count;
00120     struct m_inode * f_inode;
00121     off_t f_pos;
00122 };
00123
00124 struct super_block {
00125     unsigned short s_ninodes;
00126     unsigned short s_nzones;
00127     unsigned short s_imap_blocks;
00128     unsigned short s_zmap_blocks;
00129     unsigned short s_firstdatazone;
00130     unsigned short s_log_zone_size;
00131     unsigned long s_max_size;
00132     unsigned short s_magic;
00133 /* These are only in memory */
00134     struct buffer_head * s_imap[8];
00135     struct buffer_head * s_zmap[8];
00136     unsigned short s_dev;
00137     struct m_inode * s_isup;
00138     struct m_inode * s_imount;
00139     unsigned long s_time;
00140     struct task_struct * s_wait;
00141     unsigned char s_lock;
00142     unsigned char s_rd_only;
00143     unsigned char s_dirt;
00144 };
00145
00146 struct d_super_block {
00147     unsigned short s_ninodes;
00148     unsigned short s_nzones;
00149     unsigned short s_imap_blocks;
00150     unsigned short s_zmap_blocks;
00151     unsigned short s_firstdatazone;
00152     unsigned short s_log_zone_size;
00153     unsigned long s_max_size;
00154     unsigned short s_magic;
00155 };
00156
00157 struct dir_entry {
00158     unsigned short inode;
00159     char name[NAME_LEN];
00160 };
00161
00162 extern struct m_inode inode_table[NR_INODE];
00163 extern struct file file_table[NR_FILE];
00164 extern struct super_block super_block[NR_SUPER];
00165 extern struct buffer_head * start_buffer;
00166 extern int nr_buffers;
00167
00168 extern void check_disk_change(int dev);
00169 extern int floppy_change(unsigned int nr);
00170 extern int ticks_to_floppy_on(unsigned int dev);
00171 extern void floppy_on(unsigned int dev);
00172 extern void floppy_off(unsigned int dev);
00173 extern void truncate(struct m_inode * inode);
00174 extern void sync_inodes(void);
00175 extern void wait_on(struct m_inode * inode);
00176 extern int bmap(struct m_inode * inode,int block);
00177 extern int create_block(struct m_inode * inode,int block);
00178 extern struct m_inode * namei(const char * pathname);
00179 extern int open_namei(const char * pathname, int flag, int mode,
00180     struct m_inode ** res_inode);
00181 extern void iput(struct m_inode * inode);
00182 extern struct m_inode * iget(int dev,int nr);
00183 extern struct m_inode * get_empty_inode(void);
00184 extern struct m_inode * get_pipe_inode(void);
00185 extern struct buffer_head * get_hash_table(int dev, int block);
00186 extern struct buffer_head * getblk(int dev, int block);
00187 extern void ll_rw_block(int rw, struct buffer_head * bh);
00188 extern void brelse(struct buffer_head * buf);
00189 extern struct buffer_head * bread(int dev,int block);
00190 extern void bread_page(unsigned long addr,int dev,int b[4]);
00191 extern struct buffer_head * breada(int dev,int block,...);
00192 extern int new_block(int dev);
00193 extern void free_block(int dev, int block);
00194 extern struct m_inode * new_inode(int dev);
00195 extern void free_inode(struct m_inode * inode);
00196 extern int sync_dev(int dev);
00197 extern struct super_block * get_super(int dev);
00198 extern int ROOT_DEV;
00199
00200 extern void mount_root(void);
00201
00202 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Data Fields - Variables

- a -

  • a : desc_struct
  • a_bss : exec
  • a_data : exec
  • a_drsize : exec
  • a_entry : exec
  • a_magic : exec
  • a_syms : exec
  • a_text : exec
  • a_trsize : exec
  • actime : utimbuf
  • alarm : task_struct

- b -

  • b : desc_struct
  • b_blocknr : buffer_head
  • b_count : buffer_head
  • b_data : buffer_head
  • b_dev : buffer_head
  • b_dirt : buffer_head
  • b_lock : buffer_head
  • b_next : buffer_head
  • b_next_free : buffer_head
  • b_prev : buffer_head
  • b_prev_free : buffer_head
  • b_uptodate : buffer_head
  • b_wait : buffer_head
  • back_link : tss_struct
  • bh : request
  • blocked : task_struct
  • boot_ind : partition
  • brk : task_struct
  • bucket_size : bucket_desc
  • buf : tty_queue
  • buffer : request

- c -

  • c_cc : termios, termio
  • c_cflag : termios, termio
  • c_iflag : termios, termio
  • c_lflag : termios, termio
  • c_line : termios, termio
  • c_oflag : termios, termio
  • chain : _bucket_dir
  • close_on_exec : task_struct
  • cmd : request
  • counter : task_struct
  • cr3 : tss_struct
  • cs : tss_struct
  • cstime : task_struct
  • ctl : hd_i_struct
  • current_request : blk_dev_struct
  • cutime : task_struct
  • cwd : i387_struct
  • cyl : hd_i_struct, partition

- d -

  • data : tty_queue
  • dev : request
  • ds : tss_struct
  • dummy : drive_info

- e -

  • eax : tss_struct
  • ebp : tss_struct
  • ebx : tss_struct
  • ecx : tss_struct
  • edi : tss_struct
  • edx : tss_struct
  • eflags : tss_struct
  • egid : task_struct
  • eip : tss_struct
  • end_code : task_struct
  • end_cyl : partition
  • end_data : task_struct
  • end_head : partition
  • end_sector : partition
  • errors : request
  • es : tss_struct
  • esi : tss_struct
  • esp : tss_struct
  • esp0 : tss_struct
  • esp1 : tss_struct
  • esp2 : tss_struct
  • euid : task_struct
  • executable : task_struct
  • exit_code : task_struct

- f -

  • f_count : file
  • f_flags : file
  • f_fname : ustat
  • f_fpack : ustat
  • f_inode : file
  • f_mode : file
  • f_pos : file
  • f_tfree : ustat
  • f_tinode : ustat
  • father : task_struct
  • fcs : i387_struct
  • filp : task_struct
  • fip : i387_struct
  • fn : timer_list
  • foo : i387_struct
  • fos : i387_struct
  • freeptr : bucket_desc
  • fs : tss_struct

- g -

  • gap : floppy_struct
  • gid : task_struct
  • gs : tss_struct

- h -

  • head : hd_i_struct, floppy_struct, tty_queue, partition

- i -

  • i387 : tss_struct
  • i_atime : m_inode
  • i_count : m_inode
  • i_ctime : m_inode
  • i_dev : m_inode
  • i_dirt : m_inode
  • i_gid : m_inode, d_inode
  • i_lock : m_inode
  • i_mode : m_inode, d_inode
  • i_mount : m_inode
  • i_mtime : m_inode
  • i_nlinks : m_inode, d_inode
  • i_num : m_inode
  • i_pipe : m_inode
  • i_seek : m_inode
  • i_size : m_inode, d_inode
  • i_time : d_inode
  • i_uid : m_inode, d_inode
  • i_update : m_inode
  • i_wait : m_inode
  • i_zone : m_inode, d_inode
  • inode : dir_entry

- j -

  • jiffies : timer_list

- l -

  • l_len : flock
  • l_pid : flock
  • l_start : flock
  • l_type : flock
  • l_whence : flock
  • ldt : task_struct, tss_struct
  • leader : task_struct
  • lzone : hd_i_struct

- m -

  • machine : utsname
  • modtime : utimbuf

- n -

  • n_desc : nlist
  • n_name : nlist
  • n_next : nlist
  • n_other : nlist
  • n_strx : nlist
  • n_type : nlist
  • n_un : nlist
  • n_value : nlist
  • name : dir_entry
  • next : bucket_desc, timer_list, request
  • nodename : utsname
  • nr_sectors : request
  • nr_sects : hd_struct, partition

- p -

  • page : bucket_desc
  • pgrp : tty_struct, task_struct
  • pid : task_struct
  • priority : task_struct
  • proc_list : tty_queue
  • pwd : task_struct

- q -

  • quot : ldiv_t, div_t

- r -

  • r_address : relocation_info
  • r_extern : relocation_info
  • r_length : relocation_info
  • r_pad : relocation_info
  • r_pcrel : relocation_info
  • r_symbolnum : relocation_info
  • rate : floppy_struct
  • read_q : tty_struct
  • refcnt : bucket_desc
  • release : utsname
  • rem : ldiv_t, div_t
  • request_fn : blk_dev_struct
  • root : task_struct

- s -

  • s_dev : super_block
  • s_dirt : super_block
  • s_firstdatazone : d_super_block, super_block
  • s_imap : super_block
  • s_imap_blocks : d_super_block, super_block
  • s_imount : super_block
  • s_isup : super_block
  • s_lock : super_block
  • s_log_zone_size : d_super_block, super_block
  • s_magic : d_super_block, super_block
  • s_max_size : d_super_block, super_block
  • s_ninodes : d_super_block, super_block
  • s_nzones : d_super_block, super_block
  • s_rd_only : super_block
  • s_time : super_block
  • s_wait : super_block
  • s_zmap : super_block
  • s_zmap_blocks : d_super_block, super_block
  • sa_flags : sigaction
  • sa_handler : sigaction
  • sa_mask : sigaction
  • sa_restorer : sigaction
  • secondary : tty_struct
  • sect : hd_i_struct, floppy_struct
  • sector : request, partition
  • session : task_struct
  • sgid : task_struct
  • sigaction : task_struct
  • signal : task_struct
  • size : _bucket_dir, floppy_struct
  • spec1 : floppy_struct
  • ss : tss_struct
  • ss0 : tss_struct
  • ss1 : tss_struct
  • ss2 : tss_struct
  • st_atime : stat
  • st_ctime : stat
  • st_dev : stat
  • st_gid : stat
  • st_ino : stat
  • st_mode : stat
  • st_mtime : stat
  • st_nlink : stat
  • st_rdev : stat
  • st_size : stat
  • st_space : i387_struct
  • st_uid : stat
  • stack : task_union
  • start_code : task_struct
  • start_sect : hd_struct, partition
  • start_stack : task_struct
  • start_time : task_struct
  • state : task_struct
  • stime : task_struct
  • stopped : tty_struct
  • stretch : floppy_struct
  • suid : task_struct
  • swd : i387_struct
  • sys_ind : partition
  • sysname : utsname

- t -

  • tail : tty_queue
  • task : task_union
  • termios : tty_struct
  • tm_hour : tm
  • tm_isdst : tm
  • tm_mday : tm
  • tm_min : tm
  • tm_mon : tm
  • tm_sec : tm
  • tm_wday : tm
  • tm_yday : tm
  • tm_year : tm
  • tms_cstime : tms
  • tms_cutime : tms
  • tms_stime : tms
  • tms_utime : tms
  • trace_bitmap : tss_struct
  • track : floppy_struct
  • tss : task_struct
  • tty : task_struct
  • twd : i387_struct

- u -

  • uid : task_struct
  • umask : task_struct
  • used_math : task_struct
  • utime : task_struct

- v -

  • version : utsname

- w -

  • waiting : request
  • wpcom : hd_i_struct
  • write : tty_struct
  • write_q : tty_struct
  • ws_col : winsize
  • ws_row : winsize
  • ws_xpixel : winsize
  • ws_ypixel : winsize
Generated on Sun Mar 6 10:56:10 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Globals - Defines

- _ -

  • __GNU_EXEC_MACROS__ : a.out.h
  • __LIBRARY__ : write.c, wait.c, string.c, setsid.c, open.c, execve.c, dup.c, close.c, _exit.c, main.c
  • __va_rounded_size : stdarg.h
  • _BLOCKABLE : sched.c
  • _C : ctype.h
  • _D : ctype.h
  • _fs : traps.c
  • _hashfn : buffer.c
  • _HIGH : wait.h
  • _I_FLAG : tty_io.c
  • _L : ctype.h
  • _L_FLAG : tty_io.c
  • _LDT : sched.h
  • _LOW : wait.h
  • _N_BADMAG : a.out.h
  • _N_HDROFF : a.out.h
  • _N_SEGMENT_ROUND : a.out.h
  • _N_TXTENDADDR : a.out.h
  • _NSIG : signal.h
  • _O_FLAG : tty_io.c
  • _P : ctype.h
  • _PC_CHOWN_RESTRICTED : unistd.h
  • _PC_LINK_MAX : unistd.h
  • _PC_MAX_CANON : unistd.h
  • _PC_MAX_INPUT : unistd.h
  • _PC_NAME_MAX : unistd.h
  • _PC_NO_TRUNC : unistd.h
  • _PC_PATH_MAX : unistd.h
  • _PC_PIPE_BUF : unistd.h
  • _PC_VDISABLE : unistd.h
  • _POSIX_CHOWN_RESTRICTED : unistd.h
  • _POSIX_NO_TRUNC : unistd.h
  • _POSIX_VDISABLE : unistd.h
  • _POSIX_VERSION : unistd.h
  • _S : sched.c, ctype.h
  • _SC_ARG_MAX : unistd.h
  • _SC_CHILD_MAX : unistd.h
  • _SC_CLOCKS_PER_SEC : unistd.h
  • _SC_JOB_CONTROL : unistd.h
  • _SC_NGROUPS_MAX : unistd.h
  • _SC_OPEN_MAX : unistd.h
  • _SC_SAVED_IDS : unistd.h
  • _SC_VERSION : unistd.h
  • _set_base : sched.h
  • _set_gate : system.h
  • _set_limit : sched.h
  • _set_seg_desc : system.h
  • _set_tssldt_desc : system.h
  • _SP : ctype.h
  • _TSS : sched.h
  • _U : ctype.h
  • _X : ctype.h

- a -

  • ABRT_ERR : hdreg.h
  • ACC_MODE : namei.c
  • ALRMMASK : tty_io.c

- b -

  • B0 : termios.h
  • B110 : termios.h
  • B1200 : termios.h
  • B134 : termios.h
  • B150 : termios.h
  • B1800 : termios.h
  • B19200 : termios.h
  • B200 : termios.h
  • B2400 : termios.h
  • B300 : termios.h
  • B38400 : termios.h
  • B4800 : termios.h
  • B50 : termios.h
  • B600 : termios.h
  • B75 : termios.h
  • B9600 : termios.h
  • BADNESS : buffer.c
  • BBD_ERR : hdreg.h
  • BCD_TO_BIN : main.c
  • BLOCK_SIZE : fs.h
  • BLOCK_SIZE_BITS : fs.h
  • BRKINT : termios.h
  • BS0 : termios.h
  • BS1 : termios.h
  • BSDLY : termios.h
  • BUFFER_END : const.h
  • BUSY_STAT : hdreg.h

- c -

  • CBAUD : termios.h
  • CHARS : tty.h
  • CIBAUD : termios.h
  • clear_bit : bitmap.c
  • clear_block : bitmap.c
  • cli : system.h
  • CLOCAL : termios.h
  • CLOCKS_PER_SEC : time.h
  • CMOS_READ : hd.c, main.c
  • CODE_SPACE : memory.c
  • copy_buffer : floppy.c
  • copy_page : memory.c
  • COPYBLK : buffer.c
  • CPARENB : termios.h
  • CPARODD : termios.h
  • CR0 : termios.h
  • CR1 : termios.h
  • CR2 : termios.h
  • CR3 : termios.h
  • CRDLY : termios.h
  • CREAD : termios.h
  • CRTSCTS : termios.h
  • CS5 : termios.h
  • CS6 : termios.h
  • CS7 : termios.h
  • CS8 : termios.h
  • CSIZE : termios.h
  • CSTOPB : termios.h
  • CURRENT_TIME : sched.h

- d -

  • DAY : mktime.c
  • DEC : tty.h
  • DEFAULT_MAJOR_ROOT : build.c
  • DEFAULT_MINOR_ROOT : build.c
  • DIR_ENTRIES_PER_BLOCK : fs.h
  • DMA_READ : fdreg.h
  • DMA_WRITE : fdreg.h
  • do_div : vsprintf.c
  • DRIVE : floppy.c
  • DRIVE_INFO : main.c
  • DRQ_STAT : hdreg.h

- e -

  • E2BIG : errno.h
  • EACCES : errno.h
  • EAGAIN : errno.h
  • EBADF : errno.h
  • EBUSY : errno.h
  • ECC_ERR : hdreg.h
  • ECC_STAT : hdreg.h
  • ECHILD : errno.h
  • ECHO : termios.h
  • ECHOCTL : termios.h
  • ECHOE : termios.h
  • ECHOK : termios.h
  • ECHOKE : termios.h
  • ECHONL : termios.h
  • ECHOPRT : termios.h
  • EDEADLK : errno.h
  • EDOM : errno.h
  • EEXIST : errno.h
  • EFAULT : errno.h
  • EFBIG : errno.h
  • EINTR : errno.h
  • EINVAL : errno.h
  • EIO : errno.h
  • EISDIR : errno.h
  • EMFILE : errno.h
  • EMLINK : errno.h
  • EMPTY : tty.h
  • ENAMETOOLONG : errno.h
  • ENFILE : errno.h
  • ENODEV : errno.h
  • ENOENT : errno.h
  • ENOEXEC : errno.h
  • ENOLCK : errno.h
  • ENOMEM : errno.h
  • ENOSPC : errno.h
  • ENOSYS : errno.h
  • ENOTBLK : errno.h
  • ENOTDIR : errno.h
  • ENOTEMPTY : errno.h
  • ENOTTY : errno.h
  • ENXIO : errno.h
  • EOF_CHAR : tty.h
  • EPERM : errno.h
  • EPIPE : errno.h
  • ERANGE : errno.h
  • ERASE_CHAR : tty.h
  • EROFS : errno.h
  • ERR_STAT : hdreg.h
  • ERROR : errno.h
  • ESPIPE : errno.h
  • ESRCH : errno.h
  • ETXTBSY : errno.h
  • EXDEV : errno.h
  • EXT_MEM_K : main.c
  • EXTA : termios.h
  • EXTB : termios.h
  • extern : string.c

- f -

  • F_DUPFD : fcntl.h
  • F_GETFD : fcntl.h
  • F_GETFL : fcntl.h
  • F_GETLK : fcntl.h
  • F_OK : unistd.h
  • F_RDLCK : fcntl.h
  • F_SETFD : fcntl.h
  • F_SETFL : fcntl.h
  • F_SETLK : fcntl.h
  • F_SETLKW : fcntl.h
  • F_UNLCK : fcntl.h
  • F_WRLCK : fcntl.h
  • FD_CLOEXEC : fcntl.h
  • FD_DATA : fdreg.h
  • FD_DCR : fdreg.h
  • FD_DIR : fdreg.h
  • FD_DOR : fdreg.h
  • FD_READ : fdreg.h
  • FD_RECALIBRATE : fdreg.h
  • FD_SEEK : fdreg.h
  • FD_SENSEI : fdreg.h
  • FD_SPECIFY : fdreg.h
  • FD_STATUS : fdreg.h
  • FD_WRITE : fdreg.h
  • FF0 : termios.h
  • FF1 : termios.h
  • FFDLY : termios.h
  • find_first_zero : bitmap.c
  • FIRST_LDT_ENTRY : sched.h
  • FIRST_TASK : sched.h
  • FIRST_TSS_ENTRY : sched.h
  • FLUSHO : termios.h
  • free : kernel.h
  • FULL : tty.h

- g -

  • GCC_HEADER : build.c
  • GDT_CODE : head.h
  • GDT_DATA : head.h
  • GDT_NUL : head.h
  • GDT_TMP : head.h
  • get_base : sched.h
  • get_limit : sched.h
  • get_seg_byte : traps.c
  • get_seg_long : traps.c
  • GETCH : tty.h

- h -

  • hash : buffer.c
  • HD_CMD : hdreg.h
  • HD_COMMAND : hdreg.h
  • HD_CURRENT : hdreg.h
  • HD_DATA : hdreg.h
  • HD_ERROR : hdreg.h
  • HD_HCYL : hdreg.h
  • HD_LCYL : hdreg.h
  • HD_NSECTOR : hdreg.h
  • HD_PRECOMP : hdreg.h
  • HD_SECTOR : hdreg.h
  • HD_STATUS : hdreg.h
  • HOUR : mktime.c
  • HUPCL : termios.h
  • HZ : sched.h

- i -

  • I_BLOCK_SPECIAL : const.h
  • I_CHAR_SPECIAL : const.h
  • I_CRNL : tty_io.c
  • I_DIRECTORY : const.h
  • I_MAP_SLOTS : fs.h
  • I_NAMED_PIPE : const.h
  • I_NLCR : tty_io.c
  • I_NOCR : tty_io.c
  • I_REGULAR : const.h
  • I_SET_GID_BIT : const.h
  • I_SET_UID_BIT : const.h
  • I_TYPE : const.h
  • I_UCLC : tty_io.c
  • ICANON : termios.h
  • ICRNL : termios.h
  • ID_ERR : hdreg.h
  • IEXTEN : termios.h
  • IGNBRK : termios.h
  • IGNCR : termios.h
  • IGNPAR : termios.h
  • IMAXBEL : termios.h
  • immoutb_p : floppy.c
  • IN_ORDER : blk.h
  • inb : io.h
  • inb_p : io.h
  • INC : tty.h
  • INC_PIPE : fs.h
  • INDEX_STAT : hdreg.h
  • INIT_C_CC : tty.h
  • INIT_TASK : sched.h
  • INLCR : termios.h
  • inline : string.c
  • INODES_PER_BLOCK : fs.h
  • INPCK : termios.h
  • INTMASK : tty_io.c
  • INTR_CHAR : tty.h
  • invalidate : memory.c
  • iret : system.h
  • is_digit : vsprintf.c
  • IS_SEEKABLE : fs.h
  • isalnum : ctype.h
  • isalpha : ctype.h
  • isascii : ctype.h
  • iscntrl : ctype.h
  • isdigit : ctype.h
  • isgraph : ctype.h
  • ISIG : termios.h
  • islower : ctype.h
  • isprint : ctype.h
  • ispunct : ctype.h
  • isspace : ctype.h
  • ISTRIP : termios.h
  • isupper : ctype.h
  • isxdigit : ctype.h
  • IUCLC : termios.h
  • IXANY : termios.h
  • IXOFF : termios.h
  • IXON : termios.h

- k -

  • KBD_US : config.h
  • KILL_CHAR : tty.h
  • KILLMASK : tty_io.c

- l -

  • L_CANON : tty_io.c
  • L_ECHO : tty_io.c
  • L_ECHOCTL : tty_io.c
  • L_ECHOE : tty_io.c
  • L_ECHOK : tty_io.c
  • L_ECHOKE : tty_io.c
  • L_ISIG : tty_io.c
  • LAST : tty.h
  • LAST_TASK : sched.h
  • LATCH : sched.c
  • LDT_CODE : head.h
  • LDT_DATA : head.h
  • LDT_NUL : head.h
  • LEFT : vsprintf.c, tty.h
  • lldt : sched.h
  • LOW_MEM : memory.c
  • ltr : sched.h

- m -

  • MAJOR : fs.h
  • MAJOR_NR : ramdisk.c, hd.c, floppy.c
  • MAP_NR : memory.c
  • MARK_ERR : hdreg.h
  • MAX : file_dev.c
  • MAX_ARG_PAGES : exec.c
  • MAX_ERRORS : hd.c, floppy.c
  • MAX_HD : hd.c
  • MAX_REPLIES : floppy.c
  • MAY_EXEC : namei.c
  • MAY_READ : namei.c
  • MAY_WRITE : namei.c
  • memcpy : string.h, memory.h
  • MIN : file_dev.c
  • MINIX_HEADER : build.c
  • MINOR : fs.h
  • MINUTE : mktime.c
  • move_to_user_mode : system.h

- n -

  • N_ABS : a.out.h
  • N_BADMAG : a.out.h
  • N_BSS : a.out.h
  • N_BSSADDR : a.out.h
  • N_COMM : a.out.h
  • N_DATA : a.out.h
  • N_DATADDR : a.out.h
  • N_DATOFF : a.out.h
  • N_DRELOFF : a.out.h
  • N_EXT : a.out.h
  • N_FN : a.out.h
  • N_INDR : a.out.h
  • N_MAGIC : a.out.h
  • N_SETA : a.out.h
  • N_SETB : a.out.h
  • N_SETD : a.out.h
  • N_SETT : a.out.h
  • N_SETV : a.out.h
  • N_STAB : a.out.h
  • N_STROFF : a.out.h
  • N_SYMOFF : a.out.h
  • N_TEXT : a.out.h
  • N_TRELOFF : a.out.h
  • N_TXTADDR : a.out.h
  • N_TXTOFF : a.out.h
  • N_TYPE : a.out.h
  • N_UNDF : a.out.h
  • NAME_LEN : fs.h
  • NCC : termios.h
  • NCCS : termios.h
  • NL0 : termios.h
  • NL1 : termios.h
  • NLDLY : termios.h
  • NMAGIC : a.out.h
  • NOFLSH : termios.h
  • nop : system.h
  • NPAR : console.c
  • NR_BLK_DEV : blk.h
  • NR_BUFFERS : buffer.c, fs.h
  • NR_FILE : fs.h
  • NR_HASH : fs.h
  • NR_INODE : fs.h
  • NR_OPEN : fs.h
  • NR_REQUEST : blk.h
  • NR_SUPER : fs.h
  • NR_TASKS : sched.h
  • NRDEVS : ioctl.c, char_dev.c
  • NSIG : signal.h
  • NULL : unistd.h, types.h, string.h, stddef.h, sched.h, fs.h

- o -

  • O_ACCMODE : fcntl.h
  • O_APPEND : fcntl.h
  • O_CREAT : fcntl.h
  • O_CRNL : tty_io.c
  • O_EXCL : fcntl.h
  • O_LCUC : tty_io.c
  • O_NDELAY : fcntl.h
  • O_NLCR : tty_io.c
  • O_NLRET : tty_io.c
  • O_NOCTTY : fcntl.h
  • O_NONBLOCK : fcntl.h
  • O_POST : tty_io.c
  • O_RDONLY : fcntl.h
  • O_RDWR : fcntl.h
  • O_TRUNC : fcntl.h
  • O_WRONLY : fcntl.h
  • OCRNL : termios.h
  • OFDEL : termios.h
  • offsetof : stddef.h
  • OFILL : termios.h
  • OLCUC : termios.h
  • OMAGIC : a.out.h
  • ONLCR : termios.h
  • ONLRET : termios.h
  • ONOCR : termios.h
  • OPOST : termios.h
  • ORIG_ROOT_DEV : main.c
  • ORIG_VIDEO_COLS : console.c
  • ORIG_VIDEO_EGA_AX : console.c
  • ORIG_VIDEO_EGA_BX : console.c
  • ORIG_VIDEO_EGA_CX : console.c
  • ORIG_VIDEO_LINES : console.c
  • ORIG_VIDEO_MODE : console.c
  • ORIG_VIDEO_PAGE : console.c
  • ORIG_X : console.c
  • ORIG_Y : console.c
  • outb : io.h
  • outb_p : io.h

- p -

  • PAGE_ALIGN : sched.h
  • PAGE_SIZE : mm.h, a.out.h
  • PAGING_MEMORY : memory.c
  • PAGING_PAGES : memory.c
  • PANIC : panic.c
  • PARENB : termios.h
  • PARMRK : termios.h
  • PARODD : termios.h
  • PENDIN : termios.h
  • PIPE_EMPTY : fs.h
  • PIPE_FULL : fs.h
  • PIPE_HEAD : fs.h
  • PIPE_SIZE : fs.h
  • PIPE_TAIL : fs.h
  • PLUS : vsprintf.c
  • port_read : hd.c
  • port_write : hd.c
  • PUTCH : tty.h

- q -

  • QUIT_CHAR : tty.h
  • QUITMASK : tty_io.c

- r -

  • R_OK : unistd.h
  • READ : fs.h
  • READA : fs.h
  • READY_STAT : hdreg.h
  • RESPONSE : console.c
  • ROOT_INO : fs.h

- s -

  • S_IFBLK : stat.h
  • S_IFCHR : stat.h
  • S_IFDIR : stat.h
  • S_IFIFO : stat.h
  • S_IFMT : stat.h
  • S_IFREG : stat.h
  • S_IRGRP : stat.h
  • S_IROTH : stat.h
  • S_IRUSR : stat.h
  • S_IRWXG : stat.h
  • S_IRWXO : stat.h
  • S_IRWXU : stat.h
  • S_ISBLK : stat.h
  • S_ISCHR : stat.h
  • S_ISDIR : stat.h
  • S_ISFIFO : stat.h
  • S_ISGID : stat.h
  • S_ISREG : stat.h
  • S_ISUID : stat.h
  • S_ISVTX : stat.h
  • S_IWGRP : stat.h
  • S_IWOTH : stat.h
  • S_IWUSR : stat.h
  • S_IXGRP : stat.h
  • S_IXOTH : stat.h
  • S_IXUSR : stat.h
  • SA_NOCLDSTOP : signal.h
  • SA_NOMASK : signal.h
  • SA_ONESHOT : signal.h
  • SEEK_CUR : unistd.h
  • SEEK_END : unistd.h
  • SEEK_SET : unistd.h
  • SEEK_STAT : hdreg.h
  • SEGMENT_SIZE : a.out.h
  • set_base : sched.h
  • set_bit : super.c, bitmap.c
  • set_intr_gate : system.h
  • set_ldt_desc : system.h
  • set_limit : sched.h
  • set_system_gate : system.h
  • set_trap_gate : system.h
  • set_tss_desc : system.h
  • SETUP_SECTS : build.c
  • SIG_BLOCK : signal.h
  • SIG_DFL : signal.h
  • SIG_IGN : signal.h
  • SIG_SETMASK : signal.h
  • SIG_UNBLOCK : signal.h
  • SIGABRT : signal.h
  • SIGALRM : signal.h
  • SIGCHLD : signal.h
  • SIGCONT : signal.h
  • SIGFPE : signal.h
  • SIGHUP : signal.h
  • SIGILL : signal.h
  • SIGINT : signal.h
  • SIGIOT : signal.h
  • SIGKILL : signal.h
  • SIGN : vsprintf.c
  • SIGPIPE : signal.h
  • SIGQUIT : signal.h
  • SIGSEGV : signal.h
  • SIGSTKFLT : signal.h
  • SIGSTOP : signal.h
  • SIGTERM : signal.h
  • SIGTRAP : signal.h
  • SIGTSTP : signal.h
  • SIGTTIN : signal.h
  • SIGTTOU : signal.h
  • SIGUNUSED : signal.h
  • SIGUSR1 : signal.h
  • SIGUSR2 : signal.h
  • SMALL : vsprintf.c
  • SPACE : vsprintf.c
  • SPECIAL : vsprintf.c
  • ST0 : floppy.c
  • ST0_DS : fdreg.h
  • ST0_ECE : fdreg.h
  • ST0_HA : fdreg.h
  • ST0_INTR : fdreg.h
  • ST0_NR : fdreg.h
  • ST0_SE : fdreg.h
  • ST1 : floppy.c
  • ST1_CRC : fdreg.h
  • ST1_EOC : fdreg.h
  • ST1_MAM : fdreg.h
  • ST1_ND : fdreg.h
  • ST1_OR : fdreg.h
  • ST1_WP : fdreg.h
  • ST2 : floppy.c
  • ST2_BC : fdreg.h
  • ST2_CM : fdreg.h
  • ST2_CRC : fdreg.h
  • ST2_MAM : fdreg.h
  • ST2_SEH : fdreg.h
  • ST2_SNS : fdreg.h
  • ST2_WC : fdreg.h
  • ST3 : floppy.c
  • ST3_HA : fdreg.h
  • ST3_TZ : fdreg.h
  • ST3_WP : fdreg.h
  • START_CHAR : tty.h
  • STATUS_BUSY : fdreg.h
  • STATUS_BUSYMASK : fdreg.h
  • STATUS_DIR : fdreg.h
  • STATUS_DMA : fdreg.h
  • STATUS_READY : fdreg.h
  • STDERR_FILENO : unistd.h
  • STDIN_FILENO : unistd.h
  • STDOUT_FILENO : unistd.h
  • sti : system.h
  • STOP_CHAR : tty.h
  • str : sched.h
  • STRINGIFY : build.c
  • SUPER_MAGIC : fs.h
  • suser : kernel.h
  • SUSPEND_CHAR : tty.h
  • switch_to : sched.h
  • SYS_SIZE : build.c

- t -

  • TAB0 : termios.h
  • TAB1 : termios.h
  • TAB2 : termios.h
  • TAB3 : termios.h
  • TABDLY : termios.h
  • TASK_INTERRUPTIBLE : sched.h
  • TASK_RUNNING : sched.h
  • TASK_STOPPED : sched.h
  • TASK_UNINTERRUPTIBLE : sched.h
  • TASK_ZOMBIE : sched.h
  • TCFLSH : termios.h
  • TCGETA : termios.h
  • TCGETS : termios.h
  • TCIFLUSH : termios.h
  • TCIOFF : termios.h
  • TCIOFLUSH : termios.h
  • TCION : termios.h
  • TCOFLUSH : termios.h
  • TCOOFF : termios.h
  • TCOON : termios.h
  • TCSADRAIN : termios.h
  • TCSAFLUSH : termios.h
  • TCSANOW : termios.h
  • TCSBRK : termios.h
  • TCSETA : termios.h
  • TCSETAF : termios.h
  • TCSETAW : termios.h
  • TCSETS : termios.h
  • TCSETSF : termios.h
  • TCSETSW : termios.h
  • TCXONC : termios.h
  • TIME_REQUESTS : sched.c
  • TIOCEXCL : termios.h
  • TIOCGPGRP : termios.h
  • TIOCGSOFTCAR : termios.h
  • TIOCGWINSZ : termios.h
  • TIOCINQ : termios.h
  • TIOCM_CAR : termios.h
  • TIOCM_CD : termios.h
  • TIOCM_CTS : termios.h
  • TIOCM_DSR : termios.h
  • TIOCM_DTR : termios.h
  • TIOCM_LE : termios.h
  • TIOCM_RI : termios.h
  • TIOCM_RNG : termios.h
  • TIOCM_RTS : termios.h
  • TIOCM_SR : termios.h
  • TIOCM_ST : termios.h
  • TIOCMBIC : termios.h
  • TIOCMBIS : termios.h
  • TIOCMGET : termios.h
  • TIOCMSET : termios.h
  • TIOCNXCL : termios.h
  • TIOCOUTQ : termios.h
  • TIOCSCTTY : termios.h
  • TIOCSPGRP : termios.h
  • TIOCSSOFTCAR : termios.h
  • TIOCSTI : termios.h
  • TIOCSWINSZ : termios.h
  • toascii : ctype.h
  • tolower : ctype.h
  • TOSTOP : termios.h
  • toupper : ctype.h
  • TRK0_ERR : hdreg.h
  • TSTPMASK : tty_io.c
  • TTY_BUF_SIZE : termios.h, tty.h
  • TYPE : floppy.c

- u -

  • USED : memory.c

- v -

  • va_arg : stdarg.h
  • va_end : stdarg.h
  • va_start : stdarg.h
  • VDISCARD : termios.h
  • VEOF : termios.h
  • VEOL : termios.h
  • VEOL2 : termios.h
  • VERASE : termios.h
  • VIDEO_TYPE_CGA : console.c
  • VIDEO_TYPE_EGAC : console.c
  • VIDEO_TYPE_EGAM : console.c
  • VIDEO_TYPE_MDA : console.c
  • VINTR : termios.h
  • VKILL : termios.h
  • VLNEXT : termios.h
  • VMIN : termios.h
  • VQUIT : termios.h
  • VREPRINT : termios.h
  • VSTART : termios.h
  • VSTOP : termios.h
  • VSUSP : termios.h
  • VSWTC : termios.h
  • VT0 : termios.h
  • VT1 : termios.h
  • VTDLY : termios.h
  • VTIME : termios.h
  • VWERASE : termios.h

- w -

  • W_OK : unistd.h
  • WAKEUP_CHARS : serial.c
  • WEXITSTATUS : wait.h
  • WIFEXITED : wait.h
  • WIFSIGNALED : wait.h
  • WIFSTOPPED : wait.h
  • WIN_DIAGNOSE : hdreg.h
  • WIN_FORMAT : hdreg.h
  • WIN_INIT : hdreg.h
  • WIN_READ : hdreg.h
  • WIN_RESTORE : hdreg.h
  • WIN_SEEK : hdreg.h
  • WIN_SPECIFY : hdreg.h
  • WIN_VERIFY : hdreg.h
  • WIN_WRITE : hdreg.h
  • WNOHANG : wait.h
  • WRERR_STAT : hdreg.h
  • WRITE : fs.h
  • WRITEA : fs.h
  • WSTOPSIG : wait.h
  • WTERMSIG : wait.h
  • WUNTRACED : wait.h

- x -

  • X_OK : unistd.h
  • XCASE : termios.h
  • XTABS : termios.h

- y -

  • YEAR : mktime.c

- z -

  • Z_MAP_SLOTS : fs.h
  • ZEROPAD : vsprintf.c
  • ZMAGIC : a.out.h
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Globals - Functions

- _ -

  • _bmap() : inode.c
  • _exit() : _exit.c, unistd.h
  • _get_base() : sched.h
  • _syscall0() : main.c
  • _syscall3() : wait.c

- a -

  • access() : unistd.h
  • acct() : unistd.h
  • add_entry() : namei.c
  • add_request() : ll_rw_blk.c
  • add_timer() : sched.c, sched.h
  • alarm() : unistd.h
  • asctime() : time.h

- b -

  • bad_flp_intr() : floppy.c
  • bad_rw_intr() : hd.c
  • blk_dev_init() : ll_rw_blk.c
  • block_read() : read_write.c, block_dev.c
  • block_write() : read_write.c, block_dev.c
  • bmap() : fs.h, inode.c
  • bounds() : traps.c
  • bread() : fs.h, buffer.c
  • bread_page() : fs.h, buffer.c
  • breada() : fs.h, buffer.c
  • brelse() : fs.h, buffer.c
  • brk() : unistd.h
  • buffer_init() : fs.h, buffer.c

- c -

  • calc_mem() : memory.c
  • cfgetispeed() : termios.h
  • cfgetospeed() : termios.h
  • cfsetispeed() : termios.h
  • cfsetospeed() : termios.h
  • change_ldt() : exec.c
  • change_speed() : tty_ioctl.c
  • chdir() : unistd.h
  • check_disk_change() : fs.h, buffer.c
  • chmod() : unistd.h, stat.h
  • chown() : unistd.h
  • chr_dev_init() : tty_io.c
  • chroot() : unistd.h
  • clock() : time.h
  • close() : unistd.h
  • con_init() : console.c, tty.h
  • con_write() : console.c, tty.h
  • controller_ready() : hd.c
  • coprocessor_error() : traps.c
  • coprocessor_segment_overrun() : traps.c
  • copy_mem() : fork.c
  • copy_page_tables() : memory.c, sched.h
  • copy_process() : fork.c
  • copy_strings() : exec.c
  • copy_to_cooked() : tty_io.c, tty.h
  • count() : exec.c
  • cp_stat() : stat.c
  • cr() : console.c
  • creat() : unistd.h, fcntl.h
  • create_block() : fs.h, inode.c
  • create_tables() : exec.c
  • csi_at() : console.c
  • csi_J() : console.c
  • csi_K() : console.c
  • csi_L() : console.c
  • csi_m() : console.c
  • csi_M() : console.c
  • csi_P() : console.c
  • ctime() : time.h

- d -

  • debug() : traps.c
  • del() : console.c
  • delete_char() : console.c
  • delete_line() : console.c
  • device_not_available() : traps.c
  • die() : build.c, traps.c
  • difftime() : time.h
  • dir_namei() : namei.c
  • divide_error() : traps.c
  • do_bounds() : traps.c
  • do_coprocessor_error() : traps.c
  • do_coprocessor_segment_overrun() : traps.c
  • do_debug() : traps.c
  • do_device_not_available() : traps.c
  • do_divide_error() : traps.c
  • do_double_fault() : traps.c
  • do_execve() : exec.c
  • do_exit() : memory.c, traps.c, signal.c, exit.c
  • do_fd_request() : floppy.c
  • do_floppy_timer() : sched.c
  • do_general_protection() : traps.c
  • do_hd_request() : hd.c
  • do_int3() : traps.c
  • do_invalid_op() : traps.c
  • do_invalid_TSS() : traps.c
  • do_nmi() : traps.c
  • do_no_page() : memory.c
  • do_overflow() : traps.c
  • do_rd_request() : ramdisk.c
  • do_reserved() : traps.c
  • do_segment_not_present() : traps.c
  • do_signal() : signal.c
  • do_stack_segment() : traps.c
  • do_timer() : sched.c
  • do_tty_interrupt() : tty_io.c
  • do_wp_page() : memory.c
  • double_fault() : traps.c
  • drive_busy() : hd.c
  • dup() : unistd.h
  • dup2() : unistd.h
  • dupfd() : fcntl.c

- e -

  • empty_dir() : namei.c
  • execl() : unistd.h
  • execle() : unistd.h
  • execlp() : unistd.h
  • execv() : unistd.h
  • execve() : unistd.h
  • execvp() : unistd.h
  • exit() : unistd.h

- f -

  • fcntl() : unistd.h, fcntl.h
  • file_read() : read_write.c, file_dev.c
  • file_write() : read_write.c, file_dev.c
  • find_buffer() : buffer.c
  • find_empty_process() : fork.c
  • find_entry() : namei.c
  • floppy_change() : floppy.c, fs.h
  • floppy_deselect() : floppy.c, fdreg.h
  • floppy_init() : floppy.c
  • floppy_interrupt() : floppy.c
  • floppy_off() : sched.c, fs.h, fdreg.h
  • floppy_on() : sched.c, fs.h, fdreg.h
  • floppy_on_interrupt() : floppy.c
  • floppy_select() : fdreg.h
  • flush() : tty_ioctl.c
  • fork() : unistd.h
  • free_block() : fs.h, bitmap.c
  • free_dind() : truncate.c
  • free_ind() : truncate.c
  • free_inode() : fs.h, bitmap.c
  • free_page() : memory.c, mm.h
  • free_page_tables() : memory.c, sched.h
  • free_s() : malloc.c, kernel.h
  • free_super() : super.c
  • fstat() : unistd.h, stat.h

- g -

  • general_protection() : traps.c
  • get_dir() : namei.c
  • get_ds() : segment.h
  • get_empty_inode() : fs.h, inode.c
  • get_empty_page() : memory.c
  • get_free_page() : memory.c, mm.h
  • get_fs() : segment.h
  • get_fs_byte() : segment.h
  • get_fs_long() : segment.h
  • get_fs_word() : segment.h
  • get_hash_table() : fs.h, buffer.c
  • get_new() : signal.c
  • get_pipe_inode() : fs.h, inode.c
  • get_super() : fs.h, super.c
  • get_termio() : tty_ioctl.c
  • get_termios() : tty_ioctl.c
  • getblk() : fs.h, buffer.c
  • getegid() : unistd.h
  • geteuid() : unistd.h
  • getgid() : unistd.h
  • getpgrp() : unistd.h
  • getpid() : unistd.h
  • getppid() : unistd.h
  • getuid() : unistd.h
  • gmtime() : time.h
  • gotoxy() : console.c

- h -

  • hd_init() : hd.c
  • hd_interrupt() : hd.c
  • hd_out() : hd.c

- i -

  • iget() : fs.h, inode.c
  • init() : serial.c, main.c
  • init_bucket_desc() : malloc.c
  • insert_char() : console.c
  • insert_into_queues() : buffer.c
  • insert_line() : console.c
  • int3() : traps.c
  • interruptible_sleep_on() : sched.c, sched.h
  • invalid_op() : traps.c
  • invalid_TSS() : traps.c
  • invalidate_buffers() : buffer.c
  • invalidate_inodes() : inode.c, buffer.c
  • ioctl() : unistd.h
  • iput() : fs.h, inode.c
  • irq13() : traps.c

- k -

  • kernel_mktime() : mktime.c
  • keyboard_interrupt() : console.c
  • kill() : unistd.h, signal.h
  • kill_session() : exit.c

- l -

  • lf() : console.c
  • link() : unistd.h
  • ll_rw_block() : ll_rw_blk.c, fs.h
  • localtime() : time.h
  • lock_buffer() : ll_rw_blk.c
  • lock_inode() : inode.c
  • lock_super() : super.c
  • lseek() : unistd.h

- m -

  • main() : build.c, main.c
  • make_request() : ll_rw_blk.c
  • malloc() : malloc.c, kernel.h
  • match() : namei.c
  • math_emulate() : math_emulate.c
  • math_error() : math_emulate.c
  • math_state_restore() : sched.c
  • mem_init() : memory.c
  • mem_use() : sched.c
  • memchr() : string.h
  • memcmp() : string.h
  • memcpy() : string.h, memory.h
  • memmove() : string.h
  • memset() : string.h
  • mkdir() : stat.h
  • mkfifo() : stat.h
  • mknod() : unistd.h
  • mktime() : time.h
  • mount() : unistd.h
  • mount_root() : fs.h, super.c

- n -

  • namei() : fs.h, namei.c
  • new_block() : fs.h, bitmap.c
  • new_inode() : fs.h, bitmap.c
  • nice() : unistd.h
  • nmi() : traps.c
  • number() : vsprintf.c

- o -

  • oom() : memory.c
  • open() : open.c, unistd.h, fcntl.h
  • open_namei() : fs.h, namei.c
  • output_byte() : floppy.c
  • overflow() : traps.c

- p -

  • page_exception() : traps.c
  • page_fault() : traps.c
  • panic() : panic.c, sched.h, kernel.h
  • parallel_interrupt() : traps.c
  • pause() : unistd.h
  • permission() : namei.c
  • pipe() : unistd.h
  • printf() : main.c, kernel.h
  • printk() : printk.c, kernel.h
  • put_fs_byte() : segment.h
  • put_fs_long() : segment.h
  • put_fs_word() : segment.h
  • put_page() : memory.c, mm.h
  • put_super() : super.c, buffer.c

- r -

  • raise() : signal.h
  • rd_init() : ramdisk.c
  • rd_load() : ramdisk.c, hd.c
  • read() : unistd.h
  • read_inode() : inode.c
  • read_intr() : hd.c
  • read_pipe() : read_write.c, pipe.c
  • read_super() : super.c
  • recal_interrupt() : floppy.c
  • recal_intr() : hd.c
  • recalibrate_floppy() : floppy.c
  • release() : exit.c
  • remove_from_queues() : buffer.c
  • reserved() : traps.c
  • reset_controller() : hd.c
  • reset_floppy() : floppy.c
  • reset_hd() : hd.c
  • reset_interrupt() : floppy.c
  • respond() : console.c
  • restore_cur() : console.c
  • result() : floppy.c
  • ri() : console.c
  • rs1_interrupt() : serial.c
  • rs2_interrupt() : serial.c
  • rs_init() : serial.c, tty.h
  • rs_write() : serial.c, tty.h
  • rw_char() : read_write.c, char_dev.c
  • rw_interrupt() : floppy.c
  • rw_kmem() : char_dev.c
  • rw_mem() : char_dev.c
  • rw_memory() : char_dev.c
  • rw_port() : char_dev.c
  • rw_ram() : char_dev.c
  • rw_tty() : char_dev.c
  • rw_ttyx() : char_dev.c

- s -

  • save_cur() : console.c
  • save_old() : signal.c
  • sbrk() : unistd.h
  • sched_init() : sched.c, sched.h
  • schedule() : sched.c, sched.h
  • scrdown() : console.c
  • scrup() : console.c
  • seek_interrupt() : floppy.c
  • segment_not_present() : traps.c
  • send_break() : tty_ioctl.c
  • send_sig() : exit.c
  • set_cursor() : console.c
  • set_fs() : segment.h
  • set_origin() : console.c
  • set_termio() : tty_ioctl.c
  • set_termios() : tty_ioctl.c
  • setgid() : unistd.h
  • setpgid() : unistd.h
  • setpgrp() : unistd.h
  • setsid() : unistd.h
  • setuid() : unistd.h
  • setup_DMA() : floppy.c
  • setup_rw_floppy() : floppy.c
  • share_page() : memory.c
  • show_stat() : sched.c
  • show_task() : sched.c
  • sigaction() : signal.h
  • sigaddset() : signal.h
  • sigdelset() : signal.h
  • sigemptyset() : signal.h
  • sigfillset() : signal.h
  • sigismember() : signal.h
  • sigpending() : signal.h
  • sigprocmask() : signal.h
  • sigsuspend() : signal.h
  • skip_atoi() : vsprintf.c
  • sleep_if_empty() : tty_io.c
  • sleep_if_full() : tty_io.c
  • sleep_on() : sched.c, sched.h
  • stack_segment() : traps.c
  • stat() : unistd.h, stat.h
  • stime() : unistd.h
  • strcat() : string.h
  • strchr() : string.h
  • strcmp() : string.h
  • strcpy() : string.h
  • strcspn() : string.h
  • strerror() : string.h
  • strftime() : time.h
  • strlen() : string.h
  • strncat() : string.h
  • strncmp() : string.h
  • strncpy() : string.h
  • strpbrk() : string.h
  • strrchr() : string.h
  • strspn() : string.h
  • strstr() : string.h
  • strtok() : string.h
  • sync() : unistd.h
  • sync_dev() : fs.h, super.c, buffer.c
  • sync_inodes() : fs.h, inode.c
  • sys_access() : sys.h, open.c
  • sys_acct() : sys.c, sys.h
  • sys_alarm() : sched.c, sys.h
  • sys_break() : sys.c, sys.h
  • sys_brk() : sys.c, sys.h
  • sys_chdir() : sys.h, open.c
  • sys_chmod() : sys.h, open.c
  • sys_chown() : sys.h, open.c
  • sys_chroot() : sys.h, open.c
  • sys_close() : exit.c, sys.h, open.c, fcntl.c, exec.c
  • sys_creat() : sys.h, open.c
  • sys_dup() : sys.h, fcntl.c
  • sys_dup2() : sys.h, fcntl.c
  • sys_execve() : sys.h
  • sys_exit() : exit.c, sys.h, exec.c
  • sys_fcntl() : sys.h, fcntl.c
  • sys_fork() : sys.h
  • sys_fstat() : sys.h, stat.c
  • sys_ftime() : sys.c, sys.h
  • sys_getegid() : sched.c, sys.h
  • sys_geteuid() : sched.c, sys.h
  • sys_getgid() : sched.c, sys.h
  • sys_getpgrp() : sys.c, sys.h
  • sys_getpid() : sched.c, sys.h
  • sys_getppid() : sched.c, sys.h
  • sys_getuid() : sched.c, sys.h
  • sys_gtty() : sys.c, sys.h
  • sys_ioctl() : sys.h, ioctl.c
  • sys_kill() : exit.c, sys.h
  • sys_link() : sys.h, namei.c
  • sys_lock() : sys.c, sys.h
  • sys_lseek() : sys.h, read_write.c
  • sys_mkdir() : sys.h, namei.c
  • sys_mknod() : sys.h, namei.c
  • sys_mount() : sys.h, super.c
  • sys_mpx() : sys.c, sys.h
  • sys_nice() : sched.c, sys.h
  • sys_open() : sys.h, open.c
  • sys_pause() : sched.c, exit.c, sys.h
  • sys_phys() : sys.c, sys.h
  • sys_pipe() : sys.h, pipe.c
  • sys_prof() : sys.c, sys.h
  • sys_ptrace() : sys.c, sys.h
  • sys_read() : sys.h, read_write.c
  • sys_rename() : sys.c, sys.h
  • sys_rmdir() : sys.h, namei.c
  • sys_setgid() : sys.c, sys.h
  • sys_setpgid() : sys.c, sys.h
  • sys_setregid() : sys.c, sys.h
  • sys_setreuid() : sys.c, sys.h
  • sys_setsid() : sys.c, sys.h
  • sys_setuid() : sys.c, sys.h
  • sys_setup() : hd.c, sys.h
  • sys_sgetmask() : signal.c, sys.h
  • sys_sigaction() : signal.c, sys.h
  • sys_signal() : signal.c, sys.h
  • sys_ssetmask() : signal.c, sys.h
  • sys_stat() : sys.h, stat.c
  • sys_stime() : sys.c, sys.h
  • sys_stty() : sys.c, sys.h
  • sys_sync() : panic.c, sys.h, buffer.c
  • sys_time() : sys.c, sys.h
  • sys_times() : sys.c, sys.h
  • sys_ulimit() : sys.c, sys.h
  • sys_umask() : sys.c, sys.h
  • sys_umount() : sys.h, super.c
  • sys_uname() : sys.c, sys.h
  • sys_unlink() : sys.h, namei.c
  • sys_ustat() : sys.h, open.c
  • sys_utime() : sys.h, open.c
  • sys_waitpid() : exit.c, sys.h
  • sys_write() : sys.h, read_write.c
  • sysbeep() : console.c
  • sysbeepstop() : console.c
  • system_call() : sched.c

- t -

  • tcdrain() : termios.h
  • tcflow() : termios.h
  • tcflush() : termios.h
  • tcgetattr() : termios.h
  • tcsendbreak() : termios.h
  • tcsetattr() : termios.h
  • tell_father() : exit.c
  • ticks_to_floppy_on() : sched.c, fs.h, fdreg.h
  • time() : unistd.h, time.h
  • timer_interrupt() : sched.c
  • times() : unistd.h, times.h
  • transfer() : floppy.c
  • trap_init() : traps.c, sched.h
  • truncate() : fs.h, truncate.c
  • try_to_share() : memory.c
  • tty_init() : tty_io.c, tty.h
  • tty_intr() : tty_io.c
  • tty_ioctl() : tty_ioctl.c, ioctl.c
  • tty_read() : tty_io.c, tty.h, char_dev.c
  • tty_write() : tty_io.c, tty.h, sched.h, kernel.h, char_dev.c
  • tzset() : time.h

- u -

  • ulimit() : unistd.h
  • umask() : unistd.h, stat.h
  • umount() : unistd.h
  • un_wp_page() : memory.c
  • uname() : unistd.h, utsname.h
  • unexpected_floppy_interrupt() : floppy.c
  • unexpected_hd_interrupt() : hd.c
  • unlink() : unistd.h
  • unlock_buffer() : ll_rw_blk.c
  • unlock_inode() : inode.c
  • usage() : build.c
  • ustat() : unistd.h
  • utime() : utime.h, unistd.h

- v -

  • va_end() : stdarg.h
  • verify_area() : fork.c, kernel.h
  • vsprintf() : vsprintf.c, printk.c

- w -

  • wait() : unistd.h, wait.h
  • wait_for_keypress() : tty_io.c, super.c
  • wait_on() : fs.h
  • wait_on_buffer() : buffer.c
  • wait_on_inode() : inode.c
  • wait_on_super() : super.c
  • wait_until_sent() : tty_ioctl.c
  • waitpid() : unistd.h, wait.h
  • wake_up() : sched.c, sched.h
  • win_result() : hd.c
  • write() : unistd.h
  • write_inode() : inode.c
  • write_intr() : hd.c
  • write_pipe() : read_write.c, pipe.c
  • write_verify() : memory.c, fork.c
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Globals - Typedefs

  • buffer_block : fs.h
  • clock_t : time.h
  • crw_ptr : char_dev.c
  • daddr_t : types.h
  • desc_table : head.h
  • dev_t : types.h
  • fn_ptr : sched.h
  • gid_t : types.h
  • ino_t : types.h
  • ioctl_ptr : ioctl.c
  • mode_t : types.h
  • nlink_t : types.h
  • off_t : types.h
  • pid_t : types.h
  • ptrdiff_t : types.h, stddef.h
  • sig_atomic_t : signal.h
  • sigset_t : signal.h
  • size_t : time.h, types.h, string.h, stddef.h
  • speed_t : termios.h
  • time_t : time.h, types.h
  • u_char : types.h
  • uid_t : types.h
  • umode_t : types.h
  • ushort : types.h
  • va_list : stdarg.h
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: Globals - Variables

- _ -

  • ___strtok : string.h
  • _ctmp : ctype.c, ctype.h
  • _ctype : ctype.c, ctype.h

- a -

  • a : sched.c
  • argv : main.c
  • argv_rc : main.c
  • attr : console.c

- b -

  • b : sched.c
  • beepcount : console.c
  • blk_dev : ll_rw_blk.c, blk.h
  • bottom : console.c
  • bucket_dir : malloc.c
  • buf : printk.c
  • buffer_memory_end : main.c
  • buffer_wait : buffer.c

- c -

  • command : floppy.c
  • crw_table : char_dev.c
  • cur_rate : floppy.c
  • cur_spec1 : floppy.c
  • current : sched.c, sched.h
  • current_DOR : sched.c, floppy.c
  • current_drive : floppy.c
  • current_track : floppy.c

- d -

  • drive_info : main.c

- e -

  • end : buffer.c
  • envp : main.c
  • envp_rc : main.c
  • errno : errno.c, unistd.h, errno.h

- f -

  • file_table : fs.h, file_table.c
  • floppy : floppy.c
  • floppy_type : floppy.c
  • free_bucket_desc : malloc.c
  • free_list : buffer.c

- g -

  • gdt : head.h

- h -

  • hash_table : buffer.c
  • hd_info : hd.c
  • head : floppy.c
  • HIGH_MEMORY : memory.c

- i -

  • idt : head.h
  • init_task : sched.c
  • inode_table : fs.h, inode.c
  • ioctl_table : ioctl.c

- j -

  • jiffies : sched.c, sched.h

- l -

  • last_pid : fork.c
  • last_task_used_math : sched.c, sched.h

- m -

  • main_memory_start : main.c
  • MAX_HD : hd.c
  • mem_map : memory.c
  • memory_end : main.c
  • moff_timer : sched.c
  • mon_timer : sched.c
  • month : mktime.c

- n -

  • next_timer : sched.c
  • npar : console.c
  • nr_buffers : fs.h
  • NR_BUFFERS : buffer.c, fs.h
  • NR_HD : hd.c

- o -

  • origin : console.c

- p -

  • par : console.c
  • pg_dir : head.h
  • pos : console.c

- q -

  • ques : console.c
  • quotient : tty_ioctl.c

- r -

  • rd_length : ramdisk.c
  • rd_start : ramdisk.c
  • recalibrate : hd.c, floppy.c
  • reply_buffer : floppy.c
  • request : ll_rw_blk.c, blk.h
  • reset : hd.c, floppy.c
  • ROOT_DEV : fs.h, super.c

- s -

  • saved_x : console.c
  • saved_y : console.c
  • scr_end : console.c
  • sector : floppy.c
  • seek : floppy.c
  • seek_track : floppy.c
  • selected : floppy.c
  • signal : unistd.h, signal.h
  • stack_start : sched.c
  • start_buffer : fs.h, buffer.c
  • startup_time : sched.c, sched.h
  • state : console.c
  • super_block : fs.h, super.c
  • sys_call_table : sys.h

- t -

  • table_list : tty_io.c
  • task : sched.c, sched.h
  • timer_list : sched.c
  • tmp_floppy_area : floppy.c
  • top : console.c
  • track : floppy.c
  • tty_table : tty_io.c, tty.h

- u -

  • user_stack : sched.c

- v -

  • video_erase_char : console.c
  • video_mem_end : console.c
  • video_mem_start : console.c
  • video_num_columns : console.c
  • video_num_lines : console.c
  • video_page : console.c
  • video_port_reg : console.c
  • video_port_val : console.c
  • video_size_row : console.c
  • video_type : console.c

- w -

  • wait_for_request : ll_rw_blk.c, blk.h
  • wait_motor : sched.c
  • wait_on_floppy_select : floppy.c

- x -

  • x : console.c

- y -

  • y : console.c
Generated on Sun Mar 6 10:56:11 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/hd.c Source File

hd.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/hd.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * This is the low-level hd interrupt support. It traverses the
00009  * request-list, using interrupts to jump between functions. As
00010  * all the functions are called within interrupts, we may not
00011  * sleep. Special care is recommended.
00012  *
00013  *  modified by Drew Eckhardt to check nr of hd's from the CMOS.
00014  */
00015
00016 #include <linux/config.h>
00017 #include <linux/sched.h>
00018 #include <linux/fs.h>
00019 #include <linux/kernel.h>
00020 #include <linux/hdreg.h>
00021 #include <asm/system.h>
00022 #include <asm/io.h>
00023 #include <asm/segment.h>
00024
00025 #define MAJOR_NR 3
00026 #include "blk.h"
00027
00028 #define CMOS_READ(addr) ({ \
00029 outb_p(0x80|addr,0x70); \
00030 inb_p(0x71); \
00031 })
00032
00033 /* Max read/write errors/sector */
00034 #define MAX_ERRORS  7
00035 #define MAX_HD      2
00036
00037 static void recal_intr(void);
00038
00039 static int recalibrate = 1;
00040 static int reset = 1;
00041
00042 /*
00043  *  This struct defines the HD's and their types.
00044  */
00045 struct hd_i_struct {
00046     int head,sect,cyl,wpcom,lzone,ctl;
00047     };
00048 #ifdef HD_TYPE
00049 struct hd_i_struct hd_info[] = { HD_TYPE };
00050 #define NR_HD ((sizeof (hd_info))/(sizeof (struct hd_i_struct)))
00051 #else
00052 struct hd_i_struct hd_info[] = { {0,0,0,0,0,0},{0,0,0,0,0,0} };
00053 static int NR_HD = 0;
00054 #endif
00055
00056 static struct hd_struct {
00057     long start_sect;
00058     long nr_sects;
00059 } hd[5*MAX_HD]={{0,0},};
00060
00061 #define port_read(port,buf,nr) \
00062 __asm__("cld;rep;insw"::"d" (port),"D" (buf),"c" (nr))
00063
00064 #define port_write(port,buf,nr) \
00065 __asm__("cld;rep;outsw"::"d" (port),"S" (buf),"c" (nr))
00066
00067 extern void hd_interrupt(void);
00068 extern void rd_load(void);
00069
00070 /* This may be used only once, enforced by 'static int callable' */
00071 int sys_setup(void * BIOS)
00072 {
00073     static int callable = 1;
00074     int i,drive;
00075     unsigned char cmos_disks;
00076     struct partition *p;
00077     struct buffer_head * bh;
00078
00079     if (!callable)
00080         return -1;
00081     callable = 0;
00082 #ifndef HD_TYPE
00083     for (drive=0 ; drive<2 ; drive++) {
00084         hd_info[drive].cyl = *(unsigned short *) BIOS;
00085         hd_info[drive].head = *(unsigned char *) (2+BIOS);
00086         hd_info[drive].wpcom = *(unsigned short *) (5+BIOS);
00087         hd_info[drive].ctl = *(unsigned char *) (8+BIOS);
00088         hd_info[drive].lzone = *(unsigned short *) (12+BIOS);
00089         hd_info[drive].sect = *(unsigned char *) (14+BIOS);
00090         BIOS += 16;
00091     }
00092     if (hd_info[1].cyl)
00093         NR_HD=2;
00094     else
00095         NR_HD=1;
00096 #endif
00097     for (i=0 ; i<NR_HD ; i++) {
00098         hd[i*5].start_sect = 0;
00099         hd[i*5].nr_sects = hd_info[i].head*
00100                 hd_info[i].sect*hd_info[i].cyl;
00101     }
00102
00103     /*
00104         We querry CMOS about hard disks : it could be that
00105         we have a SCSI/ESDI/etc controller that is BIOS
00106         compatable with ST-506, and thus showing up in our
00107         BIOS table, but not register compatable, and therefore
00108         not present in CMOS.
00109
00110         Furthurmore, we will assume that our ST-506 drives
00111         <if any> are the primary drives in the system, and
00112         the ones reflected as drive 1 or 2.
00113
00114         The first drive is stored in the high nibble of CMOS
00115         byte 0x12, the second in the low nibble.  This will be
00116         either a 4 bit drive type or 0xf indicating use byte 0x19
00117         for an 8 bit type, drive 1, 0x1a for drive 2 in CMOS.
00118
00119         Needless to say, a non-zero value means we have
00120         an AT controller hard disk for that drive.
00121
00122
00123     */
00124
00125     if ((cmos_disks = CMOS_READ(0x12)) & 0xf0)
00126         if (cmos_disks & 0x0f)
00127             NR_HD = 2;
00128         else
00129             NR_HD = 1;
00130     else
00131         NR_HD = 0;
00132     for (i = NR_HD ; i < 2 ; i++) {
00133         hd[i*5].start_sect = 0;
00134         hd[i*5].nr_sects = 0;
00135     }
00136     for (drive=0 ; drive<NR_HD ; drive++) {
00137         if (!(bh = bread(0x300 + drive*5,0))) {
00138             printk("Unable to read partition table of drive %d\n\r",
00139                 drive);
00140             panic("");
00141         }
00142         if (bh->b_data[510] != 0x55 || (unsigned char)
00143             bh->b_data[511] != 0xAA) {
00144             printk("Bad partition table on drive %d\n\r",drive);
00145             panic("");
00146         }
00147         p = 0x1BE + (void *)bh->b_data;
00148         for (i=1;i<5;i++,p++) {
00149             hd[i+5*drive].start_sect = p->start_sect;
00150             hd[i+5*drive].nr_sects = p->nr_sects;
00151         }
00152         brelse(bh);
00153     }
00154     if (NR_HD)
00155         printk("Partition table%s ok.\n\r",(NR_HD>1)?"s":"");
00156     rd_load();
00157     mount_root();
00158     return (0);
00159 }
00160
00161 static int controller_ready(void)
00162 {
00163     int retries=10000;
00164
00165     while (--retries && (inb_p(HD_STATUS)&0xc0)!=0x40);
00166     return (retries);
00167 }
00168
00169 static int win_result(void)
00170 {
00171     int i=inb_p(HD_STATUS);
00172
00173     if ((i & (BUSY_STAT | READY_STAT | WRERR_STAT | SEEK_STAT | ERR_STAT))
00174         == (READY_STAT | SEEK_STAT))
00175         return(0); /* ok */
00176     if (i&1) i=inb(HD_ERROR);
00177     return (1);
00178 }
00179
00180 static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect,
00181         unsigned int head,unsigned int cyl,unsigned int cmd,
00182         void (*intr_addr)(void))
00183 {
00184     register int port asm("dx");
00185
00186     if (drive>1 || head>15)
00187         panic("Trying to write bad sector");
00188     if (!controller_ready())
00189         panic("HD controller not ready");
00190     do_hd = intr_addr;
00191     outb_p(hd_info[drive].ctl,HD_CMD);
00192     port=HD_DATA;
00193     outb_p(hd_info[drive].wpcom>>2,++port);
00194     outb_p(nsect,++port);
00195     outb_p(sect,++port);
00196     outb_p(cyl,++port);
00197     outb_p(cyl>>8,++port);
00198     outb_p(0xA0|(drive<<4)|head,++port);
00199     outb(cmd,++port);
00200 }
00201
00202 static int drive_busy(void)
00203 {
00204     unsigned int i;
00205
00206     for (i = 0; i < 10000; i++)
00207         if (READY_STAT == (inb_p(HD_STATUS) & (BUSY_STAT|READY_STAT)))
00208             break;
00209     i = inb(HD_STATUS);
00210     i &= BUSY_STAT | READY_STAT | SEEK_STAT;
00211     if (i == (READY_STAT | SEEK_STAT))
00212         return(0);
00213     printk("HD controller times out\n\r");
00214     return(1);
00215 }
00216
00217 static void reset_controller(void)
00218 {
00219     int i;
00220
00221     outb(4,HD_CMD);
00222     for(i = 0; i < 100; i++) nop();
00223     outb(hd_info[0].ctl & 0x0f ,HD_CMD);
00224     if (drive_busy())
00225         printk("HD-controller still busy\n\r");
00226     if ((i = inb(HD_ERROR)) != 1)
00227         printk("HD-controller reset failed: %02x\n\r",i);
00228 }
00229
00230 static void reset_hd(int nr)
00231 {
00232     reset_controller();
00233     hd_out(nr,hd_info[nr].sect,hd_info[nr].sect,hd_info[nr].head-1,
00234         hd_info[nr].cyl,WIN_SPECIFY,&recal_intr);
00235 }
00236
00237 void unexpected_hd_interrupt(void)
00238 {
00239     printk("Unexpected HD interrupt\n\r");
00240 }
00241
00242 static void bad_rw_intr(void)
00243 {
00244     if (++CURRENT->errors >= MAX_ERRORS)
00245         end_request(0);
00246     if (CURRENT->errors > MAX_ERRORS/2)
00247         reset = 1;
00248 }
00249
00250 static void read_intr(void)
00251 {
00252     if (win_result()) {
00253         bad_rw_intr();
00254         do_hd_request();
00255         return;
00256     }
00257     port_read(HD_DATA,CURRENT->buffer,256);
00258     CURRENT->errors = 0;
00259     CURRENT->buffer += 512;
00260     CURRENT->sector++;
00261     if (--CURRENT->nr_sectors) {
00262         do_hd = &read_intr;
00263         return;
00264     }
00265     end_request(1);
00266     do_hd_request();
00267 }
00268
00269 static void write_intr(void)
00270 {
00271     if (win_result()) {
00272         bad_rw_intr();
00273         do_hd_request();
00274         return;
00275     }
00276     if (--CURRENT->nr_sectors) {
00277         CURRENT->sector++;
00278         CURRENT->buffer += 512;
00279         do_hd = &write_intr;
00280         port_write(HD_DATA,CURRENT->buffer,256);
00281         return;
00282     }
00283     end_request(1);
00284     do_hd_request();
00285 }
00286
00287 static void recal_intr(void)
00288 {
00289     if (win_result())
00290         bad_rw_intr();
00291     do_hd_request();
00292 }
00293
00294 void do_hd_request(void)
00295 {
00296     int i,r = 0;
00297     unsigned int block,dev;
00298     unsigned int sec,head,cyl;
00299     unsigned int nsect;
00300
00301     INIT_REQUEST;
00302     dev = MINOR(CURRENT->dev);
00303     block = CURRENT->sector;
00304     if (dev >= 5*NR_HD || block+2 > hd[dev].nr_sects) {
00305         end_request(0);
00306         goto repeat;
00307     }
00308     block += hd[dev].start_sect;
00309     dev /= 5;
00310     __asm__("divl %4":"=a" (block),"=d" (sec):"0" (block),"1" (0),
00311         "r" (hd_info[dev].sect));
00312     __asm__("divl %4":"=a" (cyl),"=d" (head):"0" (block),"1" (0),
00313         "r" (hd_info[dev].head));
00314     sec++;
00315     nsect = CURRENT->nr_sectors;
00316     if (reset) {
00317         reset = 0;
00318         recalibrate = 1;
00319         reset_hd(CURRENT_DEV);
00320         return;
00321     }
00322     if (recalibrate) {
00323         recalibrate = 0;
00324         hd_out(dev,hd_info[CURRENT_DEV].sect,0,0,0,
00325             WIN_RESTORE,&recal_intr);
00326         return;
00327     }
00328     if (CURRENT->cmd == WRITE) {
00329         hd_out(dev,nsect,sec,head,cyl,WIN_WRITE,&write_intr);
00330         for(i=0 ; i<3000 && !(r=inb_p(HD_STATUS)&DRQ_STAT) ; i++)
00331             /* nothing */ ;
00332         if (!r) {
00333             bad_rw_intr();
00334             goto repeat;
00335         }
00336         port_write(HD_DATA,CURRENT->buffer,256);
00337     } else if (CURRENT->cmd == READ) {
00338         hd_out(dev,nsect,sec,head,cyl,WIN_READ,&read_intr);
00339     } else
00340         panic("unknown hd-command");
00341 }
00342
00343 void hd_init(void)
00344 {
00345     blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
00346     set_intr_gate(0x2E,&hd_interrupt);
00347     outb_p(inb_p(0x21)&0xfb,0x21);
00348     outb(inb_p(0xA1)&0xbf,0xA1);
00349 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/hdreg.h Source File

hdreg.h

Go to the documentation of this file.
00001 /*
00002  * This file contains some defines for the AT-hd-controller.
00003  * Various sources. Check out some definitions (see comments with
00004  * a ques).
00005  */
00006 #ifndef _HDREG_H
00007 #define _HDREG_H
00008
00009 /* Hd controller regs. Ref: IBM AT Bios-listing */
00010 #define HD_DATA     0x1f0   /* _CTL when writing */
00011 #define HD_ERROR    0x1f1   /* see err-bits */
00012 #define HD_NSECTOR  0x1f2   /* nr of sectors to read/write */
00013 #define HD_SECTOR   0x1f3   /* starting sector */
00014 #define HD_LCYL     0x1f4   /* starting cylinder */
00015 #define HD_HCYL     0x1f5   /* high byte of starting cyl */
00016 #define HD_CURRENT  0x1f6   /* 101dhhhh , d=drive, hhhh=head */
00017 #define HD_STATUS   0x1f7   /* see status-bits */
00018 #define HD_PRECOMP HD_ERROR /* same io address, read=error, write=precomp */
00019 #define HD_COMMAND HD_STATUS    /* same io address, read=status, write=cmd */
00020
00021 #define HD_CMD      0x3f6
00022
00023 /* Bits of HD_STATUS */
00024 #define ERR_STAT    0x01
00025 #define INDEX_STAT  0x02
00026 #define ECC_STAT    0x04    /* Corrected error */
00027 #define DRQ_STAT    0x08
00028 #define SEEK_STAT   0x10
00029 #define WRERR_STAT  0x20
00030 #define READY_STAT  0x40
00031 #define BUSY_STAT   0x80
00032
00033 /* Values for HD_COMMAND */
00034 #define WIN_RESTORE     0x10
00035 #define WIN_READ        0x20
00036 #define WIN_WRITE       0x30
00037 #define WIN_VERIFY      0x40
00038 #define WIN_FORMAT      0x50
00039 #define WIN_INIT        0x60
00040 #define WIN_SEEK        0x70
00041 #define WIN_DIAGNOSE        0x90
00042 #define WIN_SPECIFY     0x91
00043
00044 /* Bits for HD_ERROR */
00045 #define MARK_ERR    0x01    /* Bad address mark ? */
00046 #define TRK0_ERR    0x02    /* couldn't find track 0 */
00047 #define ABRT_ERR    0x04    /* ? */
00048 #define ID_ERR      0x10    /* ? */
00049 #define ECC_ERR     0x40    /* ? */
00050 #define BBD_ERR     0x80    /* ? */
00051
00052 struct partition {
00053     unsigned char boot_ind;     /* 0x80 - active (unused) */
00054     unsigned char head;     /* ? */
00055     unsigned char sector;       /* ? */
00056     unsigned char cyl;      /* ? */
00057     unsigned char sys_ind;      /* ? */
00058     unsigned char end_head;     /* ? */
00059     unsigned char end_sector;   /* ? */
00060     unsigned char end_cyl;      /* ? */
00061     unsigned int start_sect;    /* starting sector counting from 0 */
00062     unsigned int nr_sects;      /* nr of sectors in partition */
00063 };
00064
00065 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/head.h Source File

head.h

Go to the documentation of this file.
00001 #ifndef _HEAD_H
00002 #define _HEAD_H
00003
00004 typedef struct desc_struct {
00005     unsigned long a,b;
00006 } desc_table[256];
00007
00008 extern unsigned long pg_dir[1024];
00009 extern desc_table idt,gdt;
00010
00011 #define GDT_NUL 0
00012 #define GDT_CODE 1
00013 #define GDT_DATA 2
00014 #define GDT_TMP 3
00015
00016 #define LDT_NUL 0
00017 #define LDT_CODE 1
00018 #define LDT_DATA 2
00019
00020 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/inode.c Source File

inode.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/inode.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <string.h>
00008 #include <sys/stat.h>
00009
00010 #include <linux/sched.h>
00011 #include <linux/kernel.h>
00012 #include <linux/mm.h>
00013 #include <asm/system.h>
00014
00015 struct m_inode inode_table[NR_INODE]={{0,},};
00016
00017 static void read_inode(struct m_inode * inode);
00018 static void write_inode(struct m_inode * inode);
00019
00020 static inline void wait_on_inode(struct m_inode * inode)
00021 {
00022     cli();
00023     while (inode->i_lock)
00024         sleep_on(&inode->i_wait);
00025     sti();
00026 }
00027
00028 static inline void lock_inode(struct m_inode * inode)
00029 {
00030     cli();
00031     while (inode->i_lock)
00032         sleep_on(&inode->i_wait);
00033     inode->i_lock=1;
00034     sti();
00035 }
00036
00037 static inline void unlock_inode(struct m_inode * inode)
00038 {
00039     inode->i_lock=0;
00040     wake_up(&inode->i_wait);
00041 }
00042
00043 void invalidate_inodes(int dev)
00044 {
00045     int i;
00046     struct m_inode * inode;
00047
00048     inode = 0+inode_table;
00049     for(i=0 ; i<NR_INODE ; i++,inode++) {
00050         wait_on_inode(inode);
00051         if (inode->i_dev == dev) {
00052             if (inode->i_count)
00053                 printk("inode in use on removed disk\n\r");
00054             inode->i_dev = inode->i_dirt = 0;
00055         }
00056     }
00057 }
00058
00059 void sync_inodes(void)
00060 {
00061     int i;
00062     struct m_inode * inode;
00063
00064     inode = 0+inode_table;
00065     for(i=0 ; i<NR_INODE ; i++,inode++) {
00066         wait_on_inode(inode);
00067         if (inode->i_dirt && !inode->i_pipe)
00068             write_inode(inode);
00069     }
00070 }
00071
00072 static int _bmap(struct m_inode * inode,int block,int create)
00073 {
00074     struct buffer_head * bh;
00075     int i;
00076
00077     if (block<0)
00078         panic("_bmap: block<0");
00079     if (block >= 7+512+512*512)
00080         panic("_bmap: block>big");
00081     if (block<7) {
00082         if (create && !inode->i_zone[block])
00083             if ((inode->i_zone[block]=new_block(inode->i_dev))) {
00084                 inode->i_ctime=CURRENT_TIME;
00085                 inode->i_dirt=1;
00086             }
00087         return inode->i_zone[block];
00088     }
00089     block -= 7;
00090     if (block<512) {
00091         if (create && !inode->i_zone[7])
00092             if ((inode->i_zone[7]=new_block(inode->i_dev))) {
00093                 inode->i_dirt=1;
00094                 inode->i_ctime=CURRENT_TIME;
00095             }
00096         if (!inode->i_zone[7])
00097             return 0;
00098         if (!(bh = bread(inode->i_dev,inode->i_zone[7])))
00099             return 0;
00100         i = ((unsigned short *) (bh->b_data))[block];
00101         if (create && !i)
00102             if ((i=new_block(inode->i_dev))) {
00103                 ((unsigned short *) (bh->b_data))[block]=i;
00104                 bh->b_dirt=1;
00105             }
00106         brelse(bh);
00107         return i;
00108     }
00109     block -= 512;
00110     if (create && !inode->i_zone[8])
00111         if ((inode->i_zone[8]=new_block(inode->i_dev))) {
00112             inode->i_dirt=1;
00113             inode->i_ctime=CURRENT_TIME;
00114         }
00115     if (!inode->i_zone[8])
00116         return 0;
00117     if (!(bh=bread(inode->i_dev,inode->i_zone[8])))
00118         return 0;
00119     i = ((unsigned short *)bh->b_data)[block>>9];
00120     if (create && !i)
00121         if ((i=new_block(inode->i_dev))) {
00122             ((unsigned short *) (bh->b_data))[block>>9]=i;
00123             bh->b_dirt=1;
00124         }
00125     brelse(bh);
00126     if (!i)
00127         return 0;
00128     if (!(bh=bread(inode->i_dev,i)))
00129         return 0;
00130     i = ((unsigned short *)bh->b_data)[block&511];
00131     if (create && !i)
00132         if ((i=new_block(inode->i_dev))) {
00133             ((unsigned short *) (bh->b_data))[block&511]=i;
00134             bh->b_dirt=1;
00135         }
00136     brelse(bh);
00137     return i;
00138 }
00139
00140 int bmap(struct m_inode * inode,int block)
00141 {
00142     return _bmap(inode,block,0);
00143 }
00144
00145 int create_block(struct m_inode * inode, int block)
00146 {
00147     return _bmap(inode,block,1);
00148 }
00149
00150 void iput(struct m_inode * inode)
00151 {
00152     if (!inode)
00153         return;
00154     wait_on_inode(inode);
00155     if (!inode->i_count)
00156         panic("iput: trying to free free inode");
00157     if (inode->i_pipe) {
00158         wake_up(&inode->i_wait);
00159         if (--inode->i_count)
00160             return;
00161         free_page(inode->i_size);
00162         inode->i_count=0;
00163         inode->i_dirt=0;
00164         inode->i_pipe=0;
00165         return;
00166     }
00167     if (!inode->i_dev) {
00168         inode->i_count--;
00169         return;
00170     }
00171     if (S_ISBLK(inode->i_mode)) {
00172         sync_dev(inode->i_zone[0]);
00173         wait_on_inode(inode);
00174     }
00175 repeat:
00176     if (inode->i_count>1) {
00177         inode->i_count--;
00178         return;
00179     }
00180     if (!inode->i_nlinks) {
00181         truncate(inode);
00182         free_inode(inode);
00183         return;
00184     }
00185     if (inode->i_dirt) {
00186         write_inode(inode); /* we can sleep - so do again */
00187         wait_on_inode(inode);
00188         goto repeat;
00189     }
00190     inode->i_count--;
00191     return;
00192 }
00193
00194 struct m_inode * get_empty_inode(void)
00195 {
00196     struct m_inode * inode;
00197     static struct m_inode * last_inode = inode_table;
00198     int i;
00199
00200     do {
00201         inode = NULL;
00202         for (i = NR_INODE; i ; i--) {
00203             if (++last_inode >= inode_table + NR_INODE)
00204                 last_inode = inode_table;
00205             if (!last_inode->i_count) {
00206                 inode = last_inode;
00207                 if (!inode->i_dirt && !inode->i_lock)
00208                     break;
00209             }
00210         }
00211         if (!inode) {
00212             for (i=0 ; i<NR_INODE ; i++)
00213                 printk("%04x: %6d\t",inode_table[i].i_dev,
00214                     inode_table[i].i_num);
00215             panic("No free inodes in mem");
00216         }
00217         wait_on_inode(inode);
00218         while (inode->i_dirt) {
00219             write_inode(inode);
00220             wait_on_inode(inode);
00221         }
00222     } while (inode->i_count);
00223     memset(inode,0,sizeof(*inode));
00224     inode->i_count = 1;
00225     return inode;
00226 }
00227
00228 struct m_inode * get_pipe_inode(void)
00229 {
00230     struct m_inode * inode;
00231
00232     if (!(inode = get_empty_inode()))
00233         return NULL;
00234     if (!(inode->i_size=get_free_page())) {
00235         inode->i_count = 0;
00236         return NULL;
00237     }
00238     inode->i_count = 2; /* sum of readers/writers */
00239     PIPE_HEAD(*inode) = PIPE_TAIL(*inode) = 0;
00240     inode->i_pipe = 1;
00241     return inode;
00242 }
00243
00244 struct m_inode * iget(int dev,int nr)
00245 {
00246     struct m_inode * inode, * empty;
00247
00248     if (!dev)
00249         panic("iget with dev==0");
00250     empty = get_empty_inode();
00251     inode = inode_table;
00252     while (inode < NR_INODE+inode_table) {
00253         if (inode->i_dev != dev || inode->i_num != nr) {
00254             inode++;
00255             continue;
00256         }
00257         wait_on_inode(inode);
00258         if (inode->i_dev != dev || inode->i_num != nr) {
00259             inode = inode_table;
00260             continue;
00261         }
00262         inode->i_count++;
00263         if (inode->i_mount) {
00264             int i;
00265
00266             for (i = 0 ; i<NR_SUPER ; i++)
00267                 if (super_block[i].s_imount==inode)
00268                     break;
00269             if (i >= NR_SUPER) {
00270                 printk("Mounted inode hasn't got sb\n");
00271                 if (empty)
00272                     iput(empty);
00273                 return inode;
00274             }
00275             iput(inode);
00276             dev = super_block[i].s_dev;
00277             nr = ROOT_INO;
00278             inode = inode_table;
00279             continue;
00280         }
00281         if (empty)
00282             iput(empty);
00283         return inode;
00284     }
00285     if (!empty)
00286         return (NULL);
00287     inode=empty;
00288     inode->i_dev = dev;
00289     inode->i_num = nr;
00290     read_inode(inode);
00291     return inode;
00292 }
00293
00294 static void read_inode(struct m_inode * inode)
00295 {
00296     struct super_block * sb;
00297     struct buffer_head * bh;
00298     int block;
00299
00300     lock_inode(inode);
00301     if (!(sb=get_super(inode->i_dev)))
00302         panic("trying to read inode without dev");
00303     block = 2 + sb->s_imap_blocks + sb->s_zmap_blocks +
00304         (inode->i_num-1)/INODES_PER_BLOCK;
00305     if (!(bh=bread(inode->i_dev,block)))
00306         panic("unable to read i-node block");
00307     *(struct d_inode *)inode =
00308         ((struct d_inode *)bh->b_data)
00309             [(inode->i_num-1)%INODES_PER_BLOCK];
00310     brelse(bh);
00311     unlock_inode(inode);
00312 }
00313
00314 static void write_inode(struct m_inode * inode)
00315 {
00316     struct super_block * sb;
00317     struct buffer_head * bh;
00318     int block;
00319
00320     lock_inode(inode);
00321     if (!inode->i_dirt || !inode->i_dev) {
00322         unlock_inode(inode);
00323         return;
00324     }
00325     if (!(sb=get_super(inode->i_dev)))
00326         panic("trying to write inode without device");
00327     block = 2 + sb->s_imap_blocks + sb->s_zmap_blocks +
00328         (inode->i_num-1)/INODES_PER_BLOCK;
00329     if (!(bh=bread(inode->i_dev,block)))
00330         panic("unable to read i-node block");
00331     ((struct d_inode *)bh->b_data)
00332         [(inode->i_num-1)%INODES_PER_BLOCK] =
00333             *(struct d_inode *)inode;
00334     bh->b_dirt=1;
00335     inode->i_dirt=0;
00336     brelse(bh);
00337     unlock_inode(inode);
00338 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/io.h Source File

io.h

Go to the documentation of this file.
00001 #define outb(value,port) \
00002 __asm__ ("outb %%al,%%dx"::"a" (value),"d" (port))
00003
00004
00005 #define inb(port) ({ \
00006 unsigned char _v; \
00007 __asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
00008 _v; \
00009 })
00010
00011 #define outb_p(value,port) \
00012 __asm__ ("outb %%al,%%dx\n" \
00013         "\tjmp 1f\n" \
00014         "1:\tjmp 1f\n" \
00015         "1:"::"a" (value),"d" (port))
00016
00017 #define inb_p(port) ({ \
00018 unsigned char _v; \
00019 __asm__ volatile ("inb %%dx,%%al\n" \
00020     "\tjmp 1f\n" \
00021     "1:\tjmp 1f\n" \
00022     "1:":"=a" (_v):"d" (port)); \
00023 _v; \
00024 })
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/ioctl.c Source File

ioctl.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/ioctl.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /* #include <string.h>*/
00008 #include <errno.h>
00009 #include <sys/stat.h>
00010
00011 #include <linux/sched.h>
00012
00013 extern int tty_ioctl(int dev, int cmd, int arg);
00014
00015 typedef int (*ioctl_ptr)(int dev,int cmd,int arg);
00016
00017 #define NRDEVS ((sizeof (ioctl_table))/(sizeof (ioctl_ptr)))
00018
00019 static ioctl_ptr ioctl_table[]={
00020     NULL,       /* nodev */
00021     NULL,       /* /dev/mem */
00022     NULL,       /* /dev/fd */
00023     NULL,       /* /dev/hd */
00024     tty_ioctl,  /* /dev/ttyx */
00025     tty_ioctl,  /* /dev/tty */
00026     NULL,       /* /dev/lp */
00027     NULL};      /* named pipes */
00028
00029
00030 int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
00031 {
00032     struct file * filp;
00033     int dev,mode;
00034
00035     if (fd >= NR_OPEN || !(filp = current->filp[fd]))
00036         return -EBADF;
00037     mode=filp->f_inode->i_mode;
00038     if (!S_ISCHR(mode) && !S_ISBLK(mode))
00039         return -EINVAL;
00040     dev = filp->f_inode->i_zone[0];
00041     if (MAJOR(dev) >= NRDEVS)
00042         return -ENODEV;
00043     if (!ioctl_table[MAJOR(dev)])
00044         return -ENOTTY;
00045     return ioctl_table[MAJOR(dev)](dev,cmd,arg);
00046 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/kernel.h Source File

kernel.h

Go to the documentation of this file.
00001 /*
00002  * 'kernel.h' contains some often-used function prototypes etc
00003  */
00004 void verify_area(void * addr,int count);
00005 volatile void panic(const char * str);
00006 int printf(const char * fmt, ...);
00007 int printk(const char * fmt, ...);
00008 int tty_write(unsigned ch,char * buf,int count);
00009 void * malloc(unsigned int size);
00010 void free_s(void * obj, int size);
00011
00012 #define free(x) free_s((x), 0)
00013
00014 /*
00015  * This is defined as a macro, but at some point this might become a
00016  * real subroutine that sets a flag if it returns true (to do
00017  * BSD-style accounting where the process is flagged if it uses root
00018  * privs).  The implication of this is that you should do normal
00019  * permissions checks first, and check suser() last.
00020  */
00021 #define suser() (current->euid == 0)
00022
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/open.c Source File

open.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/open.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009 #include <stdarg.h>
00010
00011 int open(const char * filename, int flag, ...)
00012 {
00013     register int res;
00014     va_list arg;
00015
00016     va_start(arg,flag);
00017     __asm__("int $0x80"
00018         :"=a" (res)
00019         :"0" (__NR_open),"b" (filename),"c" (flag),
00020         "d" (va_arg(arg,int)));
00021     if (res>=0)
00022         return res;
00023     errno = -res;
00024     return -1;
00025 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/ll_rw_blk.c Source File

ll_rw_blk.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/blk_dev/ll_rw.c
00003  *
00004  * (C) 1991 Linus Torvalds
00005  */
00006
00007 /*
00008  * This handles all read/write requests to block devices
00009  */
00010 #include <errno.h>
00011 #include <linux/sched.h>
00012 #include <linux/kernel.h>
00013 #include <asm/system.h>
00014
00015 #include "blk.h"
00016
00017 /*
00018  * The request-struct contains all necessary data
00019  * to load a nr of sectors into memory
00020  */
00021 struct request request[NR_REQUEST];
00022
00023 /*
00024  * used to wait on when there are no free requests
00025  */
00026 struct task_struct * wait_for_request = NULL;
00027
00028 /* blk_dev_struct is:
00029  *  do_request-address
00030  *  next-request
00031  */
00032 struct blk_dev_struct blk_dev[NR_BLK_DEV] = {
00033     { NULL, NULL },     /* no_dev */
00034     { NULL, NULL },     /* dev mem */
00035     { NULL, NULL },     /* dev fd */
00036     { NULL, NULL },     /* dev hd */
00037     { NULL, NULL },     /* dev ttyx */
00038     { NULL, NULL },     /* dev tty */
00039     { NULL, NULL }      /* dev lp */
00040 };
00041
00042 static inline void lock_buffer(struct buffer_head * bh)
00043 {
00044     cli();
00045     while (bh->b_lock)
00046         sleep_on(&bh->b_wait);
00047     bh->b_lock=1;
00048     sti();
00049 }
00050
00051 static inline void unlock_buffer(struct buffer_head * bh)
00052 {
00053     if (!bh->b_lock)
00054         printk("ll_rw_block.c: buffer not locked\n\r");
00055     bh->b_lock = 0;
00056     wake_up(&bh->b_wait);
00057 }
00058
00059 /*
00060  * add-request adds a request to the linked list.
00061  * It disables interrupts so that it can muck with the
00062  * request-lists in peace.
00063  */
00064 static void add_request(struct blk_dev_struct * dev, struct request * req)
00065 {
00066     struct request * tmp;
00067
00068     req->next = NULL;
00069     cli();
00070     if (req->bh)
00071         req->bh->b_dirt = 0;
00072     if (!(tmp = dev->current_request)) {
00073         dev->current_request = req;
00074         sti();
00075         (dev->request_fn)();
00076         return;
00077     }
00078     for ( ; tmp->next ; tmp=tmp->next)
00079         if ((IN_ORDER(tmp,req) ||
00080             !IN_ORDER(tmp,tmp->next)) &&
00081             IN_ORDER(req,tmp->next))
00082             break;
00083     req->next=tmp->next;
00084     tmp->next=req;
00085     sti();
00086 }
00087
00088 static void make_request(int major,int rw, struct buffer_head * bh)
00089 {
00090     struct request * req;
00091     int rw_ahead;
00092
00093 /* WRITEA/READA is special case - it is not really needed, so if the */
00094 /* buffer is locked, we just forget about it, else it's a normal read */
00095     if ((rw_ahead = (rw == READA || rw == WRITEA))) {
00096         if (bh->b_lock)
00097             return;
00098         if (rw == READA)
00099             rw = READ;
00100         else
00101             rw = WRITE;
00102     }
00103     if (rw!=READ && rw!=WRITE)
00104         panic("Bad block dev command, must be R/W/RA/WA");
00105     lock_buffer(bh);
00106     if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate)) {
00107         unlock_buffer(bh);
00108         return;
00109     }
00110 repeat:
00111 /* we don't allow the write-requests to fill up the queue completely:
00112  * we want some room for reads: they take precedence. The last third
00113  * of the requests are only for reads.
00114  */
00115     if (rw == READ)
00116         req = request+NR_REQUEST;
00117     else
00118         req = request+((NR_REQUEST*2)/3);
00119 /* find an empty request */
00120     while (--req >= request)
00121         if (req->dev<0)
00122             break;
00123 /* if none found, sleep on new requests: check for rw_ahead */
00124     if (req < request) {
00125         if (rw_ahead) {
00126             unlock_buffer(bh);
00127             return;
00128         }
00129         sleep_on(&wait_for_request);
00130         goto repeat;
00131     }
00132 /* fill up the request-info, and add it to the queue */
00133     req->dev = bh->b_dev;
00134     req->cmd = rw;
00135     req->errors=0;
00136     req->sector = bh->b_blocknr<<1;
00137     req->nr_sectors = 2;
00138     req->buffer = bh->b_data;
00139     req->waiting = NULL;
00140     req->bh = bh;
00141     req->next = NULL;
00142     add_request(major+blk_dev,req);
00143 }
00144
00145 void ll_rw_block(int rw, struct buffer_head * bh)
00146 {
00147     unsigned int major;
00148
00149     if ((major=MAJOR(bh->b_dev)) >= NR_BLK_DEV ||
00150     !(blk_dev[major].request_fn)) {
00151         printk("Trying to read nonexistent block-device\n\r");
00152         return;
00153     }
00154     make_request(major,rw,bh);
00155 }
00156
00157 void blk_dev_init(void)
00158 {
00159     int i;
00160
00161     for (i=0 ; i<NR_REQUEST ; i++) {
00162         request[i].dev = -1;
00163         request[i].next = NULL;
00164     }
00165 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/init/main.c Source File

main.c

Go to the documentation of this file.
00001 /*
00002  *  linux/init/main.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009 #include <time.h>
00010
00011 /*
00012  * we need this inline - forking from kernel space will result
00013  * in NO COPY ON WRITE (!!!), until an execve is executed. This
00014  * is no problem, but for the stack. This is handled by not letting
00015  * main() use the stack at all after fork(). Thus, no function
00016  * calls - which means inline code for fork too, as otherwise we
00017  * would use the stack upon exit from 'fork()'.
00018  *
00019  * Actually only pause and fork are needed inline, so that there
00020  * won't be any messing with the stack from main(), but we define
00021  * some others too.
00022  */
00023 static inline _syscall0(int,fork)
00024 static inline _syscall0(int,pause)
00025 static inline _syscall1(int,setup,void *,BIOS)
00026 static inline _syscall0(int,sync)
00027
00028 #include <linux/tty.h>
00029 #include <linux/sched.h>
00030 #include <linux/head.h>
00031 #include <asm/system.h>
00032 #include <asm/io.h>
00033
00034 #include <stddef.h>
00035 #include <stdarg.h>
00036 #include <unistd.h>
00037 #include <fcntl.h>
00038 #include <sys/types.h>
00039
00040 #include <linux/fs.h>
00041
00042 static char printbuf[1024];
00043
00044 extern int vsprintf();
00045 extern void init(void);
00046 extern void blk_dev_init(void);
00047 extern void chr_dev_init(void);
00048 extern void hd_init(void);
00049 extern void floppy_init(void);
00050 extern void mem_init(long start, long end);
00051 extern long rd_init(long mem_start, int length);
00052 extern long kernel_mktime(struct tm * tm);
00053 extern long startup_time;
00054
00055 /*
00056  * This is set up by the setup-routine at boot-time
00057  */
00058 #define EXT_MEM_K (*(unsigned short *)0x90002)
00059 #define DRIVE_INFO (*(struct drive_info *)0x90080)
00060 #define ORIG_ROOT_DEV (*(unsigned short *)0x901FC)
00061
00062 /*
00063  * Yeah, yeah, it's ugly, but I cannot find how to do this correctly
00064  * and this seems to work. I anybody has more info on the real-time
00065  * clock I'd be interested. Most of this was trial and error, and some
00066  * bios-listing reading. Urghh.
00067  */
00068
00069 #define CMOS_READ(addr) ({ \
00070 outb_p(0x80|addr,0x70); \
00071 inb_p(0x71); \
00072 })
00073
00074 #define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
00075
00076 static void time_init(void)
00077 {
00078     struct tm time;
00079
00080     do {
00081         time.tm_sec = CMOS_READ(0);
00082         time.tm_min = CMOS_READ(2);
00083         time.tm_hour = CMOS_READ(4);
00084         time.tm_mday = CMOS_READ(7);
00085         time.tm_mon = CMOS_READ(8);
00086         time.tm_year = CMOS_READ(9);
00087     } while (time.tm_sec != CMOS_READ(0));
00088     BCD_TO_BIN(time.tm_sec);
00089     BCD_TO_BIN(time.tm_min);
00090     BCD_TO_BIN(time.tm_hour);
00091     BCD_TO_BIN(time.tm_mday);
00092     BCD_TO_BIN(time.tm_mon);
00093     BCD_TO_BIN(time.tm_year);
00094     time.tm_mon--;
00095     startup_time = kernel_mktime(&time);
00096 }
00097
00098 static long memory_end = 0;
00099 static long buffer_memory_end = 0;
00100 static long main_memory_start = 0;
00101
00102 struct drive_info { char dummy[32]; } drive_info;
00103
00104 void main(void)     /* This really IS void, no error here. */
00105 {           /* The startup routine assumes (well, ...) this */
00106 /*
00107  * Interrupts are still disabled. Do necessary setups, then
00108  * enable them
00109  */
00110     ROOT_DEV = ORIG_ROOT_DEV;
00111     drive_info = DRIVE_INFO;
00112     memory_end = (1<<20) + (EXT_MEM_K<<10);
00113     memory_end &= 0xfffff000;
00114     if (memory_end > 16*1024*1024)
00115         memory_end = 16*1024*1024;
00116     if (memory_end > 12*1024*1024)
00117         buffer_memory_end = 4*1024*1024;
00118     else if (memory_end > 6*1024*1024)
00119         buffer_memory_end = 2*1024*1024;
00120     else
00121         buffer_memory_end = 1*1024*1024;
00122     main_memory_start = buffer_memory_end;
00123 #ifdef RAMDISK
00124     main_memory_start += rd_init(main_memory_start, RAMDISK*1024);
00125 #endif
00126     mem_init(main_memory_start,memory_end);
00127     trap_init();
00128     blk_dev_init();
00129     chr_dev_init();
00130     tty_init();
00131     time_init();
00132     sched_init();
00133     buffer_init(buffer_memory_end);
00134     hd_init();
00135     floppy_init();
00136     sti();
00137     move_to_user_mode();
00138     if (!fork()) {      /* we count on this going ok */
00139         init();
00140     }
00141 /*
00142  *   NOTE!!   For any other task 'pause()' would mean we have to get a
00143  * signal to awaken, but task0 is the sole exception (see 'schedule()')
00144  * as task 0 gets activated at every idle moment (when no other tasks
00145  * can run). For task0 'pause()' just means we go check if some other
00146  * task can run, and if not we return here.
00147  */
00148     for(;;) pause();
00149 }
00150
00151 static int printf(const char *fmt, ...)
00152 {
00153     va_list args;
00154     int i;
00155
00156     va_start(args, fmt);
00157     write(1,printbuf,i=vsprintf(printbuf, fmt, args));
00158     va_end(args);
00159     return i;
00160 }
00161
00162 static char * argv_rc[] = { "/bin/sh", NULL };
00163 static char * envp_rc[] = { "HOME=/", NULL };
00164
00165 static char * argv[] = { "-/bin/sh",NULL };
00166 static char * envp[] = { "HOME=/usr/root", NULL };
00167
00168 void init(void)
00169 {
00170     int pid,i;
00171
00172     setup((void *) &drive_info);
00173     (void) open("/dev/tty0",O_RDWR,0);
00174     (void) dup(0);
00175     (void) dup(0);
00176     printf("%d buffers = %d bytes buffer space\n\r",NR_BUFFERS,
00177         NR_BUFFERS*BLOCK_SIZE);
00178     printf("Free mem: %d bytes\n\r",memory_end-main_memory_start);
00179     if (!(pid=fork())) {
00180         close(0);
00181         if (open("/etc/rc",O_RDONLY,0))
00182             _exit(1);
00183         execve("/bin/sh",argv_rc,envp_rc);
00184         _exit(2);
00185     }
00186     if (pid>0)
00187         while (pid != wait(&i))
00188             /* nothing */;
00189     while (1) {
00190         if ((pid=fork())<0) {
00191             printf("Fork failed in init\r\n");
00192             continue;
00193         }
00194         if (!pid) {
00195             close(0);close(1);close(2);
00196             setsid();
00197             (void) open("/dev/tty0",O_RDWR,0);
00198             (void) dup(0);
00199             (void) dup(0);
00200             _exit(execve("/bin/sh",argv,envp));
00201         }
00202         while (1)
00203             if (pid == wait(&i))
00204                 break;
00205         printf("\n\rchild %d died with code %04x\n\r",pid,i);
00206         sync();
00207     }
00208     _exit(0);   /* NOTE! _exit, not exit() */
00209 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/malloc.c Source File

malloc.c

Go to the documentation of this file.
00001 /*
00002  * malloc.c --- a general purpose kernel memory allocator for Linux.
00003  *
00004  * Written by Theodore Ts'o (tytso@mit.edu), 11/29/91
00005  *
00006  * This routine is written to be as fast as possible, so that it
00007  * can be called from the interrupt level.
00008  *
00009  * Limitations: maximum size of memory we can allocate using this routine
00010  *  is 4k, the size of a page in Linux.
00011  *
00012  * The general game plan is that each page (called a bucket) will only hold
00013  * objects of a given size.  When all of the object on a page are released,
00014  * the page can be returned to the general free pool.  When malloc() is
00015  * called, it looks for the smallest bucket size which will fulfill its
00016  * request, and allocate a piece of memory from that bucket pool.
00017  *
00018  * Each bucket has as its control block a bucket descriptor which keeps
00019  * track of how many objects are in use on that page, and the free list
00020  * for that page.  Like the buckets themselves, bucket descriptors are
00021  * stored on pages requested from get_free_page().  However, unlike buckets,
00022  * pages devoted to bucket descriptor pages are never released back to the
00023  * system.  Fortunately, a system should probably only need 1 or 2 bucket
00024  * descriptor pages, since a page can hold 256 bucket descriptors (which
00025  * corresponds to 1 megabyte worth of bucket pages.)  If the kernel is using
00026  * that much allocated memory, it's probably doing something wrong.  :-)
00027  *
00028  * Note: malloc() and free() both call get_free_page() and free_page()
00029  *  in sections of code where interrupts are turned off, to allow
00030  *  malloc() and free() to be safely called from an interrupt routine.
00031  *  (We will probably need this functionality when networking code,
00032  *  particularily things like NFS, is added to Linux.)  However, this
00033  *  presumes that get_free_page() and free_page() are interrupt-level
00034  *  safe, which they may not be once paging is added.  If this is the
00035  *  case, we will need to modify malloc() to keep a few unused pages
00036  *  "pre-allocated" so that it can safely draw upon those pages if
00037  *  it is called from an interrupt routine.
00038  *
00039  *  Another concern is that get_free_page() should not sleep; if it
00040  *  does, the code is carefully ordered so as to avoid any race
00041  *  conditions.  The catch is that if malloc() is called re-entrantly,
00042  *  there is a chance that unecessary pages will be grabbed from the
00043  *  system.  Except for the pages for the bucket descriptor page, the
00044  *  extra pages will eventually get released back to the system, though,
00045  *  so it isn't all that bad.
00046  */
00047
00048 #include <linux/kernel.h>
00049 #include <linux/mm.h>
00050 #include <asm/system.h>
00051
00052 struct bucket_desc {    /* 16 bytes */
00053     void            *page;
00054     struct bucket_desc  *next;
00055     void            *freeptr;
00056     unsigned short      refcnt;
00057     unsigned short      bucket_size;
00058 };
00059
00060 struct _bucket_dir {    /* 8 bytes */
00061     int         size;
00062     struct bucket_desc  *chain;
00063 };
00064
00065 /*
00066  * The following is the where we store a pointer to the first bucket
00067  * descriptor for a given size.
00068  *
00069  * If it turns out that the Linux kernel allocates a lot of objects of a
00070  * specific size, then we may want to add that specific size to this list,
00071  * since that will allow the memory to be allocated more efficiently.
00072  * However, since an entire page must be dedicated to each specific size
00073  * on this list, some amount of temperance must be exercised here.
00074  *
00075  * Note that this list *must* be kept in order.
00076  */
00077 struct _bucket_dir bucket_dir[] = {
00078     { 16,   (struct bucket_desc *) 0},
00079     { 32,   (struct bucket_desc *) 0},
00080     { 64,   (struct bucket_desc *) 0},
00081     { 128,  (struct bucket_desc *) 0},
00082     { 256,  (struct bucket_desc *) 0},
00083     { 512,  (struct bucket_desc *) 0},
00084     { 1024, (struct bucket_desc *) 0},
00085     { 2048, (struct bucket_desc *) 0},
00086     { 4096, (struct bucket_desc *) 0},
00087     { 0,    (struct bucket_desc *) 0}};   /* End of list marker */
00088
00089 /*
00090  * This contains a linked list of free bucket descriptor blocks
00091  */
00092 struct bucket_desc *free_bucket_desc = (struct bucket_desc *) 0;
00093
00094 /*
00095  * This routine initializes a bucket description page.
00096  */
00097 static inline void init_bucket_desc()
00098 {
00099     struct bucket_desc *bdesc, *first;
00100     int i;
00101
00102     first = bdesc = (struct bucket_desc *) get_free_page();
00103     if (!bdesc)
00104         panic("Out of memory in init_bucket_desc()");
00105     for (i = PAGE_SIZE/sizeof(struct bucket_desc); i > 1; i--) {
00106         bdesc->next = bdesc+1;
00107         bdesc++;
00108     }
00109     /*
00110      * This is done last, to avoid race conditions in case
00111      * get_free_page() sleeps and this routine gets called again....
00112      */
00113     bdesc->next = free_bucket_desc;
00114     free_bucket_desc = first;
00115 }
00116
00117 void *malloc(unsigned int len)
00118 {
00119     struct _bucket_dir  *bdir;
00120     struct bucket_desc  *bdesc;
00121     void            *retval;
00122
00123     /*
00124      * First we search the bucket_dir to find the right bucket change
00125      * for this request.
00126      */
00127     for (bdir = bucket_dir; bdir->size; bdir++)
00128         if (bdir->size >= len)
00129             break;
00130     if (!bdir->size) {
00131         printk("malloc called with impossibly large argument (%d)\n",
00132             len);
00133         panic("malloc: bad arg");
00134     }
00135     /*
00136      * Now we search for a bucket descriptor which has free space
00137      */
00138     cli();  /* Avoid race conditions */
00139     for (bdesc = bdir->chain; bdesc; bdesc = bdesc->next)
00140         if (bdesc->freeptr)
00141             break;
00142     /*
00143      * If we didn't find a bucket with free space, then we'll
00144      * allocate a new one.
00145      */
00146     if (!bdesc) {
00147         char        *cp;
00148         int     i;
00149
00150         if (!free_bucket_desc)
00151             init_bucket_desc();
00152         bdesc = free_bucket_desc;
00153         free_bucket_desc = bdesc->next;
00154         bdesc->refcnt = 0;
00155         bdesc->bucket_size = bdir->size;
00156         bdesc->page = bdesc->freeptr = (void *) cp = get_free_page();
00157         if (!cp)
00158             panic("Out of memory in kernel malloc()");
00159         /* Set up the chain of free objects */
00160         for (i=PAGE_SIZE/bdir->size; i > 1; i--) {
00161             *((char **) cp) = cp + bdir->size;
00162             cp += bdir->size;
00163         }
00164         *((char **) cp) = 0;
00165         bdesc->next = bdir->chain; /* OK, link it in! */
00166         bdir->chain = bdesc;
00167     }
00168     retval = (void *) bdesc->freeptr;
00169     bdesc->freeptr = *((void **) retval);
00170     bdesc->refcnt++;
00171     sti();  /* OK, we're safe again */
00172     return(retval);
00173 }
00174
00175 /*
00176  * Here is the free routine.  If you know the size of the object that you
00177  * are freeing, then free_s() will use that information to speed up the
00178  * search for the bucket descriptor.
00179  *
00180  * We will #define a macro so that "free(x)" is becomes "free_s(x, 0)"
00181  */
00182 void free_s(void *obj, int size)
00183 {
00184     void        *page;
00185     struct _bucket_dir  *bdir;
00186     struct bucket_desc  *bdesc, *prev;
00187     bdesc = prev = 0;
00188     /* Calculate what page this object lives in */
00189     page = (void *)  ((unsigned long) obj & 0xfffff000);
00190     /* Now search the buckets looking for that page */
00191     for (bdir = bucket_dir; bdir->size; bdir++) {
00192         prev = 0;
00193         /* If size is zero then this conditional is always false */
00194         if (bdir->size < size)
00195             continue;
00196         for (bdesc = bdir->chain; bdesc; bdesc = bdesc->next) {
00197             if (bdesc->page == page)
00198                 goto found;
00199             prev = bdesc;
00200         }
00201     }
00202     panic("Bad address passed to kernel free_s()");
00203 found:
00204     cli(); /* To avoid race conditions */
00205     *((void **)obj) = bdesc->freeptr;
00206     bdesc->freeptr = obj;
00207     bdesc->refcnt--;
00208     if (bdesc->refcnt == 0) {
00209         /*
00210          * We need to make sure that prev is still accurate.  It
00211          * may not be, if someone rudely interrupted us....
00212          */
00213         if ((prev && (prev->next != bdesc)) ||
00214             (!prev && (bdir->chain != bdesc)))
00215             for (prev = bdir->chain; prev; prev = prev->next)
00216                 if (prev->next == bdesc)
00217                     break;
00218         if (prev)
00219             prev->next = bdesc->next;
00220         else {
00221             if (bdir->chain != bdesc)
00222                 panic("malloc bucket chains corrupted");
00223             bdir->chain = bdesc->next;
00224         }
00225         free_page((unsigned long) bdesc->page);
00226         bdesc->next = free_bucket_desc;
00227         free_bucket_desc = bdesc;
00228     }
00229     sti();
00230     return;
00231 }
00232
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/math/math_emulate.c Source File

math_emulate.c

Go to the documentation of this file.
00001 /*
00002  * linux/kernel/math/math_emulate.c
00003  *
00004  * (C) 1991 Linus Torvalds
00005  */
00006
00007 /*
00008  * This directory should contain the math-emulation code.
00009  * Currently only results in a signal.
00010  */
00011
00012 #include <signal.h>
00013
00014 #include <linux/sched.h>
00015 #include <linux/kernel.h>
00016 #include <asm/segment.h>
00017
00018 void math_emulate(long edi, long esi, long ebp, long sys_call_ret,
00019     long eax,long ebx,long ecx,long edx,
00020     unsigned short fs,unsigned short es,unsigned short ds,
00021     unsigned long eip,unsigned short cs,unsigned long eflags,
00022     unsigned short ss, unsigned long esp)
00023 {
00024     unsigned char first, second;
00025
00026 /* 0x0007 means user code space */
00027     if (cs != 0x000F) {
00028         printk("math_emulate: %04x:%08x\n\r",cs,eip);
00029         panic("Math emulation needed in kernel");
00030     }
00031     first = get_fs_byte((char *)((*&eip)++));
00032     second = get_fs_byte((char *)((*&eip)++));
00033     printk("%04x:%08x %02x %02x\n\r",cs,eip-2,first,second);
00034     current->signal |= 1<<(SIGFPE-1);
00035 }
00036
00037 void math_error(void)
00038 {
00039     __asm__("fnclex");
00040     if (last_task_used_math)
00041         last_task_used_math->signal |= 1<<(SIGFPE-1);
00042 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/mm/memory.c Source File

memory.c

Go to the documentation of this file.
00001 /*
00002  *  linux/mm/memory.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * demand-loading started 01.12.91 - seems it is high on the list of
00009  * things wanted, and it should be easy to implement. - Linus
00010  */
00011
00012 /*
00013  * Ok, demand-loading was easy, shared pages a little bit tricker. Shared
00014  * pages started 02.12.91, seems to work. - Linus.
00015  *
00016  * Tested sharing by executing about 30 /bin/sh: under the old kernel it
00017  * would have taken more than the 6M I have free, but it worked well as
00018  * far as I could see.
00019  *
00020  * Also corrected some "invalidate()"s - I wasn't doing enough of them.
00021  */
00022
00023 #include <signal.h>
00024
00025 #include <asm/system.h>
00026
00027 #include <linux/sched.h>
00028 #include <linux/head.h>
00029 #include <linux/kernel.h>
00030
00031 volatile void do_exit(long code);
00032
00033 static inline volatile void oom(void)
00034 {
00035     printk("out of memory\n\r");
00036     do_exit(SIGSEGV);
00037 }
00038
00039 #define invalidate() \
00040 __asm__("movl %%eax,%%cr3"::"a" (0))
00041
00042 /* these are not to be changed without changing head.s etc */
00043 #define LOW_MEM 0x100000
00044 #define PAGING_MEMORY (15*1024*1024)
00045 #define PAGING_PAGES (PAGING_MEMORY>>12)
00046 #define MAP_NR(addr) (((addr)-LOW_MEM)>>12)
00047 #define USED 100
00048
00049 #define CODE_SPACE(addr) ((((addr)+4095)&~4095) < \
00050 current->start_code + current->end_code)
00051
00052 static long HIGH_MEMORY = 0;
00053
00054 #define copy_page(from,to) \
00055 __asm__("cld ; rep ; movsl"::"S" (from),"D" (to),"c" (1024))
00056
00057 static unsigned char mem_map [ PAGING_PAGES ] = {0,};
00058
00059 /*
00060  * Get physical address of first (actually last :-) free page, and mark it
00061  * used. If no free pages left, return 0.
00062  */
00063 unsigned long get_free_page(void)
00064 {
00065 register unsigned long __res asm("ax");
00066
00067 __asm__("std ; repne ; scasb\n\t"
00068     "jne 1f\n\t"
00069     "movb $1,1(%%edi)\n\t"
00070     "sall $12,%%ecx\n\t"
00071     "addl %2,%%ecx\n\t"
00072     "movl %%ecx,%%edx\n\t"
00073     "movl $1024,%%ecx\n\t"
00074     "leal 4092(%%edx),%%edi\n\t"
00075     "rep ; stosl\n\t"
00076     "movl %%edx,%%eax\n"
00077     "1:"
00078     :"=a" (__res)
00079     :"0" (0),"i" (LOW_MEM),"c" (PAGING_PAGES),
00080     "D" (mem_map+PAGING_PAGES-1)
00081     );
00082 return __res;
00083 }
00084
00085 /*
00086  * Free a page of memory at physical address 'addr'. Used by
00087  * 'free_page_tables()'
00088  */
00089 void free_page(unsigned long addr)
00090 {
00091     if (addr < LOW_MEM) return;
00092     if (addr >= HIGH_MEMORY)
00093         panic("trying to free nonexistent page");
00094     addr -= LOW_MEM;
00095     addr >>= 12;
00096     if (mem_map[addr]--) return;
00097     mem_map[addr]=0;
00098     panic("trying to free free page");
00099 }
00100
00101 /*
00102  * This function frees a continuos block of page tables, as needed
00103  * by 'exit()'. As does copy_page_tables(), this handles only 4Mb blocks.
00104  */
00105 int free_page_tables(unsigned long from,unsigned long size)
00106 {
00107     unsigned long *pg_table;
00108     unsigned long * dir, nr;
00109
00110     if (from & 0x3fffff)
00111         panic("free_page_tables called with wrong alignment");
00112     if (!from)
00113         panic("Trying to free up swapper memory space");
00114     size = (size + 0x3fffff) >> 22;
00115     dir = (unsigned long *) ((from>>20) & 0xffc); /* _pg_dir = 0 */
00116     for ( ; size-->0 ; dir++) {
00117         if (!(1 & *dir))
00118             continue;
00119         pg_table = (unsigned long *) (0xfffff000 & *dir);
00120         for (nr=0 ; nr<1024 ; nr++) {
00121             if (1 & *pg_table)
00122                 free_page(0xfffff000 & *pg_table);
00123             *pg_table = 0;
00124             pg_table++;
00125         }
00126         free_page(0xfffff000 & *dir);
00127         *dir = 0;
00128     }
00129     invalidate();
00130     return 0;
00131 }
00132
00133 /*
00134  *  Well, here is one of the most complicated functions in mm. It
00135  * copies a range of linerar addresses by copying only the pages.
00136  * Let's hope this is bug-free, 'cause this one I don't want to debug :-)
00137  *
00138  * Note! We don't copy just any chunks of memory - addresses have to
00139  * be divisible by 4Mb (one page-directory entry), as this makes the
00140  * function easier. It's used only by fork anyway.
00141  *
00142  * NOTE 2!! When from==0 we are copying kernel space for the first
00143  * fork(). Then we DONT want to copy a full page-directory entry, as
00144  * that would lead to some serious memory waste - we just copy the
00145  * first 160 pages - 640kB. Even that is more than we need, but it
00146  * doesn't take any more memory - we don't copy-on-write in the low
00147  * 1 Mb-range, so the pages can be shared with the kernel. Thus the
00148  * special case for nr=xxxx.
00149  */
00150 int copy_page_tables(unsigned long from,unsigned long to,long size)
00151 {
00152     unsigned long * from_page_table;
00153     unsigned long * to_page_table;
00154     unsigned long this_page;
00155     unsigned long * from_dir, * to_dir;
00156     unsigned long nr;
00157
00158     if ((from&0x3fffff) || (to&0x3fffff))
00159         panic("copy_page_tables called with wrong alignment");
00160     from_dir = (unsigned long *) ((from>>20) & 0xffc); /* _pg_dir = 0 */
00161     to_dir = (unsigned long *) ((to>>20) & 0xffc);
00162     size = ((unsigned) (size+0x3fffff)) >> 22;
00163     for( ; size-->0 ; from_dir++,to_dir++) {
00164         if (1 & *to_dir)
00165             panic("copy_page_tables: already exist");
00166         if (!(1 & *from_dir))
00167             continue;
00168         from_page_table = (unsigned long *) (0xfffff000 & *from_dir);
00169         if (!(to_page_table = (unsigned long *) get_free_page()))
00170             return -1;  /* Out of memory, see freeing */
00171         *to_dir = ((unsigned long) to_page_table) | 7;
00172         nr = (from==0)?0xA0:1024;
00173         for ( ; nr-- > 0 ; from_page_table++,to_page_table++) {
00174             this_page = *from_page_table;
00175             if (!(1 & this_page))
00176                 continue;
00177             this_page &= ~2;
00178             *to_page_table = this_page;
00179             if (this_page > LOW_MEM) {
00180                 *from_page_table = this_page;
00181                 this_page -= LOW_MEM;
00182                 this_page >>= 12;
00183                 mem_map[this_page]++;
00184             }
00185         }
00186     }
00187     invalidate();
00188     return 0;
00189 }
00190
00191 /*
00192  * This function puts a page in memory at the wanted address.
00193  * It returns the physical address of the page gotten, 0 if
00194  * out of memory (either when trying to access page-table or
00195  * page.)
00196  */
00197 unsigned long put_page(unsigned long page,unsigned long address)
00198 {
00199     unsigned long tmp, *page_table;
00200
00201 /* NOTE !!! This uses the fact that _pg_dir=0 */
00202
00203     if (page < LOW_MEM || page >= HIGH_MEMORY)
00204         printk("Trying to put page %p at %p\n",page,address);
00205     if (mem_map[(page-LOW_MEM)>>12] != 1)
00206         printk("mem_map disagrees with %p at %p\n",page,address);
00207     page_table = (unsigned long *) ((address>>20) & 0xffc);
00208     if ((*page_table)&1)
00209         page_table = (unsigned long *) (0xfffff000 & *page_table);
00210     else {
00211         if (!(tmp=get_free_page()))
00212             return 0;
00213         *page_table = tmp|7;
00214         page_table = (unsigned long *) tmp;
00215     }
00216     page_table[(address>>12) & 0x3ff] = page | 7;
00217 /* no need for invalidate */
00218     return page;
00219 }
00220
00221 void un_wp_page(unsigned long * table_entry)
00222 {
00223     unsigned long old_page,new_page;
00224
00225     old_page = 0xfffff000 & *table_entry;
00226     if (old_page >= LOW_MEM && mem_map[MAP_NR(old_page)]==1) {
00227         *table_entry |= 2;
00228         invalidate();
00229         return;
00230     }
00231     if (!(new_page=get_free_page()))
00232         oom();
00233     if (old_page >= LOW_MEM)
00234         mem_map[MAP_NR(old_page)]--;
00235     *table_entry = new_page | 7;
00236     invalidate();
00237     copy_page(old_page,new_page);
00238 }
00239
00240 /*
00241  * This routine handles present pages, when users try to write
00242  * to a shared page. It is done by copying the page to a new address
00243  * and decrementing the shared-page counter for the old page.
00244  *
00245  * If it's in code space we exit with a segment error.
00246  */
00247 void do_wp_page(unsigned long error_code,unsigned long address)
00248 {
00249 #if 0
00250 /* we cannot do this yet: the estdio library writes to code space */
00251 /* stupid, stupid. I really want the libc.a from GNU */
00252     if (CODE_SPACE(address))
00253         do_exit(SIGSEGV);
00254 #endif
00255     un_wp_page((unsigned long *)
00256         (((address>>10) & 0xffc) + (0xfffff000 &
00257         *((unsigned long *) ((address>>20) &0xffc)))));
00258
00259 }
00260
00261 void write_verify(unsigned long address)
00262 {
00263     unsigned long page;
00264
00265     if (!( (page = *((unsigned long *) ((address>>20) & 0xffc)) )&1))
00266         return;
00267     page &= 0xfffff000;
00268     page += ((address>>10) & 0xffc);
00269     if ((3 & *(unsigned long *) page) == 1)  /* non-writeable, present */
00270         un_wp_page((unsigned long *) page);
00271     return;
00272 }
00273
00274 void get_empty_page(unsigned long address)
00275 {
00276     unsigned long tmp;
00277
00278     if (!(tmp=get_free_page()) || !put_page(tmp,address)) {
00279         free_page(tmp);     /* 0 is ok - ignored */
00280         oom();
00281     }
00282 }
00283
00284 /*
00285  * try_to_share() checks the page at address "address" in the task "p",
00286  * to see if it exists, and if it is clean. If so, share it with the current
00287  * task.
00288  *
00289  * NOTE! This assumes we have checked that p != current, and that they
00290  * share the same executable.
00291  */
00292 static int try_to_share(unsigned long address, struct task_struct * p)
00293 {
00294     unsigned long from;
00295     unsigned long to;
00296     unsigned long from_page;
00297     unsigned long to_page;
00298     unsigned long phys_addr;
00299
00300     from_page = to_page = ((address>>20) & 0xffc);
00301     from_page += ((p->start_code>>20) & 0xffc);
00302     to_page += ((current->start_code>>20) & 0xffc);
00303 /* is there a page-directory at from? */
00304     from = *(unsigned long *) from_page;
00305     if (!(from & 1))
00306         return 0;
00307     from &= 0xfffff000;
00308     from_page = from + ((address>>10) & 0xffc);
00309     phys_addr = *(unsigned long *) from_page;
00310 /* is the page clean and present? */
00311     if ((phys_addr & 0x41) != 0x01)
00312         return 0;
00313     phys_addr &= 0xfffff000;
00314     if (phys_addr >= HIGH_MEMORY || phys_addr < LOW_MEM)
00315         return 0;
00316     to = *(unsigned long *) to_page;
00317     if (!(to & 1)) {
00318         if ((to = get_free_page()))
00319             *(unsigned long *) to_page = to | 7;
00320         else
00321             oom();
00322     }
00323     to &= 0xfffff000;
00324     to_page = to + ((address>>10) & 0xffc);
00325     if (1 & *(unsigned long *) to_page)
00326         panic("try_to_share: to_page already exists");
00327 /* share them: write-protect */
00328     *(unsigned long *) from_page &= ~2;
00329     *(unsigned long *) to_page = *(unsigned long *) from_page;
00330     invalidate();
00331     phys_addr -= LOW_MEM;
00332     phys_addr >>= 12;
00333     mem_map[phys_addr]++;
00334     return 1;
00335 }
00336
00337 /*
00338  * share_page() tries to find a process that could share a page with
00339  * the current one. Address is the address of the wanted page relative
00340  * to the current data space.
00341  *
00342  * We first check if it is at all feasible by checking executable->i_count.
00343  * It should be >1 if there are other tasks sharing this inode.
00344  */
00345 static int share_page(unsigned long address)
00346 {
00347     struct task_struct ** p;
00348
00349     if (!current->executable)
00350         return 0;
00351     if (current->executable->i_count < 2)
00352         return 0;
00353     for (p = &LAST_TASK ; p > &FIRST_TASK ; --p) {
00354         if (!*p)
00355             continue;
00356         if (current == *p)
00357             continue;
00358         if ((*p)->executable != current->executable)
00359             continue;
00360         if (try_to_share(address,*p))
00361             return 1;
00362     }
00363     return 0;
00364 }
00365
00366 void do_no_page(unsigned long error_code,unsigned long address)
00367 {
00368     int nr[4];
00369     unsigned long tmp;
00370     unsigned long page;
00371     int block,i;
00372
00373     address &= 0xfffff000;
00374     tmp = address - current->start_code;
00375     if (!current->executable || tmp >= current->end_data) {
00376         get_empty_page(address);
00377         return;
00378     }
00379     if (share_page(tmp))
00380         return;
00381     if (!(page = get_free_page()))
00382         oom();
00383 /* remember that 1 block is used for header */
00384     block = 1 + tmp/BLOCK_SIZE;
00385     for (i=0 ; i<4 ; block++,i++)
00386         nr[i] = bmap(current->executable,block);
00387     bread_page(page,current->executable->i_dev,nr);
00388     i = tmp + 4096 - current->end_data;
00389     tmp = page + 4096;
00390     while (i-- > 0) {
00391         tmp--;
00392         *(char *)tmp = 0;
00393     }
00394     if (put_page(page,address))
00395         return;
00396     free_page(page);
00397     oom();
00398 }
00399
00400 void mem_init(long start_mem, long end_mem)
00401 {
00402     int i;
00403
00404     HIGH_MEMORY = end_mem;
00405     for (i=0 ; i<PAGING_PAGES ; i++)
00406         mem_map[i] = USED;
00407     i = MAP_NR(start_mem);
00408     end_mem -= start_mem;
00409     end_mem >>= 12;
00410     while (end_mem-->0)
00411         mem_map[i++]=0;
00412 }
00413
00414 void calc_mem(void)
00415 {
00416     int i,j,k,free=0;
00417     long * pg_tbl;
00418
00419     for(i=0 ; i<PAGING_PAGES ; i++)
00420         if (!mem_map[i]) free++;
00421     printk("%d pages free (of %d)\n\r",free,PAGING_PAGES);
00422     for(i=2 ; i<1024 ; i++) {
00423         if (1&pg_dir[i]) {
00424             pg_tbl=(long *) (0xfffff000 & pg_dir[i]);
00425             for(j=k=0 ; j<1024 ; j++)
00426                 if (pg_tbl[j]&1)
00427                     k++;
00428             printk("Pg-dir[%d] uses %d pages\n",i,k);
00429         }
00430     }
00431 }
Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/memory.h Source File

memory.h

Go to the documentation of this file.
00001 /*
00002  *  NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This
00003  *  goes for all kernel functions (ds=es=kernel space, fs=local data,
00004  *  gs=null), as well as for all well-behaving user programs (ds=es=
00005  *  user data space). This is NOT a bug, as any user program that changes
00006  *  es deserves to die if it isn't careful.
00007  */
00008 #define memcpy(dest,src,n) ({ \
00009 void * _res = dest; \
00010 __asm__ ("cld;rep;movsb" \
00011     ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \
00012     ); \
00013 _res; \
00014 })
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/mktime.c Source File

mktime.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/mktime.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <time.h>
00008
00009 /*
00010  * This isn't the library routine, it is only used in the kernel.
00011  * as such, we don't care about years<1970 etc, but assume everything
00012  * is ok. Similarly, TZ etc is happily ignored. We just do everything
00013  * as easily as possible. Let's find something public for the library
00014  * routines (although I think minix times is public).
00015  */
00016 /*
00017  * PS. I hate whoever though up the year 1970 - couldn't they have gotten
00018  * a leap-year instead? I also hate Gregorius, pope or no. I'm grumpy.
00019  */
00020 #define MINUTE 60
00021 #define HOUR (60*MINUTE)
00022 #define DAY (24*HOUR)
00023 #define YEAR (365*DAY)
00024
00025 /* interestingly, we assume leap-years */
00026 static int month[12] = {
00027     0,
00028     DAY*(31),
00029     DAY*(31+29),
00030     DAY*(31+29+31),
00031     DAY*(31+29+31+30),
00032     DAY*(31+29+31+30+31),
00033     DAY*(31+29+31+30+31+30),
00034     DAY*(31+29+31+30+31+30+31),
00035     DAY*(31+29+31+30+31+30+31+31),
00036     DAY*(31+29+31+30+31+30+31+31+30),
00037     DAY*(31+29+31+30+31+30+31+31+30+31),
00038     DAY*(31+29+31+30+31+30+31+31+30+31+30)
00039 };
00040
00041 long kernel_mktime(struct tm * tm)
00042 {
00043     long res;
00044     int year;
00045
00046     year = tm->tm_year - 70;
00047 /* magic offsets (y+1) needed to get leapyears right.*/
00048     res = YEAR*year + DAY*((year+1)/4);
00049     res += month[tm->tm_mon];
00050 /* and (y+2) here. If it wasn't a leap-year, we have to adjust */
00051     if (tm->tm_mon>1 && ((year+2)%4))
00052         res -= DAY;
00053     res += DAY*(tm->tm_mday-1);
00054     res += HOUR*tm->tm_hour;
00055     res += MINUTE*tm->tm_min;
00056     res += tm->tm_sec;
00057     return res;
00058 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/mm.h Source File

mm.h

Go to the documentation of this file.
00001 #ifndef _MM_H
00002 #define _MM_H
00003
00004 #define PAGE_SIZE 4096
00005
00006 extern unsigned long get_free_page(void);
00007 extern unsigned long put_page(unsigned long page,unsigned long address);
00008 extern void free_page(unsigned long addr);
00009
00010 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/namei.c Source File

namei.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/namei.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * Some corrections by tytso.
00009  */
00010
00011 #include <linux/sched.h>
00012 #include <linux/kernel.h>
00013 #include <asm/segment.h>
00014
00015 #include <string.h>
00016 #include <fcntl.h>
00017 #include <errno.h>
00018 #include <const.h>
00019 #include <sys/stat.h>
00020
00021 #define ACC_MODE(x) ("\004\002\006\377"[(x)&O_ACCMODE])
00022
00023 /*
00024  * comment out this line if you want names > NAME_LEN chars to be
00025  * truncated. Else they will be disallowed.
00026  */
00027 /* #define NO_TRUNCATE */
00028
00029 #define MAY_EXEC 1
00030 #define MAY_WRITE 2
00031 #define MAY_READ 4
00032
00033 /*
00034  *  permission()
00035  *
00036  * is used to check for read/write/execute permissions on a file.
00037  * I don't know if we should look at just the euid or both euid and
00038  * uid, but that should be easily changed.
00039  */
00040 static int permission(struct m_inode * inode,int mask)
00041 {
00042     int mode = inode->i_mode;
00043
00044 /* special case: not even root can read/write a deleted file */
00045     if (inode->i_dev && !inode->i_nlinks)
00046         return 0;
00047     else if (current->euid==inode->i_uid)
00048         mode >>= 6;
00049     else if (current->egid==inode->i_gid)
00050         mode >>= 3;
00051     if (((mode & mask & 0007) == mask) || suser())
00052         return 1;
00053     return 0;
00054 }
00055
00056 /*
00057  * ok, we cannot use strncmp, as the name is not in our data space.
00058  * Thus we'll have to use match. No big problem. Match also makes
00059  * some sanity tests.
00060  *
00061  * NOTE! unlike strncmp, match returns 1 for success, 0 for failure.
00062  */
00063 static int match(int len,const char * name,struct dir_entry * de)
00064 {
00065     register int same ;
00066
00067     if (!de || !de->inode || len > NAME_LEN)
00068         return 0;
00069     if (len < NAME_LEN && de->name[len])
00070         return 0;
00071     __asm__("cld\n\t"
00072         "fs ; repe ; cmpsb\n\t"
00073         "setz %%al"
00074         :"=a" (same)
00075         :"0" (0),"S" ((long) name),"D" ((long) de->name),"c" (len)
00076         );
00077     return same;
00078 }
00079
00080 /*
00081  *  find_entry()
00082  *
00083  * finds an entry in the specified directory with the wanted name. It
00084  * returns the cache buffer in which the entry was found, and the entry
00085  * itself (as a parameter - res_dir). It does NOT read the inode of the
00086  * entry - you'll have to do that yourself if you want to.
00087  *
00088  * This also takes care of the few special cases due to '..'-traversal
00089  * over a pseudo-root and a mount point.
00090  */
00091 static struct buffer_head * find_entry(struct m_inode ** dir,
00092     const char * name, int namelen, struct dir_entry ** res_dir)
00093 {
00094     int entries;
00095     int block,i;
00096     struct buffer_head * bh;
00097     struct dir_entry * de;
00098     struct super_block * sb;
00099
00100 #ifdef NO_TRUNCATE
00101     if (namelen > NAME_LEN)
00102         return NULL;
00103 #else
00104     if (namelen > NAME_LEN)
00105         namelen = NAME_LEN;
00106 #endif
00107     entries = (*dir)->i_size / (sizeof (struct dir_entry));
00108     *res_dir = NULL;
00109     if (!namelen)
00110         return NULL;
00111 /* check for '..', as we might have to do some "magic" for it */
00112     if (namelen==2 && get_fs_byte(name)=='.' && get_fs_byte(name+1)=='.') {
00113 /* '..' in a pseudo-root results in a faked '.' (just change namelen) */
00114         if ((*dir) == current->root)
00115             namelen=1;
00116         else if ((*dir)->i_num == ROOT_INO) {
00117 /* '..' over a mount-point results in 'dir' being exchanged for the mounted
00118    directory-inode. NOTE! We set mounted, so that we can iput the new dir */
00119             sb=get_super((*dir)->i_dev);
00120             if (sb->s_imount) {
00121                 iput(*dir);
00122                 (*dir)=sb->s_imount;
00123                 (*dir)->i_count++;
00124             }
00125         }
00126     }
00127     if (!(block = (*dir)->i_zone[0]))
00128         return NULL;
00129     if (!(bh = bread((*dir)->i_dev,block)))
00130         return NULL;
00131     i = 0;
00132     de = (struct dir_entry *) bh->b_data;
00133     while (i < entries) {
00134         if ((char *)de >= BLOCK_SIZE+bh->b_data) {
00135             brelse(bh);
00136             bh = NULL;
00137             if (!(block = bmap(*dir,i/DIR_ENTRIES_PER_BLOCK)) ||
00138                 !(bh = bread((*dir)->i_dev,block))) {
00139                 i += DIR_ENTRIES_PER_BLOCK;
00140                 continue;
00141             }
00142             de = (struct dir_entry *) bh->b_data;
00143         }
00144         if (match(namelen,name,de)) {
00145             *res_dir = de;
00146             return bh;
00147         }
00148         de++;
00149         i++;
00150     }
00151     brelse(bh);
00152     return NULL;
00153 }
00154
00155 /*
00156  *  add_entry()
00157  *
00158  * adds a file entry to the specified directory, using the same
00159  * semantics as find_entry(). It returns NULL if it failed.
00160  *
00161  * NOTE!! The inode part of 'de' is left at 0 - which means you
00162  * may not sleep between calling this and putting something into
00163  * the entry, as someone else might have used it while you slept.
00164  */
00165 static struct buffer_head * add_entry(struct m_inode * dir,
00166     const char * name, int namelen, struct dir_entry ** res_dir)
00167 {
00168     int block,i;
00169     struct buffer_head * bh;
00170     struct dir_entry * de;
00171
00172     *res_dir = NULL;
00173 #ifdef NO_TRUNCATE
00174     if (namelen > NAME_LEN)
00175         return NULL;
00176 #else
00177     if (namelen > NAME_LEN)
00178         namelen = NAME_LEN;
00179 #endif
00180     if (!namelen)
00181         return NULL;
00182     if (!(block = dir->i_zone[0]))
00183         return NULL;
00184     if (!(bh = bread(dir->i_dev,block)))
00185         return NULL;
00186     i = 0;
00187     de = (struct dir_entry *) bh->b_data;
00188     while (1) {
00189         if ((char *)de >= BLOCK_SIZE+bh->b_data) {
00190             brelse(bh);
00191             bh = NULL;
00192             block = create_block(dir,i/DIR_ENTRIES_PER_BLOCK);
00193             if (!block)
00194                 return NULL;
00195             if (!(bh = bread(dir->i_dev,block))) {
00196                 i += DIR_ENTRIES_PER_BLOCK;
00197                 continue;
00198             }
00199             de = (struct dir_entry *) bh->b_data;
00200         }
00201         if (i*sizeof(struct dir_entry) >= dir->i_size) {
00202             de->inode=0;
00203             dir->i_size = (i+1)*sizeof(struct dir_entry);
00204             dir->i_dirt = 1;
00205             dir->i_ctime = CURRENT_TIME;
00206         }
00207         if (!de->inode) {
00208             dir->i_mtime = CURRENT_TIME;
00209             for (i=0; i < NAME_LEN ; i++)
00210                 de->name[i]=(i<namelen)?get_fs_byte(name+i):0;
00211             bh->b_dirt = 1;
00212             *res_dir = de;
00213             return bh;
00214         }
00215         de++;
00216         i++;
00217     }
00218     brelse(bh);
00219     return NULL;
00220 }
00221
00222 /*
00223  *  get_dir()
00224  *
00225  * Getdir traverses the pathname until it hits the topmost directory.
00226  * It returns NULL on failure.
00227  */
00228 static struct m_inode * get_dir(const char * pathname)
00229 {
00230     char c;
00231     const char * thisname;
00232     struct m_inode * inode;
00233     struct buffer_head * bh;
00234     int namelen,inr,idev;
00235     struct dir_entry * de;
00236
00237     if (!current->root || !current->root->i_count)
00238         panic("No root inode");
00239     if (!current->pwd || !current->pwd->i_count)
00240         panic("No cwd inode");
00241     if ((c=get_fs_byte(pathname))=='/') {
00242         inode = current->root;
00243         pathname++;
00244     } else if (c)
00245         inode = current->pwd;
00246     else
00247         return NULL;    /* empty name is bad */
00248     inode->i_count++;
00249     while (1) {
00250         thisname = pathname;
00251         if (!S_ISDIR(inode->i_mode) || !permission(inode,MAY_EXEC)) {
00252             iput(inode);
00253             return NULL;
00254         }
00255         for(namelen=0;(c=get_fs_byte(pathname++))&&(c!='/');namelen++)
00256             /* nothing */ ;
00257         if (!c)
00258             return inode;
00259         if (!(bh = find_entry(&inode,thisname,namelen,&de))) {
00260             iput(inode);
00261             return NULL;
00262         }
00263         inr = de->inode;
00264         idev = inode->i_dev;
00265         brelse(bh);
00266         iput(inode);
00267         if (!(inode = iget(idev,inr)))
00268             return NULL;
00269     }
00270 }
00271
00272 /*
00273  *  dir_namei()
00274  *
00275  * dir_namei() returns the inode of the directory of the
00276  * specified name, and the name within that directory.
00277  */
00278 static struct m_inode * dir_namei(const char * pathname,
00279     int * namelen, const char ** name)
00280 {
00281     char c;
00282     const char * basename;
00283     struct m_inode * dir;
00284
00285     if (!(dir = get_dir(pathname)))
00286         return NULL;
00287     basename = pathname;
00288     while ((c=get_fs_byte(pathname++)))
00289         if (c=='/')
00290             basename=pathname;
00291     *namelen = pathname-basename-1;
00292     *name = basename;
00293     return dir;
00294 }
00295
00296 /*
00297  *  namei()
00298  *
00299  * is used by most simple commands to get the inode of a specified name.
00300  * Open, link etc use their own routines, but this is enough for things
00301  * like 'chmod' etc.
00302  */
00303 struct m_inode * namei(const char * pathname)
00304 {
00305     const char * basename;
00306     int inr,dev,namelen;
00307     struct m_inode * dir;
00308     struct buffer_head * bh;
00309     struct dir_entry * de;
00310
00311     if (!(dir = dir_namei(pathname,&namelen,&basename)))
00312         return NULL;
00313     if (!namelen)           /* special case: '/usr/' etc */
00314         return dir;
00315     bh = find_entry(&dir,basename,namelen,&de);
00316     if (!bh) {
00317         iput(dir);
00318         return NULL;
00319     }
00320     inr = de->inode;
00321     dev = dir->i_dev;
00322     brelse(bh);
00323     iput(dir);
00324     dir=iget(dev,inr);
00325     if (dir) {
00326         dir->i_atime=CURRENT_TIME;
00327         dir->i_dirt=1;
00328     }
00329     return dir;
00330 }
00331
00332 /*
00333  *  open_namei()
00334  *
00335  * namei for open - this is in fact almost the whole open-routine.
00336  */
00337 int open_namei(const char * pathname, int flag, int mode,
00338     struct m_inode ** res_inode)
00339 {
00340     const char * basename;
00341     int inr,dev,namelen;
00342     struct m_inode * dir, *inode;
00343     struct buffer_head * bh;
00344     struct dir_entry * de;
00345
00346     if ((flag & O_TRUNC) && !(flag & O_ACCMODE))
00347         flag |= O_WRONLY;
00348     mode &= 0777 & ~current->umask;
00349     mode |= I_REGULAR;
00350     if (!(dir = dir_namei(pathname,&namelen,&basename)))
00351         return -ENOENT;
00352     if (!namelen) {         /* special case: '/usr/' etc */
00353         if (!(flag & (O_ACCMODE|O_CREAT|O_TRUNC))) {
00354             *res_inode=dir;
00355             return 0;
00356         }
00357         iput(dir);
00358         return -EISDIR;
00359     }
00360     bh = find_entry(&dir,basename,namelen,&de);
00361     if (!bh) {
00362         if (!(flag & O_CREAT)) {
00363             iput(dir);
00364             return -ENOENT;
00365         }
00366         if (!permission(dir,MAY_WRITE)) {
00367             iput(dir);
00368             return -EACCES;
00369         }
00370         inode = new_inode(dir->i_dev);
00371         if (!inode) {
00372             iput(dir);
00373             return -ENOSPC;
00374         }
00375         inode->i_uid = current->euid;
00376         inode->i_mode = mode;
00377         inode->i_dirt = 1;
00378         bh = add_entry(dir,basename,namelen,&de);
00379         if (!bh) {
00380             inode->i_nlinks--;
00381             iput(inode);
00382             iput(dir);
00383             return -ENOSPC;
00384         }
00385         de->inode = inode->i_num;
00386         bh->b_dirt = 1;
00387         brelse(bh);
00388         iput(dir);
00389         *res_inode = inode;
00390         return 0;
00391     }
00392     inr = de->inode;
00393     dev = dir->i_dev;
00394     brelse(bh);
00395     iput(dir);
00396     if (flag & O_EXCL)
00397         return -EEXIST;
00398     if (!(inode=iget(dev,inr)))
00399         return -EACCES;
00400     if ((S_ISDIR(inode->i_mode) && (flag & O_ACCMODE)) ||
00401         !permission(inode,ACC_MODE(flag))) {
00402         iput(inode);
00403         return -EPERM;
00404     }
00405     inode->i_atime = CURRENT_TIME;
00406     if (flag & O_TRUNC)
00407         truncate(inode);
00408     *res_inode = inode;
00409     return 0;
00410 }
00411
00412 int sys_mknod(const char * filename, int mode, int dev)
00413 {
00414     const char * basename;
00415     int namelen;
00416     struct m_inode * dir, * inode;
00417     struct buffer_head * bh;
00418     struct dir_entry * de;
00419
00420     if (!suser())
00421         return -EPERM;
00422     if (!(dir = dir_namei(filename,&namelen,&basename)))
00423         return -ENOENT;
00424     if (!namelen) {
00425         iput(dir);
00426         return -ENOENT;
00427     }
00428     if (!permission(dir,MAY_WRITE)) {
00429         iput(dir);
00430         return -EPERM;
00431     }
00432     bh = find_entry(&dir,basename,namelen,&de);
00433     if (bh) {
00434         brelse(bh);
00435         iput(dir);
00436         return -EEXIST;
00437     }
00438     inode = new_inode(dir->i_dev);
00439     if (!inode) {
00440         iput(dir);
00441         return -ENOSPC;
00442     }
00443     inode->i_mode = mode;
00444     if (S_ISBLK(mode) || S_ISCHR(mode))
00445         inode->i_zone[0] = dev;
00446     inode->i_mtime = inode->i_atime = CURRENT_TIME;
00447     inode->i_dirt = 1;
00448     bh = add_entry(dir,basename,namelen,&de);
00449     if (!bh) {
00450         iput(dir);
00451         inode->i_nlinks=0;
00452         iput(inode);
00453         return -ENOSPC;
00454     }
00455     de->inode = inode->i_num;
00456     bh->b_dirt = 1;
00457     iput(dir);
00458     iput(inode);
00459     brelse(bh);
00460     return 0;
00461 }
00462
00463 int sys_mkdir(const char * pathname, int mode)
00464 {
00465     const char * basename;
00466     int namelen;
00467     struct m_inode * dir, * inode;
00468     struct buffer_head * bh, *dir_block;
00469     struct dir_entry * de;
00470
00471     if (!suser())
00472         return -EPERM;
00473     if (!(dir = dir_namei(pathname,&namelen,&basename)))
00474         return -ENOENT;
00475     if (!namelen) {
00476         iput(dir);
00477         return -ENOENT;
00478     }
00479     if (!permission(dir,MAY_WRITE)) {
00480         iput(dir);
00481         return -EPERM;
00482     }
00483     bh = find_entry(&dir,basename,namelen,&de);
00484     if (bh) {
00485         brelse(bh);
00486         iput(dir);
00487         return -EEXIST;
00488     }
00489     inode = new_inode(dir->i_dev);
00490     if (!inode) {
00491         iput(dir);
00492         return -ENOSPC;
00493     }
00494     inode->i_size = 32;
00495     inode->i_dirt = 1;
00496     inode->i_mtime = inode->i_atime = CURRENT_TIME;
00497     if (!(inode->i_zone[0]=new_block(inode->i_dev))) {
00498         iput(dir);
00499         inode->i_nlinks--;
00500         iput(inode);
00501         return -ENOSPC;
00502     }
00503     inode->i_dirt = 1;
00504     if (!(dir_block=bread(inode->i_dev,inode->i_zone[0]))) {
00505         iput(dir);
00506         free_block(inode->i_dev,inode->i_zone[0]);
00507         inode->i_nlinks--;
00508         iput(inode);
00509         return -ERROR;
00510     }
00511     de = (struct dir_entry *) dir_block->b_data;
00512     de->inode=inode->i_num;
00513     strcpy(de->name,".");
00514     de++;
00515     de->inode = dir->i_num;
00516     strcpy(de->name,"..");
00517     inode->i_nlinks = 2;
00518     dir_block->b_dirt = 1;
00519     brelse(dir_block);
00520     inode->i_mode = I_DIRECTORY | (mode & 0777 & ~current->umask);
00521     inode->i_dirt = 1;
00522     bh = add_entry(dir,basename,namelen,&de);
00523     if (!bh) {
00524         iput(dir);
00525         free_block(inode->i_dev,inode->i_zone[0]);
00526         inode->i_nlinks=0;
00527         iput(inode);
00528         return -ENOSPC;
00529     }
00530     de->inode = inode->i_num;
00531     bh->b_dirt = 1;
00532     dir->i_nlinks++;
00533     dir->i_dirt = 1;
00534     iput(dir);
00535     iput(inode);
00536     brelse(bh);
00537     return 0;
00538 }
00539
00540 /*
00541  * routine to check that the specified directory is empty (for rmdir)
00542  */
00543 static int empty_dir(struct m_inode * inode)
00544 {
00545     int nr,block;
00546     int len;
00547     struct buffer_head * bh;
00548     struct dir_entry * de;
00549
00550     len = inode->i_size / sizeof (struct dir_entry);
00551     if (len<2 || !inode->i_zone[0] ||
00552         !(bh=bread(inode->i_dev,inode->i_zone[0]))) {
00553             printk("warning - bad directory on dev %04x\n",inode->i_dev);
00554         return 0;
00555     }
00556     de = (struct dir_entry *) bh->b_data;
00557     if (de[0].inode != inode->i_num || !de[1].inode ||
00558         strcmp(".",de[0].name) || strcmp("..",de[1].name)) {
00559             printk("warning - bad directory on dev %04x\n",inode->i_dev);
00560         return 0;
00561     }
00562     nr = 2;
00563     de += 2;
00564     while (nr<len) {
00565         if ((void *) de >= (void *) (bh->b_data+BLOCK_SIZE)) {
00566             brelse(bh);
00567             block=bmap(inode,nr/DIR_ENTRIES_PER_BLOCK);
00568             if (!block) {
00569                 nr += DIR_ENTRIES_PER_BLOCK;
00570                 continue;
00571             }
00572             if (!(bh=bread(inode->i_dev,block)))
00573                 return 0;
00574             de = (struct dir_entry *) bh->b_data;
00575         }
00576         if (de->inode) {
00577             brelse(bh);
00578             return 0;
00579         }
00580         de++;
00581         nr++;
00582     }
00583     brelse(bh);
00584     return 1;
00585 }
00586
00587 int sys_rmdir(const char * name)
00588 {
00589     const char * basename;
00590     int namelen;
00591     struct m_inode * dir, * inode;
00592     struct buffer_head * bh;
00593     struct dir_entry * de;
00594
00595     if (!suser())
00596         return -EPERM;
00597     if (!(dir = dir_namei(name,&namelen,&basename)))
00598         return -ENOENT;
00599     if (!namelen) {
00600         iput(dir);
00601         return -ENOENT;
00602     }
00603     if (!permission(dir,MAY_WRITE)) {
00604         iput(dir);
00605         return -EPERM;
00606     }
00607     bh = find_entry(&dir,basename,namelen,&de);
00608     if (!bh) {
00609         iput(dir);
00610         return -ENOENT;
00611     }
00612     if (!(inode = iget(dir->i_dev, de->inode))) {
00613         iput(dir);
00614         brelse(bh);
00615         return -EPERM;
00616     }
00617     if ((dir->i_mode & S_ISVTX) && current->euid &&
00618         inode->i_uid != current->euid) {
00619         iput(dir);
00620         iput(inode);
00621         brelse(bh);
00622         return -EPERM;
00623     }
00624     if (inode->i_dev != dir->i_dev || inode->i_count>1) {
00625         iput(dir);
00626         iput(inode);
00627         brelse(bh);
00628         return -EPERM;
00629     }
00630     if (inode == dir) { /* we may not delete ".", but "../dir" is ok */
00631         iput(inode);
00632         iput(dir);
00633         brelse(bh);
00634         return -EPERM;
00635     }
00636     if (!S_ISDIR(inode->i_mode)) {
00637         iput(inode);
00638         iput(dir);
00639         brelse(bh);
00640         return -ENOTDIR;
00641     }
00642     if (!empty_dir(inode)) {
00643         iput(inode);
00644         iput(dir);
00645         brelse(bh);
00646         return -ENOTEMPTY;
00647     }
00648     if (inode->i_nlinks != 2)
00649         printk("empty directory has nlink!=2 (%d)",inode->i_nlinks);
00650     de->inode = 0;
00651     bh->b_dirt = 1;
00652     brelse(bh);
00653     inode->i_nlinks=0;
00654     inode->i_dirt=1;
00655     dir->i_nlinks--;
00656     dir->i_ctime = dir->i_mtime = CURRENT_TIME;
00657     dir->i_dirt=1;
00658     iput(dir);
00659     iput(inode);
00660     return 0;
00661 }
00662
00663 int sys_unlink(const char * name)
00664 {
00665     const char * basename;
00666     int namelen;
00667     struct m_inode * dir, * inode;
00668     struct buffer_head * bh;
00669     struct dir_entry * de;
00670
00671     if (!(dir = dir_namei(name,&namelen,&basename)))
00672         return -ENOENT;
00673     if (!namelen) {
00674         iput(dir);
00675         return -ENOENT;
00676     }
00677     if (!permission(dir,MAY_WRITE)) {
00678         iput(dir);
00679         return -EPERM;
00680     }
00681     bh = find_entry(&dir,basename,namelen,&de);
00682     if (!bh) {
00683         iput(dir);
00684         return -ENOENT;
00685     }
00686     if (!(inode = iget(dir->i_dev, de->inode))) {
00687         iput(dir);
00688         brelse(bh);
00689         return -ENOENT;
00690     }
00691     if ((dir->i_mode & S_ISVTX) && !suser() &&
00692         current->euid != inode->i_uid &&
00693         current->euid != dir->i_uid) {
00694         iput(dir);
00695         iput(inode);
00696         brelse(bh);
00697         return -EPERM;
00698     }
00699     if (S_ISDIR(inode->i_mode)) {
00700         iput(inode);
00701         iput(dir);
00702         brelse(bh);
00703         return -EPERM;
00704     }
00705     if (!inode->i_nlinks) {
00706         printk("Deleting nonexistent file (%04x:%d), %d\n",
00707             inode->i_dev,inode->i_num,inode->i_nlinks);
00708         inode->i_nlinks=1;
00709     }
00710     de->inode = 0;
00711     bh->b_dirt = 1;
00712     brelse(bh);
00713     inode->i_nlinks--;
00714     inode->i_dirt = 1;
00715     inode->i_ctime = CURRENT_TIME;
00716     iput(inode);
00717     iput(dir);
00718     return 0;
00719 }
00720
00721 int sys_link(const char * oldname, const char * newname)
00722 {
00723     struct dir_entry * de;
00724     struct m_inode * oldinode, * dir;
00725     struct buffer_head * bh;
00726     const char * basename;
00727     int namelen;
00728
00729     oldinode=namei(oldname);
00730     if (!oldinode)
00731         return -ENOENT;
00732     if (S_ISDIR(oldinode->i_mode)) {
00733         iput(oldinode);
00734         return -EPERM;
00735     }
00736     dir = dir_namei(newname,&namelen,&basename);
00737     if (!dir) {
00738         iput(oldinode);
00739         return -EACCES;
00740     }
00741     if (!namelen) {
00742         iput(oldinode);
00743         iput(dir);
00744         return -EPERM;
00745     }
00746     if (dir->i_dev != oldinode->i_dev) {
00747         iput(dir);
00748         iput(oldinode);
00749         return -EXDEV;
00750     }
00751     if (!permission(dir,MAY_WRITE)) {
00752         iput(dir);
00753         iput(oldinode);
00754         return -EACCES;
00755     }
00756     bh = find_entry(&dir,basename,namelen,&de);
00757     if (bh) {
00758         brelse(bh);
00759         iput(dir);
00760         iput(oldinode);
00761         return -EEXIST;
00762     }
00763     bh = add_entry(dir,basename,namelen,&de);
00764     if (!bh) {
00765         iput(dir);
00766         iput(oldinode);
00767         return -ENOSPC;
00768     }
00769     de->inode = oldinode->i_num;
00770     bh->b_dirt = 1;
00771     brelse(bh);
00772     iput(dir);
00773     oldinode->i_nlinks++;
00774     oldinode->i_ctime = CURRENT_TIME;
00775     oldinode->i_dirt = 1;
00776     iput(oldinode);
00777     return 0;
00778 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/panic.c Source File

panic.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/panic.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * This function is used through-out the kernel (includeinh mm and fs)
00009  * to indicate a major problem.
00010  */
00011 #define PANIC
00012
00013 #include <linux/kernel.h>
00014 #include <linux/sched.h>
00015
00016 void sys_sync(void);    /* it's really int */
00017
00018 volatile void panic(const char * s)
00019 {
00020     printk("Kernel panic: %s\n\r",s);
00021     if (current == task[0])
00022         printk("In swapper task - not syncing\n\r");
00023     else
00024         sys_sync();
00025     for(;;);
00026 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/pipe.c Source File

pipe.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/pipe.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <signal.h>
00008
00009 #include <linux/sched.h>
00010 #include <linux/mm.h>   /* for get_free_page */
00011 #include <asm/segment.h>
00012
00013 int read_pipe(struct m_inode * inode, char * buf, int count)
00014 {
00015     int chars, size, read = 0;
00016
00017     while (count>0) {
00018         while (!(size=PIPE_SIZE(*inode))) {
00019             wake_up(&inode->i_wait);
00020             if (inode->i_count != 2) /* are there any writers? */
00021                 return read;
00022             sleep_on(&inode->i_wait);
00023         }
00024         chars = PAGE_SIZE-PIPE_TAIL(*inode);
00025         if (chars > count)
00026             chars = count;
00027         if (chars > size)
00028             chars = size;
00029         count -= chars;
00030         read += chars;
00031         size = PIPE_TAIL(*inode);
00032         PIPE_TAIL(*inode) += chars;
00033         PIPE_TAIL(*inode) &= (PAGE_SIZE-1);
00034         while (chars-->0)
00035             put_fs_byte(((char *)inode->i_size)[size++],buf++);
00036     }
00037     wake_up(&inode->i_wait);
00038     return read;
00039 }
00040
00041 int write_pipe(struct m_inode * inode, char * buf, int count)
00042 {
00043     int chars, size, written = 0;
00044
00045     while (count>0) {
00046         while (!(size=(PAGE_SIZE-1)-PIPE_SIZE(*inode))) {
00047             wake_up(&inode->i_wait);
00048             if (inode->i_count != 2) { /* no readers */
00049                 current->signal |= (1<<(SIGPIPE-1));
00050                 return written?written:-1;
00051             }
00052             sleep_on(&inode->i_wait);
00053         }
00054         chars = PAGE_SIZE-PIPE_HEAD(*inode);
00055         if (chars > count)
00056             chars = count;
00057         if (chars > size)
00058             chars = size;
00059         count -= chars;
00060         written += chars;
00061         size = PIPE_HEAD(*inode);
00062         PIPE_HEAD(*inode) += chars;
00063         PIPE_HEAD(*inode) &= (PAGE_SIZE-1);
00064         while (chars-->0)
00065             ((char *)inode->i_size)[size++]=get_fs_byte(buf++);
00066     }
00067     wake_up(&inode->i_wait);
00068     return written;
00069 }
00070
00071 int sys_pipe(unsigned long * fildes)
00072 {
00073     struct m_inode * inode;
00074     struct file * f[2];
00075     int fd[2];
00076     int i,j;
00077
00078     j=0;
00079     for(i=0;j<2 && i<NR_FILE;i++)
00080         if (!file_table[i].f_count)
00081             (f[j++]=i+file_table)->f_count++;
00082     if (j==1)
00083         f[0]->f_count=0;
00084     if (j<2)
00085         return -1;
00086     j=0;
00087     for(i=0;j<2 && i<NR_OPEN;i++)
00088         if (!current->filp[i]) {
00089             current->filp[ fd[j]=i ] = f[j];
00090             j++;
00091         }
00092     if (j==1)
00093         current->filp[fd[0]]=NULL;
00094     if (j<2) {
00095         f[0]->f_count=f[1]->f_count=0;
00096         return -1;
00097     }
00098     if (!(inode=get_pipe_inode())) {
00099         current->filp[fd[0]] =
00100             current->filp[fd[1]] = NULL;
00101         f[0]->f_count = f[1]->f_count = 0;
00102         return -1;
00103     }
00104     f[0]->f_inode = f[1]->f_inode = inode;
00105     f[0]->f_pos = f[1]->f_pos = 0;
00106     f[0]->f_mode = 1;       /* read */
00107     f[1]->f_mode = 2;       /* write */
00108     put_fs_long(fd[0],0+fildes);
00109     put_fs_long(fd[1],1+fildes);
00110     return 0;
00111 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/printk.c Source File

printk.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/printk.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * When in kernel-mode, we cannot use printf, as fs is liable to
00009  * point to 'interesting' things. Make a printf with fs-saving, and
00010  * all is well.
00011  */
00012 #include <stdarg.h>
00013 #include <stddef.h>
00014
00015 #include <linux/kernel.h>
00016
00017 static char buf[1024];
00018
00019 extern int vsprintf(char * buf, const char * fmt, va_list args);
00020
00021 int printk(const char *fmt, ...)
00022 {
00023     va_list args;
00024     int i;
00025
00026     va_start(args, fmt);
00027     i=vsprintf(buf,fmt,args);
00028     va_end(args);
00029     __asm__("push %%fs\n\t"
00030         "push %%ds\n\t"
00031         "pop %%fs\n\t"
00032         "pushl %0\n\t"
00033         "pushl $buf\n\t"
00034         "pushl $0\n\t"
00035         "call tty_write\n\t"
00036         "addl $8,%%esp\n\t"
00037         "popl %0\n\t"
00038         "pop %%fs"
00039         ::"r" (i):"ax","cx","dx");
00040     return i;
00041 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/blk_drv/ramdisk.c Source File

ramdisk.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/blk_drv/ramdisk.c
00003  *
00004  *  Written by Theodore Ts'o, 12/2/91
00005  */
00006
00007 #include <string.h>
00008
00009 #include <linux/config.h>
00010 #include <linux/sched.h>
00011 #include <linux/fs.h>
00012 #include <linux/kernel.h>
00013 #include <asm/system.h>
00014 #include <asm/segment.h>
00015 #include <asm/memory.h>
00016
00017 #define MAJOR_NR 1
00018 #include "blk.h"
00019
00020 char    *rd_start;
00021 int rd_length = 0;
00022
00023 void do_rd_request(void)
00024 {
00025     int len;
00026     char    *addr;
00027
00028     INIT_REQUEST;
00029     addr = rd_start + (CURRENT->sector << 9);
00030     len = CURRENT->nr_sectors << 9;
00031     if ((MINOR(CURRENT->dev) != 1) || (addr+len > rd_start+rd_length)) {
00032         end_request(0);
00033         goto repeat;
00034     }
00035     if (CURRENT-> cmd == WRITE) {
00036         (void ) memcpy(addr,
00037                   CURRENT->buffer,
00038                   len);
00039     } else if (CURRENT->cmd == READ) {
00040         (void) memcpy(CURRENT->buffer,
00041                   addr,
00042                   len);
00043     } else
00044         panic("unknown ramdisk-command");
00045     end_request(1);
00046     goto repeat;
00047 }
00048
00049 /*
00050  * Returns amount of memory which needs to be reserved.
00051  */
00052 long rd_init(long mem_start, int length)
00053 {
00054     int i;
00055     char    *cp;
00056
00057     blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
00058     rd_start = (char *) mem_start;
00059     rd_length = length;
00060     cp = rd_start;
00061     for (i=0; i < length; i++)
00062         *cp++ = '\0';
00063     return(length);
00064 }
00065
00066 /*
00067  * If the root device is the ram disk, try to load it.
00068  * In order to do this, the root device is originally set to the
00069  * floppy, and we later change it to be ram disk.
00070  */
00071 void rd_load(void)
00072 {
00073     struct buffer_head *bh;
00074     struct super_block  s;
00075     int     block = 256;    /* Start at block 256 */
00076     int     i = 1;
00077     int     nblocks;
00078     char        *cp;        /* Move pointer */
00079
00080     if (!rd_length)
00081         return;
00082     printk("Ram disk: %d bytes, starting at 0x%x\n", rd_length,
00083         (int) rd_start);
00084     if (MAJOR(ROOT_DEV) != 2)
00085         return;
00086     bh = breada(ROOT_DEV,block+1,block,block+2,-1);
00087     if (!bh) {
00088         printk("Disk error while looking for ramdisk!\n");
00089         return;
00090     }
00091     *((struct d_super_block *) &s) = *((struct d_super_block *) bh->b_data);
00092     brelse(bh);
00093     if (s.s_magic != SUPER_MAGIC)
00094         /* No ram disk image present, assume normal floppy boot */
00095         return;
00096     nblocks = s.s_nzones << s.s_log_zone_size;
00097     if (nblocks > (rd_length >> BLOCK_SIZE_BITS)) {
00098         printk("Ram disk image too big!  (%d blocks, %d avail)\n",
00099             nblocks, rd_length >> BLOCK_SIZE_BITS);
00100         return;
00101     }
00102     printk("Loading %d bytes into ram disk... 0000k",
00103         nblocks << BLOCK_SIZE_BITS);
00104     cp = rd_start;
00105     while (nblocks) {
00106         if (nblocks > 2)
00107             bh = breada(ROOT_DEV, block, block+1, block+2, -1);
00108         else
00109             bh = bread(ROOT_DEV, block);
00110         if (!bh) {
00111             printk("I/O error on block %d, aborting load\n",
00112                 block);
00113             return;
00114         }
00115         (void) memcpy(cp, bh->b_data, BLOCK_SIZE);
00116         brelse(bh);
00117         printk("\010\010\010\010\010%4dk",i);
00118         cp += BLOCK_SIZE;
00119         block++;
00120         nblocks--;
00121         i++;
00122     }
00123     printk("\010\010\010\010\010done \n");
00124     ROOT_DEV=0x0101;
00125 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/read_write.c Source File

read_write.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/read_write.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <sys/stat.h>
00008 #include <errno.h>
00009 #include <sys/types.h>
00010
00011 #include <linux/kernel.h>
00012 #include <linux/sched.h>
00013 #include <asm/segment.h>
00014
00015 extern int rw_char(int rw,int dev, char * buf, int count, off_t * pos);
00016 extern int read_pipe(struct m_inode * inode, char * buf, int count);
00017 extern int write_pipe(struct m_inode * inode, char * buf, int count);
00018 extern int block_read(int dev, off_t * pos, char * buf, int count);
00019 extern int block_write(int dev, off_t * pos, char * buf, int count);
00020 extern int file_read(struct m_inode * inode, struct file * filp,
00021         char * buf, int count);
00022 extern int file_write(struct m_inode * inode, struct file * filp,
00023         char * buf, int count);
00024
00025 int sys_lseek(unsigned int fd,off_t offset, int origin)
00026 {
00027     struct file * file;
00028     int tmp;
00029
00030     if (fd >= NR_OPEN || !(file=current->filp[fd]) || !(file->f_inode)
00031        || !IS_SEEKABLE(MAJOR(file->f_inode->i_dev)))
00032         return -EBADF;
00033     if (file->f_inode->i_pipe)
00034         return -ESPIPE;
00035     switch (origin) {
00036         case 0:
00037             if (offset<0) return -EINVAL;
00038             file->f_pos=offset;
00039             break;
00040         case 1:
00041             if (file->f_pos+offset<0) return -EINVAL;
00042             file->f_pos += offset;
00043             break;
00044         case 2:
00045             if ((tmp=file->f_inode->i_size+offset) < 0)
00046                 return -EINVAL;
00047             file->f_pos = tmp;
00048             break;
00049         default:
00050             return -EINVAL;
00051     }
00052     return file->f_pos;
00053 }
00054
00055 int sys_read(unsigned int fd,char * buf,int count)
00056 {
00057     struct file * file;
00058     struct m_inode * inode;
00059
00060     if (fd>=NR_OPEN || count<0 || !(file=current->filp[fd]))
00061         return -EINVAL;
00062     if (!count)
00063         return 0;
00064     verify_area(buf,count);
00065     inode = file->f_inode;
00066     if (inode->i_pipe)
00067         return (file->f_mode&1)?read_pipe(inode,buf,count):-EIO;
00068     if (S_ISCHR(inode->i_mode))
00069         return rw_char(READ,inode->i_zone[0],buf,count,&file->f_pos);
00070     if (S_ISBLK(inode->i_mode))
00071         return block_read(inode->i_zone[0],&file->f_pos,buf,count);
00072     if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode)) {
00073         if (count+file->f_pos > inode->i_size)
00074             count = inode->i_size - file->f_pos;
00075         if (count<=0)
00076             return 0;
00077         return file_read(inode,file,buf,count);
00078     }
00079     printk("(Read)inode->i_mode=%06o\n\r",inode->i_mode);
00080     return -EINVAL;
00081 }
00082
00083 int sys_write(unsigned int fd,char * buf,int count)
00084 {
00085     struct file * file;
00086     struct m_inode * inode;
00087
00088     if (fd>=NR_OPEN || count <0 || !(file=current->filp[fd]))
00089         return -EINVAL;
00090     if (!count)
00091         return 0;
00092     inode=file->f_inode;
00093     if (inode->i_pipe)
00094         return (file->f_mode&2)?write_pipe(inode,buf,count):-EIO;
00095     if (S_ISCHR(inode->i_mode))
00096         return rw_char(WRITE,inode->i_zone[0],buf,count,&file->f_pos);
00097     if (S_ISBLK(inode->i_mode))
00098         return block_write(inode->i_zone[0],&file->f_pos,buf,count);
00099     if (S_ISREG(inode->i_mode))
00100         return file_write(inode,file,buf,count);
00101     printk("(Write)inode->i_mode=%06o\n\r",inode->i_mode);
00102     return -EINVAL;
00103 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/sched.c Source File

sched.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/sched.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * 'sched.c' is the main kernel file. It contains scheduling primitives
00009  * (sleep_on, wakeup, schedule etc) as well as a number of simple system
00010  * call functions (type getpid(), which just extracts a field from
00011  * current-task
00012  */
00013 #include <linux/sched.h>
00014 #include <linux/kernel.h>
00015 #include <linux/sys.h>
00016 #include <linux/fdreg.h>
00017 #include <asm/system.h>
00018 #include <asm/io.h>
00019 #include <asm/segment.h>
00020
00021 #include <signal.h>
00022
00023 #define _S(nr) (1<<((nr)-1))
00024 #define _BLOCKABLE (~(_S(SIGKILL) | _S(SIGSTOP)))
00025
00026 void show_task(int nr,struct task_struct * p)
00027 {
00028     int i,j = 4096-sizeof(struct task_struct);
00029
00030     printk("%d: pid=%d, state=%d, ",nr,p->pid,p->state);
00031     i=0;
00032     while (i<j && !((char *)(p+1))[i])
00033         i++;
00034     printk("%d (of %d) chars free in kernel stack\n\r",i,j);
00035 }
00036
00037 void show_stat(void)
00038 {
00039     int i;
00040
00041     for (i=0;i<NR_TASKS;i++)
00042         if (task[i])
00043             show_task(i,task[i]);
00044 }
00045
00046 #define LATCH (1193180/HZ)
00047
00048 extern void mem_use(void);
00049
00050 extern int timer_interrupt(void);
00051 extern int system_call(void);
00052
00053 union task_union {
00054     struct task_struct task;
00055     char stack[PAGE_SIZE];
00056 };
00057
00058 static union task_union init_task = {INIT_TASK,};
00059
00060 long volatile jiffies=0;
00061 long startup_time=0;
00062 struct task_struct *current = &(init_task.task);
00063 struct task_struct *last_task_used_math = NULL;
00064
00065 struct task_struct * task[NR_TASKS] = {&(init_task.task), };
00066
00067 long user_stack [ PAGE_SIZE>>2 ] ;
00068
00069 struct {
00070     long * a;
00071     short b;
00072     } stack_start = { & user_stack [PAGE_SIZE>>2] , 0x10 };
00073 /*
00074  *  'math_state_restore()' saves the current math information in the
00075  * old math state array, and gets the new ones from the current task
00076  */
00077 void math_state_restore()
00078 {
00079     if (last_task_used_math == current)
00080         return;
00081     __asm__("fwait");
00082     if (last_task_used_math) {
00083         __asm__("fnsave %0"::"m" (last_task_used_math->tss.i387));
00084     }
00085     last_task_used_math=current;
00086     if (current->used_math) {
00087         __asm__("frstor %0"::"m" (current->tss.i387));
00088     } else {
00089         __asm__("fninit"::);
00090         current->used_math=1;
00091     }
00092 }
00093
00094 /*
00095  *  'schedule()' is the scheduler function. This is GOOD CODE! There
00096  * probably won't be any reason to change this, as it should work well
00097  * in all circumstances (ie gives IO-bound processes good response etc).
00098  * The one thing you might take a look at is the signal-handler code here.
00099  *
00100  *   NOTE!!  Task 0 is the 'idle' task, which gets called when no other
00101  * tasks can run. It can not be killed, and it cannot sleep. The 'state'
00102  * information in task[0] is never used.
00103  */
00104 void schedule(void)
00105 {
00106     int i,next,c;
00107     struct task_struct ** p;
00108
00109 /* check alarm, wake up any interruptible tasks that have got a signal */
00110
00111     for(p = &LAST_TASK ; p > &FIRST_TASK ; --p)
00112         if (*p) {
00113             if ((*p)->alarm && (*p)->alarm < jiffies) {
00114                     (*p)->signal |= (1<<(SIGALRM-1));
00115                     (*p)->alarm = 0;
00116                 }
00117             if (((*p)->signal & ~(_BLOCKABLE & (*p)->blocked)) &&
00118             (*p)->state==TASK_INTERRUPTIBLE)
00119                 (*p)->state=TASK_RUNNING;
00120         }
00121
00122 /* this is the scheduler proper: */
00123
00124     while (1) {
00125         c = -1;
00126         next = 0;
00127         i = NR_TASKS;
00128         p = &task[NR_TASKS];
00129         while (--i) {
00130             if (!*--p)
00131                 continue;
00132             if ((*p)->state == TASK_RUNNING && (*p)->counter > c)
00133                 c = (*p)->counter, next = i;
00134         }
00135         if (c) break;
00136         for(p = &LAST_TASK ; p > &FIRST_TASK ; --p)
00137             if (*p)
00138                 (*p)->counter = ((*p)->counter >> 1) +
00139                         (*p)->priority;
00140     }
00141     switch_to(next);
00142 }
00143
00144 int sys_pause(void)
00145 {
00146     current->state = TASK_INTERRUPTIBLE;
00147     schedule();
00148     return 0;
00149 }
00150
00151 void sleep_on(struct task_struct **p)
00152 {
00153     struct task_struct *tmp;
00154
00155     if (!p)
00156         return;
00157     if (current == &(init_task.task))
00158         panic("task[0] trying to sleep");
00159     tmp = *p;
00160     *p = current;
00161     current->state = TASK_UNINTERRUPTIBLE;
00162     schedule();
00163     if (tmp)
00164         tmp->state=0;
00165 }
00166
00167 void interruptible_sleep_on(struct task_struct **p)
00168 {
00169     struct task_struct *tmp;
00170
00171     if (!p)
00172         return;
00173     if (current == &(init_task.task))
00174         panic("task[0] trying to sleep");
00175     tmp=*p;
00176     *p=current;
00177 repeat: current->state = TASK_INTERRUPTIBLE;
00178     schedule();
00179     if (*p && *p != current) {
00180         (**p).state=0;
00181         goto repeat;
00182     }
00183     *p=NULL;
00184     if (tmp)
00185         tmp->state=0;
00186 }
00187
00188 void wake_up(struct task_struct **p)
00189 {
00190     if (p && *p) {
00191         (**p).state=0;
00192         *p=NULL;
00193     }
00194 }
00195
00196 /*
00197  * OK, here are some floppy things that shouldn't be in the kernel
00198  * proper. They are here because the floppy needs a timer, and this
00199  * was the easiest way of doing it.
00200  */
00201 static struct task_struct * wait_motor[4] = {NULL,NULL,NULL,NULL};
00202 static int  mon_timer[4]={0,0,0,0};
00203 static int moff_timer[4]={0,0,0,0};
00204 unsigned char current_DOR = 0x0C;
00205
00206 int ticks_to_floppy_on(unsigned int nr)
00207 {
00208     extern unsigned char selected;
00209     unsigned char mask = 0x10 << nr;
00210
00211     if (nr>3)
00212         panic("floppy_on: nr>3");
00213     moff_timer[nr]=10000;       /* 100 s = very big :-) */
00214     cli();              /* use floppy_off to turn it off */
00215     mask |= current_DOR;
00216     if (!selected) {
00217         mask &= 0xFC;
00218         mask |= nr;
00219     }
00220     if (mask != current_DOR) {
00221         outb(mask,FD_DOR);
00222         if ((mask ^ current_DOR) & 0xf0)
00223             mon_timer[nr] = HZ/2;
00224         else if (mon_timer[nr] < 2)
00225             mon_timer[nr] = 2;
00226         current_DOR = mask;
00227     }
00228     sti();
00229     return mon_timer[nr];
00230 }
00231
00232 void floppy_on(unsigned int nr)
00233 {
00234     cli();
00235     while (ticks_to_floppy_on(nr))
00236         sleep_on(nr+wait_motor);
00237     sti();
00238 }
00239
00240 void floppy_off(unsigned int nr)
00241 {
00242     moff_timer[nr]=3*HZ;
00243 }
00244
00245 void do_floppy_timer(void)
00246 {
00247     int i;
00248     unsigned char mask = 0x10;
00249
00250     for (i=0 ; i<4 ; i++,mask <<= 1) {
00251         if (!(mask & current_DOR))
00252             continue;
00253         if (mon_timer[i]) {
00254             if (!--mon_timer[i])
00255                 wake_up(i+wait_motor);
00256         } else if (!moff_timer[i]) {
00257             current_DOR &= ~mask;
00258             outb(current_DOR,FD_DOR);
00259         } else
00260             moff_timer[i]--;
00261     }
00262 }
00263
00264 #define TIME_REQUESTS 64
00265
00266 static struct timer_list {
00267     long jiffies;
00268     void (*fn)();
00269     struct timer_list * next;
00270 } timer_list[TIME_REQUESTS], * next_timer = NULL;
00271
00272 void add_timer(long jiffies, void (*fn)(void))
00273 {
00274     struct timer_list * p;
00275
00276     if (!fn)
00277         return;
00278     cli();
00279     if (jiffies <= 0)
00280         (fn)();
00281     else {
00282         for (p = timer_list ; p < timer_list + TIME_REQUESTS ; p++)
00283             if (!p->fn)
00284                 break;
00285         if (p >= timer_list + TIME_REQUESTS)
00286             panic("No more time requests free");
00287         p->fn = fn;
00288         p->jiffies = jiffies;
00289         p->next = next_timer;
00290         next_timer = p;
00291         while (p->next && p->next->jiffies < p->jiffies) {
00292             p->jiffies -= p->next->jiffies;
00293             fn = p->fn;
00294             p->fn = p->next->fn;
00295             p->next->fn = fn;
00296             jiffies = p->jiffies;
00297             p->jiffies = p->next->jiffies;
00298             p->next->jiffies = jiffies;
00299             p = p->next;
00300         }
00301     }
00302     sti();
00303 }
00304
00305 void do_timer(long cpl)
00306 {
00307     extern int beepcount;
00308     extern void sysbeepstop(void);
00309
00310     if (beepcount)
00311         if (!--beepcount)
00312             sysbeepstop();
00313
00314     if (cpl)
00315         current->utime++;
00316     else
00317         current->stime++;
00318
00319     if (next_timer) {
00320         next_timer->jiffies--;
00321         while (next_timer && next_timer->jiffies <= 0) {
00322             void (*fn)(void);
00323
00324             fn = next_timer->fn;
00325             next_timer->fn = NULL;
00326             next_timer = next_timer->next;
00327             (fn)();
00328         }
00329     }
00330     if (current_DOR & 0xf0)
00331         do_floppy_timer();
00332     if ((--current->counter)>0) return;
00333     current->counter=0;
00334     if (!cpl) return;
00335     schedule();
00336 }
00337
00338 int sys_alarm(long seconds)
00339 {
00340     int old = current->alarm;
00341
00342     if (old)
00343         old = (old - jiffies) / HZ;
00344     current->alarm = (seconds>0)?(jiffies+HZ*seconds):0;
00345     return (old);
00346 }
00347
00348 int sys_getpid(void)
00349 {
00350     return current->pid;
00351 }
00352
00353 int sys_getppid(void)
00354 {
00355     return current->father;
00356 }
00357
00358 int sys_getuid(void)
00359 {
00360     return current->uid;
00361 }
00362
00363 int sys_geteuid(void)
00364 {
00365     return current->euid;
00366 }
00367
00368 int sys_getgid(void)
00369 {
00370     return current->gid;
00371 }
00372
00373 int sys_getegid(void)
00374 {
00375     return current->egid;
00376 }
00377
00378 int sys_nice(long increment)
00379 {
00380     if (current->priority-increment>0)
00381         current->priority -= increment;
00382     return 0;
00383 }
00384
00385 void sched_init(void)
00386 {
00387     int i;
00388     struct desc_struct * p;
00389
00390     if (sizeof(struct sigaction) != 16)
00391         panic("Struct sigaction MUST be 16 bytes");
00392     set_tss_desc(gdt+FIRST_TSS_ENTRY,&(init_task.task.tss));
00393     set_ldt_desc(gdt+FIRST_LDT_ENTRY,&(init_task.task.ldt));
00394     p = gdt+2+FIRST_TSS_ENTRY;
00395     for(i=1;i<NR_TASKS;i++) {
00396         task[i] = NULL;
00397         p->a=p->b=0;
00398         p++;
00399         p->a=p->b=0;
00400         p++;
00401     }
00402 /* Clear NT, so that we won't have troubles with that later on */
00403     __asm__("pushfl ; andl $0xffffbfff,(%esp) ; popfl");
00404     ltr(0);
00405     lldt(0);
00406     outb_p(0x36,0x43);      /* binary, mode 3, LSB/MSB, ch 0 */
00407     outb_p(LATCH & 0xff , 0x40);    /* LSB */
00408     outb(LATCH >> 8 , 0x40);    /* MSB */
00409     set_intr_gate(0x20,&timer_interrupt);
00410     outb(inb_p(0x21)&~0x01,0x21);
00411     set_system_gate(0x80,&system_call);
00412 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/sched.h Source File

sched.h

Go to the documentation of this file.
00001 #ifndef _SCHED_H
00002 #define _SCHED_H
00003
00004 #define NR_TASKS 64
00005 #define HZ 100
00006
00007 #define FIRST_TASK task[0]
00008 #define LAST_TASK task[NR_TASKS-1]
00009
00010 #include <linux/head.h>
00011 #include <linux/fs.h>
00012 #include <linux/mm.h>
00013 #include <signal.h>
00014
00015 #if (NR_OPEN > 32)
00016 #error "Currently the close-on-exec-flags are in one word, max 32 files/proc"
00017 #endif
00018
00019 #define TASK_RUNNING        0
00020 #define TASK_INTERRUPTIBLE  1
00021 #define TASK_UNINTERRUPTIBLE    2
00022 #define TASK_ZOMBIE     3
00023 #define TASK_STOPPED        4
00024
00025 #ifndef NULL
00026 #define NULL ((void *) 0)
00027 #endif
00028
00029 extern int copy_page_tables(unsigned long from, unsigned long to, long size);
00030 extern int free_page_tables(unsigned long from, unsigned long size);
00031
00032 extern void sched_init(void);
00033 extern void schedule(void);
00034 extern void trap_init(void);
00035 #ifndef PANIC
00036 volatile void panic(const char * str);
00037 #endif
00038 extern int tty_write(unsigned minor,char * buf,int count);
00039
00040 typedef int (*fn_ptr)();
00041
00042 struct i387_struct {
00043     long    cwd;
00044     long    swd;
00045     long    twd;
00046     long    fip;
00047     long    fcs;
00048     long    foo;
00049     long    fos;
00050     long    st_space[20];   /* 8*10 bytes for each FP-reg = 80 bytes */
00051 };
00052
00053 struct tss_struct {
00054     long    back_link;  /* 16 high bits zero */
00055     long    esp0;
00056     long    ss0;        /* 16 high bits zero */
00057     long    esp1;
00058     long    ss1;        /* 16 high bits zero */
00059     long    esp2;
00060     long    ss2;        /* 16 high bits zero */
00061     long    cr3;
00062     long    eip;
00063     long    eflags;
00064     long    eax,ecx,edx,ebx;
00065     long    esp;
00066     long    ebp;
00067     long    esi;
00068     long    edi;
00069     long    es;     /* 16 high bits zero */
00070     long    cs;     /* 16 high bits zero */
00071     long    ss;     /* 16 high bits zero */
00072     long    ds;     /* 16 high bits zero */
00073     long    fs;     /* 16 high bits zero */
00074     long    gs;     /* 16 high bits zero */
00075     long    ldt;        /* 16 high bits zero */
00076     long    trace_bitmap;   /* bits: trace 0, bitmap 16-31 */
00077     struct i387_struct i387;
00078 };
00079
00080 struct task_struct {
00081 /* these are hardcoded - don't touch */
00082     long state; /* -1 unrunnable, 0 runnable, >0 stopped */
00083     long counter;
00084     long priority;
00085     long signal;
00086     struct sigaction sigaction[32];
00087     long blocked;   /* bitmap of masked signals */
00088 /* various fields */
00089     int exit_code;
00090     unsigned long start_code,end_code,end_data,brk,start_stack;
00091     long pid,father,pgrp,session,leader;
00092     unsigned short uid,euid,suid;
00093     unsigned short gid,egid,sgid;
00094     long alarm;
00095     long utime,stime,cutime,cstime,start_time;
00096     unsigned short used_math;
00097 /* file system info */
00098     int tty;        /* -1 if no tty, so it must be signed */
00099     unsigned short umask;
00100     struct m_inode * pwd;
00101     struct m_inode * root;
00102     struct m_inode * executable;
00103     unsigned long close_on_exec;
00104     struct file * filp[NR_OPEN];
00105 /* ldt for this task 0 - zero 1 - cs 2 - ds&ss */
00106     struct desc_struct ldt[3];
00107 /* tss for this task */
00108     struct tss_struct tss;
00109 };
00110
00111 /*
00112  *  INIT_TASK is used to set up the first task table, touch at
00113  * your own risk!. Base=0, limit=0x9ffff (=640kB)
00114  */
00115 #define INIT_TASK \
00116 /* state etc */ { 0,15,15, \
00117 /* signals */   0,{{},},0, \
00118 /* ec,brk... */ 0,0,0,0,0,0, \
00119 /* pid etc.. */ 0,-1,0,0,0, \
00120 /* uid etc */   0,0,0,0,0,0, \
00121 /* alarm */ 0,0,0,0,0,0, \
00122 /* math */  0, \
00123 /* fs info */   -1,0022,NULL,NULL,NULL,0, \
00124 /* filp */  {NULL,}, \
00125     { \
00126         {0,0}, \
00127 /* ldt */   {0x9f,0xc0fa00}, \
00128         {0x9f,0xc0f200}, \
00129     }, \
00130 /*tss*/ {0,PAGE_SIZE+(long)&init_task,0x10,0,0,0,0,(long)&pg_dir,\
00131      0,0,0,0,0,0,0,0, \
00132      0,0,0x17,0x17,0x17,0x17,0x17,0x17, \
00133      _LDT(0),0x80000000, \
00134         {} \
00135     }, \
00136 }
00137
00138 extern struct task_struct *task[NR_TASKS];
00139 extern struct task_struct *last_task_used_math;
00140 extern struct task_struct *current;
00141 extern long volatile jiffies;
00142 extern long startup_time;
00143
00144 #define CURRENT_TIME (startup_time+jiffies/HZ)
00145
00146 extern void add_timer(long jiffies, void (*fn)(void));
00147 extern void sleep_on(struct task_struct ** p);
00148 extern void interruptible_sleep_on(struct task_struct ** p);
00149 extern void wake_up(struct task_struct ** p);
00150
00151 /*
00152  * Entry into gdt where to find first TSS. 0-nul, 1-cs, 2-ds, 3-syscall
00153  * 4-TSS0, 5-LDT0, 6-TSS1 etc ...
00154  */
00155 #define FIRST_TSS_ENTRY 4
00156 #define FIRST_LDT_ENTRY (FIRST_TSS_ENTRY+1)
00157 #define _TSS(n) ((((unsigned long) n)<<4)+(FIRST_TSS_ENTRY<<3))
00158 #define _LDT(n) ((((unsigned long) n)<<4)+(FIRST_LDT_ENTRY<<3))
00159 #define ltr(n) __asm__("ltr %%ax"::"a" (_TSS(n)))
00160 #define lldt(n) __asm__("lldt %%ax"::"a" (_LDT(n)))
00161 #define str(n) \
00162 __asm__("str %%ax\n\t" \
00163     "subl %2,%%eax\n\t" \
00164     "shrl $4,%%eax" \
00165     :"=a" (n) \
00166     :"a" (0),"i" (FIRST_TSS_ENTRY<<3))
00167 /*
00168  *  switch_to(n) should switch tasks to task nr n, first
00169  * checking that n isn't the current task, in which case it does nothing.
00170  * This also clears the TS-flag if the task we switched to has used
00171  * tha math co-processor latest.
00172  */
00173 #define switch_to(n) {\
00174 struct {long a,b;} __tmp; \
00175 __asm__("cmpl %%ecx,current\n\t" \
00176     "je 1f\n\t" \
00177     "movw %%dx,%1\n\t" \
00178     "xchgl %%ecx,current\n\t" \
00179     "ljmp *%0\n\t" \
00180     "cmpl %%ecx,last_task_used_math\n\t" \
00181     "jne 1f\n\t" \
00182     "clts\n" \
00183     "1:" \
00184     ::"m" (*&__tmp.a),"m" (*&__tmp.b), \
00185     "d" (_TSS(n)),"c" ((long) task[n])); \
00186 }
00187
00188 #define PAGE_ALIGN(n) (((n)+0xfff)&0xfffff000)
00189
00190 #define _set_base(addr,base)  \
00191 __asm__ ("push %%edx\n\t" \
00192     "movw %%dx,%0\n\t" \
00193     "rorl $16,%%edx\n\t" \
00194     "movb %%dl,%1\n\t" \
00195     "movb %%dh,%2\n\t" \
00196     "pop %%edx" \
00197     ::"m" (*((addr)+2)), \
00198      "m" (*((addr)+4)), \
00199      "m" (*((addr)+7)), \
00200      "d" (base) \
00201     )
00202
00203 #define _set_limit(addr,limit) \
00204 __asm__ ("push %%edx\n\t" \
00205     "movw %%dx,%0\n\t" \
00206     "rorl $16,%%edx\n\t" \
00207     "movb %1,%%dh\n\t" \
00208     "andb $0xf0,%%dh\n\t" \
00209     "orb %%dh,%%dl\n\t" \
00210     "movb %%dl,%1\n\t" \
00211     "pop %%edx" \
00212     ::"m" (*(addr)), \
00213      "m" (*((addr)+6)), \
00214      "d" (limit) \
00215     )
00216
00217 #define set_base(ldt,base) _set_base( ((char *)&(ldt)) , (base) )
00218 #define set_limit(ldt,limit) _set_limit( ((char *)&(ldt)) , (limit-1)>>12 )
00219
00235 static inline unsigned long _get_base(char * addr)
00236 {
00237          unsigned long __base;
00238          __asm__("movb %3,%%dh\n\t"
00239                  "movb %2,%%dl\n\t"
00240                  "shll $16,%%edx\n\t"
00241                  "movw %1,%%dx"
00242                  :"=&d" (__base)
00243                  :"m" (*((addr)+2)),
00244                   "m" (*((addr)+4)),
00245                   "m" (*((addr)+7)));
00246          return __base;
00247 }
00248
00249 #define get_base(ldt) _get_base( ((char *)&(ldt)) )
00250
00251 #define get_limit(segment) ({ \
00252 unsigned long __limit; \
00253 __asm__("lsll %1,%0\n\tincl %0":"=r" (__limit):"r" (segment)); \
00254 __limit;})
00255
00256 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/segment.h Source File

segment.h

Go to the documentation of this file.
00001 static inline unsigned char get_fs_byte(const char * addr)
00002 {
00003     unsigned register char _v;
00004
00005     __asm__ ("movb %%fs:%1,%0":"=r" (_v):"m" (*addr));
00006     return _v;
00007 }
00008
00009 static inline unsigned short get_fs_word(const unsigned short *addr)
00010 {
00011     unsigned short _v;
00012
00013     __asm__ ("movw %%fs:%1,%0":"=r" (_v):"m" (*addr));
00014     return _v;
00015 }
00016
00017 static inline unsigned long get_fs_long(const unsigned long *addr)
00018 {
00019     unsigned long _v;
00020
00021     __asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); \
00022     return _v;
00023 }
00024
00025 static inline void put_fs_byte(char val,char *addr)
00026 {
00027 __asm__ ("movb %0,%%fs:%1"::"r" (val),"m" (*addr));
00028 }
00029
00030 static inline void put_fs_word(short val,short * addr)
00031 {
00032 __asm__ ("movw %0,%%fs:%1"::"r" (val),"m" (*addr));
00033 }
00034
00035 static inline void put_fs_long(unsigned long val,unsigned long * addr)
00036 {
00037 __asm__ ("movl %0,%%fs:%1"::"r" (val),"m" (*addr));
00038 }
00039
00040 /*
00041  * Someone who knows GNU asm better than I should double check the followig.
00042  * It seems to work, but I don't know if I'm doing something subtly wrong.
00043  * --- TYT, 11/24/91
00044  * [ nothing wrong here, Linus ]
00045  */
00046
00047 static inline unsigned long get_fs()
00048 {
00049     unsigned short _v;
00050     __asm__("mov %%fs,%%ax":"=a" (_v):);
00051     return _v;
00052 }
00053
00054 static inline unsigned long get_ds()
00055 {
00056     unsigned short _v;
00057     __asm__("mov %%ds,%%ax":"=a" (_v):);
00058     return _v;
00059 }
00060
00061 static inline void set_fs(unsigned long val)
00062 {
00063     __asm__("mov %0,%%fs"::"a" ((unsigned short) val));
00064 }
00065
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/serial.c Source File

serial.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/serial.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  *  serial.c
00009  *
00010  * This module implements the rs232 io functions
00011  *  void rs_write(struct tty_struct * queue);
00012  *  void rs_init(void);
00013  * and all interrupts pertaining to serial IO.
00014  */
00015
00016 #include <linux/tty.h>
00017 #include <linux/sched.h>
00018 #include <asm/system.h>
00019 #include <asm/io.h>
00020
00021 #define WAKEUP_CHARS (TTY_BUF_SIZE/4)
00022
00023 extern void rs1_interrupt(void);
00024 extern void rs2_interrupt(void);
00025
00026 static void init(int port)
00027 {
00028     outb_p(0x80,port+3);    /* set DLAB of line control reg */
00029     outb_p(0x30,port);  /* LS of divisor (48 -> 2400 bps */
00030     outb_p(0x00,port+1);    /* MS of divisor */
00031     outb_p(0x03,port+3);    /* reset DLAB */
00032     outb_p(0x0b,port+4);    /* set DTR,RTS, OUT_2 */
00033     outb_p(0x0d,port+1);    /* enable all intrs but writes */
00034     (void)inb(port);    /* read data port to reset things (?) */
00035 }
00036
00037 void rs_init(void)
00038 {
00039     set_intr_gate(0x24,rs1_interrupt);
00040     set_intr_gate(0x23,rs2_interrupt);
00041     init(tty_table[1].read_q.data);
00042     init(tty_table[2].read_q.data);
00043     outb(inb_p(0x21)&0xE7,0x21);
00044 }
00045
00046 /*
00047  * This routine gets called when tty_write has put something into
00048  * the write_queue. It must check wheter the queue is empty, and
00049  * set the interrupt register accordingly
00050  *
00051  *  void _rs_write(struct tty_struct * tty);
00052  */
00053 void rs_write(struct tty_struct * tty)
00054 {
00055     cli();
00056     if (!EMPTY(tty->write_q))
00057         outb(inb_p(tty->write_q.data+1)|0x02,tty->write_q.data+1);
00058     sti();
00059 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/setsid.c Source File

setsid.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/setsid.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009
00010 _syscall0(pid_t,setsid)
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/signal.c Source File

signal.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/signal.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <linux/sched.h>
00008 #include <linux/kernel.h>
00009 #include <asm/segment.h>
00010
00011 #include <signal.h>
00012
00013 volatile void do_exit(int error_code);
00014
00015 int sys_sgetmask()
00016 {
00017     return current->blocked;
00018 }
00019
00020 int sys_ssetmask(int newmask)
00021 {
00022     int old=current->blocked;
00023
00024     current->blocked = newmask & ~(1<<(SIGKILL-1));
00025     return old;
00026 }
00027
00028 static inline void save_old(char * from,char * to)
00029 {
00030     int i;
00031
00032     verify_area(to, sizeof(struct sigaction));
00033     for (i=0 ; i< sizeof(struct sigaction) ; i++) {
00034         put_fs_byte(*from,to);
00035         from++;
00036         to++;
00037     }
00038 }
00039
00040 static inline void get_new(char * from,char * to)
00041 {
00042     int i;
00043
00044     for (i=0 ; i< sizeof(struct sigaction) ; i++)
00045         *(to++) = get_fs_byte(from++);
00046 }
00047
00048 int sys_signal(int signum, long handler, long restorer)
00049 {
00050     struct sigaction tmp;
00051
00052     if (signum<1 || signum>32 || signum==SIGKILL)
00053         return -1;
00054     tmp.sa_handler = (void (*)(int)) handler;
00055     tmp.sa_mask = 0;
00056     tmp.sa_flags = SA_ONESHOT | SA_NOMASK;
00057     tmp.sa_restorer = (void (*)(void)) restorer;
00058     handler = (long) current->sigaction[signum-1].sa_handler;
00059     current->sigaction[signum-1] = tmp;
00060     return handler;
00061 }
00062
00063 int sys_sigaction(int signum, const struct sigaction * action,
00064     struct sigaction * oldaction)
00065 {
00066     struct sigaction tmp;
00067
00068     if (signum<1 || signum>32 || signum==SIGKILL)
00069         return -1;
00070     tmp = current->sigaction[signum-1];
00071     get_new((char *) action,
00072         (char *) (signum-1+current->sigaction));
00073     if (oldaction)
00074         save_old((char *) &tmp,(char *) oldaction);
00075     if (current->sigaction[signum-1].sa_flags & SA_NOMASK)
00076         current->sigaction[signum-1].sa_mask = 0;
00077     else
00078         current->sigaction[signum-1].sa_mask |= (1<<(signum-1));
00079     return 0;
00080 }
00081
00082 void do_signal(long signr,long eax, long ebx, long ecx, long edx,
00083     long fs, long es, long ds,
00084     long eip, long cs, long eflags,
00085     unsigned long * esp, long ss)
00086 {
00087     unsigned long sa_handler;
00088     long old_eip=eip;
00089     struct sigaction * sa = current->sigaction + signr - 1;
00090     int longs;
00091     unsigned long * tmp_esp;
00092
00093     sa_handler = (unsigned long) sa->sa_handler;
00094     if (sa_handler==1)
00095         return;
00096     if (!sa_handler) {
00097         if (signr==SIGCHLD)
00098             return;
00099         else
00100             do_exit(1<<(signr-1));
00101     }
00102     if (sa->sa_flags & SA_ONESHOT)
00103         sa->sa_handler = NULL;
00104     *(&eip) = sa_handler;
00105     longs = (sa->sa_flags & SA_NOMASK)?7:8;
00106     *(&esp) -= longs;
00107     verify_area(esp,longs*4);
00108     tmp_esp=esp;
00109     put_fs_long((long) sa->sa_restorer,tmp_esp++);
00110     put_fs_long(signr,tmp_esp++);
00111     if (!(sa->sa_flags & SA_NOMASK))
00112         put_fs_long(current->blocked,tmp_esp++);
00113     put_fs_long(eax,tmp_esp++);
00114     put_fs_long(ecx,tmp_esp++);
00115     put_fs_long(edx,tmp_esp++);
00116     put_fs_long(eflags,tmp_esp++);
00117     put_fs_long(old_eip,tmp_esp++);
00118     current->blocked |= sa->sa_mask;
00119 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/signal.h Source File

signal.h

Go to the documentation of this file.
00001 #ifndef _SIGNAL_H
00002 #define _SIGNAL_H
00003
00004 #include <sys/types.h>
00005
00006 typedef int sig_atomic_t;
00007 typedef unsigned int sigset_t;      /* 32 bits */
00008
00009 #define _NSIG             32
00010 #define NSIG        _NSIG
00011
00012 #define SIGHUP       1
00013 #define SIGINT       2
00014 #define SIGQUIT      3
00015 #define SIGILL       4
00016 #define SIGTRAP      5
00017 #define SIGABRT      6
00018 #define SIGIOT       6
00019 #define SIGUNUSED    7
00020 #define SIGFPE       8
00021 #define SIGKILL      9
00022 #define SIGUSR1     10
00023 #define SIGSEGV     11
00024 #define SIGUSR2     12
00025 #define SIGPIPE     13
00026 #define SIGALRM     14
00027 #define SIGTERM     15
00028 #define SIGSTKFLT   16
00029 #define SIGCHLD     17
00030 #define SIGCONT     18
00031 #define SIGSTOP     19
00032 #define SIGTSTP     20
00033 #define SIGTTIN     21
00034 #define SIGTTOU     22
00035
00036 /* Ok, I haven't implemented sigactions, but trying to keep headers POSIX */
00037 #define SA_NOCLDSTOP    1
00038 #define SA_NOMASK   0x40000000
00039 #define SA_ONESHOT  0x80000000
00040
00041 #define SIG_BLOCK          0    /* for blocking signals */
00042 #define SIG_UNBLOCK        1    /* for unblocking signals */
00043 #define SIG_SETMASK        2    /* for setting the signal mask */
00044
00045 #define SIG_DFL     ((void (*)(int))0)  /* default signal handling */
00046 #define SIG_IGN     ((void (*)(int))1)  /* ignore signal */
00047
00048 struct sigaction {
00049     void (*sa_handler)(int);
00050     sigset_t sa_mask;
00051     int sa_flags;
00052     void (*sa_restorer)(void);
00053 };
00054
00055 void (*signal(int _sig, void (*_func)(int)))(int);
00056 int raise(int sig);
00057 int kill(pid_t pid, int sig);
00058 int sigaddset(sigset_t *mask, int signo);
00059 int sigdelset(sigset_t *mask, int signo);
00060 int sigemptyset(sigset_t *mask);
00061 int sigfillset(sigset_t *mask);
00062 int sigismember(sigset_t *mask, int signo); /* 1 - is, 0 - not, -1 error */
00063 int sigpending(sigset_t *set);
00064 int sigprocmask(int how, sigset_t *set, sigset_t *oldset);
00065 int sigsuspend(sigset_t *sigmask);
00066 int sigaction(int sig, struct sigaction *act, struct sigaction *oldact);
00067
00068 #endif /* _SIGNAL_H */
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/stat.c Source File

stat.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/stat.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008 #include <sys/stat.h>
00009
00010 #include <linux/fs.h>
00011 #include <linux/sched.h>
00012 #include <linux/kernel.h>
00013 #include <asm/segment.h>
00014
00015 static void cp_stat(struct m_inode * inode, struct stat * statbuf)
00016 {
00017     struct stat tmp;
00018     int i;
00019
00020     verify_area(statbuf,sizeof (* statbuf));
00021     tmp.st_dev = inode->i_dev;
00022     tmp.st_ino = inode->i_num;
00023     tmp.st_mode = inode->i_mode;
00024     tmp.st_nlink = inode->i_nlinks;
00025     tmp.st_uid = inode->i_uid;
00026     tmp.st_gid = inode->i_gid;
00027     tmp.st_rdev = inode->i_zone[0];
00028     tmp.st_size = inode->i_size;
00029     tmp.st_atime = inode->i_atime;
00030     tmp.st_mtime = inode->i_mtime;
00031     tmp.st_ctime = inode->i_ctime;
00032     for (i=0 ; i<sizeof (tmp) ; i++)
00033         put_fs_byte(((char *) &tmp)[i],&((char *) statbuf)[i]);
00034 }
00035
00036 int sys_stat(char * filename, struct stat * statbuf)
00037 {
00038     struct m_inode * inode;
00039
00040     if (!(inode=namei(filename)))
00041         return -ENOENT;
00042     cp_stat(inode,statbuf);
00043     iput(inode);
00044     return 0;
00045 }
00046
00047 int sys_fstat(unsigned int fd, struct stat * statbuf)
00048 {
00049     struct file * f;
00050     struct m_inode * inode;
00051
00052     if (fd >= NR_OPEN || !(f=current->filp[fd]) || !(inode=f->f_inode))
00053         return -EBADF;
00054     cp_stat(inode,statbuf);
00055     return 0;
00056 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/stat.h Source File

stat.h

Go to the documentation of this file.
00001 #ifndef _SYS_STAT_H
00002 #define _SYS_STAT_H
00003
00004 #include <sys/types.h>
00005
00006 struct stat {
00007     dev_t   st_dev;
00008     ino_t   st_ino;
00009     umode_t st_mode;
00010     nlink_t st_nlink;
00011     uid_t   st_uid;
00012     gid_t   st_gid;
00013     dev_t   st_rdev;
00014     off_t   st_size;
00015     time_t  st_atime;
00016     time_t  st_mtime;
00017     time_t  st_ctime;
00018 };
00019
00020 #define S_IFMT  00170000
00021 #define S_IFREG  0100000
00022 #define S_IFBLK  0060000
00023 #define S_IFDIR  0040000
00024 #define S_IFCHR  0020000
00025 #define S_IFIFO  0010000
00026 #define S_ISUID  0004000
00027 #define S_ISGID  0002000
00028 #define S_ISVTX  0001000
00029
00030 #define S_ISREG(m)  (((m) & S_IFMT) == S_IFREG)
00031 #define S_ISDIR(m)  (((m) & S_IFMT) == S_IFDIR)
00032 #define S_ISCHR(m)  (((m) & S_IFMT) == S_IFCHR)
00033 #define S_ISBLK(m)  (((m) & S_IFMT) == S_IFBLK)
00034 #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
00035
00036 #define S_IRWXU 00700
00037 #define S_IRUSR 00400
00038 #define S_IWUSR 00200
00039 #define S_IXUSR 00100
00040
00041 #define S_IRWXG 00070
00042 #define S_IRGRP 00040
00043 #define S_IWGRP 00020
00044 #define S_IXGRP 00010
00045
00046 #define S_IRWXO 00007
00047 #define S_IROTH 00004
00048 #define S_IWOTH 00002
00049 #define S_IXOTH 00001
00050
00051 extern int chmod(const char *_path, mode_t mode);
00052 extern int fstat(int fildes, struct stat *stat_buf);
00053 extern int mkdir(const char *_path, mode_t mode);
00054 extern int mkfifo(const char *_path, mode_t mode);
00055 extern int stat(const char *filename, struct stat *stat_buf);
00056 extern mode_t umask(mode_t mask);
00057
00058 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/stdarg.h Source File

stdarg.h

Go to the documentation of this file.
00001 #ifndef _STDARG_H
00002 #define _STDARG_H
00003
00004 typedef char *va_list;
00005
00006 /* Amount of space required in an argument list for an arg of type TYPE.
00007    TYPE may alternatively be an expression whose type is used.  */
00008
00009 #define __va_rounded_size(TYPE)  \
00010   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
00011
00012 #ifndef __sparc__
00013 #define va_start(AP, LASTARG)                       \
00014  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
00015 #else
00016 #define va_start(AP, LASTARG)                       \
00017  (__builtin_saveregs (),                        \
00018   AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
00019 #endif
00020
00021 void va_end (va_list);      /* Defined in gnulib */
00022 #define va_end(AP)
00023
00024 #define va_arg(AP, TYPE)                        \
00025  (AP += __va_rounded_size (TYPE),                   \
00026   *((TYPE *) (AP - __va_rounded_size (TYPE))))
00027
00028 #endif /* _STDARG_H */
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/stddef.h Source File

stddef.h

Go to the documentation of this file.
00001 #ifndef _STDDEF_H
00002 #define _STDDEF_H
00003
00004 #ifndef _PTRDIFF_T
00005 #define _PTRDIFF_T
00006 typedef long ptrdiff_t;
00007 #endif
00008
00009 #ifndef _SIZE_T
00010 #define _SIZE_T
00011 typedef unsigned long size_t;
00012 #endif
00013
00014 #undef NULL
00015 #define NULL ((void *)0)
00016
00017 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
00018
00019 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/string.c Source File

string.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/string.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #ifndef __GNUC__
00008 #error I want gcc!
00009 #endif
00010
00011 #define extern
00012 #define inline
00013 #define __LIBRARY__
00014 #include <string.h>
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/string.h Source File

string.h

Go to the documentation of this file.
00001 #ifndef _STRING_H_
00002 #define _STRING_H_
00003
00004 #ifndef NULL
00005 #define NULL ((void *) 0)
00006 #endif
00007
00008 #ifndef _SIZE_T
00009 #define _SIZE_T
00010 typedef unsigned int size_t;
00011 #endif
00012
00013 extern char * strerror(int errno);
00014
00015 /*
00016  * This string-include defines all string functions as inline
00017  * functions. Use gcc. It also assumes ds=es=data space, this should be
00018  * normal. Most of the string-functions are rather heavily hand-optimized,
00019  * see especially strtok,strstr,str[c]spn. They should work, but are not
00020  * very easy to understand. Everything is done entirely within the register
00021  * set, making the functions fast and clean. String instructions have been
00022  * used through-out, making for "slightly" unclear code :-)
00023  *
00024  *      (C) 1991 Linus Torvalds
00025  */
00026
00027 extern inline char * strcpy(char * dest,const char *src)
00028 {
00029 __asm__("cld\n"
00030     "1:\tlodsb\n\t"
00031     "stosb\n\t"
00032     "testb %%al,%%al\n\t"
00033     "jne 1b"
00034     ::"S" (src),"D" (dest));
00035 return dest;
00036 }
00037
00038 static inline char * strncpy(char * dest,const char *src,int count)
00039 {
00040 __asm__("cld\n"
00041     "1:\tdecl %2\n\t"
00042     "js 2f\n\t"
00043     "lodsb\n\t"
00044     "stosb\n\t"
00045     "testb %%al,%%al\n\t"
00046     "jne 1b\n\t"
00047     "rep\n\t"
00048     "stosb\n"
00049     "2:"
00050     ::"S" (src),"D" (dest),"c" (count));
00051 return dest;
00052 }
00053
00054 extern inline char * strcat(char * dest,const char * src)
00055 {
00056 __asm__("cld\n\t"
00057     "repne\n\t"
00058     "scasb\n\t"
00059     "decl %1\n"
00060     "1:\tlodsb\n\t"
00061     "stosb\n\t"
00062     "testb %%al,%%al\n\t"
00063     "jne 1b"
00064     ::"S" (src),"D" (dest),"a" (0),"c" (0xffffffff));
00065 return dest;
00066 }
00067
00068 static inline char * strncat(char * dest,const char * src,int count)
00069 {
00070 __asm__("cld\n\t"
00071     "repne\n\t"
00072     "scasb\n\t"
00073     "decl %1\n\t"
00074     "movl %4,%3\n"
00075     "1:\tdecl %3\n\t"
00076     "js 2f\n\t"
00077     "lodsb\n\t"
00078     "stosb\n\t"
00079     "testb %%al,%%al\n\t"
00080     "jne 1b\n"
00081     "2:\txorl %2,%2\n\t"
00082     "stosb"
00083     ::"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
00084     );
00085 return dest;
00086 }
00087
00088 extern inline int strcmp(const char * cs,const char * ct)
00089 {
00090 register int __res ;
00091 __asm__("cld\n"
00092     "1:\tlodsb\n\t"
00093     "scasb\n\t"
00094     "jne 2f\n\t"
00095     "testb %%al,%%al\n\t"
00096     "jne 1b\n\t"
00097     "xorl %%eax,%%eax\n\t"
00098     "jmp 3f\n"
00099     "2:\tmovl $1,%%eax\n\t"
00100     "jl 3f\n\t"
00101     "negl %%eax\n"
00102     "3:"
00103     :"=a" (__res):"D" (cs),"S" (ct));
00104 return __res;
00105 }
00106
00107 static inline int strncmp(const char * cs,const char * ct,int count)
00108 {
00109 register int __res ;
00110 __asm__("cld\n"
00111     "1:\tdecl %3\n\t"
00112     "js 2f\n\t"
00113     "lodsb\n\t"
00114     "scasb\n\t"
00115     "jne 3f\n\t"
00116     "testb %%al,%%al\n\t"
00117     "jne 1b\n"
00118     "2:\txorl %%eax,%%eax\n\t"
00119     "jmp 4f\n"
00120     "3:\tmovl $1,%%eax\n\t"
00121     "jl 4f\n\t"
00122     "negl %%eax\n"
00123     "4:"
00124     :"=a" (__res):"D" (cs),"S" (ct),"c" (count));
00125 return __res;
00126 }
00127
00128 static inline char * strchr(const char * s,char c)
00129 {
00130 register char * __res ;
00131 __asm__("cld\n\t"
00132     "movb %%al,%%ah\n"
00133     "1:\tlodsb\n\t"
00134     "cmpb %%ah,%%al\n\t"
00135     "je 2f\n\t"
00136     "testb %%al,%%al\n\t"
00137     "jne 1b\n\t"
00138     "movl $1,%1\n"
00139     "2:\tmovl %1,%0\n\t"
00140     "decl %0"
00141     :"=a" (__res):"S" (s),"0" (c));
00142 return __res;
00143 }
00144
00145 static inline char * strrchr(const char * s,char c)
00146 {
00147 register char * __res;
00148 __asm__("cld\n\t"
00149     "movb %%al,%%ah\n"
00150     "1:\tlodsb\n\t"
00151     "cmpb %%ah,%%al\n\t"
00152     "jne 2f\n\t"
00153     "movl %%esi,%0\n\t"
00154     "decl %0\n"
00155     "2:\ttestb %%al,%%al\n\t"
00156     "jne 1b"
00157     :"=d" (__res):"0" (0),"S" (s),"a" (c));
00158 return __res;
00159 }
00160
00161 extern inline int strspn(const char * cs, const char * ct)
00162 {
00163 register char * __res;
00164 __asm__("cld\n\t"
00165     "movl %4,%%edi\n\t"
00166     "repne\n\t"
00167     "scasb\n\t"
00168     "notl %%ecx\n\t"
00169     "decl %%ecx\n\t"
00170     "movl %%ecx,%%edx\n"
00171     "1:\tlodsb\n\t"
00172     "testb %%al,%%al\n\t"
00173     "je 2f\n\t"
00174     "movl %4,%%edi\n\t"
00175     "movl %%edx,%%ecx\n\t"
00176     "repne\n\t"
00177     "scasb\n\t"
00178     "je 1b\n"
00179     "2:\tdecl %0"
00180     :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
00181     );
00182 return __res-cs;
00183 }
00184
00185 extern inline int strcspn(const char * cs, const char * ct)
00186 {
00187 register char * __res;
00188 __asm__("cld\n\t"
00189     "movl %4,%%edi\n\t"
00190     "repne\n\t"
00191     "scasb\n\t"
00192     "notl %%ecx\n\t"
00193     "decl %%ecx\n\t"
00194     "movl %%ecx,%%edx\n"
00195     "1:\tlodsb\n\t"
00196     "testb %%al,%%al\n\t"
00197     "je 2f\n\t"
00198     "movl %4,%%edi\n\t"
00199     "movl %%edx,%%ecx\n\t"
00200     "repne\n\t"
00201     "scasb\n\t"
00202     "jne 1b\n"
00203     "2:\tdecl %0"
00204     :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
00205     );
00206 return __res-cs;
00207 }
00208
00209 extern inline char * strpbrk(const char * cs,const char * ct)
00210 {
00211 register char * __res ;
00212 __asm__("cld\n\t"
00213     "movl %4,%%edi\n\t"
00214     "repne\n\t"
00215     "scasb\n\t"
00216     "notl %%ecx\n\t"
00217     "decl %%ecx\n\t"
00218     "movl %%ecx,%%edx\n"
00219     "1:\tlodsb\n\t"
00220     "testb %%al,%%al\n\t"
00221     "je 2f\n\t"
00222     "movl %4,%%edi\n\t"
00223     "movl %%edx,%%ecx\n\t"
00224     "repne\n\t"
00225     "scasb\n\t"
00226     "jne 1b\n\t"
00227     "decl %0\n\t"
00228     "jmp 3f\n"
00229     "2:\txorl %0,%0\n"
00230     "3:"
00231     :"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
00232     );
00233 return __res;
00234 }
00235
00236 extern inline char * strstr(const char * cs,const char * ct)
00237 {
00238 register char * __res ;
00239 __asm__("cld\n\t" \
00240     "movl %4,%%edi\n\t"
00241     "repne\n\t"
00242     "scasb\n\t"
00243     "notl %%ecx\n\t"
00244     "decl %%ecx\n\t"    /* NOTE! This also sets Z if searchstring='' */
00245     "movl %%ecx,%%edx\n"
00246     "1:\tmovl %4,%%edi\n\t"
00247     "movl %%esi,%%eax\n\t"
00248     "movl %%edx,%%ecx\n\t"
00249     "repe\n\t"
00250     "cmpsb\n\t"
00251     "je 2f\n\t"     /* also works for empty string, see above */
00252     "xchgl %%eax,%%esi\n\t"
00253     "incl %%esi\n\t"
00254     "cmpb $0,-1(%%eax)\n\t"
00255     "jne 1b\n\t"
00256     "xorl %%eax,%%eax\n\t"
00257     "2:"
00258     :"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
00259     );
00260 return __res;
00261 }
00262
00263 extern inline int strlen(const char * s)
00264 {
00265 register int __res ;
00266 __asm__("cld\n\t"
00267     "repne\n\t"
00268     "scasb\n\t"
00269     "notl %0\n\t"
00270     "decl %0"
00271     :"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff));
00272 return __res;
00273 }
00274
00275 extern char * ___strtok;
00276
00277 extern inline char * strtok(char * s,const char * ct)
00278 {
00279 register char * __res ;
00280 __asm__("testl %1,%1\n\t"
00281     "jne 1f\n\t"
00282     "testl %0,%0\n\t"
00283     "je 8f\n\t"
00284     "movl %0,%1\n"
00285     "1:\txorl %0,%0\n\t"
00286     "movl $-1,%%ecx\n\t"
00287     "xorl %%eax,%%eax\n\t"
00288     "cld\n\t"
00289     "movl %4,%%edi\n\t"
00290     "repne\n\t"
00291     "scasb\n\t"
00292     "notl %%ecx\n\t"
00293     "decl %%ecx\n\t"
00294     "je 7f\n\t"         /* empty delimeter-string */
00295     "movl %%ecx,%%edx\n"
00296     "2:\tlodsb\n\t"
00297     "testb %%al,%%al\n\t"
00298     "je 7f\n\t"
00299     "movl %4,%%edi\n\t"
00300     "movl %%edx,%%ecx\n\t"
00301     "repne\n\t"
00302     "scasb\n\t"
00303     "je 2b\n\t"
00304     "decl %1\n\t"
00305     "cmpb $0,(%1)\n\t"
00306     "je 7f\n\t"
00307     "movl %1,%0\n"
00308     "3:\tlodsb\n\t"
00309     "testb %%al,%%al\n\t"
00310     "je 5f\n\t"
00311     "movl %4,%%edi\n\t"
00312     "movl %%edx,%%ecx\n\t"
00313     "repne\n\t"
00314     "scasb\n\t"
00315     "jne 3b\n\t"
00316     "decl %1\n\t"
00317     "cmpb $0,(%1)\n\t"
00318     "je 5f\n\t"
00319     "movb $0,(%1)\n\t"
00320     "incl %1\n\t"
00321     "jmp 6f\n"
00322     "5:\txorl %1,%1\n"
00323     "6:\tcmpb $0,(%0)\n\t"
00324     "jne 7f\n\t"
00325     "xorl %0,%0\n"
00326     "7:\ttestl %0,%0\n\t"
00327     "jne 8f\n\t"
00328     "movl %0,%1\n"
00329     "8:"
00330     :"=b" (__res),"=S" (___strtok)
00331     :"0" (___strtok),"1" (s),"g" (ct)
00332     );
00333 return __res;
00334 }
00335
00336 static inline void * memcpy(void * dest,const void * src, int n)
00337 {
00338 __asm__("cld\n\t"
00339     "rep\n\t"
00340     "movsb"
00341     ::"c" (n),"S" (src),"D" (dest)
00342     );
00343 return dest;
00344 }
00345
00346 extern inline void * memmove(void * dest,const void * src, int n)
00347 {
00348 if (dest<src)
00349 __asm__("cld\n\t"
00350     "rep\n\t"
00351     "movsb"
00352     ::"c" (n),"S" (src),"D" (dest)
00353     );
00354 else
00355 __asm__("std\n\t"
00356     "rep\n\t"
00357     "movsb"
00358     ::"c" (n),"S" (src+n-1),"D" (dest+n-1)
00359     );
00360 return dest;
00361 }
00362
00363 static inline int memcmp(const void * cs,const void * ct,int count)
00364 {
00365 register int __res ;
00366 __asm__("cld\n\t"
00367     "repe\n\t"
00368     "cmpsb\n\t"
00369     "je 1f\n\t"
00370     "movl $1,%%eax\n\t"
00371     "jl 1f\n\t"
00372     "negl %%eax\n"
00373     "1:"
00374     :"=a" (__res):"0" (0),"D" (cs),"S" (ct),"c" (count)
00375     );
00376 return __res;
00377 }
00378
00379 extern inline void * memchr(const void * cs,char c,int count)
00380 {
00381 register void * __res ;
00382 if (!count)
00383     return NULL;
00384 __asm__("cld\n\t"
00385     "repne\n\t"
00386     "scasb\n\t"
00387     "je 1f\n\t"
00388     "movl $1,%0\n"
00389     "1:\tdecl %0"
00390     :"=D" (__res):"a" (c),"D" (cs),"c" (count)
00391     );
00392 return __res;
00393 }
00394
00395 static inline void * memset(void * s,char c,int count)
00396 {
00397 __asm__("cld\n\t"
00398     "rep\n\t"
00399     "stosb"
00400     ::"a" (c),"D" (s),"c" (count)
00401     );
00402 return s;
00403 }
00404
00405 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/super.c Source File

super.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/super.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * super.c contains code to handle the super-block tables.
00009  */
00010 #include <linux/config.h>
00011 #include <linux/sched.h>
00012 #include <linux/kernel.h>
00013 #include <asm/system.h>
00014
00015 #include <errno.h>
00016 #include <sys/stat.h>
00017
00018 int sync_dev(int dev);
00019 void wait_for_keypress(void);
00020
00021 /* set_bit uses setb, as gas doesn't recognize setc */
00022 #define set_bit(bitnr,addr) ({ \
00023 register int __res ; \
00024 __asm__("bt %2,%3;setb %%al":"=a" (__res):"a" (0),"r" (bitnr),"m" (*(addr))); \
00025 __res; })
00026
00027 struct super_block super_block[NR_SUPER];
00028 /* this is initialized in init/main.c */
00029 int ROOT_DEV = 0;
00030
00031 static void lock_super(struct super_block * sb)
00032 {
00033     cli();
00034     while (sb->s_lock)
00035         sleep_on(&(sb->s_wait));
00036     sb->s_lock = 1;
00037     sti();
00038 }
00039
00040 static void free_super(struct super_block * sb)
00041 {
00042     cli();
00043     sb->s_lock = 0;
00044     wake_up(&(sb->s_wait));
00045     sti();
00046 }
00047
00048 static void wait_on_super(struct super_block * sb)
00049 {
00050     cli();
00051     while (sb->s_lock)
00052         sleep_on(&(sb->s_wait));
00053     sti();
00054 }
00055
00056 struct super_block * get_super(int dev)
00057 {
00058     struct super_block * s;
00059
00060     if (!dev)
00061         return NULL;
00062     s = 0+super_block;
00063     while (s < NR_SUPER+super_block)
00064         if (s->s_dev == dev) {
00065             wait_on_super(s);
00066             if (s->s_dev == dev)
00067                 return s;
00068             s = 0+super_block;
00069         } else
00070             s++;
00071     return NULL;
00072 }
00073
00074 void put_super(int dev)
00075 {
00076     struct super_block * sb;
00077     /* struct m_inode * inode;*/
00078     int i;
00079
00080     if (dev == ROOT_DEV) {
00081         printk("root diskette changed: prepare for armageddon\n\r");
00082         return;
00083     }
00084     if (!(sb = get_super(dev)))
00085         return;
00086     if (sb->s_imount) {
00087         printk("Mounted disk changed - tssk, tssk\n\r");
00088         return;
00089     }
00090     lock_super(sb);
00091     sb->s_dev = 0;
00092     for(i=0;i<I_MAP_SLOTS;i++)
00093         brelse(sb->s_imap[i]);
00094     for(i=0;i<Z_MAP_SLOTS;i++)
00095         brelse(sb->s_zmap[i]);
00096     free_super(sb);
00097     return;
00098 }
00099
00100 static struct super_block * read_super(int dev)
00101 {
00102     struct super_block * s;
00103     struct buffer_head * bh;
00104     int i,block;
00105
00106     if (!dev)
00107         return NULL;
00108     check_disk_change(dev);
00109     if ((s = get_super(dev)))
00110         return s;
00111     for (s = 0+super_block ;; s++) {
00112         if (s >= NR_SUPER+super_block)
00113             return NULL;
00114         if (!s->s_dev)
00115             break;
00116     }
00117     s->s_dev = dev;
00118     s->s_isup = NULL;
00119     s->s_imount = NULL;
00120     s->s_time = 0;
00121     s->s_rd_only = 0;
00122     s->s_dirt = 0;
00123     lock_super(s);
00124     if (!(bh = bread(dev,1))) {
00125         s->s_dev=0;
00126         free_super(s);
00127         return NULL;
00128     }
00129     *((struct d_super_block *) s) =
00130         *((struct d_super_block *) bh->b_data);
00131     brelse(bh);
00132     if (s->s_magic != SUPER_MAGIC) {
00133         s->s_dev = 0;
00134         free_super(s);
00135         return NULL;
00136     }
00137     for (i=0;i<I_MAP_SLOTS;i++)
00138         s->s_imap[i] = NULL;
00139     for (i=0;i<Z_MAP_SLOTS;i++)
00140         s->s_zmap[i] = NULL;
00141     block=2;
00142     for (i=0 ; i < s->s_imap_blocks ; i++)
00143         if ((s->s_imap[i]=bread(dev,block)))
00144             block++;
00145         else
00146             break;
00147     for (i=0 ; i < s->s_zmap_blocks ; i++)
00148         if ((s->s_zmap[i]=bread(dev,block)))
00149             block++;
00150         else
00151             break;
00152     if (block != 2+s->s_imap_blocks+s->s_zmap_blocks) {
00153         for(i=0;i<I_MAP_SLOTS;i++)
00154             brelse(s->s_imap[i]);
00155         for(i=0;i<Z_MAP_SLOTS;i++)
00156             brelse(s->s_zmap[i]);
00157         s->s_dev=0;
00158         free_super(s);
00159         return NULL;
00160     }
00161     s->s_imap[0]->b_data[0] |= 1;
00162     s->s_zmap[0]->b_data[0] |= 1;
00163     free_super(s);
00164     return s;
00165 }
00166
00167 int sys_umount(char * dev_name)
00168 {
00169     struct m_inode * inode;
00170     struct super_block * sb;
00171     int dev;
00172
00173     if (!(inode=namei(dev_name)))
00174         return -ENOENT;
00175     dev = inode->i_zone[0];
00176     if (!S_ISBLK(inode->i_mode)) {
00177         iput(inode);
00178         return -ENOTBLK;
00179     }
00180     iput(inode);
00181     if (dev==ROOT_DEV)
00182         return -EBUSY;
00183     if (!(sb=get_super(dev)) || !(sb->s_imount))
00184         return -ENOENT;
00185     if (!sb->s_imount->i_mount)
00186         printk("Mounted inode has i_mount=0\n");
00187     for (inode=inode_table+0 ; inode<inode_table+NR_INODE ; inode++)
00188         if (inode->i_dev==dev && inode->i_count)
00189                 return -EBUSY;
00190     sb->s_imount->i_mount=0;
00191     iput(sb->s_imount);
00192     sb->s_imount = NULL;
00193     iput(sb->s_isup);
00194     sb->s_isup = NULL;
00195     put_super(dev);
00196     sync_dev(dev);
00197     return 0;
00198 }
00199
00200 int sys_mount(char * dev_name, char * dir_name, int rw_flag)
00201 {
00202     struct m_inode * dev_i, * dir_i;
00203     struct super_block * sb;
00204     int dev;
00205
00206     if (!(dev_i=namei(dev_name)))
00207         return -ENOENT;
00208     dev = dev_i->i_zone[0];
00209     if (!S_ISBLK(dev_i->i_mode)) {
00210         iput(dev_i);
00211         return -EPERM;
00212     }
00213     iput(dev_i);
00214     if (!(dir_i=namei(dir_name)))
00215         return -ENOENT;
00216     if (dir_i->i_count != 1 || dir_i->i_num == ROOT_INO) {
00217         iput(dir_i);
00218         return -EBUSY;
00219     }
00220     if (!S_ISDIR(dir_i->i_mode)) {
00221         iput(dir_i);
00222         return -EPERM;
00223     }
00224     if (!(sb=read_super(dev))) {
00225         iput(dir_i);
00226         return -EBUSY;
00227     }
00228     if (sb->s_imount) {
00229         iput(dir_i);
00230         return -EBUSY;
00231     }
00232     if (dir_i->i_mount) {
00233         iput(dir_i);
00234         return -EPERM;
00235     }
00236     sb->s_imount=dir_i;
00237     dir_i->i_mount=1;
00238     dir_i->i_dirt=1;        /* NOTE! we don't iput(dir_i) */
00239     return 0;           /* we do that in umount */
00240 }
00241
00242 void mount_root(void)
00243 {
00244     int i,free;
00245     struct super_block * p;
00246     struct m_inode * mi;
00247
00248     if (32 != sizeof (struct d_inode))
00249         panic("bad i-node size");
00250     for(i=0;i<NR_FILE;i++)
00251         file_table[i].f_count=0;
00252     if (MAJOR(ROOT_DEV) == 2) {
00253         printk("Insert root floppy and press ENTER");
00254         wait_for_keypress();
00255     }
00256     for(p = &super_block[0] ; p < &super_block[NR_SUPER] ; p++) {
00257         p->s_dev = 0;
00258         p->s_lock = 0;
00259         p->s_wait = NULL;
00260     }
00261     if (!(p=read_super(ROOT_DEV)))
00262         panic("Unable to mount root");
00263     if (!(mi=iget(ROOT_DEV,ROOT_INO)))
00264         panic("Unable to read root i-node");
00265     mi->i_count += 3 ;  /* NOTE! it is logically used 4 times, not 1 */
00266     p->s_isup = p->s_imount = mi;
00267     current->pwd = mi;
00268     current->root = mi;
00269     free=0;
00270     i=p->s_nzones;
00271     while (-- i >= 0)
00272         if (!set_bit(i&8191,p->s_zmap[i>>13]->b_data))
00273             free++;
00274     printk("%d/%d free blocks\n\r",free,p->s_nzones);
00275     free=0;
00276     i=p->s_ninodes+1;
00277     while (-- i >= 0)
00278         if (!set_bit(i&8191,p->s_imap[i>>13]->b_data))
00279             free++;
00280     printk("%d/%d free inodes\n\r",free,p->s_ninodes);
00281 }
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/sys.c Source File

sys.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/sys.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008
00009 #include <linux/sched.h>
00010 #include <linux/tty.h>
00011 #include <linux/kernel.h>
00012 #include <asm/segment.h>
00013 #include <sys/times.h>
00014 #include <sys/utsname.h>
00015
00016 int sys_ftime()
00017 {
00018     return -ENOSYS;
00019 }
00020
00021 int sys_break()
00022 {
00023     return -ENOSYS;
00024 }
00025
00026 int sys_ptrace()
00027 {
00028     return -ENOSYS;
00029 }
00030
00031 int sys_stty()
00032 {
00033     return -ENOSYS;
00034 }
00035
00036 int sys_gtty()
00037 {
00038     return -ENOSYS;
00039 }
00040
00041 int sys_rename()
00042 {
00043     return -ENOSYS;
00044 }
00045
00046 int sys_prof()
00047 {
00048     return -ENOSYS;
00049 }
00050
00051 int sys_setregid(int rgid, int egid)
00052 {
00053     if (rgid>0) {
00054         if ((current->gid == rgid) ||
00055             suser())
00056             current->gid = rgid;
00057         else
00058             return(-EPERM);
00059     }
00060     if (egid>0) {
00061         if ((current->gid == egid) ||
00062             (current->egid == egid) ||
00063             (current->sgid == egid) ||
00064             suser())
00065             current->egid = egid;
00066         else
00067             return(-EPERM);
00068     }
00069     return 0;
00070 }
00071
00072 int sys_setgid(int gid)
00073 {
00074     return(sys_setregid(gid, gid));
00075 }
00076
00077 int sys_acct()
00078 {
00079     return -ENOSYS;
00080 }
00081
00082 int sys_phys()
00083 {
00084     return -ENOSYS;
00085 }
00086
00087 int sys_lock()
00088 {
00089     return -ENOSYS;
00090 }
00091
00092 int sys_mpx()
00093 {
00094     return -ENOSYS;
00095 }
00096
00097 int sys_ulimit()
00098 {
00099     return -ENOSYS;
00100 }
00101
00102 int sys_time(long * tloc)
00103 {
00104     int i;
00105
00106     i = CURRENT_TIME;
00107     if (tloc) {
00108         verify_area(tloc,4);
00109         put_fs_long(i,(unsigned long *)tloc);
00110     }
00111     return i;
00112 }
00113
00114 /*
00115  * Unprivileged users may change the real user id to the effective uid
00116  * or vice versa.
00117  */
00118 int sys_setreuid(int ruid, int euid)
00119 {
00120     int old_ruid = current->uid;
00121
00122     if (ruid>0) {
00123         if ((current->euid==ruid) ||
00124                     (old_ruid == ruid) ||
00125             suser())
00126             current->uid = ruid;
00127         else
00128             return(-EPERM);
00129     }
00130     if (euid>0) {
00131         if ((old_ruid == euid) ||
00132                     (current->euid == euid) ||
00133             suser())
00134             current->euid = euid;
00135         else {
00136             current->uid = old_ruid;
00137             return(-EPERM);
00138         }
00139     }
00140     return 0;
00141 }
00142
00143 int sys_setuid(int uid)
00144 {
00145     return(sys_setreuid(uid, uid));
00146 }
00147
00148 int sys_stime(long * tptr)
00149 {
00150     if (!suser())
00151         return -EPERM;
00152     startup_time = get_fs_long((unsigned long *)tptr) - jiffies/HZ;
00153     return 0;
00154 }
00155
00156 int sys_times(struct tms * tbuf)
00157 {
00158     if (tbuf) {
00159         verify_area(tbuf,sizeof *tbuf);
00160         put_fs_long(current->utime,(unsigned long *)&tbuf->tms_utime);
00161         put_fs_long(current->stime,(unsigned long *)&tbuf->tms_stime);
00162         put_fs_long(current->cutime,(unsigned long *)&tbuf->tms_cutime);
00163         put_fs_long(current->cstime,(unsigned long *)&tbuf->tms_cstime);
00164     }
00165     return jiffies;
00166 }
00167
00168 int sys_brk(unsigned long end_data_seg)
00169 {
00170     if (end_data_seg >= current->end_code &&
00171         end_data_seg < current->start_stack - 16384)
00172         current->brk = end_data_seg;
00173     return current->brk;
00174 }
00175
00176 /*
00177  * This needs some heave checking ...
00178  * I just haven't get the stomach for it. I also don't fully
00179  * understand sessions/pgrp etc. Let somebody who does explain it.
00180  */
00181 int sys_setpgid(int pid, int pgid)
00182 {
00183     int i;
00184
00185     if (!pid)
00186         pid = current->pid;
00187     if (!pgid)
00188         pgid = current->pid;
00189     for (i=0 ; i<NR_TASKS ; i++)
00190         if (task[i] && task[i]->pid==pid) {
00191             if (task[i]->leader)
00192                 return -EPERM;
00193             if (task[i]->session != current->session)
00194                 return -EPERM;
00195             task[i]->pgrp = pgid;
00196             return 0;
00197         }
00198     return -ESRCH;
00199 }
00200
00201 int sys_getpgrp(void)
00202 {
00203     return current->pgrp;
00204 }
00205
00206 int sys_setsid(void)
00207 {
00208     if (current->leader && !suser())
00209         return -EPERM;
00210     current->leader = 1;
00211     current->session = current->pgrp = current->pid;
00212     current->tty = -1;
00213     return current->pgrp;
00214 }
00215
00216 int sys_uname(struct utsname * name)
00217 {
00218     static struct utsname thisname = {
00219         "linux .0","nodename","release ","version ","machine "
00220     };
00221     int i;
00222
00223     if (!name) return -ERROR;
00224     verify_area(name,sizeof *name);
00225     for(i=0;i<sizeof *name;i++)
00226         put_fs_byte(((char *) &thisname)[i],i+(char *) name);
00227     return 0;
00228 }
00229
00230 int sys_umask(int mask)
00231 {
00232     int old = current->umask;
00233
00234     current->umask = mask & 0777;
00235     return (old);
00236 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/sys.h Source File

sys.h

Go to the documentation of this file.
00001 extern int sys_setup();
00002 extern int sys_exit();
00003 extern int sys_fork();
00004 extern int sys_read();
00005 extern int sys_write();
00006 extern int sys_open();
00007 extern int sys_close();
00008 extern int sys_waitpid();
00009 extern int sys_creat();
00010 extern int sys_link();
00011 extern int sys_unlink();
00012 extern int sys_execve();
00013 extern int sys_chdir();
00014 extern int sys_time();
00015 extern int sys_mknod();
00016 extern int sys_chmod();
00017 extern int sys_chown();
00018 extern int sys_break();
00019 extern int sys_stat();
00020 extern int sys_lseek();
00021 extern int sys_getpid();
00022 extern int sys_mount();
00023 extern int sys_umount();
00024 extern int sys_setuid();
00025 extern int sys_getuid();
00026 extern int sys_stime();
00027 extern int sys_ptrace();
00028 extern int sys_alarm();
00029 extern int sys_fstat();
00030 extern int sys_pause();
00031 extern int sys_utime();
00032 extern int sys_stty();
00033 extern int sys_gtty();
00034 extern int sys_access();
00035 extern int sys_nice();
00036 extern int sys_ftime();
00037 extern int sys_sync();
00038 extern int sys_kill();
00039 extern int sys_rename();
00040 extern int sys_mkdir();
00041 extern int sys_rmdir();
00042 extern int sys_dup();
00043 extern int sys_pipe();
00044 extern int sys_times();
00045 extern int sys_prof();
00046 extern int sys_brk();
00047 extern int sys_setgid();
00048 extern int sys_getgid();
00049 extern int sys_signal();
00050 extern int sys_geteuid();
00051 extern int sys_getegid();
00052 extern int sys_acct();
00053 extern int sys_phys();
00054 extern int sys_lock();
00055 extern int sys_ioctl();
00056 extern int sys_fcntl();
00057 extern int sys_mpx();
00058 extern int sys_setpgid();
00059 extern int sys_ulimit();
00060 extern int sys_uname();
00061 extern int sys_umask();
00062 extern int sys_chroot();
00063 extern int sys_ustat();
00064 extern int sys_dup2();
00065 extern int sys_getppid();
00066 extern int sys_getpgrp();
00067 extern int sys_setsid();
00068 extern int sys_sigaction();
00069 extern int sys_sgetmask();
00070 extern int sys_ssetmask();
00071 extern int sys_setreuid();
00072 extern int sys_setregid();
00073
00074 fn_ptr sys_call_table[] = { sys_setup, sys_exit, sys_fork, sys_read,
00075 sys_write, sys_open, sys_close, sys_waitpid, sys_creat, sys_link,
00076 sys_unlink, sys_execve, sys_chdir, sys_time, sys_mknod, sys_chmod,
00077 sys_chown, sys_break, sys_stat, sys_lseek, sys_getpid, sys_mount,
00078 sys_umount, sys_setuid, sys_getuid, sys_stime, sys_ptrace, sys_alarm,
00079 sys_fstat, sys_pause, sys_utime, sys_stty, sys_gtty, sys_access,
00080 sys_nice, sys_ftime, sys_sync, sys_kill, sys_rename, sys_mkdir,
00081 sys_rmdir, sys_dup, sys_pipe, sys_times, sys_prof, sys_brk, sys_setgid,
00082 sys_getgid, sys_signal, sys_geteuid, sys_getegid, sys_acct, sys_phys,
00083 sys_lock, sys_ioctl, sys_fcntl, sys_mpx, sys_setpgid, sys_ulimit,
00084 sys_uname, sys_umask, sys_chroot, sys_ustat, sys_dup2, sys_getppid,
00085 sys_getpgrp, sys_setsid, sys_sigaction, sys_sgetmask, sys_ssetmask,
00086 sys_setreuid,sys_setregid };
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/asm/system.h Source File

system.h

Go to the documentation of this file.
00001 #define move_to_user_mode() \
00002 __asm__ ("movl %%esp,%%eax\n\t" \
00003     "pushl $0x17\n\t" \
00004     "pushl %%eax\n\t" \
00005     "pushfl\n\t" \
00006     "pushl $0x0f\n\t" \
00007     "pushl $1f\n\t" \
00008     "iret\n" \
00009     "1:\tmovl $0x17,%%eax\n\t" \
00010     "movw %%ax,%%ds\n\t" \
00011     "movw %%ax,%%es\n\t" \
00012     "movw %%ax,%%fs\n\t" \
00013     "movw %%ax,%%gs" \
00014     :::"ax")
00015
00016 #define sti() __asm__ ("sti"::)
00017 #define cli() __asm__ ("cli"::)
00018 #define nop() __asm__ ("nop"::)
00019
00020 #define iret() __asm__ ("iret"::)
00021
00022 #define _set_gate(gate_addr,type,dpl,addr) \
00023 __asm__ ("movw %%dx,%%ax\n\t" \
00024     "movw %0,%%dx\n\t" \
00025     "movl %%eax,%1\n\t" \
00026     "movl %%edx,%2" \
00027     : \
00028     : "i" ((short) (0x8000+(dpl<<13)+(type<<8))), \
00029     "o" (*((char *) (gate_addr))), \
00030     "o" (*(4+(char *) (gate_addr))), \
00031     "d" ((char *) (addr)),"a" (0x00080000))
00032
00033 #define set_intr_gate(n,addr) \
00034     _set_gate(&idt[n],14,0,addr)
00035
00036 #define set_trap_gate(n,addr) \
00037     _set_gate(&idt[n],15,0,addr)
00038
00039 #define set_system_gate(n,addr) \
00040     _set_gate(&idt[n],15,3,addr)
00041
00042 #define _set_seg_desc(gate_addr,type,dpl,base,limit) {\
00043     *(gate_addr) = ((base) & 0xff000000) | \
00044         (((base) & 0x00ff0000)>>16) | \
00045         ((limit) & 0xf0000) | \
00046         ((dpl)<<13) | \
00047         (0x00408000) | \
00048         ((type)<<8); \
00049     *((gate_addr)+1) = (((base) & 0x0000ffff)<<16) | \
00050         ((limit) & 0x0ffff); }
00051
00052 #define _set_tssldt_desc(n,addr,type) \
00053 __asm__ ("movw $104,%1\n\t" \
00054     "movw %%ax,%2\n\t" \
00055     "rorl $16,%%eax\n\t" \
00056     "movb %%al,%3\n\t" \
00057     "movb $" type ",%4\n\t" \
00058     "movb $0x00,%5\n\t" \
00059     "movb %%ah,%6\n\t" \
00060     "rorl $16,%%eax" \
00061     ::"a" (addr), "m" (*(n)), "m" (*(n+2)), "m" (*(n+4)), \
00062      "m" (*(n+5)), "m" (*(n+6)), "m" (*(n+7)) \
00063     )
00064
00065 #define set_tss_desc(n,addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),"0x89")
00066 #define set_ldt_desc(n,addr) _set_tssldt_desc(((char *) (n)),((int)(addr)),"0x82")
00067
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/termios.h Source File

termios.h

Go to the documentation of this file.
00001 #ifndef _TERMIOS_H
00002 #define _TERMIOS_H
00003
00004 #define TTY_BUF_SIZE 1024
00005
00006 /* 0x54 is just a magic number to make these relatively uniqe ('T') */
00007
00008 #define TCGETS      0x5401
00009 #define TCSETS      0x5402
00010 #define TCSETSW     0x5403
00011 #define TCSETSF     0x5404
00012 #define TCGETA      0x5405
00013 #define TCSETA      0x5406
00014 #define TCSETAW     0x5407
00015 #define TCSETAF     0x5408
00016 #define TCSBRK      0x5409
00017 #define TCXONC      0x540A
00018 #define TCFLSH      0x540B
00019 #define TIOCEXCL    0x540C
00020 #define TIOCNXCL    0x540D
00021 #define TIOCSCTTY   0x540E
00022 #define TIOCGPGRP   0x540F
00023 #define TIOCSPGRP   0x5410
00024 #define TIOCOUTQ    0x5411
00025 #define TIOCSTI     0x5412
00026 #define TIOCGWINSZ  0x5413
00027 #define TIOCSWINSZ  0x5414
00028 #define TIOCMGET    0x5415
00029 #define TIOCMBIS    0x5416
00030 #define TIOCMBIC    0x5417
00031 #define TIOCMSET    0x5418
00032 #define TIOCGSOFTCAR    0x5419
00033 #define TIOCSSOFTCAR    0x541A
00034 #define TIOCINQ     0x541B
00035
00036 struct winsize {
00037     unsigned short ws_row;
00038     unsigned short ws_col;
00039     unsigned short ws_xpixel;
00040     unsigned short ws_ypixel;
00041 };
00042
00043 #define NCC 8
00044 struct termio {
00045     unsigned short c_iflag;     /* input mode flags */
00046     unsigned short c_oflag;     /* output mode flags */
00047     unsigned short c_cflag;     /* control mode flags */
00048     unsigned short c_lflag;     /* local mode flags */
00049     unsigned char c_line;       /* line discipline */
00050     unsigned char c_cc[NCC];    /* control characters */
00051 };
00052
00053 #define NCCS 17
00054 struct termios {
00055     unsigned long c_iflag;      /* input mode flags */
00056     unsigned long c_oflag;      /* output mode flags */
00057     unsigned long c_cflag;      /* control mode flags */
00058     unsigned long c_lflag;      /* local mode flags */
00059     unsigned char c_line;       /* line discipline */
00060     unsigned char c_cc[NCCS];   /* control characters */
00061 };
00062
00063 /* c_cc characters */
00064 #define VINTR 0
00065 #define VQUIT 1
00066 #define VERASE 2
00067 #define VKILL 3
00068 #define VEOF 4
00069 #define VTIME 5
00070 #define VMIN 6
00071 #define VSWTC 7
00072 #define VSTART 8
00073 #define VSTOP 9
00074 #define VSUSP 10
00075 #define VEOL 11
00076 #define VREPRINT 12
00077 #define VDISCARD 13
00078 #define VWERASE 14
00079 #define VLNEXT 15
00080 #define VEOL2 16
00081
00082 /* c_iflag bits */
00083 #define IGNBRK  0000001
00084 #define BRKINT  0000002
00085 #define IGNPAR  0000004
00086 #define PARMRK  0000010
00087 #define INPCK   0000020
00088 #define ISTRIP  0000040
00089 #define INLCR   0000100
00090 #define IGNCR   0000200
00091 #define ICRNL   0000400
00092 #define IUCLC   0001000
00093 #define IXON    0002000
00094 #define IXANY   0004000
00095 #define IXOFF   0010000
00096 #define IMAXBEL 0020000
00097
00098 /* c_oflag bits */
00099 #define OPOST   0000001
00100 #define OLCUC   0000002
00101 #define ONLCR   0000004
00102 #define OCRNL   0000010
00103 #define ONOCR   0000020
00104 #define ONLRET  0000040
00105 #define OFILL   0000100
00106 #define OFDEL   0000200
00107 #define NLDLY   0000400
00108 #define   NL0   0000000
00109 #define   NL1   0000400
00110 #define CRDLY   0003000
00111 #define   CR0   0000000
00112 #define   CR1   0001000
00113 #define   CR2   0002000
00114 #define   CR3   0003000
00115 #define TABDLY  0014000
00116 #define   TAB0  0000000
00117 #define   TAB1  0004000
00118 #define   TAB2  0010000
00119 #define   TAB3  0014000
00120 #define   XTABS 0014000
00121 #define BSDLY   0020000
00122 #define   BS0   0000000
00123 #define   BS1   0020000
00124 #define VTDLY   0040000
00125 #define   VT0   0000000
00126 #define   VT1   0040000
00127 #define FFDLY   0040000
00128 #define   FF0   0000000
00129 #define   FF1   0040000
00130
00131 /* c_cflag bit meaning */
00132 #define CBAUD   0000017
00133 #define  B0 0000000     /* hang up */
00134 #define  B50    0000001
00135 #define  B75    0000002
00136 #define  B110   0000003
00137 #define  B134   0000004
00138 #define  B150   0000005
00139 #define  B200   0000006
00140 #define  B300   0000007
00141 #define  B600   0000010
00142 #define  B1200  0000011
00143 #define  B1800  0000012
00144 #define  B2400  0000013
00145 #define  B4800  0000014
00146 #define  B9600  0000015
00147 #define  B19200 0000016
00148 #define  B38400 0000017
00149 #define EXTA B19200
00150 #define EXTB B38400
00151 #define CSIZE   0000060
00152 #define   CS5   0000000
00153 #define   CS6   0000020
00154 #define   CS7   0000040
00155 #define   CS8   0000060
00156 #define CSTOPB  0000100
00157 #define CREAD   0000200
00158 #define CPARENB 0000400
00159 #define CPARODD 0001000
00160 #define HUPCL   0002000
00161 #define CLOCAL  0004000
00162 #define CIBAUD  03600000        /* input baud rate (not used) */
00163 #define CRTSCTS 020000000000        /* flow control */
00164
00165 #define PARENB CPARENB
00166 #define PARODD CPARODD
00167
00168 /* c_lflag bits */
00169 #define ISIG    0000001
00170 #define ICANON  0000002
00171 #define XCASE   0000004
00172 #define ECHO    0000010
00173 #define ECHOE   0000020
00174 #define ECHOK   0000040
00175 #define ECHONL  0000100
00176 #define NOFLSH  0000200
00177 #define TOSTOP  0000400
00178 #define ECHOCTL 0001000
00179 #define ECHOPRT 0002000
00180 #define ECHOKE  0004000
00181 #define FLUSHO  0010000
00182 #define PENDIN  0040000
00183 #define IEXTEN  0100000
00184
00185 /* modem lines */
00186 #define TIOCM_LE    0x001
00187 #define TIOCM_DTR   0x002
00188 #define TIOCM_RTS   0x004
00189 #define TIOCM_ST    0x008
00190 #define TIOCM_SR    0x010
00191 #define TIOCM_CTS   0x020
00192 #define TIOCM_CAR   0x040
00193 #define TIOCM_RNG   0x080
00194 #define TIOCM_DSR   0x100
00195 #define TIOCM_CD    TIOCM_CAR
00196 #define TIOCM_RI    TIOCM_RNG
00197
00198 /* tcflow() and TCXONC use these */
00199 #define TCOOFF      0
00200 #define TCOON       1
00201 #define TCIOFF      2
00202 #define TCION       3
00203
00204 /* tcflush() and TCFLSH use these */
00205 #define TCIFLUSH    0
00206 #define TCOFLUSH    1
00207 #define TCIOFLUSH   2
00208
00209 /* tcsetattr uses these */
00210 #define TCSANOW     0
00211 #define TCSADRAIN   1
00212 #define TCSAFLUSH   2
00213
00214 typedef int speed_t;
00215
00216 extern speed_t cfgetispeed(struct termios *termios_p);
00217 extern speed_t cfgetospeed(struct termios *termios_p);
00218 extern int cfsetispeed(struct termios *termios_p, speed_t speed);
00219 extern int cfsetospeed(struct termios *termios_p, speed_t speed);
00220 extern int tcdrain(int fildes);
00221 extern int tcflow(int fildes, int action);
00222 extern int tcflush(int fildes, int queue_selector);
00223 extern int tcgetattr(int fildes, struct termios *termios_p);
00224 extern int tcsendbreak(int fildes, int duration);
00225 extern int tcsetattr(int fildes, int optional_actions,
00226     struct termios *termios_p);
00227
00228 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/time.h Source File

time.h

Go to the documentation of this file.
00001 #ifndef _TIME_H
00002 #define _TIME_H
00003
00004 #ifndef _TIME_T
00005 #define _TIME_T
00006 typedef long time_t;
00007 #endif
00008
00009 #ifndef _SIZE_T
00010 #define _SIZE_T
00011 typedef unsigned int size_t;
00012 #endif
00013
00014 #define CLOCKS_PER_SEC 100
00015
00016 typedef long clock_t;
00017
00018 struct tm {
00019     int tm_sec;
00020     int tm_min;
00021     int tm_hour;
00022     int tm_mday;
00023     int tm_mon;
00024     int tm_year;
00025     int tm_wday;
00026     int tm_yday;
00027     int tm_isdst;
00028 };
00029
00030 clock_t clock(void);
00031 time_t time(time_t * tp);
00032 double difftime(time_t time2, time_t time1);
00033 time_t mktime(struct tm * tp);
00034
00035 char * asctime(const struct tm * tp);
00036 char * ctime(const time_t * tp);
00037 struct tm * gmtime(const time_t *tp);
00038 struct tm *localtime(const time_t * tp);
00039 size_t strftime(char * s, size_t smax, const char * fmt, const struct tm * tp);
00040 void tzset(void);
00041
00042 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/times.h Source File

times.h

Go to the documentation of this file.
00001 #ifndef _TIMES_H
00002 #define _TIMES_H
00003
00004 #include <sys/types.h>
00005
00006 struct tms {
00007     time_t tms_utime;
00008     time_t tms_stime;
00009     time_t tms_cutime;
00010     time_t tms_cstime;
00011 };
00012
00013 extern time_t times(struct tms * tp);
00014
00015 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/traps.c Source File

traps.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/traps.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * 'Traps.c' handles hardware traps and faults after we have saved some
00009  * state in 'asm.s'. Currently mostly a debugging-aid, will be extended
00010  * to mainly kill the offending process (probably by giving it a signal,
00011  * but possibly by killing it outright if necessary).
00012  */
00013 #include <string.h>
00014
00015 #include <linux/head.h>
00016 #include <linux/sched.h>
00017 #include <linux/kernel.h>
00018 #include <asm/system.h>
00019 #include <asm/segment.h>
00020 #include <asm/io.h>
00021
00022 #define get_seg_byte(seg,addr) ({ \
00023 register char __res; \
00024 __asm__("push %%fs;mov %%ax,%%fs;movb %%fs:%2,%%al;pop %%fs" \
00025     :"=a" (__res):"0" (seg),"m" (*(addr))); \
00026 __res;})
00027
00028 #define get_seg_long(seg,addr) ({ \
00029 register unsigned long __res; \
00030 __asm__("push %%fs;mov %%ax,%%fs;movl %%fs:%2,%%eax;pop %%fs" \
00031     :"=a" (__res):"0" (seg),"m" (*(addr))); \
00032 __res;})
00033
00034 #define _fs() ({ \
00035 register unsigned short __res; \
00036 __asm__("mov %%fs,%%ax":"=a" (__res):); \
00037 __res;})
00038
00039 int do_exit(long code);
00040
00041 void page_exception(void);
00042
00043 void divide_error(void);
00044 void debug(void);
00045 void nmi(void);
00046 void int3(void);
00047 void overflow(void);
00048 void bounds(void);
00049 void invalid_op(void);
00050 void device_not_available(void);
00051 void double_fault(void);
00052 void coprocessor_segment_overrun(void);
00053 void invalid_TSS(void);
00054 void segment_not_present(void);
00055 void stack_segment(void);
00056 void general_protection(void);
00057 void page_fault(void);
00058 void coprocessor_error(void);
00059 void reserved(void);
00060 void parallel_interrupt(void);
00061 void irq13(void);
00062
00063 static void die(char * str,long esp_ptr,long nr)
00064 {
00065     long * esp = (long *) esp_ptr;
00066     int i;
00067
00068     printk("%s: %04x\n\r",str,nr&0xffff);
00069     printk("EIP:\t%04x:%p\nEFLAGS:\t%p\nESP:\t%04x:%p\n",
00070         esp[1],esp[0],esp[2],esp[4],esp[3]);
00071     printk("fs: %04x\n",_fs());
00072     printk("base: %p, limit: %p\n",get_base(current->ldt[1]),get_limit(0x17));
00073     if (esp[4] == 0x17) {
00074         printk("Stack: ");
00075         for (i=0;i<4;i++)
00076             printk("%p ",get_seg_long(0x17,i+(long *)esp[3]));
00077         printk("\n");
00078     }
00079     str(i);
00080     printk("Pid: %d, process nr: %d\n\r",current->pid,0xffff & i);
00081     for(i=0;i<10;i++)
00082         printk("%02x ",0xff & get_seg_byte(esp[1],(i+(char *)esp[0])));
00083     printk("\n\r");
00084     do_exit(11);        /* play segment exception */
00085 }
00086
00087 void do_double_fault(long esp, long error_code)
00088 {
00089     die("double fault",esp,error_code);
00090 }
00091
00092 void do_general_protection(long esp, long error_code)
00093 {
00094     die("general protection",esp,error_code);
00095 }
00096
00097 void do_divide_error(long esp, long error_code)
00098 {
00099     die("divide error",esp,error_code);
00100 }
00101
00102 void do_int3(long * esp, long error_code,
00103         long fs,long es,long ds,
00104         long ebp,long esi,long edi,
00105         long edx,long ecx,long ebx,long eax)
00106 {
00107     int tr;
00108
00109     __asm__("str %%ax":"=a" (tr):"0" (0));
00110     printk("eax\t\tebx\t\tecx\t\tedx\n\r%8x\t%8x\t%8x\t%8x\n\r",
00111         eax,ebx,ecx,edx);
00112     printk("esi\t\tedi\t\tebp\t\tesp\n\r%8x\t%8x\t%8x\t%8x\n\r",
00113         esi,edi,ebp,(long) esp);
00114     printk("\n\rds\tes\tfs\ttr\n\r%4x\t%4x\t%4x\t%4x\n\r",
00115         ds,es,fs,tr);
00116     printk("EIP: %8x   CS: %4x  EFLAGS: %8x\n\r",esp[0],esp[1],esp[2]);
00117 }
00118
00119 void do_nmi(long esp, long error_code)
00120 {
00121     die("nmi",esp,error_code);
00122 }
00123
00124 void do_debug(long esp, long error_code)
00125 {
00126     die("debug",esp,error_code);
00127 }
00128
00129 void do_overflow(long esp, long error_code)
00130 {
00131     die("overflow",esp,error_code);
00132 }
00133
00134 void do_bounds(long esp, long error_code)
00135 {
00136     die("bounds",esp,error_code);
00137 }
00138
00139 void do_invalid_op(long esp, long error_code)
00140 {
00141     die("invalid operand",esp,error_code);
00142 }
00143
00144 void do_device_not_available(long esp, long error_code)
00145 {
00146     die("device not available",esp,error_code);
00147 }
00148
00149 void do_coprocessor_segment_overrun(long esp, long error_code)
00150 {
00151     die("coprocessor segment overrun",esp,error_code);
00152 }
00153
00154 void do_invalid_TSS(long esp,long error_code)
00155 {
00156     die("invalid TSS",esp,error_code);
00157 }
00158
00159 void do_segment_not_present(long esp,long error_code)
00160 {
00161     die("segment not present",esp,error_code);
00162 }
00163
00164 void do_stack_segment(long esp,long error_code)
00165 {
00166     die("stack segment",esp,error_code);
00167 }
00168
00169 void do_coprocessor_error(long esp, long error_code)
00170 {
00171     if (last_task_used_math != current)
00172         return;
00173     die("coprocessor error",esp,error_code);
00174 }
00175
00176 void do_reserved(long esp, long error_code)
00177 {
00178     die("reserved (15,17-47) error",esp,error_code);
00179 }
00180
00181 void trap_init(void)
00182 {
00183     int i;
00184
00185     set_trap_gate(0,&divide_error);
00186     set_trap_gate(1,&debug);
00187     set_trap_gate(2,&nmi);
00188     set_system_gate(3,&int3);   /* int3-5 can be called from all */
00189     set_system_gate(4,&overflow);
00190     set_system_gate(5,&bounds);
00191     set_trap_gate(6,&invalid_op);
00192     set_trap_gate(7,&device_not_available);
00193     set_trap_gate(8,&double_fault);
00194     set_trap_gate(9,&coprocessor_segment_overrun);
00195     set_trap_gate(10,&invalid_TSS);
00196     set_trap_gate(11,&segment_not_present);
00197     set_trap_gate(12,&stack_segment);
00198     set_trap_gate(13,&general_protection);
00199     set_trap_gate(14,&page_fault);
00200     set_trap_gate(15,&reserved);
00201     set_trap_gate(16,&coprocessor_error);
00202     for (i=17;i<48;i++)
00203         set_trap_gate(i,&reserved);
00204     set_trap_gate(45,&irq13);
00205     outb_p(inb_p(0x21)&0xfb,0x21);
00206     outb(inb_p(0xA1)&0xdf,0xA1);
00207     set_trap_gate(39,&parallel_interrupt);
00208 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/fs/truncate.c Source File

truncate.c

Go to the documentation of this file.
00001 /*
00002  *  linux/fs/truncate.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <linux/sched.h>
00008
00009 #include <sys/stat.h>
00010
00011 static void free_ind(int dev,int block)
00012 {
00013     struct buffer_head * bh;
00014     unsigned short * p;
00015     int i;
00016
00017     if (!block)
00018         return;
00019     if ((bh=bread(dev,block))) {
00020         p = (unsigned short *) bh->b_data;
00021         for (i=0;i<512;i++,p++)
00022             if (*p)
00023                 free_block(dev,*p);
00024         brelse(bh);
00025     }
00026     free_block(dev,block);
00027 }
00028
00029 static void free_dind(int dev,int block)
00030 {
00031     struct buffer_head * bh;
00032     unsigned short * p;
00033     int i;
00034
00035     if (!block)
00036         return;
00037     if ((bh=bread(dev,block))) {
00038         p = (unsigned short *) bh->b_data;
00039         for (i=0;i<512;i++,p++)
00040             if (*p)
00041                 free_ind(dev,*p);
00042         brelse(bh);
00043     }
00044     free_block(dev,block);
00045 }
00046
00047 void truncate(struct m_inode * inode)
00048 {
00049     int i;
00050
00051     if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
00052         return;
00053     for (i=0;i<7;i++)
00054         if (inode->i_zone[i]) {
00055             free_block(inode->i_dev,inode->i_zone[i]);
00056             inode->i_zone[i]=0;
00057         }
00058     free_ind(inode->i_dev,inode->i_zone[7]);
00059     free_dind(inode->i_dev,inode->i_zone[8]);
00060     inode->i_zone[7] = inode->i_zone[8] = 0;
00061     inode->i_size = 0;
00062     inode->i_dirt = 1;
00063     inode->i_mtime = inode->i_ctime = CURRENT_TIME;
00064 }
00065
Generated on Sun Mar 6 10:56:04 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/linux/tty.h Source File

tty.h

Go to the documentation of this file.
00001 /*
00002  * 'tty.h' defines some structures used by tty_io.c and some defines.
00003  *
00004  * NOTE! Don't touch this without checking that nothing in rs_io.s or
00005  * con_io.s breaks. Some constants are hardwired into the system (mainly
00006  * offsets into 'tty_queue'
00007  */
00008
00009 #ifndef _TTY_H
00010 #define _TTY_H
00011
00012 #include <termios.h>
00013
00014 #define TTY_BUF_SIZE 1024
00015
00016 struct tty_queue {
00017     unsigned long data;
00018     unsigned long head;
00019     unsigned long tail;
00020     struct task_struct * proc_list;
00021     char buf[TTY_BUF_SIZE];
00022 };
00023
00024 #define INC(a) ((a) = ((a)+1) & (TTY_BUF_SIZE-1))
00025 #define DEC(a) ((a) = ((a)-1) & (TTY_BUF_SIZE-1))
00026 #define EMPTY(a) ((a).head == (a).tail)
00027 #define LEFT(a) (((a).tail-(a).head-1)&(TTY_BUF_SIZE-1))
00028 #define LAST(a) ((a).buf[(TTY_BUF_SIZE-1)&((a).head-1)])
00029 #define FULL(a) (!LEFT(a))
00030 #define CHARS(a) (((a).head-(a).tail)&(TTY_BUF_SIZE-1))
00031 #define GETCH(queue,c) \
00032 (void)({c=(queue).buf[(queue).tail];INC((queue).tail);})
00033 #define PUTCH(c,queue) \
00034 (void)({(queue).buf[(queue).head]=(c);INC((queue).head);})
00035
00036 #define INTR_CHAR(tty) ((tty)->termios.c_cc[VINTR])
00037 #define QUIT_CHAR(tty) ((tty)->termios.c_cc[VQUIT])
00038 #define ERASE_CHAR(tty) ((tty)->termios.c_cc[VERASE])
00039 #define KILL_CHAR(tty) ((tty)->termios.c_cc[VKILL])
00040 #define EOF_CHAR(tty) ((tty)->termios.c_cc[VEOF])
00041 #define START_CHAR(tty) ((tty)->termios.c_cc[VSTART])
00042 #define STOP_CHAR(tty) ((tty)->termios.c_cc[VSTOP])
00043 #define SUSPEND_CHAR(tty) ((tty)->termios.c_cc[VSUSP])
00044
00045 struct tty_struct {
00046     struct termios termios;
00047     int pgrp;
00048     int stopped;
00049     void (*write)(struct tty_struct * tty);
00050     struct tty_queue read_q;
00051     struct tty_queue write_q;
00052     struct tty_queue secondary;
00053     };
00054
00055 extern struct tty_struct tty_table[];
00056
00057 /*  intr=^C     quit=^|     erase=del   kill=^U
00058     eof=^D      vtime=\0    vmin=\1     sxtc=\0
00059     start=^Q    stop=^S     susp=^Z     eol=\0
00060     reprint=^R  discard=^U  werase=^W   lnext=^V
00061     eol2=\0
00062 */
00063 #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
00064
00065 void rs_init(void);
00066 void con_init(void);
00067 void tty_init(void);
00068
00069 int tty_read(unsigned c, char * buf, int n);
00070 int tty_write(unsigned c, char * buf, int n);
00071
00072 void rs_write(struct tty_struct * tty);
00073 void con_write(struct tty_struct * tty);
00074
00075 void copy_to_cooked(struct tty_struct * tty);
00076
00077 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/tty_io.c Source File

tty_io.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/tty_io.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /*
00008  * 'tty_io.c' gives an orthogonal feeling to tty's, be they consoles
00009  * or rs-channels. It also implements echoing, cooked mode etc.
00010  *
00011  * Kill-line thanks to John T Kohl.
00012  */
00013 #include <ctype.h>
00014 #include <errno.h>
00015 #include <signal.h>
00016
00017 #define ALRMMASK (1<<(SIGALRM-1))
00018 #define KILLMASK (1<<(SIGKILL-1))
00019 #define INTMASK (1<<(SIGINT-1))
00020 #define QUITMASK (1<<(SIGQUIT-1))
00021 #define TSTPMASK (1<<(SIGTSTP-1))
00022
00023 #include <linux/sched.h>
00024 #include <linux/tty.h>
00025 #include <asm/segment.h>
00026 #include <asm/system.h>
00027
00028 #define _L_FLAG(tty,f)  ((tty)->termios.c_lflag & f)
00029 #define _I_FLAG(tty,f)  ((tty)->termios.c_iflag & f)
00030 #define _O_FLAG(tty,f)  ((tty)->termios.c_oflag & f)
00031
00032 #define L_CANON(tty)    _L_FLAG((tty),ICANON)
00033 #define L_ISIG(tty) _L_FLAG((tty),ISIG)
00034 #define L_ECHO(tty) _L_FLAG((tty),ECHO)
00035 #define L_ECHOE(tty)    _L_FLAG((tty),ECHOE)
00036 #define L_ECHOK(tty)    _L_FLAG((tty),ECHOK)
00037 #define L_ECHOCTL(tty)  _L_FLAG((tty),ECHOCTL)
00038 #define L_ECHOKE(tty)   _L_FLAG((tty),ECHOKE)
00039
00040 #define I_UCLC(tty) _I_FLAG((tty),IUCLC)
00041 #define I_NLCR(tty) _I_FLAG((tty),INLCR)
00042 #define I_CRNL(tty) _I_FLAG((tty),ICRNL)
00043 #define I_NOCR(tty) _I_FLAG((tty),IGNCR)
00044
00045 #define O_POST(tty) _O_FLAG((tty),OPOST)
00046 #define O_NLCR(tty) _O_FLAG((tty),ONLCR)
00047 #define O_CRNL(tty) _O_FLAG((tty),OCRNL)
00048 #define O_NLRET(tty)    _O_FLAG((tty),ONLRET)
00049 #define O_LCUC(tty) _O_FLAG((tty),OLCUC)
00050
00051 struct tty_struct tty_table[] = {
00052     {
00053         {ICRNL,     /* change incoming CR to NL */
00054         OPOST|ONLCR,    /* change outgoing NL to CRNL */
00055         0,
00056         ISIG | ICANON | ECHO | ECHOCTL | ECHOKE,
00057         0,      /* console termio */
00058         INIT_C_CC},
00059         0,          /* initial pgrp */
00060         0,          /* initial stopped */
00061         con_write,
00062         {0,0,0,0,""},       /* console read-queue */
00063         {0,0,0,0,""},       /* console write-queue */
00064         {0,0,0,0,""}        /* console secondary queue */
00065     },{
00066         {0, /* no translation */
00067         0,  /* no translation */
00068         B2400 | CS8,
00069         0,
00070         0,
00071         INIT_C_CC},
00072         0,
00073         0,
00074         rs_write,
00075         {0x3f8,0,0,0,""},       /* rs 1 */
00076         {0x3f8,0,0,0,""},
00077         {0,0,0,0,""}
00078     },{
00079         {0, /* no translation */
00080         0,  /* no translation */
00081         B2400 | CS8,
00082         0,
00083         0,
00084         INIT_C_CC},
00085         0,
00086         0,
00087         rs_write,
00088         {0x2f8,0,0,0,""},       /* rs 2 */
00089         {0x2f8,0,0,0,""},
00090         {0,0,0,0,""}
00091     }
00092 };
00093
00094 /*
00095  * these are the tables used by the machine code handlers.
00096  * you can implement pseudo-tty's or something by changing
00097  * them. Currently not done.
00098  */
00099 struct tty_queue * table_list[]={
00100     &tty_table[0].read_q, &tty_table[0].write_q,
00101     &tty_table[1].read_q, &tty_table[1].write_q,
00102     &tty_table[2].read_q, &tty_table[2].write_q
00103     };
00104
00105 void tty_init(void)
00106 {
00107     rs_init();
00108     con_init();
00109 }
00110
00111 void tty_intr(struct tty_struct * tty, int mask)
00112 {
00113     int i;
00114
00115     if (tty->pgrp <= 0)
00116         return;
00117     for (i=0;i<NR_TASKS;i++)
00118         if (task[i] && task[i]->pgrp==tty->pgrp)
00119             task[i]->signal |= mask;
00120 }
00121
00122 static void sleep_if_empty(struct tty_queue * queue)
00123 {
00124     cli();
00125     while (!current->signal && EMPTY(*queue))
00126         interruptible_sleep_on(&queue->proc_list);
00127     sti();
00128 }
00129
00130 static void sleep_if_full(struct tty_queue * queue)
00131 {
00132     if (!FULL(*queue))
00133         return;
00134     cli();
00135     while (!current->signal && LEFT(*queue)<128)
00136         interruptible_sleep_on(&queue->proc_list);
00137     sti();
00138 }
00139
00140 void wait_for_keypress(void)
00141 {
00142     sleep_if_empty(&tty_table[0].secondary);
00143 }
00144
00145 void copy_to_cooked(struct tty_struct * tty)
00146 {
00147     signed char c;
00148
00149     while (!EMPTY(tty->read_q) && !FULL(tty->secondary)) {
00150         GETCH(tty->read_q,c);
00151         if (c==13)
00152             if (I_CRNL(tty))
00153                 c=10;
00154             else if (I_NOCR(tty))
00155                 continue;
00156             else ;
00157         else if (c==10 && I_NLCR(tty))
00158             c=13;
00159         if (I_UCLC(tty))
00160             c=tolower(c);
00161         if (L_CANON(tty)) {
00162             if (c==KILL_CHAR(tty)) {
00163                 /* deal with killing the input line */
00164                 while(!(EMPTY(tty->secondary) ||
00165                         (c=LAST(tty->secondary))==10 ||
00166                         c==EOF_CHAR(tty))) {
00167                     if (L_ECHO(tty)) {
00168                         if (c<32)
00169                             PUTCH(127,tty->write_q);
00170                         PUTCH(127,tty->write_q);
00171                         tty->write(tty);
00172                     }
00173                     DEC(tty->secondary.head);
00174                 }
00175                 continue;
00176             }
00177             if (c==ERASE_CHAR(tty)) {
00178                 if (EMPTY(tty->secondary) ||
00179                    (c=LAST(tty->secondary))==10 ||
00180                    c==EOF_CHAR(tty))
00181                     continue;
00182                 if (L_ECHO(tty)) {
00183                     if (c<32)
00184                         PUTCH(127,tty->write_q);
00185                     PUTCH(127,tty->write_q);
00186                     tty->write(tty);
00187                 }
00188                 DEC(tty->secondary.head);
00189                 continue;
00190             }
00191             if (c==STOP_CHAR(tty)) {
00192                 tty->stopped=1;
00193                 continue;
00194             }
00195             if (c==START_CHAR(tty)) {
00196                 tty->stopped=0;
00197                 continue;
00198             }
00199         }
00200         if (L_ISIG(tty)) {
00201             if (c==INTR_CHAR(tty)) {
00202                 tty_intr(tty,INTMASK);
00203                 continue;
00204             }
00205             if (c==QUIT_CHAR(tty)) {
00206                 tty_intr(tty,QUITMASK);
00207                 continue;
00208             }
00209         }
00210         if (c==10 || c==EOF_CHAR(tty))
00211             tty->secondary.data++;
00212         if (L_ECHO(tty)) {
00213             if (c==10) {
00214                 PUTCH(10,tty->write_q);
00215                 PUTCH(13,tty->write_q);
00216             } else if (c<32) {
00217                 if (L_ECHOCTL(tty)) {
00218                     PUTCH('^',tty->write_q);
00219                     PUTCH(c+64,tty->write_q);
00220                 }
00221             } else
00222                 PUTCH(c,tty->write_q);
00223             tty->write(tty);
00224         }
00225         PUTCH(c,tty->secondary);
00226     }
00227     wake_up(&tty->secondary.proc_list);
00228 }
00229
00230 int tty_read(unsigned channel, char * buf, int nr)
00231 {
00232     struct tty_struct * tty;
00233     char c, * b=buf;
00234     int minimum,time,flag=0;
00235     long oldalarm;
00236
00237     if (channel>2 || nr<0) return -1;
00238     tty = &tty_table[channel];
00239     oldalarm = current->alarm;
00240     time = 10L*tty->termios.c_cc[VTIME];
00241     minimum = tty->termios.c_cc[VMIN];
00242     if (time && !minimum) {
00243         minimum=1;
00244         if ((flag=(!oldalarm || time+jiffies<oldalarm)))
00245             current->alarm = time+jiffies;
00246     }
00247     if (minimum>nr)
00248         minimum=nr;
00249     while (nr>0) {
00250         if (flag && (current->signal & ALRMMASK)) {
00251             current->signal &= ~ALRMMASK;
00252             break;
00253         }
00254         if (current->signal)
00255             break;
00256         if (EMPTY(tty->secondary) || (L_CANON(tty) &&
00257         !tty->secondary.data && LEFT(tty->secondary)>20)) {
00258             sleep_if_empty(&tty->secondary);
00259             continue;
00260         }
00261         do {
00262             GETCH(tty->secondary,c);
00263             if (c==EOF_CHAR(tty) || c==10)
00264                 tty->secondary.data--;
00265             if (c==EOF_CHAR(tty) && L_CANON(tty))
00266                 return (b-buf);
00267             else {
00268                 put_fs_byte(c,b++);
00269                 if (!--nr)
00270                     break;
00271             }
00272         } while (nr>0 && !EMPTY(tty->secondary));
00273         if (time && !L_CANON(tty)) {
00274             if ((flag=(!oldalarm || time+jiffies<oldalarm)))
00275                 current->alarm = time+jiffies;
00276             else
00277                 current->alarm = oldalarm;
00278         }
00279         if (L_CANON(tty)) {
00280             if (b-buf)
00281                 break;
00282         } else if (b-buf >= minimum)
00283             break;
00284     }
00285     current->alarm = oldalarm;
00286     if (current->signal && !(b-buf))
00287         return -EINTR;
00288     return (b-buf);
00289 }
00290
00291 int tty_write(unsigned channel, char * buf, int nr)
00292 {
00293     static int cr_flag=0;
00294     struct tty_struct * tty;
00295     char c, *b=buf;
00296
00297     if (channel>2 || nr<0) return -1;
00298     tty = channel + tty_table;
00299     while (nr>0) {
00300         sleep_if_full(&tty->write_q);
00301         if (current->signal)
00302             break;
00303         while (nr>0 && !FULL(tty->write_q)) {
00304             c=get_fs_byte(b);
00305             if (O_POST(tty)) {
00306                 if (c=='\r' && O_CRNL(tty))
00307                     c='\n';
00308                 else if (c=='\n' && O_NLRET(tty))
00309                     c='\r';
00310                 if (c=='\n' && !cr_flag && O_NLCR(tty)) {
00311                     cr_flag = 1;
00312                     PUTCH(13,tty->write_q);
00313                     continue;
00314                 }
00315                 if (O_LCUC(tty))
00316                     c=toupper(c);
00317             }
00318             b++; nr--;
00319             cr_flag = 0;
00320             PUTCH(c,tty->write_q);
00321         }
00322         tty->write(tty);
00323         if (nr>0)
00324             schedule();
00325     }
00326     return (b-buf);
00327 }
00328
00329 /*
00330  * Jeh, sometimes I really like the 386.
00331  * This routine is called from an interrupt,
00332  * and there should be absolutely no problem
00333  * with sleeping even in an interrupt (I hope).
00334  * Of course, if somebody proves me wrong, I'll
00335  * hate intel for all time :-). We'll have to
00336  * be careful and see to reinstating the interrupt
00337  * chips before calling this, though.
00338  *
00339  * I don't think we sleep here under normal circumstances
00340  * anyway, which is good, as the task sleeping might be
00341  * totally innocent.
00342  */
00343 void do_tty_interrupt(int tty)
00344 {
00345     copy_to_cooked(tty_table+tty);
00346 }
00347
00348 void chr_dev_init(void)
00349 {
00350 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/chr_drv/tty_ioctl.c Source File

tty_ioctl.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/chr_drv/tty_ioctl.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #include <errno.h>
00008 #include <termios.h>
00009
00010 #include <linux/sched.h>
00011 #include <linux/kernel.h>
00012 #include <linux/tty.h>
00013
00014 #include <asm/io.h>
00015 #include <asm/segment.h>
00016 #include <asm/system.h>
00017
00018 static unsigned short quotient[] = {
00019     0, 2304, 1536, 1047, 857,
00020     768, 576, 384, 192, 96,
00021     64, 48, 24, 12, 6, 3
00022 };
00023
00024 static void change_speed(struct tty_struct * tty)
00025 {
00026     unsigned short port,quot;
00027
00028     if (!(port = tty->read_q.data))
00029         return;
00030     quot = quotient[tty->termios.c_cflag & CBAUD];
00031     cli();
00032     outb_p(0x80,port+3);        /* set DLAB */
00033     outb_p(quot & 0xff,port);   /* LS of divisor */
00034     outb_p(quot >> 8,port+1);   /* MS of divisor */
00035     outb(0x03,port+3);      /* reset DLAB */
00036     sti();
00037 }
00038
00039 static void flush(struct tty_queue * queue)
00040 {
00041     cli();
00042     queue->head = queue->tail;
00043     sti();
00044 }
00045
00046 static void wait_until_sent(struct tty_struct * tty)
00047 {
00048     /* do nothing - not implemented */
00049 }
00050
00051 static void send_break(struct tty_struct * tty)
00052 {
00053     /* do nothing - not implemented */
00054 }
00055
00056 static int get_termios(struct tty_struct * tty, struct termios * termios)
00057 {
00058     int i;
00059
00060     verify_area(termios, sizeof (*termios));
00061     for (i=0 ; i< (sizeof (*termios)) ; i++)
00062         put_fs_byte( ((char *)&tty->termios)[i] , i+(char *)termios );
00063     return 0;
00064 }
00065
00066 static int set_termios(struct tty_struct * tty, struct termios * termios)
00067 {
00068     int i;
00069
00070     for (i=0 ; i< (sizeof (*termios)) ; i++)
00071         ((char *)&tty->termios)[i]=get_fs_byte(i+(char *)termios);
00072     change_speed(tty);
00073     return 0;
00074 }
00075
00076 static int get_termio(struct tty_struct * tty, struct termio * termio)
00077 {
00078     int i;
00079     struct termio tmp_termio;
00080
00081     verify_area(termio, sizeof (*termio));
00082     tmp_termio.c_iflag = tty->termios.c_iflag;
00083     tmp_termio.c_oflag = tty->termios.c_oflag;
00084     tmp_termio.c_cflag = tty->termios.c_cflag;
00085     tmp_termio.c_lflag = tty->termios.c_lflag;
00086     tmp_termio.c_line = tty->termios.c_line;
00087     for(i=0 ; i < NCC ; i++)
00088         tmp_termio.c_cc[i] = tty->termios.c_cc[i];
00089     for (i=0 ; i< (sizeof (*termio)) ; i++)
00090         put_fs_byte( ((char *)&tmp_termio)[i] , i+(char *)termio );
00091     return 0;
00092 }
00093
00094 /*
00095  * This only works as the 386 is low-byt-first
00096  */
00097 static int set_termio(struct tty_struct * tty, struct termio * termio)
00098 {
00099     int i;
00100     struct termio tmp_termio;
00101
00102     for (i=0 ; i< (sizeof (*termio)) ; i++)
00103         ((char *)&tmp_termio)[i]=get_fs_byte(i+(char *)termio);
00104     *(unsigned short *)&tty->termios.c_iflag = tmp_termio.c_iflag;
00105     *(unsigned short *)&tty->termios.c_oflag = tmp_termio.c_oflag;
00106     *(unsigned short *)&tty->termios.c_cflag = tmp_termio.c_cflag;
00107     *(unsigned short *)&tty->termios.c_lflag = tmp_termio.c_lflag;
00108     tty->termios.c_line = tmp_termio.c_line;
00109     for(i=0 ; i < NCC ; i++)
00110         tty->termios.c_cc[i] = tmp_termio.c_cc[i];
00111     change_speed(tty);
00112     return 0;
00113 }
00114
00115 int tty_ioctl(int dev, int cmd, int arg)
00116 {
00117     struct tty_struct * tty;
00118     if (MAJOR(dev) == 5) {
00119         dev=current->tty;
00120         if (dev<0)
00121             panic("tty_ioctl: dev<0");
00122     } else
00123         dev=MINOR(dev);
00124     tty = dev + tty_table;
00125     switch (cmd) {
00126         case TCGETS:
00127             return get_termios(tty,(struct termios *) arg);
00128         case TCSETSF:
00129             flush(&tty->read_q); /* fallthrough */
00130         case TCSETSW:
00131             wait_until_sent(tty); /* fallthrough */
00132         case TCSETS:
00133             return set_termios(tty,(struct termios *) arg);
00134         case TCGETA:
00135             return get_termio(tty,(struct termio *) arg);
00136         case TCSETAF:
00137             flush(&tty->read_q); /* fallthrough */
00138         case TCSETAW:
00139             wait_until_sent(tty); /* fallthrough */
00140         case TCSETA:
00141             return set_termio(tty,(struct termio *) arg);
00142         case TCSBRK:
00143             if (!arg) {
00144                 wait_until_sent(tty);
00145                 send_break(tty);
00146             }
00147             return 0;
00148         case TCXONC:
00149             return -EINVAL; /* not implemented */
00150         case TCFLSH:
00151             if (arg==0)
00152                 flush(&tty->read_q);
00153             else if (arg==1)
00154                 flush(&tty->write_q);
00155             else if (arg==2) {
00156                 flush(&tty->read_q);
00157                 flush(&tty->write_q);
00158             } else
00159                 return -EINVAL;
00160             return 0;
00161         case TIOCEXCL:
00162             return -EINVAL; /* not implemented */
00163         case TIOCNXCL:
00164             return -EINVAL; /* not implemented */
00165         case TIOCSCTTY:
00166             return -EINVAL; /* set controlling term NI */
00167         case TIOCGPGRP:
00168             verify_area((void *) arg,4);
00169             put_fs_long(tty->pgrp,(unsigned long *) arg);
00170             return 0;
00171         case TIOCSPGRP:
00172             tty->pgrp=get_fs_long((unsigned long *) arg);
00173             return 0;
00174         case TIOCOUTQ:
00175             verify_area((void *) arg,4);
00176             put_fs_long(CHARS(tty->write_q),(unsigned long *) arg);
00177             return 0;
00178         case TIOCINQ:
00179             verify_area((void *) arg,4);
00180             put_fs_long(CHARS(tty->secondary),
00181                 (unsigned long *) arg);
00182             return 0;
00183         case TIOCSTI:
00184             return -EINVAL; /* not implemented */
00185         case TIOCGWINSZ:
00186             return -EINVAL; /* not implemented */
00187         case TIOCSWINSZ:
00188             return -EINVAL; /* not implemented */
00189         case TIOCMGET:
00190             return -EINVAL; /* not implemented */
00191         case TIOCMBIS:
00192             return -EINVAL; /* not implemented */
00193         case TIOCMBIC:
00194             return -EINVAL; /* not implemented */
00195         case TIOCMSET:
00196             return -EINVAL; /* not implemented */
00197         case TIOCGSOFTCAR:
00198             return -EINVAL; /* not implemented */
00199         case TIOCSSOFTCAR:
00200             return -EINVAL; /* not implemented */
00201         default:
00202             return -EINVAL;
00203     }
00204 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/types.h Source File

types.h

Go to the documentation of this file.
00001 #ifndef _SYS_TYPES_H
00002 #define _SYS_TYPES_H
00003
00004 #ifndef _SIZE_T
00005 #define _SIZE_T
00006 typedef unsigned int size_t;
00007 #endif
00008
00009 #ifndef _TIME_T
00010 #define _TIME_T
00011 typedef long time_t;
00012 #endif
00013
00014 #ifndef _PTRDIFF_T
00015 #define _PTRDIFF_T
00016 typedef long ptrdiff_t;
00017 #endif
00018
00019 #ifndef NULL
00020 #define NULL ((void *) 0)
00021 #endif
00022
00023 typedef int pid_t;
00024 typedef unsigned short uid_t;
00025 typedef unsigned char gid_t;
00026 typedef unsigned short dev_t;
00027 typedef unsigned short ino_t;
00028 typedef unsigned short mode_t;
00029 typedef unsigned short umode_t;
00030 typedef unsigned char nlink_t;
00031 typedef int daddr_t;
00032 typedef long off_t;
00033 typedef unsigned char u_char;
00034 typedef unsigned short ushort;
00035
00036 typedef struct { int quot,rem; } div_t;
00037 typedef struct { long quot,rem; } ldiv_t;
00038
00039 struct ustat {
00040     daddr_t f_tfree;
00041     ino_t f_tinode;
00042     char f_fname[6];
00043     char f_fpack[6];
00044 };
00045
00046 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/unistd.h Source File

unistd.h

Go to the documentation of this file.
00001 #ifndef _UNISTD_H
00002 #define _UNISTD_H
00003
00004 /* ok, this may be a joke, but I'm working on it */
00005 #define _POSIX_VERSION 198808L
00006
00007 #define _POSIX_CHOWN_RESTRICTED /* only root can do a chown (I think..) */
00008 #define _POSIX_NO_TRUNC     /* no pathname truncation (but see in kernel) */
00009 #define _POSIX_VDISABLE '\0'    /* character to disable things like ^C */
00010 /*#define _POSIX_SAVED_IDS */   /* we'll get to this yet */
00011 /*#define _POSIX_JOB_CONTROL */ /* we aren't there quite yet. Soon hopefully */
00012
00013 #define STDIN_FILENO    0
00014 #define STDOUT_FILENO   1
00015 #define STDERR_FILENO   2
00016
00017 #ifndef NULL
00018 #define NULL    ((void *)0)
00019 #endif
00020
00021 /* access */
00022 #define F_OK    0
00023 #define X_OK    1
00024 #define W_OK    2
00025 #define R_OK    4
00026
00027 /* lseek */
00028 #define SEEK_SET    0
00029 #define SEEK_CUR    1
00030 #define SEEK_END    2
00031
00032 /* _SC stands for System Configuration. We don't use them much */
00033 #define _SC_ARG_MAX     1
00034 #define _SC_CHILD_MAX       2
00035 #define _SC_CLOCKS_PER_SEC  3
00036 #define _SC_NGROUPS_MAX     4
00037 #define _SC_OPEN_MAX        5
00038 #define _SC_JOB_CONTROL     6
00039 #define _SC_SAVED_IDS       7
00040 #define _SC_VERSION     8
00041
00042 /* more (possibly) configurable things - now pathnames */
00043 #define _PC_LINK_MAX        1
00044 #define _PC_MAX_CANON       2
00045 #define _PC_MAX_INPUT       3
00046 #define _PC_NAME_MAX        4
00047 #define _PC_PATH_MAX        5
00048 #define _PC_PIPE_BUF        6
00049 #define _PC_NO_TRUNC        7
00050 #define _PC_VDISABLE        8
00051 #define _PC_CHOWN_RESTRICTED    9
00052
00053 #include <sys/stat.h>
00054 #include <sys/times.h>
00055 #include <sys/utsname.h>
00056 #include <utime.h>
00057
00058 #ifdef __LIBRARY__
00059
00060 #define __NR_setup  0   /* used only by init, to get system going */
00061 #define __NR_exit   1
00062 #define __NR_fork   2
00063 #define __NR_read   3
00064 #define __NR_write  4
00065 #define __NR_open   5
00066 #define __NR_close  6
00067 #define __NR_waitpid    7
00068 #define __NR_creat  8
00069 #define __NR_link   9
00070 #define __NR_unlink 10
00071 #define __NR_execve 11
00072 #define __NR_chdir  12
00073 #define __NR_time   13
00074 #define __NR_mknod  14
00075 #define __NR_chmod  15
00076 #define __NR_chown  16
00077 #define __NR_break  17
00078 #define __NR_stat   18
00079 #define __NR_lseek  19
00080 #define __NR_getpid 20
00081 #define __NR_mount  21
00082 #define __NR_umount 22
00083 #define __NR_setuid 23
00084 #define __NR_getuid 24
00085 #define __NR_stime  25
00086 #define __NR_ptrace 26
00087 #define __NR_alarm  27
00088 #define __NR_fstat  28
00089 #define __NR_pause  29
00090 #define __NR_utime  30
00091 #define __NR_stty   31
00092 #define __NR_gtty   32
00093 #define __NR_access 33
00094 #define __NR_nice   34
00095 #define __NR_ftime  35
00096 #define __NR_sync   36
00097 #define __NR_kill   37
00098 #define __NR_rename 38
00099 #define __NR_mkdir  39
00100 #define __NR_rmdir  40
00101 #define __NR_dup    41
00102 #define __NR_pipe   42
00103 #define __NR_times  43
00104 #define __NR_prof   44
00105 #define __NR_brk    45
00106 #define __NR_setgid 46
00107 #define __NR_getgid 47
00108 #define __NR_signal 48
00109 #define __NR_geteuid    49
00110 #define __NR_getegid    50
00111 #define __NR_acct   51
00112 #define __NR_phys   52
00113 #define __NR_lock   53
00114 #define __NR_ioctl  54
00115 #define __NR_fcntl  55
00116 #define __NR_mpx    56
00117 #define __NR_setpgid    57
00118 #define __NR_ulimit 58
00119 #define __NR_uname  59
00120 #define __NR_umask  60
00121 #define __NR_chroot 61
00122 #define __NR_ustat  62
00123 #define __NR_dup2   63
00124 #define __NR_getppid    64
00125 #define __NR_getpgrp    65
00126 #define __NR_setsid 66
00127 #define __NR_sigaction  67
00128 #define __NR_sgetmask   68
00129 #define __NR_ssetmask   69
00130 #define __NR_setreuid   70
00131 #define __NR_setregid   71
00132
00133 #define _syscall0(type,name) \
00134 type name(void) \
00135 { \
00136 long __res; \
00137 __asm__ volatile ("int $0x80" \
00138     : "=a" (__res) \
00139     : "0" (__NR_##name)); \
00140 if (__res >= 0) \
00141     return (type) __res; \
00142 errno = -__res; \
00143 return -1; \
00144 }
00145
00146 #define _syscall1(type,name,atype,a) \
00147 type name(atype a) \
00148 { \
00149 long __res; \
00150 __asm__ volatile ("int $0x80" \
00151     : "=a" (__res) \
00152     : "0" (__NR_##name),"b" ((long)(a))); \
00153 if (__res >= 0) \
00154     return (type) __res; \
00155 errno = -__res; \
00156 return -1; \
00157 }
00158
00159 #define _syscall2(type,name,atype,a,btype,b) \
00160 type name(atype a,btype b) \
00161 { \
00162 long __res; \
00163 __asm__ volatile ("int $0x80" \
00164     : "=a" (__res) \
00165     : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b))); \
00166 if (__res >= 0) \
00167     return (type) __res; \
00168 errno = -__res; \
00169 return -1; \
00170 }
00171
00172 #define _syscall3(type,name,atype,a,btype,b,ctype,c) \
00173 type name(atype a,btype b,ctype c) \
00174 { \
00175 long __res; \
00176 __asm__ volatile ("int $0x80" \
00177     : "=a" (__res) \
00178     : "0" (__NR_##name),"b" ((long)(a)),"c" ((long)(b)),"d" ((long)(c))); \
00179 if (__res>=0) \
00180     return (type) __res; \
00181 errno=-__res; \
00182 return -1; \
00183 }
00184
00185 #endif /* __LIBRARY__ */
00186
00187 extern int errno;
00188
00189 int access(const char * filename, mode_t mode);
00190 int acct(const char * filename);
00191 int alarm(int sec);
00192 int brk(void * end_data_segment);
00193 void * sbrk(ptrdiff_t increment);
00194 int chdir(const char * filename);
00195 int chmod(const char * filename, mode_t mode);
00196 int chown(const char * filename, uid_t owner, gid_t group);
00197 int chroot(const char * filename);
00198 int close(int fildes);
00199 int creat(const char * filename, mode_t mode);
00200 int dup(int fildes);
00201 int execve(const char * filename, char ** argv, char ** envp);
00202 int execv(const char * pathname, char ** argv);
00203 int execvp(const char * file, char ** argv);
00204 int execl(const char * pathname, char * arg0, ...);
00205 int execlp(const char * file, char * arg0, ...);
00206 int execle(const char * pathname, char * arg0, ...);
00207 volatile void exit(int status);
00208 volatile void _exit(int status);
00209 int fcntl(int fildes, int cmd, ...);
00210 int fork(void);
00211 int getpid(void);
00212 int getuid(void);
00213 int geteuid(void);
00214 int getgid(void);
00215 int getegid(void);
00216 int ioctl(int fildes, int cmd, ...);
00217 int kill(pid_t pid, int signal);
00218 int link(const char * filename1, const char * filename2);
00219 int lseek(int fildes, off_t offset, int origin);
00220 int mknod(const char * filename, mode_t mode, dev_t dev);
00221 int mount(const char * specialfile, const char * dir, int rwflag);
00222 int nice(int val);
00223 int open(const char * filename, int flag, ...);
00224 int pause(void);
00225 int pipe(int * fildes);
00226 int read(int fildes, char * buf, off_t count);
00227 int setpgrp(void);
00228 int setpgid(pid_t pid,pid_t pgid);
00229 int setuid(uid_t uid);
00230 int setgid(gid_t gid);
00231 void (*signal(int sig, void (*fn)(int)))(int);
00232 int stat(const char * filename, struct stat * stat_buf);
00233 int fstat(int fildes, struct stat * stat_buf);
00234 int stime(time_t * tptr);
00235 int sync(void);
00236 time_t time(time_t * tloc);
00237 time_t times(struct tms * tbuf);
00238 int ulimit(int cmd, long limit);
00239 mode_t umask(mode_t mask);
00240 int umount(const char * specialfile);
00241 int uname(struct utsname * name);
00242 int unlink(const char * filename);
00243 int ustat(dev_t dev, struct ustat * ubuf);
00244 int utime(const char * filename, struct utimbuf * times);
00245 pid_t waitpid(pid_t pid,int * wait_stat,int options);
00246 pid_t wait(int * wait_stat);
00247 int write(int fildes, const char * buf, off_t count);
00248 int dup2(int oldfd, int newfd);
00249 int getppid(void);
00250 pid_t getpgrp(void);
00251 pid_t setsid(void);
00252
00253 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/utime.h Source File

utime.h

Go to the documentation of this file.
00001 #ifndef _UTIME_H
00002 #define _UTIME_H
00003
00004 #include <sys/types.h>  /* I know - shouldn't do this, but .. */
00005
00006 struct utimbuf {
00007     time_t actime;
00008     time_t modtime;
00009 };
00010
00011 extern int utime(const char *filename, struct utimbuf *times);
00012
00013 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/utsname.h Source File

utsname.h

Go to the documentation of this file.
00001 #ifndef _SYS_UTSNAME_H
00002 #define _SYS_UTSNAME_H
00003
00004 #include <sys/types.h>
00005
00006 struct utsname {
00007     char sysname[9];
00008     char nodename[9];
00009     char release[9];
00010     char version[9];
00011     char machine[9];
00012 };
00013
00014 extern int uname(struct utsname * utsbuf);
00015
00016 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/kernel/vsprintf.c Source File

vsprintf.c

Go to the documentation of this file.
00001 /*
00002  *  linux/kernel/vsprintf.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 /* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
00008 /*
00009  * Wirzenius wrote this portably, Torvalds fucked it up :-)
00010  */
00011
00012 #include <stdarg.h>
00013 #include <string.h>
00014
00015 /* we use this so that we can do without the ctype library */
00016 #define is_digit(c) ((c) >= '0' && (c) <= '9')
00017
00018 static int skip_atoi(const char **s)
00019 {
00020     int i=0;
00021
00022     while (is_digit(**s))
00023         i = i*10 + *((*s)++) - '0';
00024     return i;
00025 }
00026
00027 #define ZEROPAD 1       /* pad with zero */
00028 #define SIGN    2       /* unsigned/signed long */
00029 #define PLUS    4       /* show plus */
00030 #define SPACE   8       /* space if plus */
00031 #define LEFT    16      /* left justified */
00032 #define SPECIAL 32      /* 0x */
00033 #define SMALL   64      /* use 'abcdef' instead of 'ABCDEF' */
00034
00035 #define do_div(n,base) ({ \
00036 int __res; \
00037 __asm__("divl %4":"=a" (n),"=d" (__res):"0" (n),"1" (0),"r" (base)); \
00038 __res; })
00039
00040 static char * number(char * str, int num, int base, int size, int precision
00041     ,int type)
00042 {
00043     char c,sign,tmp[36];
00044     const char *digits="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
00045     int i;
00046
00047     if (type&SMALL) digits="0123456789abcdefghijklmnopqrstuvwxyz";
00048     if (type&LEFT) type &= ~ZEROPAD;
00049     if (base<2 || base>36)
00050         return 0;
00051     c = (type & ZEROPAD) ? '0' : ' ' ;
00052     if (type&SIGN && num<0) {
00053         sign='-';
00054         num = -num;
00055     } else
00056         sign=(type&PLUS) ? '+' : ((type&SPACE) ? ' ' : 0);
00057     if (sign) size--;
00058     if (type&SPECIAL) {
00059         if (base==16) size -= 2;
00060         else if (base==8) size--;
00061     }
00062     i=0;
00063     if (num==0)
00064         tmp[i++]='0';
00065     else while (num!=0)
00066         tmp[i++]=digits[do_div(num,base)];
00067     if (i>precision) precision=i;
00068     size -= precision;
00069     if (!(type&(ZEROPAD+LEFT)))
00070         while(size-->0)
00071             *str++ = ' ';
00072     if (sign)
00073         *str++ = sign;
00074     if (type&SPECIAL) {
00075         if (base==8)
00076             *str++ = '0';
00077         else if (base==16) {
00078             *str++ = '0';
00079             *str++ = digits[33];
00080         }
00081     }
00082     if (!(type&LEFT))
00083         while(size-->0)
00084             *str++ = c;
00085     while(i<precision--)
00086         *str++ = '0';
00087     while(i-->0)
00088         *str++ = tmp[i];
00089     while(size-->0)
00090         *str++ = ' ';
00091     return str;
00092 }
00093
00094 int vsprintf(char *buf, const char *fmt, va_list args)
00095 {
00096     int len;
00097     int i;
00098     char * str;
00099     char *s;
00100     int *ip;
00101
00102     int flags;      /* flags to number() */
00103
00104     int field_width;    /* width of output field */
00105     int precision;      /* min. # of digits for integers; max
00106                    number of chars for from string */
00107     int qualifier;      /* 'h', 'l', or 'L' for integer fields */
00108
00109     for (str=buf ; *fmt ; ++fmt) {
00110         if (*fmt != '%') {
00111             *str++ = *fmt;
00112             continue;
00113         }
00114
00115         /* process flags */
00116         flags = 0;
00117         repeat:
00118             ++fmt;      /* this also skips first '%' */
00119             switch (*fmt) {
00120                 case '-': flags |= LEFT; goto repeat;
00121                 case '+': flags |= PLUS; goto repeat;
00122                 case ' ': flags |= SPACE; goto repeat;
00123                 case '#': flags |= SPECIAL; goto repeat;
00124                 case '0': flags |= ZEROPAD; goto repeat;
00125                 }
00126
00127         /* get field width */
00128         field_width = -1;
00129         if (is_digit(*fmt))
00130             field_width = skip_atoi(&fmt);
00131         else if (*fmt == '*') {
00132             /* it's the next argument */
00133             field_width = va_arg(args, int);
00134             if (field_width < 0) {
00135                 field_width = -field_width;
00136                 flags |= LEFT;
00137             }
00138         }
00139
00140         /* get the precision */
00141         precision = -1;
00142         if (*fmt == '.') {
00143             ++fmt;
00144             if (is_digit(*fmt))
00145                 precision = skip_atoi(&fmt);
00146             else if (*fmt == '*') {
00147                 /* it's the next argument */
00148                 precision = va_arg(args, int);
00149             }
00150             if (precision < 0)
00151                 precision = 0;
00152         }
00153
00154         /* get the conversion qualifier */
00155         qualifier = -1;
00156         if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') {
00157             qualifier = *fmt;
00158             ++fmt;
00159         }
00160
00161         switch (*fmt) {
00162         case 'c':
00163             if (!(flags & LEFT))
00164                 while (--field_width > 0)
00165                     *str++ = ' ';
00166             *str++ = (unsigned char) va_arg(args, int);
00167             while (--field_width > 0)
00168                 *str++ = ' ';
00169             break;
00170
00171         case 's':
00172             s = va_arg(args, char *);
00173             len = strlen(s);
00174             if (precision < 0)
00175                 precision = len;
00176             else if (len > precision)
00177                 len = precision;
00178
00179             if (!(flags & LEFT))
00180                 while (len < field_width--)
00181                     *str++ = ' ';
00182             for (i = 0; i < len; ++i)
00183                 *str++ = *s++;
00184             while (len < field_width--)
00185                 *str++ = ' ';
00186             break;
00187
00188         case 'o':
00189             str = number(str, va_arg(args, unsigned long), 8,
00190                 field_width, precision, flags);
00191             break;
00192
00193         case 'p':
00194             if (field_width == -1) {
00195                 field_width = 8;
00196                 flags |= ZEROPAD;
00197             }
00198             str = number(str,
00199                 (unsigned long) va_arg(args, void *), 16,
00200                 field_width, precision, flags);
00201             break;
00202
00203         case 'x':
00204             flags |= SMALL;
00205         case 'X':
00206             str = number(str, va_arg(args, unsigned long), 16,
00207                 field_width, precision, flags);
00208             break;
00209
00210         case 'd':
00211         case 'i':
00212             flags |= SIGN;
00213         case 'u':
00214             str = number(str, va_arg(args, unsigned long), 10,
00215                 field_width, precision, flags);
00216             break;
00217
00218         case 'n':
00219             ip = va_arg(args, int *);
00220             *ip = (str - buf);
00221             break;
00222
00223         default:
00224             if (*fmt != '%')
00225                 *str++ = '%';
00226             if (*fmt)
00227                 *str++ = *fmt;
00228             else
00229                 --fmt;
00230             break;
00231         }
00232     }
00233     *str = '\0';
00234     return str-buf;
00235 }
Generated on Sun Mar 6 10:56:06 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/wait.c Source File

wait.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/wait.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009 #include <sys/wait.h>
00010
00011 _syscall3(pid_t,waitpid,pid_t,pid,int *,wait_stat,int,options)
00012
00013 pid_t wait(int * wait_stat)
00014 {
00015     return waitpid(-1,wait_stat,0);
00016 }
Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/include/sys/wait.h Source File

wait.h

Go to the documentation of this file.
00001 #ifndef _SYS_WAIT_H
00002 #define _SYS_WAIT_H
00003
00004 #include <sys/types.h>
00005
00006 #define _LOW(v)     ( (v) & 0377)
00007 #define _HIGH(v)    ( ((v) >> 8) & 0377)
00008
00009 /* options for waitpid, WUNTRACED not supported */
00010 #define WNOHANG     1
00011 #define WUNTRACED   2
00012
00013 #define WIFEXITED(s)    (!((s)&0xFF)
00014 #define WIFSTOPPED(s)   (((s)&0xFF)==0x7F)
00015 #define WEXITSTATUS(s)  (((s)>>8)&0xFF)
00016 #define WTERMSIG(s) ((s)&0x7F)
00017 #define WSTOPSIG(s) (((s)>>8)&0xFF)
00018 #define WIFSIGNALED(s)  (((unsigned int)(s)-1 & 0xFFFF) < 0xFF)
00019
00020 pid_t wait(int *stat_loc);
00021 pid_t waitpid(pid_t pid, int *stat_loc, int options);
00022
00023 #endif
Generated on Sun Mar 6 10:56:05 2005 for Linux Source v0.11 by doxygen 1.4.1


Linux Source v0.11: K:/Linux/lib/write.c Source File

write.c

Go to the documentation of this file.
00001 /*
00002  *  linux/lib/write.c
00003  *
00004  *  (C) 1991  Linus Torvalds
00005  */
00006
00007 #define __LIBRARY__
00008 #include <unistd.h>
00009
00010 _syscall3(int,write,int,fd,const char *,buf,off_t,count)
Generated on Sun Mar 6 10:56:07 2005 for Linux Source v0.11 by doxygen 1.4.1