c
菩提本無樹-永不放棄
这个作者很懒,什么都没留下…
展开
-
列出所有使用bss段的變數與使用的空間大小
objdump -t XXX.elf | grep ".bss"原创 2020-11-10 22:36:34 · 165 阅读 · 0 评论 -
thread termination
轉載自http://stackoverflow.com/questions/6621785/posix-pthread-programmingThere are mainly two approaches for thread termination.Use a cancellation point. The thread will terminate when requested转载 2014-12-25 15:04:16 · 489 阅读 · 0 评论 -
write and read mtd device(轉載自http://stackoverflow.com/questions/15336285/write-on-a-mtd-block-devic)
#include #include #include #include int main(){ mtd_info_t mtd_info; // the MTD structure erase_info_t ei; // the erase block structure int i; int nwrite转载 2014-12-22 10:12:16 · 779 阅读 · 0 评论 -
How to pass macro definition from “makefile” command line arguments to C source code?
12345678#FILENAME:Makefileexport SAI=y ifeq ($(SAI),y)CFLAGS += -DSAIendif all: @gcc $(CFLAGS) macro_test.c -o ma原创 2014-12-03 14:29:55 · 649 阅读 · 0 评论 -
如何為pthread 命名
12345678910111213141516171819202122// filename:pthread_name.c#include #include void转载 2014-11-26 18:20:29 · 1155 阅读 · 0 评论 -
Program in c that will make the CPU run at 100%
#include #include int main (void) { volatile unsigned x = 0, y = 1; while (x++ || y++) { ;/*Nothing to doing*/ } return 0;}转载 2014-10-01 17:03:37 · 363 阅读 · 0 评论 -
write gpio reg
FILENAME:setreg.c-------------------------------------------------------------------------------- 1 /* 2 * Configure GPIO 3 */ 4 5 #include 6 #include 7 #include 8 #转载 2014-09-04 10:54:00 · 1226 阅读 · 0 评论 -
VxWork介绍及编程
轉載自http://www.embhelp.com/drew/mypage/VxWorks.htm 一.嵌入式操作系统VxWorks简介VxWorks操作系统是美国WindRiver公司于1983年设计开发的一种嵌入式实时操作系统(RTOS),是嵌入式开发环境的关键组成部分。良好的持续发展能力、高性能的内核以及友好的用户开发环境,在嵌入式实时操作系统领域占据一席之地。它以其转载 2013-12-23 15:34:44 · 624 阅读 · 0 评论 -
How to initialize an array in C
If your compiler is GCC you can use following syntax:int array[1024]={[0...1023]=5};Check out detailed description: http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Designated-Inits.html转载 2013-12-19 11:02:33 · 608 阅读 · 0 评论 -
c keyword restrict
轉載自 http://baike.baidu.com/view/3962518.htmrestrict是c99标准引入的,它只可以用于限定和约束指针,并表明指针是访问一个数据对象的唯一且初始的方式.即它告诉编译器,所有修改该指针所指向内存中内容的操作都必须通过该指针来修改,而不能通过其它途径(其它变量或指针)来修改;这样做的好处是,能帮助编译器进行更好的优化代码,生成更有效率的汇编代码.如转载 2015-01-01 14:40:48 · 485 阅读 · 0 评论 -
++*ip
*ip += 1++*ip(*ip)++三者相同转载 2013-11-21 00:36:47 · 716 阅读 · 0 评论 -
Unix Domain Sockets
原文地址 http://www.thomasstover.com/uds.html轉載自http://bbs.sjtu.edu.cn/bbstcon,board,GNULinux,reid,1345013026.html转载 2015-01-05 16:36:16 · 814 阅读 · 0 评论 -
What does “%.*s” mean in printf?
轉載自http://stackoverflow.com/questions/7899119/what-does-s-mean-in-printfYou can use an asterisk (*) to pass the width specifier/precision to printf(), rather than hard coding it into the format转载 2015-09-03 18:29:40 · 319 阅读 · 0 评论 -
A library of generic data structures
轉載自https://www.facebook.com/softdevtools/?fref=nf寫C語言如果要實現Link list, Hash, queue都要自己去實現, 這個opensource則幫你都寫好了. 以前面試工程師都會考一下如何利用C語言實現資料結構, 現在的程式設計語言幾乎都內建, 直接拿來用就好了https://github.com/srdja/转载 2016-03-14 23:12:53 · 429 阅读 · 0 评论 -
Glib相關
Compiling GLib Applicationshttps://developer.gnome.org/glib/stable/glib-compiling.html Here's a tutorial, a little old but still applicable: http://www.ibm.com/developerworks/linux/tu转载 2017-07-05 17:34:01 · 208 阅读 · 0 评论 -
c11新書
C 語法暨程式庫標準辭典, 2/e (C in a Nutshell: The Definitive Reference, 2/e) https://www.tenlong.com.tw/products/9789864762422转载 2017-09-28 10:36:23 · 133 阅读 · 0 评论 -
The Linux Programming Interface - A Linux and UNIX System Programming Handbook
第1章 历史和标准第2章 基础概念 第3章 系统编程概念 第4章 文件I/O:统一的I/O模型 第5章 文件I/O:更多细节 第6章 进程 第7章 内存分配 第8章 用户和组 第9章 进程凭证 第10章 时间 第11章 系统限制和选项翻译 2014-01-04 23:57:19 · 1146 阅读 · 0 评论 -
一个进程可以malloc多少空间,由malloc引发的killed
http://blog.chinaunix.net/uid-23204078-id-3045296.html转载 2013-12-19 11:02:04 · 534 阅读 · 0 评论 -
daemon to monitor firm upgrade
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include string.h> 13 14 /*原创 2013-12-19 11:01:29 · 579 阅读 · 0 评论 -
dlopen dlclose dlXXX
下載glibc-2.18.tar.gz後 解壓縮再include/link.h中的163 unsigned int l_direct_opencount; /* Reference count for dlopen/dlclose. */有dlopen的reference count 轉載自http://soon0530.blogspot.tw/2012转载 2013-11-21 00:36:26 · 1363 阅读 · 0 评论 -
posix and system V IPC
轉載自http://www1.huachu.com.cn/read/readbook.asp?bookid=10104131 http://www1.huachu.com.cn/read/readbookinfo.asp?sectionid=1000001837http://www1.huachu.com.cn/read/readbookinfo.asp?secti转载 2013-11-21 00:35:20 · 1010 阅读 · 0 评论 -
man page分類與說明
轉載自http://itzone.hk/article/article.php?aid=200407152225014657(如有侵權,請留言或來信告知)前言Man page是每位程式設計員及Unix/Linux系統管理員日常必備的參考,它必須是可靠以及準確(reliable & accurate)的,當然man page的擺放位置亦是關鍵,起碼你的man page是能夠被转载 2013-11-21 00:39:09 · 640 阅读 · 0 评论 -
make filesystem and erase mtdblock指令
cat /dev/mtdblock1 > 123.txthexdump 123.txt -cflash_eraseall /dev/mtd6flashcp -v 123.txt /dev/mtd6hexdump /dev/mtd6 -c ==============================================mkfs.jf原创 2013-10-28 00:20:41 · 969 阅读 · 0 评论 -
assert
例如, 一個假設只接受非空 指針的函數, 可以寫: assert(p != NULL);當程式執行到該行時,若 p != NULL 則程式可以繼續執行;若 p == NULL ,則會秀出維護錯誤訊息的字串,並結束程式。 維護字串包含有:判斷式子、程式檔名及該行的行號。翻译 2013-10-28 00:18:30 · 558 阅读 · 0 评论 -
pthread
ref https://computing.llnl.gov/tutorials/pthreads/ //filename thread.c#include #include #define NUM_THREADS 5void *PrintHello(void *threadid){ long tid;转载 2013-10-28 00:02:05 · 529 阅读 · 0 评论 -
const
1.const出現在星號左邊,代表被指物是常量。2.const出現在星號右邊,代表被指標自身是常量。 char greeting[] = "Hello";char* p = greeting; //non-const pointer, non-const dataconst char* p = greeting; //non-const pointer, c翻译 2013-10-27 23:50:20 · 502 阅读 · 0 评论 -
glib和gllibc區別
轉載自http://dpinglee.blog.163.com/blog/static/144097753201071831042845/ glib不是gllibc,尽管两者都是基于(L)GPL的开源软件。但这一字之差却误之千里,glibc是GNU实现的一套标准C的库函数,而glib是gtk+的一套函数库。在linux平台上,像其它任何软件一样,glib依赖于glibc。g转载 2013-10-27 23:47:33 · 798 阅读 · 0 评论 -
mq_open
在unix network programming Volume2中第五章的poisx message queue中的mq_open現在的linux系統,已經不像書中的執行結果。需參考man mq_overview或參考http://cpp.ezbty.org/import_doc/linux_manpage/mq_overview.7.html mq_o原创 2013-11-25 10:32:20 · 1874 阅读 · 0 评论 -
pthread man page
使用ubuntu的話,會發現當要查詢pthread相關的function時,會找不到,此時可以安裝sudo apt-get install manpages-posix manpages-posix-dev glibc-doc 使用man -k pthread 可以查找到當前manpages中關於pthread的手冊原创 2013-12-15 22:24:57 · 494 阅读 · 0 评论 -
sctp协议在ubuntu12.04中怎样开启
轉載自http://www.dewen.org/q/13270/sctp%E5%8D%8F%E8%AE%AE%E5%9C%A8ubuntu12.04%E4%B8%AD%E6%80%8E%E6%A0%B7%E5%BC%80%E5%90%AF sctp协议在ubuntu12.04中怎样开启在学习unix网络编程,关于sctp协议时,实践书上的代码发现自己转载 2013-12-19 11:01:13 · 3255 阅读 · 0 评论 -
mmap
1 /* 2 * Configure PCIE 3 */ 4 5 #include 6 #include 7 #include 8 #include 9 #include 10 #include 11 #include 12 #include 13 #include 14 #include string.h> 15 #inclu原创 2013-12-19 11:02:44 · 521 阅读 · 0 评论 -
unix network programming volume2 sorce code build and get(UNIX網絡編程卷2第二版)
轉載自http://linuxjcq.blog.51cto.com/3042600/718200本文出自 “linuxjcq” 博客,请务必保留此出处http://linuxjcq.blog.51cto.com/3042600/7182001. 下载源码,W. Richard Stevens的主页:http://www.kohala.com/start/wget http:转载 2013-11-21 00:38:35 · 1272 阅读 · 0 评论 -
unix network programming volume1 sorce code build and get(UNIX網絡編程卷1第三版)
source code下载地址:unpv13e.tar.gz下载 (也有放一份在google cloud storage)compile1. ./configure2. cd lib make3. cd libfree 修改inet_ntop.c60 size_t size;變成60转载 2013-12-18 17:13:18 · 610 阅读 · 0 评论 -
指標
int *f[ ] ; f 是一個arrary,它的元素類型是指向int的pointint (*f [ ])() ; f 是一個array,它的元素類型是function point,它所指向的函數的返回值是一個intint *(*f [ ])() ; f 是一個array,它的元素類型是function point,它所指向的函數的返回值是一個int point=====原创 2013-12-19 11:02:24 · 470 阅读 · 0 评论 -
DRAM test code
#include #include #define LEVEL 5#define RAM_TEST_PATTERNS 2intmain (int argc, char *argv[]){ ulong *ptrMalloc = NULL; int i = 0, j = 0; ulong test_value; ulong *原创 2013-12-19 11:02:13 · 1214 阅读 · 0 评论 -
ethernet switch loopback test transfer
platform/kernel/linux-2.6.29.6/drivers/net/gianfar_ethtool.cplatform/htp/ethtool-3.4.1After system boot up:ifconfig eth0 192.168.1.1ethtool -S eth0ethtool -t eth0ethtool -S eth0 // y原创 2013-12-16 10:59:50 · 1111 阅读 · 0 评论 -
dram test
#include #include #define LEVEL 5#define RAM_TEST_PATTERNS 2intmain (int argc, char *argv[]){ ulong *ptrMalloc = NULL; int i = 0, j = 0; ulong test_value; ulong *ptrl = NULL; int level =转载 2013-12-28 21:46:28 · 1568 阅读 · 0 评论 -
C的 "#" 與 "##"
1.如果再替代象徵序列中的參數識別字有 #, 則 " 字符將被加在對應的參數前後#define tempfile(dir) #dir "/%s"當tempfile(/usr/tmp)呼叫這個macro時,會產生"/usr/tmp" "%s" 2.如果再替代象徵序列中的參數識別字有 ##, 則再參數替代後##就會被捨棄,這樣會使象徵字串連在一起#de翻译 2013-10-28 00:16:59 · 475 阅读 · 0 评论