- 博客(82)
- 资源 (24)
- 收藏
- 关注
转载 Linux系统调用--fcntl函数详解
转载自 企鹅乐园_雅虎群组。【fcntl系统调用】 功能描述:根据文件描述词来操作文件的特性。 用法: int fcntl(int fd, int cmd); int fcntl(int fd, int cmd, long arg); int fcntl(int fd, int cmd, struct flock *lock);
2014-08-21 10:53:59
918
转载 Linux core dump
调试技术: Linux core dump file, like windows CreateMiniDumpfrom: http://blog.youkuaiyun.com/yangzhu1982/archive/2011/04/13/6321093.aspx 调试技术: Linux core d
2014-02-10 11:04:41
810
转载 sar命令
sar(System Activity Reporter系统活动情况报告)是目前Linux 上最为全面的系统性能分析工具之一,可以从多方面对系统的活动进行报告,包括:文件的读写情况、系统调用的使用情况、磁盘I/O、CPU效率、内存使用状况、进程活动及IPC有关的活动等。本文主要以CentOS 6.3 x64系统为例,介绍sar命令。sar命令常用格式sar [options] [-
2013-08-22 11:24:25
909
转载 Jni函数调用大全
转自:http://helloxuweifu.iteye.com/blog/1168647Chap1:JNI完全手册... 3Chap2:JNI-百度百科... 11Chap 3:javah命令帮助信息... 16Chap 4:用javah产生一个.h文件... 17Chap5:jni教程(very very good) 19Chap6: JNI传递返回值... 2
2013-06-21 14:17:12
3243
转载 [转贴] Linux下好用的软件
下面列出我常用的一些 Linux 程序。一个列表里可能有很多,那是为了方便你来选择,我列出了比较信得过的。但其实很多只有第一个是我真正在用的,我不喜欢试用程序。我不是一个合格的网络管理员,我的服务器都只设置了我自己需要的功能,那样可以省去我很多麻烦。Shell: bash 。它结合了 csh 和 ksh 的优点,并且有 readline 功能,你可以随意绑定自己的键盘。 编辑器: VI
2013-06-04 10:35:29
760
转载 5 simple ways to troubleshoot using Strace
转载:http://www.hokstad.com/5-simple-ways-to-troubleshoot-using-straceI keep being surprised how few people are aware of all the things they can use strace for. It's always one of the first debug tool
2013-05-29 16:37:12
859
转载 如何建立你的第一个linux模块驱动
转载:http://www.cyberciti.biz/tips/compiling-linux-kernel-module.htmlThis is one the essential and important task. Many time we upgrade our kernel and some precompiled drivers won't work with Linux.
2013-05-29 13:52:04
616
转载 多线程传递参数
涉及多参数传递给线程的,都需要使用结构体将参数封装后,将结构体指针传给线程定义一个结构体struct mypara{ var para1;//参数1 var para2;//参数2}将这个结构体指针,作为void *形参的实际参数传递struct mypara pstru;pthread_create(&ntid, NULL, thr_fn,& (pstr
2013-03-19 11:16:29
644
转载 select 应用
select系统调用是用来让我们的程序监视多个文件描述符(file descrīptor)的状态变化的。程序会停在select这里等待,直到被监视的文件描述符有某一个或多个发生了状态改变。select()的机制中提供一fd_set的数据结构,实际上是一long类型的数组, 每一个数组元素都能与一打开的文件描述符(不管是Socket描述符,还是其他 文件或命名管道或设备描述符)建立联系,建立联系的工
2013-02-06 17:12:22
513
原创 利用efence调试内存泄漏
1.What is efence It attempts to use the virtual memory facilities of Linux to protect the memory used by malloc and free to halt the program at the point of memory corruption.2. How to
2013-01-30 17:04:40
2582
转载 Gnu gprof进行Linux平台下的程序分析
【转】使用Gnu gprof进行Linux平台下的程序分析Gprof 简介:Gprof功能:打印出程序运行中各个函数消耗的时间,可以帮助程序员找出众多函数中耗时最多的函数。产生程序运行时候的函数调用关系,包括调用次数,可以帮助程序员分析程序的运行流程。有 了函数的调用关系,这会让开发人员大大提高工作效率,不用费心地去一点点找出程序的运行流程,这对小程序来说可能效果不是很明显,但对于有几
2013-01-30 14:48:16
655
转载 linux 下fcntl的使用
linux 下fcntl的使用转自:http://www.cnblogs.com/lonelycatcher/archive/2011/12/22/2297349.html功能描述:根据文件描述词来操作文件的特性。#include #include int fcntl(int fd, int cmd); int fcntl(int fd, int cmd,
2013-01-29 15:40:49
653
转载 Linux Shell的信号trap功能你必须知道的细节
它有三种形式分别对应三种不同的信号回应方式.第一种: trap 'commands' signal-list当脚本收到signal-list清单内列出的信号时,trap命令执行双引号中的命令.第二种: trap signal-list trap不指定任何命令,接受信号的默认操作.默认操作是结束进程的运行.第三种: trap ' ' signal-list
2013-01-21 17:05:40
35014
3
转载 SHELL编程常用列子参考
BASH SHELL编程:1. 初始化顺序: /etc/profile ( ~/.bash_profile | ~/.bash_login | ~/.profile ) ~/.bashrc2. set -o allexport 当前shell变量对其所有子shell都有效. set +o allexport 当前shell变量对其所有子she
2012-12-27 10:08:01
922
转载 Shell 脚本参数说明
Shell中的内部变量:$?: 表示shell命令的返回值.$$: 表示当前shell的pid.$!: 最后一个放入后台作业的PID值.$0: 表示脚本的名字.$1--$9,${10}: 表示脚本的第一到九个参数,和第十个参数.$#: 表示参数的个数.$*,$@: 表示所有的参数. 两者的区别如下: //都是双引号惹的祸^-^ /> set 'apple pie' pears
2012-12-27 10:02:20
1625
转载 Eclipse 注释乱码
Eclipse 注释乱码原文地址:http://hi.baidu.com/tollyhuang/blog/item/6e8df0fceaa4410f08244d57.html将别人的项目或JAVA文件导入到自己的Eclipse中时,常常会出现JAVA文件的中文注释变成乱码的情况,主要原因就是别人的IDE编码格式和自己的Eclipse编码格式不同。总结网上的建议和自己的体会,可以参考以下
2012-12-14 09:21:41
548
转载 c语言 正则表达式可编译c文件
C语言中使用正则表达式一般分为三步:编译正则表达式 regcomp()匹配正则表达式 regexec()释放正则表达式 regfree()下边是对三个函数的详细解释1、int regcomp (regex_t *compiled, const char *pattern, int cflags)这个函数把指定的正则表达式pattern编译成一种特定的数据格式comp
2012-09-04 18:16:54
2042
转载 SQLite入门之基本语法
SQLite入门之基本语法来源:SeaYeeSQLite虽然很小巧,但是支持的SQL语句不会逊色于其他开源数据库,同时它还支持事务处理功能等等。我觉得它像MySQL,但SQLite 支持跨平台,操作简单,能够使用很多语言直接创建数据库。一、结构定义1、CREATE TABLE创建新表。语法:sql-command ::= CREATE [TEMP | TEMPORA
2012-07-02 16:21:23
1037
转载 Linux进程状态(ps stat)之R、S、D、T、Z、X
Linux进程状态(ps stat)之R、S、D、T、Z、XLinux是一个多用户,多任务的系统,可以同时运行多个用户的多个程序,就必然会产生很多的进程,而每个进程会有不同的状态。Linux进程状态:R (TASK_RUNNING),可执行状态。只有在该状态的进程才可能在CPU上运行。而同一时刻可能有多个进程处于可执行状态,这些进程的task_struct结构(进程控制块)
2012-06-18 15:10:11
1113
转载 文件属性说明
The first column of output specifies the following. The first letter corresponds to: "-"—if it is a regular file. "d"—if it is a directory "c"—for a character device "b"—for a block device "
2012-06-15 14:11:16
512
转载 mkdir 创建目录忽略路径判断
mkdir -p /home/slynux/test/hello/childThis single command takes the place of the five different commands listed above. It ignoresif any level of directory exists and creates the missing directorie
2012-06-15 14:05:34
2201
转载 比较两个文档中元素的不同
Note that comm takes sorted files as input. Take a look at the following example:$ cat A.txtappleorangegoldsilversteeliron$ cat B.txtorangegoldcookiescarrot$ sort A.txt -o A.
2012-06-15 13:37:47
430
原创 交互式输入shell参数
Let's write a script that reads input interactively and uses this script for automation examples:#!/bin/bash#Filename: interactive.shread -p "Enter number:" no ; #-p "Enter number:"
2012-06-15 13:12:31
8453
原创 查看某个字符串是否是一个英语单词
The /usr/share/dict/ directory contains some of the dictionary files. Dictionary files aretext files that contain a list of dictionary words. We can use this list to check whether a word is a dictio
2012-06-15 11:03:49
2644
原创 为大量图片重新命名
The easiest way of renaming image files in the current directory to our own filename with aspecific format is by using the following script:#!/bin/bash#Filename: rename.sh#Description: Ren
2012-06-15 10:33:36
815
转载 Slicing filenames based on extension
Here is practical example that can be used to extract different portions of a domain name,given URL="www.google.com":$ echo ${URL%.*} # Remove rightmost .*www.google$ echo ${URL%%.*} # Remove
2012-06-15 10:10:49
392
转载 dd命令解析和例子
一、dd命令的解释。1.定义 dd是 Linux/UNIX 下的一个非常有用的命令,作用是用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换。dd命令在拷贝完文件之后还会显示拷贝所用的时间,以及每秒的数据传输速度。可以指定不同的block size以测定在不同的block size下的传输速度。2.参数 1. if=文件名:输入文件名,缺省为标准输入。即
2012-06-15 09:44:57
770
转载 创建守护进程
创建子进程,父进程退出 这是编写守护进程的第一步。由于守护进程是脱离控制终端的,因此,完成第一步后就会在Shell终端里造成一程序已经运行完毕的假象。之后的所有工作都在子进程中完成,而用户在Shell终端里则可以执行其他命令,从而在形式上做到了与控制终端的脱离。 在Linux中父进程先于子进程退出会造成子进程成为孤儿进程,而每当系统发现一个孤儿进程时,就会自动由1号进程
2012-06-08 18:18:51
571
原创 pthread_cond 应用
一、家庭成员:pthread_cond_t cond = PTHREAD_COND_INITIALIZER;int pthread_cond_init(pthread_cond_t *cond,pthread_condattr_t *cond_attr);int pthread_cond_signal(pthread_cond_t *cond);int pthread_cond
2012-05-29 17:04:52
1806
转载 popen和pclose函数
理论:库函数: popen();函数声明: FILE *popen ( char *command, char *type);返回值: new file stream on successNULL on unsuccessful fork() or pipe() callNOTES: creates a pipe, and performs fork/exec oper
2012-05-28 15:40:38
1481
原创 pthread_mutex 应用
一、 pthread_mutex 家庭成员:1.int pthread_mutex_init (pthread_mutex_t *mutex , pthread_mutexattr_t *attr );Description The pthread_mutex_init function initializes the given mutex with the given at
2012-05-25 18:22:20
9598
原创 sigaction 和 signal 函数
1.sigaction 函数NAME sigaction - examine and change a signal actionSYNOPSIS #include int sigaction(int sig, const struct sigaction * act, struct sigaction * oact);
2012-05-24 15:40:06
961
原创 sigprocmask , sigpending 和 sigsuspend函数
sigprocmask函数:功能描述:设定对信号屏蔽集内的信号的处理方式(阻塞或不阻塞)。用法:#include int sigprocmask(int how, const sigset_t *set, sigset_t *oldset);NOTE: If oldset is non-null, the previous value of the si
2012-05-24 11:22:09
6145
转载 linux setjmp和longjmp函数
setjmp和longjmp的函数原型在setjmp.h中。函数原型:int setjmp(jmp_buf envbuf);setjmp函数用缓冲区envbuf保存系统堆栈的内容,以便后续的longjmp函数使用。setjmp函数初次启用时返回0值。 void longjmp(jmp_buf envbuf, int val);longjmp函数中的参数envbuf是由set
2012-05-23 13:54:01
763
原创 alarm和pause函数
NOTE:部分文字说明出自《UNIX环境高级编程》1. alarm函数 每个进程只能有一个闹钟时钟。如果在调用alarm时,以前已为该进程设置过时钟,而且它还没超时,则将该闹钟的余值作为本次alarm函数调用的值返回。以前登记的时钟则被新值代替。如果闹钟到时,默认操作为终止该进程,但是大多数进程会捕捉该信号然后进行相应的处理。代码说明1:#include "un
2012-05-23 12:24:38
601
原创 bash之提取文件的每行
1.统计某个目录下所有文件的个数:find . -type f | wc -l 2.提取文档中每行内容:while read linedo a=$(dirname ${line}) echo ${here}${a} mkdir -p ${here}$a cp -r ${here}/Noise.wav ${h
2012-05-23 09:06:52
1507
转载 valgrind 调试
调不尽的内存泄露,用不完的Valgrind(一个介绍程序调试的精彩讲解:http://www.ibm.com/developerworks/cn/linux/l-pow-debug/)Valgrind 介绍 Valgrind是一个GPL的软件,用于Linux(For x86, amd64 and ppc32)程序的内存调试和代码剖析。你可以在它的环境中运行你的程序来监视内存的使
2012-05-23 08:54:51
557
转载 kill 与 raise 函数
1. 函数说明:kill和raise是用来发送信号的:kill把信号发送给进程或进程组;raise把信号发送给(进程)自身.他们的原型如下:#include signal.h>int kill(pid_t pid, int signo);int raise(int signo);成功则返回0, 出错则返回-1 从原型上可以看出, raise函数是
2012-05-23 08:54:25
8064
转载 popen函数的应用
Linux C 进程I/O函数,与pclose函数一起使用。表头文件 #include stdio.h>函数定义 FILE * popen ( const char * command , const char *type ); int pclose ( FILE * stream );函数说明 popen() 函数通过创建一个管道,调用 fork 产
2012-05-22 17:19:56
696
如何使用STM32的软件库在IAR的EWARM(4.42A)下进行应用开发
2011-10-20
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人