2011年10月13日木曜日

emacs tab幅

set-variable[RET]tab-width[RET]4



(setq tab-width 4)
(setq tab-stop-list '(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80))
(setq indent-tabs-mode nil)



2011年9月17日土曜日

rpmの使い方 情報表示 その2

未インストール時-qp
インストール時-q

パッケージ情報rpm -qpi MyPkgXXX-0.0-0.x86_64.rpm

パッケージ内ファイルrpm -qpl MyPkgXXX-0.0-0.x86_64.rpm

パッケージ内のファイル状態(normal/not install/replaced)
rpm -qps MyPkgXXX-0.0-0.x86_64.rpm

install/uninstallスクリプトpreinstall/postinstall/preuninstall
rpm -qp --scripts MyPkgXXX-0.0-0.x86_64.rpm

依存パッケージ情報rpm -qp --requires MyPkgXXX-0.0-0.x86_64.rpm
rpm -q --whatrequires ntsysv

提供パッケージ情報rpm -qp --provides MyPkgXXX-0.0-0.x86_64.rpm
rpm -q --whatprovides ntsysv



2011年8月13日土曜日

CPUコア数を調べる /proc/cpuinfo

cat /proc/cpuinfo |egrep 'physical id|core' |sort

physical id の数字(種) ソケットに挿さっているCPUチップの数。
core id の数字(種)1コアのスレッド数
同じcore id が複数表示されたらそれは1つのコアあたりのスレッドの数

physical id が2通り = 2CPUチップ
同じcore id が2ある = 1物理コアあたり2スレッド(HyperThread)

$ cat /proc/cpuinfo |egrep 'physical id|core' |sort
core id : 0 スレッド1
core id : 0 スレッド2
core id : 1 スレッド1
core id : 1 スレッド2
core id : 2 スレッド1
core id : 2 スレッド2
core id : 3 スレッド1
core id : 3 スレッド2
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
cpu cores : 4
physical id : 0 ソケット0
physical id : 0 ソケット0
physical id : 0 ソケット0
physical id : 0 ソケット0
physical id : 1 ソケット1
physical id : 1 ソケット1
physical id : 1 ソケット1
physical id : 1 ソケット1

CPUチップ 2つ
スレッド 2つ
CORE 4つ
8スレッド、topコマンドで見ると8個のCPUのように見える。


すばらしい!
http://wiki.princo.org/?CPU%A4%CE%CA%AA%CD%FD%BF%F4%A1%A6%A5%B3%A5%A2%BF%F4%A1%A6%A5%B9%A5%EC%A5%C3%A5%C9%BF%F4%A4%CE%C4%B4%A4%D9%CA%FD



2011年7月17日日曜日

assert機能 C言語

assert機能 C言語

-------------------------------------------

#include <stdio.h>

#if 0 /* アサート機能を無効にしたい場合はNDEBUGを定義する */
#define NDEBUG
#endif

#include <assert.h>

int main()
{
int a;

a = 99;
assert(a < 100);
printf("[OK]\n");

a = 101;
assert(a < 100);
/*printf("[OK]\n");*/


return 0;

}

--------------------------------------------------------------------------------------

#ifndef MY_ASSERT_H_
#define MY_ASSERT_H_


#ifndef MY_NDEBUG
/*#define myassert(expr) ((expr) ? 0: error_handler(__FILE__, __LINE__))*/
#define myassert(expr) ((expr) ? 0: printf("[ASSERT] %s(%d)\n", __FILE__, __LINE__))
#else
#define myassert(expr) /* none */
#endif


#endif





#include <stdio.h>

#if 0 /* アサート機能を無効にしたい場合はMY_NDEBUGを定義する */
#define MY_NDEBUG
#endif

#include "./myassert.h"

int main()
{
int a;

a = 99;
myassert(a < 100);
printf("[OK]\n");

a = 101;
myassert(a < 100);
/*printf("[OK]\n");*/

return 0;

}



2011年7月5日火曜日

アサート機能 assert

#include <stdio.h>

/*#define NDEBUG */ /* アサート機能を無効にしたい場合はNDEBUGを定義する */

#include <assert.h>

int main()
{
int a;

a = 100;

assert(a < 100);

printf("[OK]\n");

return 0;

}



実行例
$ ./myassert
myassert: myassert.c:13: main: Assertion `a < 100' failed.
Abort



2011年7月2日土曜日

2011年6月30日木曜日

vxWorks FTP タイムアウト時間

vxWorks FTP タイムアウト時間


config.h
ftpのタイムアウト時間を設定(追加)
--->
#undef FTP_TIMEOUT
#define FTP_TIMEOUT (30) /* 30sec */
<---


デフォルトは0
0だとFTP_REPLYTIMEOUTDEFAULT (10 秒 ) 。

ネットワークスタックプログラマーズガイド FTPクライアントの章