1.依赖头文件
#include
#include
2.函数定义:
int truncate(const char *path,off_t length);
int ftruncate(int fd,off_t length);
函数说明:
The truncate() and ftruncate() functions cause the regular file named...
分类:
系统相关 时间:
2014-09-14 19:20:57
阅读次数:
289
1.依赖的头文件
#include
2.函数定义:
//通过传入path的方式,改变和文件的拥有关系,如果他是一个符号链接,则跟踪它
int chown(const char *path, uid_t owner, gid_t group);
//通过文件描述的方式进行修改用户所有组等的情况
int fchown(int fd, uid_t owner, gid_t group);
...
分类:
系统相关 时间:
2014-09-14 18:03:07
阅读次数:
321
1.依赖的头文件
#include
2.函数定义:
//通过传入path中给定的文件名的方式来改变文件制定的权限
int chmod(const char *path,mode_t mode);
//通过传入文件描述符的方式为一个文件重设权限
int fchmod(int fd,mode_t mode);
注意:如果使用Linux的chmod命令时,得有root权...
分类:
系统相关 时间:
2014-09-14 15:26:47
阅读次数:
273
1.依赖的头文件
#include
#include
#include
2.函数定义:
//通过传入文件路径,struct stat结构体指针的方式
int stat(const char *path, struct stat *buf);
//通过文件描述符获取文件对应的属性。文件打开后这样操作
int fstat(int fd, struct stat *buf)...
分类:
系统相关 时间:
2014-09-14 12:52:37
阅读次数:
352
select比epoll效率差的原因:select是轮询,epoll是触发式的,所以效率高。Select:1.Socket数量限制:该模式可操作的Socket数由FD_SETSIZE决定,内核默认32*32=1024.2.操作限制:通过遍历FD_SETSIZE(1024)个Socket来完成调度,不...
分类:
系统相关 时间:
2014-09-13 20:06:55
阅读次数:
199
#include "elf.h"
#include
int main(int argc, char *argv[])
{
FILE *fp;
int i = 0;
int fd = 0;
Elf64_Ehdr ehdr;
if ((fp=fopen(argv[1],"r"))==NULL)
{
...
分类:
其他好文 时间:
2014-09-12 08:55:03
阅读次数:
259
#include "elf.h"
#include
int main(int argc, char *argv[])
{
FILE *fp;
int i = 0;
int fd = 0;
Elf64_Ehdr ehdr;
if ((fp=fopen(argv[1],"r"))==NULL)
{
...
分类:
其他好文 时间:
2014-09-12 08:54:53
阅读次数:
183
// 创建文件上传路径 public static void mkdir(String path) { File fd = null; try { fd = new File(path); if (!fd.exists()...
分类:
编程语言 时间:
2014-09-11 07:39:51
阅读次数:
195
今天在看redis源码的时候发现这样的一种函数定义方法,就是将函数作为类型来定义,然后在结构体当中使用 typedef void aeFileProc(struct aeEventLoop *eventLoop, int fd, void *clientData, int mask); typ...
分类:
其他好文 时间:
2014-09-10 13:55:30
阅读次数:
259
struct epoll_event 的data成员是一个union类型里面要么就是fd,要么就是ptr最好不要一会用ptr一会用fd最好坚持从头到尾的使用一个第一种只是使用epoll_event.data.fd#include #include #include #include #include...
分类:
其他好文 时间:
2014-09-09 22:50:29
阅读次数:
293