91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 6KB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發(fā)布日期: 2021-06-06
  • 語言: 其他
  • 標(biāo)簽: csapp.h??

資源簡介

深入理解操作系統(tǒng)中的頭文件和源代碼,此處提供下載,免于自己敲代碼

資源截圖

代碼片段和文件信息

/*?$begin?csapp.c?*/
#include?“csapp.h“

/**************************?
?*?Error-handling?functions
?**************************/
/*?$begin?errorfuns?*/
/*?$begin?unixerror?*/
void?unix_error(char?*msg)?/*?unix-style?error?*/
{
????fprintf(stderr?“%s:?%s\n“?msg?strerror(errno));
????exit(0);
}
/*?$end?unixerror?*/

void?posix_error(int?code?char?*msg)?/*?posix-style?error?*/
{
????fprintf(stderr?“%s:?%s\n“?msg?strerror(code));
????exit(0);
}

void?dns_error(char?*msg)?/*?dns-style?error?*/
{
????fprintf(stderr?“%s:?DNS?error?%d\n“?msg?h_errno);
????exit(0);
}

void?app_error(char?*msg)?/*?application?error?*/
{
????fprintf(stderr?“%s\n“?msg);
????exit(0);
}
/*?$end?errorfuns?*/

/*********************************************
?*?Wrappers?for?Unix?process?control?functions
?********************************************/

/*?$begin?forkwrapper?*/
pid_t?Fork(void)?
{
????pid_t?pid;

????if?((pid?=?fork())? unix_error(“Fork?error“);
????return?pid;
}
/*?$end?forkwrapper?*/

void?Execve(const?char?*filename?char?*const?argv[]?char?*const?envp[])?
{
????if?(execve(filename?argv?envp)? unix_error(“Execve?error“);
}

/*?$begin?wait?*/
pid_t?Wait(int?*status)?
{
????pid_t?pid;

????if?((pid??=?wait(status))? unix_error(“Wait?error“);
????return?pid;
}
/*?$end?wait?*/

pid_t?Waitpid(pid_t?pid?int?*iptr?int?options)?
{
????pid_t?retpid;

????if?((retpid??=?waitpid(pid?iptr?options))? unix_error(“Waitpid?error“);
????return(retpid);
}

/*?$begin?kill?*/
void?Kill(pid_t?pid?int?signum)?
{
????int?rc;

????if?((rc?=?kill(pid?signum))? unix_error(“Kill?error“);
}
/*?$end?kill?*/

void?Pause()?
{
????(void)pause();
????return;
}

unsigned?int?Sleep(unsigned?int?secs)?
{
????unsigned?int?rc;

????if?((rc?=?sleep(secs))? unix_error(“Sleep?error“);
????return?rc;
}

unsigned?int?Alarm(unsigned?int?seconds)?{
????return?alarm(seconds);
}
?
void?Setpgid(pid_t?pid?pid_t?pgid)?{
????int?rc;

????if?((rc?=?setpgid(pid?pgid))? unix_error(“Setpgid?error“);
????return;
}

pid_t?Getpgrp(void)?{
????return?getpgrp();
}

/************************************
?*?Wrappers?for?Unix?signal?functions?
?***********************************/

/*?$begin?sigaction?*/
handler_t?*Signal(int?signum?handler_t?*handler)?
{
????struct?sigaction?action?old_action;

????action.sa_handler?=?handler;??
????sigemptyset(&action.sa_mask);?/*?block?sigs?of?type?being?handled?*/
????action.sa_flags?=?SA_RESTART;?/*?restart?syscalls?if?possible?*/

????if?(sigaction(signum?&action?&old_action)? unix_error(“Signal?error“);
????return?(old_action.sa_handler);
}
/*?$end?sigaction?*/

void?Sigprocmask(int?how?const?sigset_t?*set?sigset_t?*oldset)
{
????if?(sigprocmask(how?set?oldset)? unix_error(“Sigprocmask?error“);
????return;
}

void?Sigemptyset(sigset_t?*set)
{
????if?(sigemptyset(set)? unix_error(“Sigemptyset?error“);
????return;
}

void?Sigfillset(sigset_t?*set)
{?
????if?(sigfillset(set)? unix_error(“Sigfillset?error

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件??????17746??2011-04-02?16:02??csapp.c

?????文件???????5581??2011-04-02?14:16??csapp.h

-----------?---------??----------?-----??----

????????????????23327????????????????????2


評論

共有 條評論

相關(guān)資源