![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C/C++/Linux
lantianjialiang
这个作者很懒,什么都没留下…
展开
-
Linux中的五种网络API的模型的解释
Blocking I/O一堆人去咖啡店买咖啡,第一个人点了咖啡后,就在柜台前等店员煮好咖啡;第一个人拿到咖啡后,才可以服务下一个人;Non-Blocking I/O一堆人去咖啡店买咖啡,第一个人点了咖啡后,他一直会问店员,咖啡好了没?没好的话,等一会继续问;直到咖啡好了为止I/O Multiplexing店员回主动通知客人咖啡好了,但是客人还是需要站在柜台旁边等着select/poll/epollSignal-driven I/O客人在柜台点餐后,客人就可以离开去干别的事情了;咖啡好了后店员主动通知原创 2022-11-09 18:28:10 · 492 阅读 · 0 评论 -
64bit architecture support 32bit so file
64bit architecture support 32bit so file# dpkg --print-architectureamd64# dpkg --print-foreign-architectures# dpkg --add-architecture i386# dpkg --print-foreign-architecturesi386# dpkg --remove-architecture i386# dpkg --print-foreign-architecture原创 2021-06-17 10:45:55 · 131 阅读 · 0 评论 -
Ubuntu apt source的软件分类
main:完全的自由软件。restricted:不完全的自由软件。universe:ubuntu官方不提供支持与补丁,全靠社区支持。muitiverse:非自由软件,完全不提供支持和补丁。https://www.cnblogs.com/neters/p/8964384.htmlhttps://www.cnblogs.com/sparkdev/p/10489017.html...原创 2021-06-17 10:44:10 · 165 阅读 · 0 评论 -
apt update output
apt update outputWhen you use apt-get update it verifies if the same update indexes need downloading, if not it does not download the same updated indexes again.Hit means apt checked the timestamps on package list, those match and there are no changes.原创 2021-06-17 10:40:43 · 111 阅读 · 0 评论 -
Apache httpd module learning memo2
port.conf文件是让httpd监听某些端口[root@controller conf]# pwd/etc/httpd/conf[root@controller conf]# cat ports.conf# ************************************# Listen & NameVirtualHost resources in module puppetlabs-apache# Managed by Puppet# ******************原创 2021-06-17 10:33:15 · 86 阅读 · 0 评论 -
docker使用时的命令
docker remove imagedocker rmi IMAGEdocker rm CONTAINERdocker commit: create images from containerdocker commit -a liang -m "ubuntu installed basic tools" b3185dbd6b39 ubuntu-basic:20.04docker container clean# docker container pruneWARNING! This wi原创 2021-06-17 10:33:33 · 100 阅读 · 0 评论 -
在中国,在Ubuntu上安装OpenStack需要的mirror
replace ubuntu mirror# vi /etc/apt/sources.list# tsinghua ubuntu 20.04 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe mult原创 2021-06-16 17:57:07 · 406 阅读 · 0 评论 -
cirros的密码
在openstack中使用到的默认image是cirros,但是在使用的时候一直创建不了instance,最后发现packstack安装的cirrosimage文件很小,应该是下载的时候网络断掉了。所以重新在他们的官网上下载一个后,上传到openstack中去,就可以创建instance了。但是在使用virsh console连接cirros的instance的时候,不知道用户名和密码。其实在进入console之后连续按两次enter键,就会提示用户名和密码是什么了。...原创 2021-06-16 17:45:43 · 3423 阅读 · 0 评论 -
CentOS中查找包依赖和所安装的文件
find the rpm dependency(rpm or yum)# rpm -qR openstack-packstack-puppet# yum -q deplist openstack-packstack-puppetfind which package contains the specified file# rpm -qf /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libgomp.so# rpm -qf [file name]# yum wh.原创 2021-06-16 17:41:02 · 1050 阅读 · 0 评论 -
CentOS/Ubuntu下的包安装时的额外处理
find the deb postinst under below folder/var/lib/dpkg/infodeb包的介绍control 用了记录软件标识,版本号,平台,依赖信息等数据preinst 在解包data.tar.gz前运行的脚本postinst 在解包数据后运行的脚本prerm 卸载时,在删除文件之前运行的脚本postrm 在删除文件之后运行的脚本https://blog.csdn.net/gatieme/article/details/5282990原创 2021-06-16 17:35:31 · 140 阅读 · 0 评论 -
Ubuntu下查找package的依赖
11.root@b5100be54915:/etc/mysql/mariadb.conf.d# apt list|grep openstackWARNING: apt does not have a stable CLI interface. Use with caution in scripts.openstack-dashboard-common/focal-updates 4:19.2.0-0ubuntu1~cloud0 allopenstack-dashboard-ubuntu-th..原创 2021-06-16 17:31:55 · 480 阅读 · 0 评论 -
在CentOS/Ubuntu下,怎么找到你安装的文件
CentOS:# rpm -qa | grep package_keyword# rpm -ql package_nameUbuntu10. search/list file for package in ubuntu# dpkg-query -l# dpkg -l|grep openstackii python3-openstackclient 5.5.0-0ubuntu1~cloud0 all OpenStack Command-li原创 2021-06-16 17:29:20 · 104 阅读 · 0 评论 -
最新版本的mysql-workbench在Ubuntu 20上连接maridb崩溃
mysql-workbench seems can not direct connect to maridbpay attention the bind ip address for maridb when create connection# netstat -nap|grep 3306|grep LISTEtcp 0 0 192.168.8.13:3306 0.0.0.0:* LISTEN 1617/mysqld原创 2021-06-16 17:23:23 · 142 阅读 · 0 评论 -
Ubuntu/CentOS中的journal log的查看方法
什么是journal log它是一个binary格式的集中存放的Linux系统下的log文件Journal is a component of systemd. It capture log messages of kernel logs, syslog messages, or error log messages. It collect them, index them and makes availabe to the users. Journal are stored in /run/log/原创 2021-06-16 13:32:30 · 1409 阅读 · 0 评论 -
puppet的一些总结
packstack使用的是puppet安装的openstack,所以把puppet简单的分析了一下。Puppet will perform the following tasks:Test whether the resource is already in sync with the target stateIf the resource is not in sync, it will trigger a sync actiondot file to png# dot -Tpng relat原创 2021-05-28 10:49:21 · 160 阅读 · 0 评论 -
启用iptables的log
use insert to insert the rule into the first entry to input table, or your packet maybe drop by the previous rule# iptables -I INPUT -j LOG log file is here check with below commandShow only kernel messages. This implies -b and adds the match “_TRANSPO原创 2021-05-28 10:40:26 · 953 阅读 · 0 评论 -
使用命令来查看rabbitmq的状态
# man rabbitmq-env.conf# rabbitmqctl report# rabbitmqctl status# rabbitmqctl list_usersListing usersguest [administrator]use Erlang to display RabbitMQ configuration parameters.[root@controller rabbitmq]# rabbitmqctl eval 'application:get_all_en原创 2021-05-28 10:32:50 · 2455 阅读 · 0 评论 -
Apache httpd module learning memo 1
moduleModules are pieces of code which can be used to provide or extend functionality of the Apache HTTP Server.Modules can either be statically or dynamically included with the core.For static inclusion, the module’s source code has to be added to the原创 2021-05-21 11:14:09 · 99 阅读 · 0 评论 -
how to monitor Linux with MRTG
install MRTG/SNMP# yum install mrtg net-snmp net-snmp-utilsconfig SNMP# modify /etc/snmp/snmpd.conf file# chkconfig snmpd on# service snmpd restartconfig MRTG/etc/mrtg/mrtg.cfggather dataenv LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfghttps:/.原创 2020-08-21 11:30:44 · 134 阅读 · 0 评论 -
linux 软连接和硬链接的区别
(1)软连接可以 跨文件系统 ,硬连接不可以 。实践的方法就是用共享文件把windows下的aa.txt文本文档连接到linux下/root目录 下 bb. ln -s aa.txt /root/bb 连接成功 。lnaa.txt /root/bb 失败 。(2)关于 I节点的问题 。硬连接不管有多少个,都指向的是同一个I节点,会把 结点连接数增加,只要结点的连接数不是 0,文件就一转载 2008-10-22 14:34:00 · 550 阅读 · 0 评论 -
Linux's boot process explained
Short history of the UNIX operating system Linux is an implementation of the UNIX operating system concept. UNIX was derived from AT&Ts ”Sys V” (System 5). The initialization process is meant to con转载 2008-10-22 14:41:00 · 613 阅读 · 0 评论 -
Test/Test2/Test3/Test4(内存问题)
#include #include #include #include /* * Test.cpp * * Created on: Oct 22, 2008 * Author: root */char *GetMemory(void) { char p[] = "hello world"; return p;}void Test(void) { char *str =转载 2008-10-22 18:14:00 · 1272 阅读 · 0 评论 -
如何在Linux使用Eclipse + CDT开发C/C++程序?
见: http://www.cppblog.com/oomusou/转载 2008-10-22 16:47:00 · 478 阅读 · 0 评论 -
C++ 拷贝构造函数的调用
拷贝构造函数主要在以下三种情况下起初始化作用:1. 在声明语句中用一个对象初始化另一个对象;2. 将一个对象作为参数按值调用方式传递给另一个对象时生成对象副本;3. 生成一个临时对象作为函数的返回结果。(这种情况只有在windwos下是真的,我只是在windos xp + VC 6.0)以下面的代码为例:// Tt.cpp : Defines the entry point for the co原创 2008-10-22 19:20:00 · 729 阅读 · 0 评论 -
c源代码到可执行文件的过程
编译器(Compiler)是一个将一种语言的指令集转换成等价的另一种语言的指令集的程序。 我们通常认为编译器总是将像C++一样的高级语言转换成目标计算机硬件能够执行的文件,但是不总是这样的。很多编译器只是将代码转换成汇编语言,还有一些将一种高级语言转换成另外一种高级语言。以下是对GCC的编译过程的描述:预处理(Pre-Processing)预处理程序主要完成的工作是:头文件(Include fil原创 2008-10-13 14:29:00 · 1191 阅读 · 0 评论 -
elf文件查找函数的过程
要反编译的程序:hello.c#includeint main(){ printf("Hello World!/n"); return 0;} 1.对hello进行反汇编,并查找包含"printf"的行;可以看到它调用了地址0x80482b0的函数;[root@localhost src]# objdump -d hello | grep printf080482b0 : 804838c:原创 2008-10-13 14:43:00 · 2262 阅读 · 0 评论 -
extern变量和inculde的区别
[root@localhost src2]# cat test.cint a = 10;static int b = 100;[root@localhost src2]# cat main.c#include #include "test.c"extern int a;extern int b;int main(){ printf("a is %d/n", a); printf("b is %原创 2008-10-14 15:29:00 · 1216 阅读 · 0 评论 -
C/C++中的指针
Step 1:int a;//定义了一个整型变量aint *p;//定义了一个整型指针pint **p;//定义了一个整型指针的指针 int array[];//定义了一个整型数组arrayint (*pointerToArray)[];//定义了一个指向整型数组的指针pointerToArrayint *array[];//定义了一个数组array,数组的内容是整型指针int method();原创 2008-11-12 14:48:00 · 665 阅读 · 0 评论 -
使用stty屏蔽ctrl+c,ctrl+s
注意只适用stty进行设置之前,要先使用stty -g进行备份;stty -isig 屏蔽ctrl+c等信号stty -ixon 屏蔽ctrl+s等信号原创 2009-12-09 10:07:00 · 1326 阅读 · 1 评论 -
opensolaris下启动/停止/查看服务状态的命令
启动服务:svcadm enable network/ftp停止服务:svcadm disable network/ftp 查看服务状态:svcs -l /network/ftp 或者svcs -a | grep ftp http://www.linuxtopia.org/online_books/opensolaris_2008/SYSADV4/html/原创 2010-03-11 15:55:00 · 729 阅读 · 0 评论 -
linux下的netstat命令
Displaying the Routing Table:netstat -nrDisplaying Interface Statistics:netstat -iShow the address resolution (ARP) tables:netstat -pDisplaying Connections:netstat -ta (linux)netstat -原创 2010-03-11 15:53:00 · 529 阅读 · 0 评论 -
解压.tar.gz文件
先使用:tar xzf filename.tar.gz如果不行的话,使用:gzip -dc filename.tar.gz | tar xf -解释:[http://freeengineer.org/learnUNIXin10minutes.html#Listing]gzip -d decompressgzip -c write on standard output,原创 2010-03-11 16:58:00 · 432 阅读 · 0 评论 -
bash中的quote(/,',")
Quoted characters do not have a special meaning以下的命令都一个执行:touch file1 file2ls file1 file2rm file1 file2touch file1 file2ls file1 file2rm file1 file2touch file1 file2ls原创 2010-03-31 14:04:00 · 957 阅读 · 0 评论 -
bash中的$0,$@,$*等的意义
$0 - Scriptname$* - All positional parameters$@ - All positional parameters with spaces$# - Number of parameters$$ - Current process ID$! - ID of Background job$? - error status原创 2010-03-31 14:11:00 · 590 阅读 · 0 评论 -
bash中特殊的变量赋值
看例子就好: unset X Y Z#${variable?value} - Complain if undefinedcat ${jack?"Please define jack, and try again"}#${variable-default} - Use default if undefinedecho X is: $Xecho X is: ${X-defa原创 2010-03-31 14:12:00 · 687 阅读 · 0 评论 -
如何写扩张mib
0.环境:OS:opensolaris 2009.06版gcc:3.4.3 (csl-sol210-3_4-20050802)snmp:NET-SNMP version: 5.0.91.环境准备 确认snmp和gcc的相关包是否已经安装: pkginfo SUNWsmaS pkginfo SUNWsmdoc pkginfo SUNWsm原创 2010-04-22 11:40:00 · 2154 阅读 · 0 评论 -
write mib and let it run
1.write mib尽管这里没有具体写,但是写一个mib文件是很费力的事情。将自己的mib文件放到: /etc/sma/snmp/mibs(refs:http://www.net-snmp.org/wiki/index.php/TUT:Using_and_loading_MIBS)让snmpd加载你写的mib文件:/etc/sma/snmp/snmp.conf:追加一原创 2010-04-27 10:13:00 · 1166 阅读 · 0 评论 -
在opensolaris下设置DNS和DHCP
首先以DHCP获得IP:ifconfig pcn0 dhcp start启动完成后,检查默认网关是否正确获得:netstat -nr如果没有正确获得,/etc/defaultrouter文件中应该有东西,有的话,将之删除cat /etc/defaultrouter然后重新运行:ifconfig pcn0 dhcp start 在DHCPserver中是可以设置D原创 2010-04-27 09:44:00 · 718 阅读 · 0 评论 -
杂项--20100514
windows:turn on/off windows firewall with command:netsh firewall set opmode enablenetsh firewall set opmode disable递归copy目录: xcopyxcopy /e *.* e:/testlinux:递归copy目录: cp -r src原创 2010-05-14 09:44:00 · 420 阅读 · 0 评论 -
在opensoalris下net-snmp使用的加密库
如果你在netsnmp的官网上的说明的话,你会以为他是用的是openssl,其实不是的,我刚开始也以为是使用的openssl,但是在多次尝试未果的情况下,我使用ldd才知道它使用的是libpkcs11.具体见下面的分析: test@test:~# ldd /usr/sbin/snmpd libc.so.1 => /lib/libc.so.1 li原创 2010-05-14 09:54:00 · 802 阅读 · 0 评论