• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ errnoAbort函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中errnoAbort函数的典型用法代码示例。如果您正苦于以下问题:C++ errnoAbort函数的具体用法?C++ errnoAbort怎么用?C++ errnoAbort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了errnoAbort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tcpCountServer

void tcpCountServer(char *portName)
/* tcpCountServer - A server that just returns a steadily increasing stream of numbers. 
 * This one is based on tcp */
{
int port = atoi(portName);
int ear, socket, size;
char buf[1024];
int count = 0;
struct timeval startTime, tv;
struct countMessage sendMessage, receiveMessage;

ear = netAcceptingSocket(port, 100);
gettimeofday(&startTime, NULL);
for (;;)
    {
    socket = netAccept(ear);
    if (socket < 0)
	errnoAbort("Couldn't accept first");
    size = netReadAll(socket, &receiveMessage, sizeof(receiveMessage));
    if (size < sizeof(receiveMessage))
        continue;
    gettimeofday(&tv, NULL);
    sendMessage.time = timeDiff(&startTime, &tv);
    sendMessage.echoTime = receiveMessage.time;
    sendMessage.count = ++count;
    sendMessage.message = receiveMessage.message + 256;
    write(socket, &sendMessage, sizeof(sendMessage));
    close(socket);
    if (size < 0)
	errnoAbort("Couldn't read first");
    if (!receiveMessage.message)
         break;
    }
printf("All done after %d\n", count);
}
开发者ID:davidhoover,项目名称:kent,代码行数:35,代码来源:countServer.c


示例2: plProcSetup

