1 // CopyStandardInputToStandardOutput.cpp 2 #include "../apuesunyj.h" 3 4 #define BUFFSIZE 4096 5 6 int main(void) 7 { 8 int n; 9 char buf...
分类:
其他好文 时间:
2015-02-10 20:15:52
阅读次数:
180
1 // 1.3ListAllTheFilesInADirectory.cpp 2 #include 3 4 #include "../apuesunyj.h" 5 6 int main(int argc, char *argv[]) 7 { 8 DIR *dp; 9 str...
分类:
其他好文 时间:
2015-02-10 20:15:06
阅读次数:
133
// apue.h
#ifndef APUE_SUNYJ
#define APUE_SUNYJ void err_quit(const char *fmt, ...);
void err_sys(const char *fmt, ...); #endif
// error.cpp
#include ...
分类:
系统相关 时间:
2015-02-10 18:37:05
阅读次数:
495
APUE: Advance Programming in the Unix EnviromentULK : Undertanding the Linux Kernel一直想读这两本书,希望对Linux有更多的了解,尤其是memory management & multi-process/thread...
分类:
系统相关 时间:
2015-02-09 20:10:41
阅读次数:
135
习题3.2的要求是不使用fcntl()而编写一个同dup2()功能相同的函数。直觉上是不断使用dup()直到返回指定的文件描述符。#include #include #define OPEN_MAX 63int my_dup2(int filedes,int filedes2);intmain(in...
分类:
系统相关 时间:
2015-02-08 23:09:46
阅读次数:
296
原文网址:http://www.cnblogs.com/fusae-blog/p/4256794.htmlAPUE第三章的最后面给出的函数,现在还用不着,所以,先留个名字,待到时候用着了再补上好了。dup和dup2函数:用来复制文件描述符的sync函数,fsync函数和fdatasync函数:大致的...
分类:
其他好文 时间:
2015-02-08 21:52:41
阅读次数:
202
问题:编写一个程序,它调用uname并输出utsname结构中的所有字段,并将输出与uname(1)命令的输出结构做比较。我本来以为utsname结构也跟passwd结构一样,也有那三个函数来获取整个结构的内容,但是看了头文件后才发现,头文件里面除了结构体的定义就只有这个uname函数了。我用逐项输...
分类:
其他好文 时间:
2015-02-07 13:06:53
阅读次数:
116
这一章主要介绍了口令文件和组文件的结构和一些围绕这些结构的函数。口令文件即passwd就是在/etc/passwd中可以查阅。其结构是:上图四个平台能支持的就用黑点表示。因为加密口令这一项放在passwd这个人人可读的文件中,可能会有安全问题。所以现在的Linux中的加密口令都是放在/etc/sha...
分类:
其他好文 时间:
2015-02-07 11:25:57
阅读次数:
115
// threads/exitstatus.c 11-2
#include "apue.h"
#include void* thr_fn1(void* arg)
{ printf("thread 1 returning\n"); /* return a variable of type void* ...
分类:
编程语言 时间:
2015-02-06 23:09:43
阅读次数:
197
程序清单11-1打印线程ID// threads/threadid.c 11-1
#include "apue.h"
#include pthread_t ntid; void printids(const char* s)
{ printf("%d ", (unsigned int)ntid); ...
分类:
编程语言 时间:
2015-02-06 21:43:01
阅读次数:
339