S_ISREG等几个常见的宏 struct stat

S_ISLNK(st_mode):是否是一个连接.
S_ISREG是否是一个常规文件.
S_ISDIR是否是一个目录S_ISCHR是否是一个字符设 备.
S_ISBLK是否是一个块设备
S_ISFIFO是否 是一个FIFO文件.

S_ISSOCK是否是一个SOCKET文件 

man 2 stat ... 
struct
 stat {
             dev_t st_dev;                       
 
             ino_t st_ino;                         
             mode_t st_mode;                 
 
             nlink_t st_nlink;                   
 
             uid_t st_uid;                        
 
             gid_t st_gid;                         
             dev_t st_rdev;                      
 
             off_t st_size;                        
 
             blksize_t st_blksize;               
 
             blkcnt_t st_blocks;                
 
             time_t st_mtime;                  
 
             time_t st_ctime;                    
 
 }; ...

你可能感兴趣的:(socket,struct)