mycat/mycat.c#include "apue.h"#define BUFFSIZE 4096intmain(void){ int n; char buf[BUFFSIZE]; while ((n = read(STDIN_FILENO, buf, BUFFSIZE)) > 0) if .....
分类:
其他好文 时间:
2014-07-19 00:00:58
阅读次数:
216
file/filetype.c #include "apue.h"intmain(int argc, char *argv[]){ int i; struct stat buf; char *ptr; for (i = 1; i < argc; i++) { printf("%s: ", argv[...
分类:
其他好文 时间:
2014-07-18 23:38:27
阅读次数:
412
lib/setfl.c #include "apue.h"#include voidset_fl(int fd, int flags) /* flags are file status flags to turn on */{ int val; if ((val = fcntl(fd, F_GETF...
分类:
其他好文 时间:
2014-07-18 23:38:21
阅读次数:
333
lib/openmax.c#include "apue.h"#include #include #ifdef OPEN_MAXstatic long openmax = OPEN_MAX;#elsestatic long openmax = 0;#endif/* * If OPEN_MAX is i...
分类:
其他好文 时间:
2014-07-18 23:36:31
阅读次数:
279
file/hole.c #include "apue.h"#include char buf1[] = "abcdefghij";char buf2[] = "ABCDEFGHIJ";intmain(void){ int fd; if ((fd = creat("file.hole", FILE_M...
分类:
其他好文 时间:
2014-07-18 23:35:26
阅读次数:
193
file/fileflags.c #include "apue.h"#include intmain(int argc, char *argv[]){ int val; if (argc != 2) err_quit("usage: a.out "); if ((val = fcntl(atoi(a...
分类:
其他好文 时间:
2014-07-18 23:28:24
阅读次数:
203
file/seek.c#include "apue.h"intmain(void){ if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1) printf("cannot seek\n"); else printf("seek OK\n"); exit(0);}
分类:
其他好文 时间:
2014-07-18 23:27:20
阅读次数:
187
8.1 引言本章介绍UNIX的进程控制,包括创建新进程、执行程序和进程终止。还将说明进程属性的各种ID-----实际、有效和保存的用户和组ID,以及他们如何受到进程控制原语的影响。本章还包括了解释器文件和system函数。本章最后讲述大多数UNIX系统所提供的进程会计机制。这种机制使我们能够从另一个...
分类:
其他好文 时间:
2014-07-18 14:18:37
阅读次数:
225
每个线程都有自己的信号屏蔽字,但是信号的处理是进程中所有线程共享的。进程中的信号是递送到单个线程的。线程中pthread_sigmask函数类似与进程的sigprocmask函数,可以用来阻塞信号。#include int pthread_sigmask(int how,const sigset_t...
分类:
编程语言 时间:
2014-07-18 08:34:25
阅读次数:
325
7.1 引言本章将学习:当执行程序时,其main函数是如何被调用的;命令行参数是如何传送给执行程序的;典型的存储器布局是什么样式;如何分配另外的存储空间;进程如何使用环境变量;各种不同的进程终止方式等;另外还将说明longjmp和setjmp函数以及它们与栈的交互作用;还将介绍研究进程的资源限制7....
分类:
其他好文 时间:
2014-07-17 10:07:37
阅读次数:
363