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函数详解
相关文档:
Linux内核中用于同步的几种机制集中起来分析,强调了它们之间在实现和使用上的不同。
同步通常是为了达到多线程协同的目的而设计的一种机制,通常包含异步信号机制和互斥机制作为其实现的底层。在Linux 2.4内核中也有相应的技术实现,包括信号量、自旋锁、原子操作和等待队列,其中原子操作和等待队列又是实现信号量的 ......
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 ......
转自:http://www.cic.tsinghua.edu.cn/jdx/book1/CHAPTER3.htm
在源文件开始增加#include <winsock.h>语句。
调用WSAStartup()函数初始化Windows Sockets DLL,并在结束时调用WSACleanup()函数通知Windows Sockets DLL释放资源。
将套接字的类型为int改为SOCKET。
获取、设置错误码不要使用全局变量er ......
网上有篇帖子包含里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 ......