Linux系统调用
功能描述:
获取一些文件相关的信息。
用法:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int stat(const char *path, struct stat *buf);
int fstat(int filedes, struct stat *buf);
int lstat(const char *path, struct stat *buf);
参数:
path:文件路径名。
filedes:文件描述词。
buf:是以下结构体的指针
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; /* 分配给文件的块的数量,512字节为单元 */
time_t st_atime; /* 最后访问时间 */
time_t st_mtime; /* 最后修改时间 */
time_t st_ctime; /* 最后状态改变时间 */
};
返回说明:
成功执行时,返回0。失败返回-1,errno被设为以下的某个值
EBADF: 文件描述词无效
EFAULT: 地址空间不可访问
ELOOP: 遍历路径时遇到太多的符号连接
ENAMETOOLONG:文件路径名太长
ENOENT:路径名的部分组件不存在,或路径名是空字串
ENOMEM:内存不足
ENOTDIR:路径名的部分组件不是目录
Linux系统调用--fstat/stat/lstat函数详解
相关文档:
准备工作:
用到的perl 扩展组件(modules)在上篇贴出.( win32::odbc 模块
)下载组件后按照Readme文件安装倒响应目录.配置好相应的odbc数据源.
程序实现:
使用
use
Win32::ODBC;
语句包含应使用的模块是win32::odbc,写出数据库
连接字符串
$DSN = "DSN =
My DSN ......
5.3.2 设备类型分类
纵览linux/drivers目录,大概还有35个以上的子目录,每个子目录基本上就代表了一种设备驱动,有atm、block、char、misc、input、net、usb、sound、video等。这里只描述在嵌入式系统里面用得最为广泛的3种设备。
1.字符设备(char device)
字符设备是Linux最简单的设备,可以像文件一样访问。 ......
Linux
多线程编程:【
http://fanqiang.chinaunix.net/a4/b8/20010811/0905001105.html
】
Linux
多线程支持
POSIX
线程接口,称为
pthread,
pthread_create
用来创建线程,
pthread_join
等待线程结束,函数的原型分别如下:
&nbs ......
add user:
[root@localhost ~]# useradd test
[root@localhost ~]# passwd test
add user to a group:
e.g. add nexus to admin
useradd -g admin nexus
default role:
[root@localhost ~]# useradd -D
GROUP=100
HOME=/home
INACTIVE=-1
EXPIRE=
SHELL=/bin/bash
SKEL=/etc/skel
CREATE_MAIL_SPOOL=no
de ......
网上有篇帖子包含里linux下的dnw,我在用idea6410,编译dnw和secbulk后并不能正常使用
LINUX下的DNW程序下载
http://linux.chinaunix.net/bbs/viewthread.php?tid=1055992
secbulk设备未建立,手动建立/dev/secbulk0并不起作用,原因是secbulk probe会匹配id_table,这个是为QQ2440准备的,所以需要改id_table
static s ......