原创 linux下面编程的几个数据结构

2008-7-3 20:07 3477 12 12 分类: 工程师职场

1、获取磁盘信息


                              struct   statfs   {  
                                    long         f_type;           /*   type   of   filesystem   (see   below)   */  
                                    long         f_bsize;         /*   optimal   transfer   block   size   */  
                                    long         f_blocks;       /*   total   data   blocks   in   file   system   */  
                                    long         f_bfree;         /*   free   blocks   in   fs   */  
                                    long         f_bavail;       /*   free   blocks   avail   to   non-superuser   */  
                                    long         f_files;         /*   total   file   nodes   in   file   system   */  
                                    long         f_ffree;         /*   free   file   nodes   in   fs   */  
                                    fsid_t     f_fsid;           /*   file   system   id   */  
                                    long         f_namelen;     /*   maximum   length   of   filenames   */  
                              };  
   
  f_bfree   *   f_bsize   应该就是剩余空间


2、获得终端信息的


termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed - 获取和设置终端属性,行控制,获取和设置波特率


 


它是指向一个 termios 结构的指针。这个结构包含了至少下列成员:



tcflag_t c_iflag;      /* 输入模式 */
tcflag_t c_oflag;      /* 输出模式 */
tcflag_t c_cflag;      /* 控制模式 */
tcflag_t c_lflag;      /* 本地模式 */
cc_t c_cc[NCCS];       /* 控制字符 */

PARTNER CONTENT

文章评论0条评论)

登录后参与讨论
我要评论
0
12
关闭 站长推荐上一条 /3 下一条