APUE Cpt 1

来源:互联网 发布:弱视治疗软件 编辑:程序博客网 时间:2024/06/04 01:29

读完了Advanced Programming in the UNIX Environment (APUE)chapter 1,但不能说学完了……嗯……蛮仔细的一点一点看的。


现在写写课后题?突然发现要上课了……好吧……先留着……


ok……拖了很久,终于开始写了。

1.1 Verify on your system that the directories dot and dot-dot are not the same, except in the root directory.

在linux或者unix目录下,dot(.)表示的是当前目录,dot-dot(..)表示父亲目录.

e.g../a.out 就是执行当前目录的a.out

e.g.cd .. 就是返回上层目录。其中根目录(/)的father-direction is itself.

1.2 In the output from the program in Figure 1.6, what happened to the processes with process IDs 852 and 853?

If we compile this program into the file a.out and execute it, we have   $ ./a.out   hello world from process ID 851   $ ./a.out   hello world from process ID 854When this program runs, it calls the function getpid to obtain its process ID.Figure 1.6. Print the process ID#include "apue.h"intmain(void){    printf("hello world from process ID %d\n", getpid());    exit(0);}
the UNIX is a multi-programming, or multitasking, system. Other processes were running at that time.


1.3 In Section 1.7, the argument to perror is defined with the ISO C attribute const, whereas the integer argument to strerror isn't defined with the attribute. Why?

1.4In the error-handing function err_sys in Appendix B, why is the value of errno saved when the function sis called?

太监了吧

写到这里,突然觉得写得没啥意思……答案哪里都有了,中文的,英文的……


还要我做什么?等我遇到没有答案的,找到答案再来写上吧……就把这个文章摆成现在残破的样子……倒也不错


1.1


1.2

In the output from the program in Figure 1.6, what happened to the processes with process IDs 852 and 853?

1.3

In Section 1.7, the argument to perror is defined with the ISO C attribute const, whereas the integer argument to strerror isn't defined with this attribute. Why?

1.4

In the error-handling function err_sys in Appendix B, why is the value of errno saved when the function is called?

1.5

If the calendar time is stored as a signed 32-bit integer, in what year will it overflow? What ways can be used to extend the overflow point? Are they compatible with existing applications?

1.6

If the process time is stored as a signed 32-bit integer, and if the system counts 100 ticks per second, after how many days will the value overflow?