zoukankan      html  css  js  c++  java
  • minix文件读写中使用的一个额外但是必须的结构filp表

    1.为什么需要他

    因为子进程与父进程之间需要共享文件读写指针。

    2.构成

    代码:

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                          servers/fs/file.h
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    
     21700    /* This is the filp table.  It is an intermediary between file descriptors and
     21701     * inodes.  A slot is free if filp_count == 0.
     21702     */
     21703    
     21704    EXTERN struct filp {
     21705      mode_t filp_mode;             /* RW bits, telling how file is opened */
     21706      int filp_flags;               /* flags from open and fcntl */
     21707      int filp_count;               /* how many file descriptors share this slot?*/
     21708      struct inode *filp_ino;       /* pointer to the inode */
     21709      off_t filp_pos;               /* file position */
       File: Page: 928 servers/fs/file.h
     21710    
     21711      /* the following fields are for select() and are owned by the generic
     21712       * select() code (i.e., fd-type-specific select() code can't touch these).
     21713       */
     21714      int filp_selectors;           /* select()ing processes blocking on this fd */
     21715      int filp_select_ops;          /* interested in these SEL_* operations */
     21716    
     21717      /* following are for fd-type-specific select() */
     21718      int filp_pipe_select_ops;
     21719    } filp[NR_FILPS];
     21720    
     21721    #define FILP_CLOSED     0       /* filp_mode:  associated device closed */
     21722    
     21723    #define NIL_FILP (struct filp *) 0      /* indicates absence of a filp slot */

    filp真正必须包含的内容是共享文件的位置,但是实现时候将inode也放在里面。

    这么做的好处是,在进程表中的文件描述符数组只需要包含指向filp表项的指针。

  • 相关阅读:
    SQL Server2016 AlwaysOn无域高可用
    Windows Server 2016 无域故障转移群集
    SQL Server高可用实现方案
    oracle11g RMAN catalog的基本使用
    Oracle_Windows server ORA-01031: insufficient privileges
    MySQL MGR 单主模式下master角色切换规则
    SQL Server AlwaysOn原理简介
    DB2创建视图并授权给其他用户
    Oracle数据库用户的密码过期问题处理
    访问GitLab的PostgreSQL数据库
  • 原文地址:https://www.cnblogs.com/jun14/p/2809999.html
Copyright © 2011-2022 走看看