static void plProcSetup(struct plProc* proc, int stdinFd, int stdoutFd, int stderrFd)
/* setup signal, error handling, and file descriptors after fork */
{
/* Optionally treat a closed pipe as an EOF rather than getting SIGPIPE */
if (signal(SIGPIPE, ((proc->pl->options & pipelineSigpipe) ? SIG_DFL : SIG_IGN)) == SIG_ERR)
    errnoAbort("error ignoring SIGPIPE");

if (setpgid(getpid(), proc->pl->groupLeader) != 0)
    errnoAbort("error from setpgid(%d, %d)", getpid(), proc->pl->groupLeader);

/* child, first setup stdio files */
if (stdinFd != STDIN_FILENO)
    {
    if (dup2(stdinFd, STDIN_FILENO) < 0)
        errnoAbort("can't dup2 to stdin");
    }
    
if (stdoutFd != STDOUT_FILENO)
    {
    if (dup2(stdoutFd, STDOUT_FILENO) < 0)
        errnoAbort("can't dup2 to stdout");
    }
    
if (stderrFd != STDERR_FILENO)
    {
    if (dup2(stderrFd, STDERR_FILENO) < 0)
        errnoAbort("can't dup2 to stderr");
    }
closeNonStdDescriptors();
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:30,代码来源:pipeline.c


示例3: mustMkstemp

int mustMkstemp(char tempFileName[PATH_LEN])
/* Fill in temporary file name with name of a tmp file and return open file handle. 
 * Also set permissions to something better. */
{
int fd = mkstemp(tempFileName);
if (fd == -1)
    errnoAbort("Couldn't make temp file %s", tempFileName);
if (fchmod(fd, 0664) == -1)
    errnoAbort("Couldn't change permissions on temp file %s", tempFileName);
return fd;
}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:11,代码来源:edwSubmit.c


示例4: errnoAbort

char *mustReadSymlink(char *path)
/* Read symlink or abort. Checks that path is a symlink. 
FreeMem the returned value. */
{
struct stat sb;
if (lstat(path, &sb) == -1)
    errnoAbort("lstat failure on %s", path);
if ((sb.st_mode & S_IFMT) != S_IFLNK)
    errnoAbort("path %s not a symlink.", path);
return mustReadSymlinkExt(path, &sb);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:11,代码来源:osunix.c


示例5: copyOpenFile

void copyOpenFile(FILE *inFh, FILE *outFh)
/* copy an open stdio file */
{
int c;
while ((c = fgetc(inFh)) != EOF)
    fputc(c, outFh);
if (ferror(inFh))
    errnoAbort("file read failed");
if (ferror(outFh))
    errnoAbort("file write failed");
}
开发者ID:andrelmartins,项目名称:bigWig,代码行数:11,代码来源:obscure.c


示例6: touchFileFromFile

void touchFileFromFile(const char *oldFile, const char *newFile)
/* Set access and mod time of newFile from oldFile. */
{
    struct stat buf;
    if (stat(oldFile, &buf) != 0)
        errnoAbort("stat failed on %s", oldFile);
    struct utimbuf puttime;
    puttime.modtime = buf.st_mtime;
    puttime.actime = buf.st_atime;
    if (utime(newFile, &puttime) != 0)
	errnoAbort("utime failed on %s", newFile);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:12,代码来源:osunix.c


示例7: mustRemove

void mustRemove(char *path)
/* Remove file or die trying */
{
int err = remove(path);
if (err < 0)
    errnoAbort("Couldn't remove %s", path);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:7,代码来源:osunix.c


示例8: mustRename

void mustRename(char *oldName, char *newName)
/* Rename file or die trying. */
{
int err = rename(oldName, newName);
if (err < 0)
    errnoAbort("Couldn't rename %s to %s", oldName, newName);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:7,代码来源:osunix.c


示例9: safeGetOne

boolean safeGetOne(char *source, char *dest)
/* Fetch file from source to tmp file.  When fetch
 * is done rename temp file to dest and return TRUE. */
{
struct dyString *command = dyStringNew(0);
boolean ok = TRUE;
int err;

dyStringClear(command);
dyStringPrintf(command, "wget -nv -O %s '%s'", 
    tmpName, source);
verbose(2, "%s\n", command->string);
if ((err = system(command->string)) != 0)
    {
    fprintf(fLog, "Error %d on %s\n", err, command->string);
    warn("Error %d on %s", err, command->string);
    ++errCount;
    if (errCount > maxErrs)
        errAbort("Aborting after %d wget errors", errCount);
    ok = FALSE;
    }
verbose(2, "wget returned %d\n", err);

/* Rename file to proper name */
if (ok)
    {
    if ((err = rename(tmpName, dest)) < 0)
	{
	fprintf(fLog, "Couldn't rename %s to %s\n", tmpName, dest);
	errnoAbort("Couldn't rename %s to %s", tmpName, dest);
	}
    }
dyStringFree(&command);
return ok;
}
开发者ID:davidhoover,项目名称:kent,代码行数:35,代码来源:gensatImageDownload.c


示例10: copyFile

void copyFile(char *source, char *dest)
/* Copy file from source to dest. */
{
int bufSize = 64*1024;
char *buf = needMem(bufSize);
int bytesRead;
int s, d;

s = open(source, O_RDONLY);
if (s < 0)
    errAbort("Couldn't open %s. %s\n", source, strerror(errno));
d = creat(dest, 0777);
if (d < 0)
    {
    close(s);
    errAbort("Couldn't open %s. %s\n", dest, strerror(errno));
    }
while ((bytesRead = read(s, buf, bufSize)) > 0)
    {
    if (write(d, buf, bytesRead) < 0)
        errAbort("Write error on %s. %s\n", dest, strerror(errno));
    }
close(s);
if (close(d) != 0)
    errnoAbort("close failed");
freeMem(buf);
}
开发者ID:andrelmartins,项目名称:bigWig,代码行数:27,代码来源:obscure.c


示例11: moreMimeBuf

static void moreMimeBuf(struct mimeBuf *b)
{
int bytesRead = 0, bytesToRead = 0;
if (b->blen > 1)
    {
    int r = b->eoi - b->i;
    memmove(b->buf, b->i, r);
    b->eoi = b->buf+r;
    }
else
    {
    b->eoi = b->buf;
    }
b->i = b->buf+0;
bytesToRead = b->eom - b->eoi;
while (bytesToRead > 0)
    {
    bytesRead = read(b->d, b->eoi, bytesToRead);
    if (bytesRead < 0)
        errnoAbort("moreMimeBuf: error reading MIME input descriptor");
    b->eoi += bytesRead;
    if (bytesRead == 0)
        break;
    bytesToRead = bytesToRead - bytesRead;
    }
setEopMB(b);
setEodMB(b);
//debug
//fprintf(stderr,"post-moreMime dumpMB: ");
//dumpMB(b);  //debug
}
开发者ID:JimKent,项目名称:linearSat,代码行数:31,代码来源:mime.c


示例12: plProcExecChild

static void plProcExecChild(struct plProc* proc, int stdinFd, int stdoutFd, int stderrFd)
/* child part of process startup. */
{
plProcSetup(proc, stdinFd, stdoutFd, stderrFd);
execvp(proc->cmd[0], proc->cmd);
errnoAbort("exec failed: %s", proc->cmd[0]);
}
开发者ID:Nicholas-NVS,项目名称:kentUtils,代码行数:7,代码来源:pipeline.c


示例13: pipelineExecProc

static int pipelineExecProc(struct pipeline* pl, struct plProc *proc,
                            int prevStdoutFd, int stdinFd, int stdoutFd, int stderrFd,
                            void *otherEndBuf, size_t otherEndBufSize)
/* start a process in the pipeline, return the stdout fd of the process */
{
/* determine stdin/stdout to use */
int procStdinFd, procStdoutFd;
if (proc == pl->procs)
    procStdinFd = stdinFd; /* first process in pipeline */
else
    procStdinFd = prevStdoutFd;
if (proc->next == NULL)
    procStdoutFd = stdoutFd; /* last process in pipeline */
else
    prevStdoutFd = pipeCreate(&procStdoutFd);

/* start process */
if ((proc->pid = fork()) < 0)
    errnoAbort("can't fork");
if (proc->pid == 0)
    {
    if (otherEndBuf != NULL)
        plProcMemWrite(proc, procStdoutFd, stderrFd, otherEndBuf, otherEndBufSize);
    else
        plProcExecChild(proc, procStdinFd, procStdoutFd, stderrFd);
    }

/* don't leave intermediate pipes open in parent */
if (proc != pl->procs)
    safeClose(&procStdinFd);
if (proc->next != NULL)
    safeClose(&procStdoutFd);
return prevStdoutFd;
}
开发者ID:kenongit,项目名称:sequencing,代码行数:34,代码来源:pipeline.c


示例14: samToOpenBed

void samToOpenBed(char *samIn, FILE *f)
/* Like samToOpenBed, but the output is the already open file f. */
{
    samfile_t *sf = samopen(samIn, "r", NULL);
    bam_header_t *bamHeader = sf->header;
    bam1_t one;
    ZeroVar(&one);
    int err;
    while ((err = samread(sf, &one)) >= 0)
    {
        int32_t tid = one.core.tid;
        if (tid < 0)
            continue;
        char *chrom = bamHeader->target_name[tid];
        // Approximate here... can do better if parse cigar.
        int start = one.core.pos;
        int size = one.core.l_qseq;
        int end = start + size;
        boolean isRc = (one.core.flag & BAM_FREVERSE);
        char strand = '+';
        if (isRc)
        {
            strand = '-';
            reverseIntRange(&start, &end, bamHeader->target_len[tid]);
        }
        fprintf(f, "%s\t%d\t%d\t.\t0\t%c\n", chrom, start, end, strand);
    }
    if (err < 0 && err != -1)
        errnoAbort("samread err %d", err);
    samclose(sf);
}
开发者ID:avilella,项目名称:methylQA,代码行数:31,代码来源:bamFile.c


示例15: rawKeyIn

int rawKeyIn()
/* Read in an unbuffered, unechoed character from keyboard. */
{
struct termios attr;
tcflag_t old;
char c;

/* Set terminal to non-echoing non-buffered state. */
if (tcgetattr(STDIN_FILENO, &attr) != 0)
    errAbort("Couldn't do tcgetattr");
old = attr.c_lflag;
attr.c_lflag &= ~ICANON;
attr.c_lflag &= ~ECHO;
if (tcsetattr(STDIN_FILENO, TCSANOW, &attr) == -1)
    errAbort("Couldn't do tcsetattr");

/* Read one byte */
if (read(STDIN_FILENO,&c,1) != 1)
   errnoAbort("rawKeyIn: I/O error");

/* Put back terminal to how it was. */
attr.c_lflag = old;
if (tcsetattr(STDIN_FILENO, TCSANOW, &attr) == -1)
    errAbort("Couldn't do tcsetattr2");
return c;
}
开发者ID:Bioinformaticsnl,项目名称:SimSeq,代码行数:26,代码来源:osunix.c


示例16: getFloatArray

static void getFloatArray(struct annoStreamWig *self, struct wiggle *wiggle,
			  boolean *retRightFail, int *retValidCount, float *vector)
/* expand wiggle bytes & spans to per-bp floats; filter values here! */
{
udcSeek(self->wibFH, wiggle->offset);
UBYTE wigBuf[wiggle->count];
size_t expectedBytes = sizeof(wigBuf);
size_t bytesRead = udcRead(self->wibFH, wigBuf, expectedBytes);
if (bytesRead != expectedBytes)
    errnoAbort("annoStreamWig: failed to udcRead %llu bytes from %s (got %llu)\n",
	       (unsigned long long)expectedBytes, wiggle->file, (unsigned long long)bytesRead);
paranoidCheckSize(self, wiggle);
int i, j, validCount = 0;
for (i = 0;  i < wiggle->count;  i++)
    {
    float value;
    if (wigBuf[i] == WIG_NO_DATA)
	value = NAN;
    else
	{
	value = BIN_TO_VALUE(wigBuf[i], wiggle->lowerLimit, wiggle->dataRange);
	if (annoFilterWigValueFails(self->streamer.filters, value, retRightFail))
	    value = NAN;
	else
	    validCount++;
	}
    int bpOffset = i * wiggle->span;
    for (j = 0;  j < wiggle->span;  j++)
	vector[bpOffset + j] = value;
    }
if (retValidCount != NULL)
    *retValidCount = validCount;
}
开发者ID:EffieChantzi,项目名称:UCSC-Genome-Browser,代码行数:33,代码来源:annoStreamWig.c


示例17: makeSymLink

void makeSymLink(char *oldName, char *newName)
/* Return a symbolic link from newName to oldName or die trying */
{
int err = symlink(oldName, newName);
if (err < 0)
     errnoAbort("Couldn't make symbolic link from %s to %s\n", oldName, newName);
}
开发者ID:ucscGenomeBrowser,项目名称:kent,代码行数:7,代码来源:osunix.c


示例18: openRead

static int openRead(char *fname)
/* open a file for reading */
{
int fd = open(fname, O_RDONLY);
if (fd < 0)
    errnoAbort("can't open for read access: %s", fname);
return fd;
}
开发者ID:kenongit,项目名称:sequencing,代码行数:8,代码来源:pipeline.c


示例19: plProcExecChild

static void plProcExecChild(struct plProc* proc, int stdinFd, int stdoutFd, int stderrFd)
/* child part of process startup. */
{
plProcSetup(proc, stdinFd, stdoutFd, stderrFd);
/* FIXME: add close-on-exec startup error reporting here */
execvp(proc->cmd[0], proc->cmd);
errnoAbort("exec failed: %s", proc->cmd[0]);
}
开发者ID:kenongit,项目名称:sequencing,代码行数:8,代码来源:pipeline.c


示例20: isPipe

boolean isPipe(int fd)
/* determine in an open file is a pipe  */
{
struct stat buf;
if (fstat(fd, &buf) < 0)
    errnoAbort("isPipe: fstat failed");
return S_ISFIFO(buf.st_mode);
}
开发者ID:Bioinformaticsnl,项目名称:SimSeq,代码行数:8,代码来源:osunix.c



注:本文中的errnoAbort函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ errno_assert函数代码示例发布时间:2022-05-30
下一篇:
C++ errmsg函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap