加载中
determine the max number of open file descriptor

1. header file + sysconf + guess 2. use dup() function #include <unistd.h> #include <limits.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #ifdef OPEN_MAX ...

Introspection of a process (C programming)

Process introspection, mainly for debugging purpose. Code /* Introspection of a process */ #include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <string.h> #inc...

打印二叉树(diagram)

/** * print_binary_tree.c * print out a binary tree * **/ #include <stdio.h> #include <stdlib.h> /* structures */ struct Node {   int id;   struct Node *left;   struct Node *...

Linux中的Pipe和FIFO的原理浅析

之前从编程角度写过Linux的Pipe和FIFO,主要侧重于使用,附带了简单的原理介绍。(链接如下) http://my.oschina.net/u/158589/blog/54705 http://my.oschina.net/u/158589/blog/55051 今天在...

pthread中的互斥锁和条件锁

pthread_mutex_t和pthread_cond_t. 为什么互斥锁和条件锁通常要一起使用? 目的是给资源或者临界区加锁,同时不消耗CPU资源。 如果没有条件锁,互斥锁会一直轮询,导致大量CPU时间被占用。如...

2012/07/04 12:01
857
域名,ip相互转换(Linux,getaddrinfo, getnameinfo)

参考链接: http://en.wikipedia.org/wiki/Getaddrinfo 代码: /* ip_to_hostname ip */ #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include...

A Simple Introduction to Linux Daemon (with exa...

Daemon In Unix and other multitasking computer operating systems, a daemon is a computer program that runs as a background process, rather than being under the direct control of...

How to log time in Linux? (C Programming)

#include <unistd.h> #include <stdio.h> #include <time.h> #include <stdlib.h> #include <string.h> #include <assert.h> /* time, gmtime, asctime */ static void log_time() { ...

2012/06/13 14:11
64
检测目录递归循环 (Linux C 实现)

效果: root@localhost :/home/James/mypro/Linux-Pro/dir_operation# ./detect_dir_loop /home/James/mypro/ Error occured when getting realpath of [link2]: No such file or directory ...

2012/06/01 17:36
513
Linux下遍历打印目录

stat, lstat用以判断文件属性(link?direcotry?or other?) opendir, readdir用以遍历目录 主要数据结构struct dirent, DIR, struct stat /** ...

2012/06/01 13:28
79
得到绝对路径(自动扩展软连接)

主要函数char* realpath(const char *path, char *resolved_path); 主要是想要测试下该函数自动扩展symbolic link时,最多允许symbolic link的多少层嵌套。(关键词:nested symbolic links...

2012/05/31 22:51
322
高亮关键词并且输出(Highlighten Keywords )

效果: chenqi@chenqi-laptop ~/MyPro/CFiles/highlighten $ ./highlight God input.txt Six Dyas of Creation and the Sabbath In the beginning when God created the heavens and the ear...

2012/05/31 21:29
308
IPC机制学习---D-BUS

以下内容大部分是笔记。以后如果有机会接触D-BUS,这篇文章需要改写和完善。目前仅作一个整理吧,算是个自己一个提醒。 Basics a full-featured IPC and object system First, D-BUS can pe...

2012/05/23 18:04
331
不认真分析问题,后果很严重!(Auto的教训)

========================== 自动化程序管理器 【Auto】 ========================== 需求: 平常经常写一些程序,有些程序虽然不完善,但是今后却有可能会用到。那么,你在一个月后甚至几个...

2012/05/14 20:58
292
Linux Filesystem Hierarchy Standard (FHS) -- Li...

Linux Filesystem Hierarchy Standard (FHS) ==================================================== Directory Required? Use /bin Y Important system binary files. /boot Y Files requir...

2012/05/14 17:16
39
IPC研究(7) -- IPC Status Commands

为了system V IPC的完整性,加上两个有用的shell command: ipcs 和 ipcrm chenqi@chenqi-laptop ~/MyPro/CFiles/IPC/msg_queue $ ipcs -q ------ Message Queues -------- key msqid owner p...

2012/05/10 22:51
51
IPC研究(6) -- 消息队列(message queue)

"In many ways, message queues are like named pipes, but without the complexity associated with opening and closing the pipe. However, using messages doesn’t get you away from t...

2012/05/10 22:43
166
Linux下C语言实现“域名“转“ip“

#include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> #include <stdlib.h> #incl...

2012/05/09 23:30
388
IPC研究(5) -- 共享内存(shared memory)

================================================== IPC SystemV IPC shared memory ================================================== Related System Calls #include <sys/shm.h> voi...

没有更多内容

加载失败,请刷新页面

返回顶部
顶部