System call in linux by C
1: #include <stdlib.h>
2: int system(const char *command);
3:
4: while (something) {
5: int ret = system("foo");
6: if (WIFSIGNALED(ret) &&
7: (WTERMSIG(ret) == SIGINT || WTERMSIG(ret) == SIGQUIT))
8: break;
9: }
宏定义
含义
WIFEXITED(status)
如果进程通过系统调用_exit或函数调用exit正常退出,该宏的值为真。
WIFSIGNALED(status)
如果子进程由于得到的信号(signal)没有被捕捉而导致退出时,该宏的值为真。
WIFSTOPPED(status)
如果子进程没有终止,但停止了并可以重新执行时,该宏返回真。这种情况仅出现在waitpid调用中使用了WUNTRACED选项。
WEXITSTATUS(status)
如果WIFEXITED(status)返回真,该宏返回由子进程调用_exit(status)或exit(status)时设置的调用参数status值。
WTERMSIG(status)
如果WIFSIGNALED(status)返回为真,该宏返回导致子进程退出的信号(signal)的值。
WSTOPSIG(status)
如果WIFSTOPPED(status)返回真,该宏返回导致子进程停止的信号(signal)值。
Termination Signals
int SIGINT
The
SIGINT(“program interrupt”) signal is sent when the user types the INTR character (normally C-c). See Special Characters, for information about terminal driver support for C-c.
int SIGQUIT
The
SIGQUITsignal is similar toSIGINT, except that it's controlled by a different key—the QUIT character, usually C-\—and produces a core dump when it terminates the process, just like a program error signal. You can think of this as a program error condition “detected” by the user.
System call in linux by C的更多相关文章
- 转 PHP中exec、system等函数调用linux命令问题
PHP中exec.system等函数调用linux命令问题 先小说两句:今天研究了下PHP调用LINUX命令的功能,一开始怎么做都调用不成功,试了好久才终于成功了,所以发出来分享一下.下面我将详细介绍 ...
- [转帖]DotNetCore跨平台~System.DrawingCore部署Linux需要注意的
DotNetCore跨平台~System.DrawingCore部署Linux需要注意的 https://www.bbsmax.com/A/QV5ZemYVJy/?tdsourcetag=s_pc ...
- DotNetCore跨平台~System.DrawingCore部署Linux需要注意的
回到目录 你在windows上使用图像组件没有任务问题,但部署到linux之后,将注意以下几点: 安装nuget包ZKWeb.System.Drawing 项目里还是引用System.DrawingC ...
- c/c++中system函数在Linux和windows下区别
windows 在windows下的system函数中命令可以不区别大小写! 功 能: 发出一个DOS命令 #include <stdlib.h> int system(char *com ...
- os.system('cmd')在linux和windows系统下返回值的差异
今天,用os.system('cmd')分别在windows和linux平台上执行同一ping命令,命令执行失败时返回码不同,windows为1,而linux下返回为256,如下: linux下: & ...
- Linux出现Read-only file system错误的解决方法
造成这个问题的解决办法大多数是由于非正常关机后导致文件系统受损引起的,在系统重新启动之后,受损分区就会被Linux自己主动挂载为仅仅读.解决办法是通过fsck来修复文件系统,然后重新启动就可以,下面是 ...
- linux flushing file system caches
We may drop the file system caches on Linux to free up memory for applications. Kernels 2.6.16 and n ...
- System.Drawing Linux Centos7 The type initializer for 'Gdip' threw an exception
System.Drawing 在linux使用时提示异常 The type initializer for 'Gdip' threw an exception 解决方案: yum install au ...
- Linux环境搭建-在虚拟机中安装Centos7.0
最近在空闲时间学习Linux环境中各种服务的安装与配置,都属于入门级别的,这里把所有的学习过程记录下来,和大家一起分享. 我的电脑系统是win7,所以我需要在win7上安装一个虚拟机-VMware,然 ...
随机推荐
- 即时聊天 / XMPP
MQTT是第二个即时聊天协议(了解) 5.即时通讯 即时通讯网上有第三方的解决方案,比如环信,融云等.我们是自己搭的xmpp服务器,服务器使用的tigase,之前写过相关的博客,自己去年也做了对应的w ...
- reverse array java
/* package whatever; // don't place package name! */ import java.util.*; import java.lang.*; import ...
- 转:PCL+VS2010环境配置
1.下载 http://www.pointclouds.org/downloads/windows.html出下载PCL完全安装包1.6.0 all-in-one-installer,我的电脑是32位 ...
- Linux LAMP环境搭建
什么是LAMP Linux+Apache+Mysql/MariaDB+Perl/PHP/Python一组常用来搭建动态网站或者服务器的开源软件,本身都是各自独立的程序,但是因为常被放在一起使用,拥有了 ...
- html标签属性大全
<marquee>...</marquee>普通卷动 <marquee behavior=slide>...</marquee>滑动 <marqu ...
- Greedy:Fence Repair(POJ 3252)
Fence Repair 问题大意:农夫约翰为了修理栅栏,要将一块很长的木块切割成N块,准备切成的木板的长度为L1,L2...LN,未切割前的木板的长度恰好为切割后木板的长度的总和,每次切断木板的时候 ...
- 【python】时间性能分析
参考: http://blog.jobbole.com/47619/ http://chenpeng.info/html/1754 1.计算整个程序运行时间,直接用linux的time命令即可 tim ...
- linux 远程 windows 命令:rdesktop vs windows mstsc
[root@bass tmp]# which rdesktop /usr/bin/rdesktop [root@bass tmp]# rpm -qf /usr/bin/rdesktop rdeskto ...
- 菜鸟学Linux命令:find命令 查找文件
find命令是Linux下最常用的命令之一,灵活的使用find命令,你会发现查找文件变得十分简单. 命令格式 find [指定查找目录] [查找规则(选项)] [查找完后执行的动作] 参数规则 - ...
- sdut 2413:n a^o7 !(第三届山东省省赛原题,水题,字符串处理)
n a^o7 ! Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you w ...