我有一个应用程序从服务器读取大文件并经常挂起在特定的机器上.它已在RHEL5.2下成功运行了很长时间.我们最近升级到RHEL6.1,它现在定期挂起.
我创建了一个可以重现问题的测试应用程序.它在100个中挂起约98次.
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/time.h>
int mFD = 0;
void open_socket()
{
struct addrinfo hints, *res;
memset(&hints, 0, sizeof(hints));
hints.ai_socktype = SOCK_STREAM;
hints.ai_family = AF_INET;
if (getaddrinfo("localhost", "60000", &hints, &res) != 0)
{
fprintf(stderr, "Exit %d\n", __LINE__);
exit(1);
}
mFD = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
if (mFD == -1)
{
fprintf(stderr, "Exit %d\n", __LINE__);
exit(1);
}
if (connect(mFD, res->ai_addr, res->ai_addrlen) < 0) …Run Code Online (Sandbox Code Playgroud) 请解释为什么以下表达式不输出任何内容:
echo "<firstname.lastname@domain.com>" | egrep "<lastname@domain.com>"
Run Code Online (Sandbox Code Playgroud)
但以下是:
echo "<firstname.lastname@domain.com>" | egrep "\<lastname@domain.com>"
Run Code Online (Sandbox Code Playgroud)
第一个的行为是预期的,但第二个不应该输出.在正则表达式中是否会忽略"\ <"或导致其他一些特殊行为?