APUE Cpt 1

读完了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 854



When this program runs, it calls the function getpid to obtain its process ID.

Figure 1.6. Print the process ID
#include "apue.h"

int
main(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.4 In 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?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值