随笔分类 -  Linux编程

摘要:从指针的层次上理解函数——函数的函数名实际上就是一个指针,函数名指向该函数的代码在内存中的首地址 对此,我们写如下代码做测试: int fun(int a) { return a; } int main() { cout << fun(22) << endl; cout << (*fun)(33) 阅读全文
posted @ 2021-01-18 12:17 zeroPatrick 阅读(47) 评论(0) 推荐(0)
摘要:kill 信号列表 SignalDescriptionSignal number on Linux x86[1] SIGABRT Process aborted 6 SIGALRM Signal raised by alarm 14 SIGBUS Bus error: "access to unde 阅读全文
posted @ 2021-01-18 10:51 zeroPatrick 阅读(1093) 评论(0) 推荐(0)
摘要:头文件<stdio.h> C 库函数 void perror(const char *str) 用来将上一个函数发生错误的原因输出到标准设备(stderr)。参数 s 所指的字符串会先打印出,后面再加上错误原因字符串。此错误原因依照全局变量errno的值来决定要输出的字符串。 在库函数中有个errn 阅读全文
posted @ 2021-01-18 10:23 zeroPatrick 阅读(375) 评论(0) 推荐(0)
摘要:头文件 <stdlib.h> C 库函数 void exit(int status) 立即终止调用进程。任何属于该进程的打开的文件描述符都会被关闭,该进程的子进程由进程 1 继承,初始化,且会向父进程发送一个 SIGCHLD 信号。 EXIT_SUCCESS 和 EXIT_FAILURE 是常量,其 阅读全文
posted @ 2021-01-18 09:39 zeroPatrick 阅读(168) 评论(0) 推荐(0)
摘要:机器环境:Lubuntu-16.04 首先查看 /usr/include 目录下的 unistd.h 其中有这样两行: 220 #include <bits/types.h> 263 typedef __pid_t pid_t; 即:pid_t 是 __pid_t 的别名。 由此,我们到 /usr/ 阅读全文
posted @ 2021-01-17 20:52 zeroPatrick 阅读(1379) 评论(0) 推荐(1)
摘要:《Linux高性能服务器编程》游双 阅读全文
posted @ 2021-01-14 20:57 zeroPatrick 阅读(79) 评论(0) 推荐(0)
摘要:/* * File: Client.c * Author: root * * Created on 2012年6月20日, 下午1:30 */ #include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <strin 阅读全文
posted @ 2021-01-04 22:55 zeroPatrick 阅读(118) 评论(0) 推荐(0)