本文整理汇总了C++中err_printf函数的典型用法代码示例。如果您正苦于以下问题:C++ err_printf函数的具体用法?C++ err_printf怎么用?C++ err_printf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了err_printf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
/* main function takes a PLATYPUS source file as
* an argument at the command line.
* usage: scanner source_file_name"
*/
int main(int argc, char ** argv){
Buffer *sc_buf; /* pointer to input (source) buffer */
FILE *fi; /* input file handle */
Token t; /* token produced by the scanner */
int loadsize = 0; /*the size of the file loaded in the buffer */
int ansi_c = !ANSI_C; /* ANSI C compliancy flag */
/* Check if the compiler option is set to compile ANSI C */
/* __DATE__, __TIME__, __LINE__, __FILE__, __STDC__ are predefined preprocessor macros*/
if(ansi_c){
err_printf("Date: %s Time: %s",__DATE__, __TIME__);
err_printf("ERROR: Compiler is not ANSI C compliant!\n");
exit(1);
}
/*check for correct arrguments - source file name */
if (argc <= 1){
/* __DATE__, __TIME__, __LINE__, __FILE__ are predefined preprocessor macros*/
err_printf("Date: %s Time: %s",__DATE__, __TIME__);
err_printf("Runtime error at line %d in file %s", __LINE__, __FILE__);
err_printf("%s%s%s",argv[0],": ","Missing source file name.");
err_printf("%s%s%s","Usage: ", "scanner", " source_file_name");
exit(1);
}
/* create a source code input buffer - multiplicative mode */
sc_buf = b_create(INIT_CAPACITY,INC_FACTOR,'m');
if (sc_buf == NULL){
err_printf("%s%s%s",argv[0],": ","Could not create source buffer");
exit(1);
}
/*open source file */
if ((fi = fopen(argv[1],"r")) == NULL){
err_printf("%s%s%s%s",argv[0],": ", "Cannot open file: ",argv[1]);
exit (1);
}
/* load source file into input buffer */
printf("Reading file %s ....Please wait\n",argv[1]);
loadsize = b_load (fi,sc_buf);
if(loadsize == R_FAIL_1)
err_printf("%s%s%s",argv[0],": ","Error in loading buffer.");
/* close source file */
fclose(fi);
/*find the size of the file */
if (loadsize == LOAD_FAIL){
printf("The input file %s %s\n", argv[1],"is not completely loaded.");
printf("Input file size: %ld\n", get_filesize(argv[1]));
}
/* pack and display the source buffer */
if(b_pack(sc_buf)){
display(sc_buf);
}
/* create string Literal Table */
str_LTBL = b_create(INIT_CAPACITY,INC_FACTOR,'a');
if (str_LTBL == NULL){
err_printf("%s%s%s",argv[0],": ","Could not create string literals buffer");
exit(1);
}
/*Testbed for the scanner */
/* add SEOF to input program buffer*/
b_addc(sc_buf,'\0');
/* Initialize scanner input buffer */
if(scanner_init(sc_buf)){;
err_printf("%s%s%s",argv[0],": ","Empty program buffer - scanning canceled");
exit(1);
}
printf("\nScanning source file...\n\n");
printf("Token\t\tAttribute\n");
printf("----------------------------------\n");
do{
t= mlwpar_next_token(sc_buf);
print_token(t);
}while(t.code != SEOF_T);
if(b_size(str_LTBL)) b_print(str_LTBL);
b_destroy(sc_buf);
b_destroy(str_LTBL);
sc_buf = str_LTBL = NULL;
return (0);
}
开发者ID:Flaniel44,项目名称:Scanner,代码行数:94,代码来源:platy_st.c
示例2: while
SysStatus
HATDefaultBase<ALLOC>::unmapRange(uval rangeAddr, uval rangeSize, VPSet ppset)
{
SysStatus rc=0;
SegmentList<ALLOC>* restart;
SegmentHATRef ref;
VPSet *tmpset, unionset;
VPNum numprocs, pp, mypp;
uval rangeEnd = rangeAddr+rangeSize;
uval segmentAddr, segmentEnd;
UnmapRangeMsg msg;
/* we first cleanup the global list and find what processors have cached
* copies of the segment in their local lists.
*/
glock.acquire();
restart = &segmentList;
while (0<=(rc = SegmentList<ALLOC>::DeleteSegment(
rangeAddr, rangeEnd, segmentAddr, segmentEnd,
ref, tmpset, restart))) {
// accumulate all pp's which have seen any relevant segment
unionset.unite(*tmpset);
if(rc == 0) {
// if we delete the whole segmentHAT, we must visit
// every processor that's seen it, no matter what this
// region says
ppset.unite(*tmpset);
}
}
glock.release();
// only visit pp's which this region has seen
unionset.intersect(ppset);
msg.barrier = 1;
msg.waiter = Scheduler::GetCurThread();
msg.myRef = getRef();
msg.start = rangeAddr;
msg.size = rangeSize;
mypp = Scheduler::GetVP(); // physical processor
numprocs = DREFGOBJK(TheProcessRef)->vpCount();
for (pp = unionset.firstVP(numprocs); pp < numprocs;
pp = unionset.nextVP(pp, numprocs)) {
if (pp != mypp) {
//err_printf("Remote unmap for %d\n", vp);
FetchAndAddSignedVolatile(&msg.barrier,1);
rc = MPMsgMgr::SendAsyncUval(Scheduler::GetEnabledMsgMgr(),
SysTypes::DSPID(0, pp),
UnmapRangeMsgHandler, uval(&msg));
tassert(_SUCCESS(rc),err_printf("UnmapRange remote failed\n"));
}
}
if (unionset.isSet(mypp)) {
rc = unmapRangeLocal(rangeAddr, rangeSize);
tassert(_SUCCESS(rc), err_printf("oops\n"));
}
FetchAndAddSignedVolatile(&msg.barrier,-1);
while (msg.barrier != 0) {
Scheduler::Block();
}
//err_printf("All done unmapRange\n");
return 0;
}
开发者ID:BillTheBest,项目名称:k42,代码行数:67,代码来源:HATDefault.C
示例3: bwa_print_sam_PG
void bwa_print_sam_PG()
{
err_printf("@PG\tID:bwa\tPN:bwa\tVN:%s\n", PACKAGE_VERSION);
}
开发者ID:Frogee,项目名称:bwa,代码行数:4,代码来源:main.c
示例4: kinit
//.........这里部分代码省略.........
(unsigned long long)virtBase);
/*
* Memory from __end_bss
* to the end of physical memory is available for allocation.
* Correct first for the 2MB page mapping the kernel.
*/
early_printk("__bss_end is 0x%lx physEnd is 0x%lx \n", __bss_end , physEnd);
uval allocStart = ALIGN_UP(__bss_end, SEGMENT_SIZE);
uval allocEnd = virtBase + physEnd;
early_printk("allocStart is 0x%lx allocEnd is 0x%lx \n",
allocStart, allocEnd);
memory->init(physStart, physEnd, virtBase, allocStart, allocEnd);
/*
* Remove mappings between allocStart and
* BOOT_MINIMUM_REAL_MEMORY to allow 4KB page mapping for
* that range. No need to tlb invalidate, unless they are
* touched (debugging). Actually we need to keep the first
* 2MB mapping above allocStart so that we can initialize the
* first 2 (or 3 if we need a PDP page as well) 4KB pages
* which are PDE and PTE pages for the V->R mapping before
* they are themselves mapped as 4KB pages.
*/
early_printk("top page real address is 0x%lx \n", (uval)&level4_pgt);
uval level1_pgt_virt = memory->virtFromPhys((uval)&level4_pgt);
early_printk("top page real address is 0x%lx \n", (uval)level4_pgt & ~0xfff);
early_printk("top page virtual address is 0x%lx \n", (uval )level1_pgt_virt);
for (vaddr = allocStart + SEGMENT_SIZE; vaddr < allocEnd; vaddr += SEGMENT_SIZE) {
#ifndef NDEBUG
// early_printk("removing pde, pml4 at virtual address 0x%lx \n", EARLY_VADDR_TO_L1_PTE_P(level1_pgt_virt, vaddr, memory));
TOUCH(EARLY_VADDR_TO_L1_PTE_P(level1_pgt_virt, vaddr, memory));
// early_printk("removing pde, pdp at virtual address 0x%lx \n", EARLY_VADDR_TO_L2_PTE_P(level1_pgt_virt, vaddr, memory));
TOUCH(EARLY_VADDR_TO_L2_PTE_P(level1_pgt_virt, vaddr, memory));
// early_printk("removing pde at virtual address 0x%lx \n", EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt, vaddr, memory));
TOUCH(EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt, vaddr, memory));
#endif /* #ifndef NDEBUG */
EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt, vaddr, memory)->P = 0;
EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt, vaddr, memory)->PS = 0;
EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt, vaddr, memory)->G = 0;
EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt, vaddr, memory)->Frame = 0;
__flush_tlb_one(vaddr);
}
/*
* Because of the 2MB page mapping for the kernel no
* unused space can be recuperated at a 4KB page granularity.
* We may want to map the fringe bss with 4KB page(s)
* or alternatively make free for (pinned only) 4KB allocation
* the unused 4KB pages unused in the 2MB pages at this point. XXX dangerous
*/
early_printk("Calling InitKernelMappings\n");
InitKernelMappings(0, memory);
// kernelInitArgs.onSim = onSim; not there anymore but where is it set XXX
kernelInitArgs.vp = 0;
kernelInitArgs.barrierP = 0;
#define LOOP_NUMBER 0x000fffff // iteration counter for delay
init_PIC(LOOP_NUMBER);
early_printk("Calling InitIdt\n");
InitIdt(); // initialize int handlers
early_printk("Calling enableHardwareInterrupts\n");
enableHardwareInterrupts();
early_printk("Calling thinwireInit\n");
thinwireInit(memory);
/* no thinwire console XXX taken from mips64 but check */
early_printk("Calling LocalConsole and switching to tty \n");
LocalConsole::Init(vp, memory, CONSOLE_CHANNEL, 1, 0 );
err_printf("Calling KernelInit.C\n");
/* Remove the V=R initial mapping only used for jumping to
* the final mapping, i.e the first 2MB. XXX todo should not
* do it until VGABASE has been relocated currently mapped
* V==R XXX cannot use early_printk() from now on. */
L3_PTE *p;
p = EARLY_VADDR_TO_L3_PTE_P(level1_pgt_virt,(uval)0x100000,memory);
p->P = 0;
p->PS = 0;
p->G = 0;
p->Frame = 0;
__flush_tlb_one(0x100000);
KernelInit(kernelInitArgs);
/* NOTREACHED */
}
开发者ID:BillTheBest,项目名称:k42,代码行数:101,代码来源:kinit.C
示例5: wisvc_CreateKublService
void
wisvc_CreateKublService (int argc, char **argv,
char *service_name, char *BinaryPathName,
int autostart, int start_now)
{
int called_as_service = 0; /* Needed by macro err_printf */
SC_HANDLE schSCManager, schService;
int stat;
schSCManager = OpenSCManager (
NULL, /* LPCTSTR lpMachineName, address of machine name string */
NULL, /* LPCTSTR lpDatabaseName, address of database name string */
SC_MANAGER_ALL_ACCESS /* DWORD dwDesiredAccess, type of access */
);
if (NULL == schSCManager)
{
DWORD erhe = GetLastError ();
err_printf ((
"%s: Installing \"%s\" (path: \"%s\") as Windows NT service failed. "
"Could not open Services Database with OpenSCManager, errno=%ld.\n",
argv[0], service_name, BinaryPathName, erhe));
exit (1);
}
schService = CreateService (
schSCManager, /* SCManager database */
TEXT (service_name), /* name of service */
service_name, /* service name to display */
SERVICE_ALL_ACCESS, /* desired access */
SERVICE_WIN32_OWN_PROCESS, /* service type */
(autostart ? SERVICE_AUTO_START : SERVICE_DEMAND_START), /* start type */
SERVICE_ERROR_NORMAL, /* error control type */
((LPCSTR) BinaryPathName), /* service's binary */
NULL, /* no load ordering group */
NULL, /* no tag identifier */
NULL, /* no dependencies */
NULL, /* LocalSystem account */
NULL); /* no password */
if (NULL == schService)
{
DWORD erhe = GetLastError ();
if (ERROR_SERVICE_EXISTS == erhe)
{
err_printf ((
"%s: Cannot install service \"%s\" because a service with the same "
"name already exists! (errno=%ld, path=\"%s\").\n",
argv[0], service_name, erhe, BinaryPathName));
}
else if (ERROR_SERVICE_MARKED_FOR_DELETE == erhe)
{
err_printf ((
"%s: Cannot install service \"%s\" because a service with the same "
"name still exists, although it has been marked for delete. Use ISQL to "
"stop the old service with shutdown or raw_exit() before continuing "
" (errno=%ld, path=\"%s\").\n",
argv[0], service_name, erhe, BinaryPathName));
}
else
{
err_printf ((
"%s: Installing \"%s\" (path: \"%s\") as Windows NT service failed. "
"CreateService returned NULL, errno=%ld.\n",
argv[0], service_name, BinaryPathName, erhe));
}
exit (1);
}
err_printf (("%s: Service \"%s\" installed successfully.\n",
argv[0], service_name));
if (start_now)
{
stat = wisvc_StartKublService (argc, argv, schService,
service_name, BinaryPathName, 1);
}
CloseServiceHandle (schService);
exit (!stat);
}
开发者ID:China-ls,项目名称:virtuoso-opensource,代码行数:85,代码来源:wiservic.c
示例6: setPFBit
/* virtual */ SysStatusUval
FCMPrimitive<PL,ALLOC>::mapPage(uval offset, uval regionVaddr, uval regionSize,
AccessMode::pageFaultInfo pfinfo, uval vaddr,
AccessMode::mode access, HATRef hat, VPNum vp,
RegionRef reg, uval firstAccessOnPP,
PageFaultNotification */*fn*/)
{
SysStatus rc;
uval paddr;
uval unneededFrameAddr=0;
setPFBit(fcmPrimitive);
ScopeTime timer(MapPageTimer);
/*
* we round vaddr down to a pageSize boundary.
* thus, pageSize is the smallest pageSize this FCM supports.
* for now, its the only size - but we may consider using multiple
* page sizes in a single FCM in the future.
* Note that caller can't round down since caller may not know
* the FCM pageSize.
*/
vaddr &= -this->pageSize;
if (firstAccessOnPP) this->updateRegionPPSet(reg);
this->lock.acquire();
offset += vaddr - regionVaddr;
//err_printf("FCMPrimitive::mapPage(o %lx, h %lx)\n", offset, hat);
MLSStatistics::StartTimer(4);
PageDesc *pg = this->findPage(offset);
MLSStatistics::DoneTimer(4);
if (!pg) {
// allocate a new page
uval virtAddr;
this->lock.release();
rc = DREF(this->pmRef)->allocPages(this->getRef(), virtAddr,
this->pageSize, this->pageable);
tassert(_SUCCESS(rc), err_printf("woops\n"));
this->lock.acquire();
if ((pg = this->findPage(offset)) != 0) {
// added in our absence
unneededFrameAddr = virtAddr;
paddr = pg->paddr;
TraceOSMemFCMPrimFoundPage(offset, paddr);
} else {
paddr = PageAllocatorKernPinned::virtToReal(virtAddr);
TraceOSMemFCMPrimMapPage(vaddr, offset, paddr,
(uval64)this);
pg = this->addPage(offset, paddr, this->pageSize);
pg->cacheSynced = PageDesc::SET;
DILMA_TRACE_PAGE_DIRTY(this,pg,1);
pg->dirty = PageDesc::SET;
}
} else {
paddr = pg->paddr;
TraceOSMemFCMPrimFound1Page(offset, paddr);
}
tassert(1, err_printf(" should use offset %ld\n", offset));
MLSStatistics::StartTimer(5);
rc = this->mapPageInHAT(vaddr, pfinfo, access, vp, hat, reg, pg, offset);
MLSStatistics::DoneTimer(5);
this->lock.release();
/*
* do the free not holding a lock for safety sake
*/
if (unneededFrameAddr != 0) {
DREF(this->pmRef)->deallocPages(this->getRef(), unneededFrameAddr,
this->pageSize);
}
return rc;
}
开发者ID:BillTheBest,项目名称:k42,代码行数:78,代码来源:FCMPrimitive.C
示例7: coord_rmsd
/*-------------------- coord_rmsd ------------------------------------------
* Takes a pairset and two structures and moves coord1 on top of coord2 so
* that the RMSD is minimized. The superimposed structures are returned as
* c1_new and c2_new. If sub_flag is set, the returned structures contain only
* the subset of residues specified by the pairset.
*/
int
coord_rmsd(struct pair_set *const pairset, struct coord *source,
struct coord *target, const int sub_flag, float *rmsd,
struct coord **c1_new, struct coord **c2_new)
{
float rmat[3][3];
size_t tmp_idx = 0;
size_t size, i;
int r, a, b;
struct RPoint translation1, translation2;
int **pairs = pairset->indices;
struct coord *temp_struct_1 =
coord_template(source, coord_size(source));
struct coord *temp_struct_2 =
coord_template(target, coord_size(target));
const char *this_sub = "coord_rmsd";
/* Create temporary structures to hold the aligned parts of the two structures */
temp_struct_1->seq = seq_copy(source->seq);
temp_struct_2->seq = seq_copy(target->seq);
coord_nm_2_a(temp_struct_1);
coord_nm_2_a(temp_struct_2);
if(sub_flag > 4){
for (i = 0; i < pairset->n; i++) {
a = pairs[i][0];
b = pairs[i][1];
if (a != GAP_INDEX && b != GAP_INDEX) {
copy_coord_elem(temp_struct_1, source, tmp_idx, pairs[i][1]);
copy_coord_elem(temp_struct_2, target, tmp_idx, pairs[i][0]);
tmp_idx++;
}
}
}
else{
for (i = 0; i < pairset->n; i++) {
a = pairs[i][0];
b = pairs[i][1];
if (a != GAP_INDEX && b != GAP_INDEX) {
copy_coord_elem(temp_struct_1, source, tmp_idx, pairs[i][0]);
copy_coord_elem(temp_struct_2, target, tmp_idx, pairs[i][1]);
tmp_idx++;
}
}
}
size = tmp_idx;
coord_trim(temp_struct_1, size);
coord_trim(temp_struct_2, size);
/* Determine the center of mass of the two structures and move the CoMs to the
* coordinate origin.
*/
translation1 = calc_CM(size, temp_struct_1->rp_ca);
translation2 = calc_CM(size, temp_struct_2->rp_ca);
coord_trans(&translation1, temp_struct_1, size);
coord_trans(&translation2, temp_struct_2, size);
/* Determine the rotation matrix and apply the rotation to structure 2.
* Then calculate the RMSD
*/
r = lsq_fit(tmp_idx, temp_struct_1->rp_ca, temp_struct_2->rp_ca,
rmat);
if (r == EXIT_FAILURE) {
err_printf(this_sub, "lsq_fit fail\n");
*rmsd = -1;
goto escape;
}
apply_rot(rmat, temp_struct_1);
*rmsd = calc_RMSD(size, temp_struct_1->rp_ca, temp_struct_2->rp_ca);
/* Move the structures' CoMs back to the original CoM of structure 2.*/
translation2.x *= -1;
translation2.y *= -1;
translation2.z *= -1;
/* If only the aligned subset of the structures is needed, translate and
* return the temporary structures.
*/
if (sub_flag%2) {
coord_trans(&translation2, temp_struct_1, size);
coord_trans(&translation2, temp_struct_2, size);
*c1_new = temp_struct_1;
*c2_new = temp_struct_2;
}
/* Otherwise create a copy of the original structures, apply translation
* and rotation to the copies and return those.
*/
else {
coord_destroy(temp_struct_1);
coord_destroy(temp_struct_2);
*c1_new = coord_template(source, coord_size(source));
*c2_new = coord_template(target, coord_size(target));
(*c1_new)->seq = seq_copy(source->seq);
(*c2_new)->seq = seq_copy(target->seq);
for (i = 0; i < coord_size(source); i++) {
copy_coord_elem(*c1_new, source, i, i);
}
//.........这里部分代码省略.........
开发者ID:AlexWoroschilow,项目名称:wurst-alphabet,代码行数:101,代码来源:lsqf.c
示例8: exec_wait
void exec_wait()
{
int finished = 0;
/* Process children that signaled. */
while ( !finished )
{
int i;
struct timeval tv;
struct timeval * ptv = NULL;
int select_timeout = globs.timeout;
/* Check for timeouts:
* - kill children that already timed out
* - decide how long until the next one times out
*/
if ( globs.timeout > 0 )
{
struct tms buf;
clock_t const current = times( &buf );
for ( i = 0; i < globs.jobs; ++i )
if ( cmdtab[ i ].pid )
{
clock_t const consumed =
( current - cmdtab[ i ].start_time ) / tps;
if ( consumed >= globs.timeout )
{
killpg( cmdtab[ i ].pid, SIGKILL );
cmdtab[ i ].exit_reason = EXIT_TIMEOUT;
}
else if ( globs.timeout - consumed < select_timeout )
select_timeout = globs.timeout - consumed;
}
/* If nothing else causes our select() call to exit, force it after
* however long it takes for the next one of our child processes to
* crossed its alloted processing time so we can terminate it.
*/
tv.tv_sec = select_timeout;
tv.tv_usec = 0;
ptv = &tv;
}
/* select() will wait for I/O on a descriptor, a signal, or timeout. */
{
/* disable child termination signals while in select */
int ret;
sigset_t sigmask;
sigemptyset(&sigmask);
sigaddset(&sigmask, SIGCHLD);
sigprocmask(SIG_BLOCK, &sigmask, NULL);
while ( ( ret = poll( wait_fds, WAIT_FDS_SIZE, select_timeout * 1000 ) ) == -1 )
if ( errno != EINTR )
break;
/* restore original signal mask by unblocking sigchld */
sigprocmask(SIG_UNBLOCK, &sigmask, NULL);
if ( ret <= 0 )
continue;
}
for ( i = 0; i < globs.jobs; ++i )
{
int out_done = 0;
int err_done = 0;
if ( GET_WAIT_FD( i )[ OUT ].revents )
out_done = read_descriptor( i, OUT );
if ( globs.pipe_action && ( GET_WAIT_FD( i )[ ERR ].revents ) )
err_done = read_descriptor( i, ERR );
/* If feof on either descriptor, we are done. */
if ( out_done || err_done )
{
int pid;
int status;
int rstat;
timing_info time_info;
struct rusage cmd_usage;
/* We found a terminated child process - our search is done. */
finished = 1;
/* Close the stream and pipe descriptors. */
close_streams( i, OUT );
if ( globs.pipe_action )
close_streams( i, ERR );
/* Reap the child and release resources. */
while ( ( pid = wait4( cmdtab[ i ].pid, &status, 0, &cmd_usage ) ) == -1 )
if ( errno != EINTR )
break;
if ( pid != cmdtab[ i ].pid )
{
err_printf( "unknown pid %d with errno = %d\n", pid, errno );
exit( EXITBAD );
}
/* Set reason for exit if not timed out. */
if ( WIFEXITED( status ) )
cmdtab[ i ].exit_reason = WEXITSTATUS( status )
//.........这里部分代码省略.........
开发者ID:DanielaE,项目名称:boost.build,代码行数:101,代码来源:execunix.c
示例9: RunWorkerThread
void RunWorkerThread()
{
DWORD dwKey, nBytes;
OVERLAPPED *p_Ovl;
int error;
MPD_Context *pContext;
int ret_val;
while (true)
{
if (GetQueuedCompletionStatus(g_hCommPort, &nBytes, &dwKey, &p_Ovl, INFINITE))
{
//dbg_printf("RunWorkerThread::%d bytes\n", nBytes);
if (dwKey == EXIT_WORKER_KEY)
ExitThread(0);
pContext = (MPD_Context*)dwKey;
if (nBytes)
{
if (nBytes == 1)
{
pContext->bReadPosted = false;
if (!RunRead(pContext, &ret_val))
ErrorExit("RunRead returned FALSE", ret_val);
if (pContext->bDeleteMe)
{
RemoveContext(pContext);
pContext = NULL;
}
else
{
// post the next read
error = PostContextRead(pContext);
if (error)
{
if (error == ERROR_NETNAME_DELETED || error == ERROR_IO_PENDING || error == WSAECONNABORTED)
dbg_printf("RunWorkerThread:Post read for %s(%d) failed, error %d\n", ContextTypeToString(pContext), pContext->sock, error);
else
err_printf("RunWorkerThread:Post read for %s(%d) failed, error %d\n", ContextTypeToString(pContext), pContext->sock, error);
RemoveContext(pContext);
pContext = NULL;
}
}
}
else
{
dbg_printf("RunWorkerThread: nBytes = %d, *** unexpected ***\n", nBytes);
error = PostContextRead(pContext);
if (error)
{
err_printf("RunWorkerThread:Post read for %s(%d) failed, error %d\n", ContextTypeToString(pContext), pContext->sock, error);
RemoveContext(pContext);
pContext = NULL;
}
}
}
else
{
dbg_printf("RunWorkerThread::closing context %s(%d)\n", ContextTypeToString(pContext), pContext->sock);
RemoveContext(pContext);
pContext = NULL;
}
}
else
{
error = GetLastError();
if (error == ERROR_NETNAME_DELETED || error == ERROR_IO_PENDING || error == WSAECONNABORTED)
{
dbg_printf("RunWorkerThread: GetQueuedCompletionStatus failed, error %d\n", error);
}
else
{
err_printf("RunWorkerThread: GetQueuedCompletionStatus failed, error %d\n", error);
}
//return;
}
}
}
开发者ID:hpc,项目名称:mvapich-cce,代码行数:78,代码来源:run.cpp
示例10: while
/*
* writeBlock()
*
* Writes the logical block specified to the disk. This operation is
* the only difference between PSOBasicRW and PSOPreallocExtent.
*/
sval
PSOPreallocExtent::writeBlock(uval32 lblkno, char *buffer, uval local)
{
sval rc;
uval32 dblkno;
// lock this PSO
lock.acquire();
if (lblkno < RW_MAXBLK) {
dblkno = dblk[lblkno];
// If there isn't a block already there, allocate one
if (dblkno == 0) {
uval32 extentLen = 1;
// Here is where we do extent allocation!
// First, try to see how many blocks we can sequentially allocate
while (extentLen < EXTENT_SIZE
&& lblkno + extentLen < RW_MAXBLK
&& !dblk[lblkno + extentLen]) {
extentLen++;
}
KFS_DPRINTF(DebugMask::PSO_REALLOC_EXTENT,
"PSOPreallocExtent::writeBlock() trying to allocate "
"%u blocks\n", extentLen);
rc = dblkno = globals->super->allocExtent(extentLen);
KFS_DPRINTF(DebugMask::PSO_REALLOC_EXTENT,
"PSOPreallocExtent::writeBlock() successfully "
"allocated %u blocks\n", extentLen);
if (_FAILURE(rc)) {
tassertMsg(0, "PSOPreallocExtent::writeBlock() failed to "
"alloc extent\n");
lock.release();
return rc;
}
for (uval i = 0; i < extentLen; i++) {
dblk[lblkno + i] = dblkno + i;
}
locked_markDirty(lblkno);
}
KFS_DPRINTF(DebugMask::PSO_REALLOC_EXTENT_RW,
"PSOPreallocExtent::writeBlock: writing block %u %u\n",
dblkno, lblkno);
passertMsg(dblkno, "PSOPreallocExtent::writeBlock() bad disk block "
"for writing d=%u, l=%u, this=0x%p\n",
dblkno, lblkno, this);
// FIXME: change disk routines to handle correct token
rc = llpso->writeBlock(dblkno, buffer, local);
lock.release();
return rc;
}
/* pass on to sub-object */
KFS_DPRINTF(DebugMask::PSO_REALLOC_EXTENT_RW,
"PSOPreallocExtent::write_page: forwarding subobj\n");
if (subPSO == NULL) {
// need to get a new PSO to extend the file! Since allocRecord writes
// the entry to subObjID it will be written out to the data buffer,
// because subObjID is a pointer to the correct place in the data buffer
rc = getRecordMap()->allocRecord(OT_BASIC_EXTENT, subObjID);
if (_FAILURE(rc)) {
err_printf("PSOPreallocExtent::writeBlock() problem creating ORSMap"
" entry\n");
return rc;
}
// We have to make sure the subObjID goes to disk. It'll hopefully get
// correctly flushed later. Warning: lockedMarkDirty() won't work here.
flags |= PSO_BASICRW_DIRTY;
subPSO = (PSOBase *)recordMap->getObj(subObjID);
if (subPSO == NULL) {
tassertMsg(0, "?");
// this is a problem...
lock.release();
return -1;
}
}
rc = subPSO->writeBlock(lblkno - RW_MAXBLK, buffer, local);
lock.release();
return rc;
}
开发者ID:BillTheBest,项目名称:k42,代码行数:97,代码来源:PSOPreallocExtent.C
示例11: regmatch
static int /* 0 failure, 1 success */
regmatch( char * prog )
{
char * scan; /* Current node. */
char * next; /* Next node. */
scan = prog;
#ifdef DEBUG
if (scan != NULL && regnarrate)
err_printf("%s(\n", regprop(scan));
#endif
while (scan != NULL) {
#ifdef DEBUG
if (regnarrate)
err_printf("%s...\n", regprop(scan));
#endif
next = regnext(scan);
switch (OP(scan)) {
case BOL:
if (reginput != regbol)
return(0);
break;
case EOL:
if (*reginput != '\0')
return(0);
break;
case WORDA:
/* Must be looking at a letter, digit, or _ */
if ((!isalnum(*reginput)) && *reginput != '_')
return(0);
/* Prev must be BOL or nonword */
if (reginput > regbol &&
(isalnum(reginput[-1]) || reginput[-1] == '_'))
return(0);
break;
case WORDZ:
/* Must be looking at non letter, digit, or _ */
if (isalnum(*reginput) || *reginput == '_')
return(0);
/* We don't care what the previous char was */
break;
case ANY:
if (*reginput == '\0')
return(0);
reginput++;
break;
case EXACTLY: {
register int len;
register char *opnd;
opnd = OPERAND(scan);
/* Inline the first character, for speed. */
if (*opnd != *reginput)
return(0);
len = strlen(opnd);
if (len > 1 && strncmp(opnd, reginput, len) != 0)
return(0);
reginput += len;
}
break;
case ANYOF:
if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL)
return(0);
reginput++;
break;
case ANYBUT:
if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL)
return(0);
reginput++;
break;
case NOTHING:
break;
case BACK:
break;
case OPEN+1:
case OPEN+2:
case OPEN+3:
case OPEN+4:
case OPEN+5:
case OPEN+6:
case OPEN+7:
case OPEN+8:
case OPEN+9: {
register int no;
register const char *save;
no = OP(scan) - OPEN;
save = reginput;
if (regmatch(next)) {
/*
* Don't set startp if some later
* invocation of the same parentheses
* already has.
*/
if (regstartp[no] == NULL)
regstartp[no] = save;
return(1);
} else
//.........这里部分代码省略.........
开发者ID:Cabriter,项目名称:abelkhan,代码行数:101,代码来源:regexp.c
示例12: i915_error_state_to_str
int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
const struct i915_error_state_file_priv *error_priv)
{
struct drm_device *dev = error_priv->dev;
drm_i915_private_t *dev_priv = dev->dev_private;
struct drm_i915_error_state *error = error_priv->error;
struct intel_ring_buffer *ring;
int i, j, page, offset, elt;
if (!error) {
err_printf(m, "no error state collected\n");
goto out;
}
err_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
error->time.tv_usec);
err_printf(m, "Kernel: " UTS_RELEASE "\n");
err_printf(m, "PCI ID: 0x%04x\n", dev->pdev->device);
err_printf(m, "EIR: 0x%08x\n", error->eir);
err_printf(m, "IER: 0x%08x\n", error->ier);
err_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er);
err_printf(m, "FORCEWAKE: 0x%08x\n", error->forcewake);
err_printf(m, "DERRMR: 0x%08x\n", error->derrmr);
err_printf(m, "CCID: 0x%08x\n", error->ccid);
err_printf(m, "Missed interrupts: 0x%08lx\n", dev_priv->gpu_error.missed_irq_rings);
for (i = 0; i < dev_priv->num_fence_regs; i++)
err_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]);
for (i = 0; i < ARRAY_SIZE(error->extra_instdone); i++)
err_printf(m, " INSTDONE_%d: 0x%08x\n", i,
error->extra_instdone[i]);
if (INTEL_INFO(dev)->gen >= 6) {
err_printf(m, "ERROR: 0x%08x\n", error->error);
err_printf(m, "DONE_REG: 0x%08x\n", error->done_reg);
}
if (INTEL_INFO(dev)->gen == 7)
err_printf(m, "ERR_INT: 0x%08x\n", error->err_int);
for_each_ring(ring, dev_priv, i)
i915_ring_error_state(m, dev, error, i);
if (error->active_bo)
print_error_buffers(m, "Active",
error->active_bo[0],
error->active_bo_count[0]);
if (error->pinned_bo)
print_error_buffers(m, "Pinned",
error->pinned_bo[0],
error->pinned_bo_count[0]);
for (i = 0; i < ARRAY_SIZE(error->ring); i++) {
struct drm_i915_error_object *obj;
if ((obj = error->ring[i].batchbuffer)) {
err_printf(m, "%s --- gtt_offset = 0x%08x\n",
dev_priv->ring[i].name,
obj->gtt_offset);
offset = 0;
for (page = 0; page < obj->page_count; page++) {
for (elt = 0; elt < PAGE_SIZE/4; elt++) {
err_printf(m, "%08x : %08x\n", offset,
obj->pages[page][elt]);
offset += 4;
}
}
}
if (error->ring[i].num_requests) {
err_printf(m, "%s --- %d requests\n",
dev_priv->ring[i].name,
error->ring[i].num_requests);
for (j = 0; j < error->ring[i].num_requests; j++) {
err_printf(m, " seqno 0x%08x, emitted %ld, tail 0x%08x\n",
error->ring[i].requests[j].seqno,
error->ring[i].requests[j].jiffies,
error->ring[i].requests[j].tail);
}
}
if ((obj = error->ring[i].ringbuffer)) {
err_printf(m, "%s --- ringbuffer = 0x%08x\n",
dev_priv->ring[i].name,
obj->gtt_offset);
offset = 0;
for (page = 0; page < obj->page_count; page++) {
for (elt = 0; elt < PAGE_SIZE/4; elt++) {
err_printf(m, "%08x : %08x\n",
offset,
obj->pages[page][elt]);
offset += 4;
}
}
}
obj = error->ring[i].ctx;
if (obj) {
//.........这里部分代码省略.........
开发者ID:bjayesh,项目名称:chandra,代码行数:101,代码来源:i915_gpu_error.c
示例13: i915_ring_error_state
static void i915_ring_error_state(struct drm_i915_error_state_buf *m,
struct drm_device *dev,
struct drm_i915_error_state *error,
unsigned ring)
{
BUG_ON(ring >= I915_NUM_RINGS); /* shut up confused gcc */
err_printf(m, "%s command stream:\n", ring_str(ring));
err_printf(m, " HEAD: 0x%08x\n", error->head[ring]);
err_printf(m, " TAIL: 0x%08x\n", error->tail[ring]);
err_printf(m, " CTL: 0x%08x\n", error->ctl[ring]);
err_printf(m, " ACTHD: 0x%08x\n", error->acthd[ring]);
err_printf(m, " IPEIR: 0x%08x\n", error->ipeir[ring]);
err_printf(m, " IPEHR: 0x%08x\n", error->ipehr[ring]);
err_printf(m, " INSTDONE: 0x%08x\n", error->instdone[ring]);
if (ring == RCS && INTEL_INFO(dev)->gen >= 4)
err_printf(m, " BBADDR: 0x%08llx\n", error->bbaddr);
if (INTEL_INFO(dev)->gen >= 4)
err_printf(m, " INSTPS: 0x%08x\n", error->instps[ring]);
err_printf(m, " INSTPM: 0x%08x\n", error->instpm[ring]);
err_printf(m, " FADDR: 0x%08x\n", error->faddr[ring]);
if (INTEL_INFO(dev)->gen >= 6) {
err_printf(m, " RC PSMI: 0x%08x\n", error->rc_psmi[ring]);
err_printf(m, " FAULT_REG: 0x%08x\n", error->fault_reg[ring]);
err_printf(m, " SYNC_0: 0x%08x [last synced 0x%08x]\n",
error->semaphore_mboxes[ring][0],
error->semaphore_seqno[ring][0]);
err_printf(m, " SYNC_1: 0x%08x [last synced 0x%08x]\n",
error->semaphore_mboxes[ring][1],
error->semaphore_seqno[ring][1]);
if (HAS_VEBOX(dev)) {
err_printf(m, " SYNC_2: 0x%08x [last synced 0x%08x]\n",
error->semaphore_mboxes[ring][2],
error->semaphore_seqno[ring][2]);
}
}
err_printf(m, " seqno: 0x%08x\n", error->seqno[ring]);
err_printf(m, " waiting: %s\n", yesno(error->waiting[ring]));
err_printf(m, " ring->head: 0x%08x\n", error->cpu_ring_head[ring]);
err_printf(m, " ring->tail: 0x%08x\n", error->cpu_ring_tail[ring]);
err_printf(m, " hangcheck: %s [%d]\n",
hangcheck_action_to_str(error->hangcheck_action[ring]),
error->hangcheck_score[ring]);
}
开发者ID:bjayesh,项目名称:chandra,代码行数:44,代码来源:i915_gpu_error.c
示例14: _convert_gstat2kstat32
/*
* convert a 64 bit glibc stat struct, produced by k42, into a linux
* 32 bit stat structure, as used by the 64 bit linux kernel for a 32
* bit system call.
*
* kstat <-- gstat
*/
void _convert_gstat2kstat32(struct compat_stat *kstat, struct _gstat64 *gstat)
{
kstat->st_dev = gstat->st_dev;
kstat->st_ino = gstat->st_ino;
kstat->st_mode = gstat->st_mode;
kstat->st_nlink = gstat->st_nlink;
kstat->st_uid = gstat->st_uid;
kstat->st_gid = gstat->st_gid;
kstat->st_rdev = gstat->st_rdev;
kstat->st_size = gstat->st_size;
kstat->st_blksize = gstat->st_blksize;
kstat->st_blocks = gstat->st_blocks;
kstat->st_atime = gstat->st_atim.tv_sec;
kstat->st_atime_nsec= gstat->st_atim.tv_nsec;
kstat->st_mtime = gstat->st_mtim.tv_sec;
kstat->st_mtime_nsec= gstat->st_mtim.tv_nsec;
kstat->st_ctime = gstat->st_ctim.tv_sec;
kstat->st_ctime_nsec= gstat->st_ctim.tv_nsec;
kstat->__unused4 = 0;
kstat->__unused5 = 0;
#if 0
int verbose = 1;
if (verbose)
{
unsigned int i;
err_printf("struct _gstat64 (glibc version size=%ld):",
sizeof(struct _gstat64));
for ( i = 0; i < sizeof (struct _gstat64); i += 4)
err_printf("%c%08x",
i%(8*4)==0 ? '\n' : ' ',
*(unsigned int *) ( (long)gstat + i));
err_printf("\nstruct kstat (linux 32 version size=%ld):",
sizeof(struct compat_stat));
for ( i = 0; i < sizeof (struct compat_stat); i += 4)
err_printf("%c%08x",
i%(8*4)==0 ? '\n' : ' ',
*(unsigned int *) ( (long)kstat + i));
err_printf("\nsizeof ndev %ld offset %d\n",
sizeof (kstat->st_dev),
(int) ( (uval) &(kstat->st_dev) - (uval) kstat));
err_printf("\nsizeof ino %ld offset %d\n",
sizeof (kstat->st_ino),
(int) ( (uval) &(kstat->st_ino) - (uval) kstat));
err_printf( "\nsizeof nlink %ld offset %d\n",
sizeof (kstat->st_nlink),
(int) ( (uval) &(kstat->st_nlink) - (uval) kstat));
err_printf( "\nsizeof mode %ld offset %d\n",
sizeof (kstat->st_mode),
(int) ( (uval) &(kstat->st_mode) - (uval) kstat));
err_printf( "\nsizeof uid %ld offset %d\n",
sizeof (kstat->st_uid),
(int) ( (uval) &(kstat->st_uid) - (uval) kstat));
err_printf( "\nsizeof gid %ld offset %d\n",
sizeof (kstat->st_gid),
(int) ( (uval) &(kstat->st_gid) - (uval) kstat));
err_printf( "\nsizeof rdev %ld offset %d\n",
sizeof (kstat->st_rdev),
(int) ( (uval) &(kstat->st_rdev) - (uval) kstat));
err_printf( "\nsizeof size %ld offset %d\n",
sizeof (kstat->st_size),
(int) ( (uval) &(kstat->st_size) - (uval) kstat));
err_printf( "\nsizeof blksize %ld offset %d\n",
sizeof (kstat->st_blksize),
(int) ( (uval) &(kstat->st_blksize) - (uval) kstat));
err_printf( "\nsizeof blocks %ld offset %d\n",
sizeof (kstat->st_blocks),
(int) ( (uval) &(kstat->st_blocks) - (uval) kstat));
err_printf( "\nsizeof atime %ld offset %d\n",
sizeof (kstat->st_atime),
(int) ( (uval) &(kstat->st_atime) - (uval) kstat));
err_printf("\ndev=%ud\tino=%d\tnlink=%d\tmode=%x\n",
kstat->st_dev, kstat->st_ino, kstat->st_nlink, kstat->st_mode);
err_printf("uid=%d\tgid=%d\tsize=%ud\n",
kstat->st_uid, kstat->st_gid, kstat->st_size);
err_printf("blksize=%d\tblocks=%d\tatime=%d\tmtime=%d\n",
kstat->st_blksize, kstat->st_blocks, kstat->st_atime,
kstat->st_mtime);
}
#endif
}
开发者ID:BillTheBest,项目名称:k42,代码行数:90,代码来源:stat.C
示例15: main
int main(int argc, char **argv){
Buffer *ptr_Buffer; /* pointer to Buffer structure */
FILE *fi; /* input file handle */
int loadsize = 0; /*the size of the file loaded in the buffer */
int ansi_c = !ANSI_C; /* ANSI C compliancy flag */
/* Check if the compiler option is set to compile ANSI C */
/* __DATE__, __TIME__, __LINE__, __FILE__, __STDC__ are predefined preprocessor macros*/
if (ansi_c){
err_printf("Date: %s Time: %s", __DATE__, __TIME__);
err_printf("ERROR: Compiler is not ANSI C compliant!\n");
exit(1);
}
/* missing file name or/and mode parameter */
if (argc <= 2){
err_printf("\nDate: %s Time: %s", __DATE__, __TIME__);
err_printf("\nRuntime error at line %d in file %s\n", __LINE__, __FILE__);
err_printf("%s\b\b\b\b%s%s", argv[0], ": ", "Missing parameters.");
err_printf("Usage: platybt source_file_name mode");
exit(1);
}
/* create a source code input buffer */
switch (*argv[2]){ /*gets the first caracter of the mode argument*/
case 'f': case 'a': case 'm': break;
|
请发表评论