我写了个 module,挂在 NF_IP_PRE_ROUTING 上,很简单的功能 [code] static unsigned int br_prerouting(unsigned int hooknum,struct sk_buff **skb, const struct net_device *in, const struct net_device *out, int (*okfn)(struct sk_buff *)) { struct iphdr *iph; struct icmphdr *icmph; if (!skb_make_w...
by platinum - 内核/嵌入技术 - 2006-04-14 16:07:45 阅读(2221) 回复(7)
#!/bin/sh sleep 3 echo "input a:" read a if [ "$a" == y ]; then echo $a else echo no fi 问题: 如果在shell sleep 的过程敲很多次回车 例如3次 现象为 [root@localhost]#./filename input a: no [root@localhost]# [root@localhost]# [root@localhost]# _ 也就是说shell记住了你敲的这3次回车 怎么能达到这种效果: 不管敲几次回车 只捕捉input a: 出现后的那一次输入 [root@localhost]#./filename i...
typedef struct { volatile int counter; } atomic_t; 据说对这个atomic_t类型的操作都是原子的.原因是在对这种类型的操作之前都有lock语句.可是在程序中并没有发现lock,想问下程序在看到atomic_t类型时,是如何得知就要对它实现原子操作.
请问在linux/unix中, atomic操作的含义 比如: 在多cpu环境的情况下 两个进程p1,p2同时分别在两个cpu下运行,执行把主存的一个值A(初始值为0)加1,并返回原值的操作.他们是atomic操作 ,其结果是什么
嵌入式Linux平台下的GPS数据采集涉及到Linux串口编程技术,从串口读取GPS信息需要用到read函数, read函数的定义如下: ssize_t read(int filedes, void *buf, size_t nbytes); 我想问两个问题: 1、这里的参数buf是什么类型的?是char型的吗? 2、当从串口接收到信息并保存到buf中时,我想看buf中保存的信息的第一个字符是不是%,请问 可不可以用if(buf[0]=='%')进行判断?
TMLIMIT=4 read -t $TMLIMIT variable echo if [ -z "$variable" ]; then echo "Timed out, variable still unset." else echo "variable=$variable" fi exit 0 红色部分的一行是什么意思,请高手赐教。
我要将一些输出的结果赋给变量,这样操作为什么不能实现呢? vmstat 3 2|sed 1,3d|awk '{printf("%s %s %s\n",$1,$7,$8)}'|while read A B C ...... 如何才能实现将结果赋给ABC呢? 谢谢~!