本文整理匯總了C++中ERRMSG函數的典型用法代碼示例。如果您正苦於以下問題:C++ ERRMSG函數的具體用法?C++ ERRMSG怎麽用?C++ ERRMSG使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ERRMSG函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: usleep
bool clsYarp::checkYarp()
{
if(!yarpInitiated){
usleep(100);
#ifdef REQUIRE_YARP
ERRMSG(("yarp failed to initialize"));
#else
WARNMSG(("yarp failed to initialize"));
#endif
}
return yarpInitiated;
}
示例2: GetGIDFromConfig
int
GetGIDFromConfig(Process* proc, Config* config)
{
const char* pGroupName = 0;
INT32 ulGID = -1;
if (pGroupName = config->GetString(proc, "config.Group"))
{
/* "%n" allows you to use the GID */
if (pGroupName[0] == '%')
{
ulGID = strtol(pGroupName + 1, 0, 0);
}
else
{
int isNumeric = 1;
const char* ptr = pGroupName;
while (ptr)
{
if (!isdigit(*ptr))
{
isNumeric = 0;
break;
}
ptr++;
}
if (isNumeric)
{
ulGID = strtol(pGroupName + 1, 0, 0);
}
else
{
struct group* pGroupInfo = getgrnam(pGroupName);
if (pGroupInfo)
{
ulGID = pGroupInfo->gr_gid;
}
else
{
ERRMSG(proc->pc->error_handler,
"Couldn't find group %s in the system database",
pGroupName);
}
}
}
}
else
ulGID = config->GetInt(proc, "config.Group");
return ulGID;
}
示例3: DBGMSG
void ModelReader::ModelHandler::onElementEnd(const std::string& name) {
if(_toSkip.size() > 0) {
const std::string& expected= _toSkip.back();
if(expected == name) {
_toSkip.pop_back();
if(_toSkip.size() <= 0) {
DBGMSG("skipped %s", name.c_str());
}
} else {
ERRMSG("expected %s but got %s", expected.c_str(), name.c_str());
}
} else {
if(_parser != NULL) {
_parser= _parser->post();
} else {
ERRMSG("invalid end tag %s", name.c_str());
}
}
}
示例4: run_decoder
static int run_decoder(aac_t *aac)
{
char *darg[8]={AAC_DECODER,"-f","2","-o", NULL, NULL, NULL};
darg[4]=FIFO_NAME;
darg[5]=aac->fname;
aac->dpid=child_start(darg,NULL,NULL,NULL);
if(!(aac->inf=fopen(FIFO_NAME,"r"))) {
ERRMSG("can't open fifo\n");
return -1;
}
return 0;
}
示例5: ckd_connect
/*! EINTR aware connect() call */
int ckd_connect (int sock_fd, struct sockaddr *addr, socklen_t len)
{
ssize_t ret;
do {
ret = connect(sock_fd, addr, len);
} while (ret == -1 && errno == EINTR);
if (ret == -1) {
ERRMSG("dpid.c", "connect", errno);
}
return ret;
}
示例6: check_elf_format
static int
check_elf_format(int fd, char *filename, int *phnum, unsigned int *num_load)
{
int i;
Elf64_Ehdr ehdr64;
Elf64_Phdr load64;
Elf32_Ehdr ehdr32;
Elf32_Phdr load32;
if (lseek(fd, 0, SEEK_SET) < 0) {
ERRMSG("Can't seek %s. %s\n", filename, strerror(errno));
return FALSE;
}
if (read(fd, &ehdr64, sizeof(Elf64_Ehdr)) != sizeof(Elf64_Ehdr)) {
ERRMSG("Can't read %s. %s\n", filename, strerror(errno));
return FALSE;
}
if (lseek(fd, 0, SEEK_SET) < 0) {
ERRMSG("Can't seek %s. %s\n", filename, strerror(errno));
return FALSE;
}
if (read(fd, &ehdr32, sizeof(Elf32_Ehdr)) != sizeof(Elf32_Ehdr)) {
ERRMSG("Can't read %s. %s\n", filename, strerror(errno));
return FALSE;
}
(*num_load) = 0;
if ((ehdr64.e_ident[EI_CLASS] == ELFCLASS64)
&& (ehdr32.e_ident[EI_CLASS] != ELFCLASS32)) {
(*phnum) = ehdr64.e_phnum;
for (i = 0; i < ehdr64.e_phnum; i++) {
if (!get_elf64_phdr(fd, filename, i, &load64)) {
ERRMSG("Can't find Phdr %d.\n", i);
return FALSE;
}
if (load64.p_type == PT_LOAD)
(*num_load)++;
}
return ELF64;
} else if ((ehdr64.e_ident[EI_CLASS] != ELFCLASS64)
&& (ehdr32.e_ident[EI_CLASS] == ELFCLASS32)) {
(*phnum) = ehdr32.e_phnum;
for (i = 0; i < ehdr32.e_phnum; i++) {
if (!get_elf32_phdr(fd, filename, i, &load32)) {
ERRMSG("Can't find Phdr %d.\n", i);
return FALSE;
}
if (load32.p_type == PT_LOAD)
(*num_load)++;
}
return ELF32;
}
ERRMSG("Can't get valid ehdr.\n");
return FALSE;
}
示例7: get_machdep_info_ppc
int
get_machdep_info_ppc(void)
{
unsigned long vmlist, vmalloc_start;
info->section_size_bits = _SECTION_SIZE_BITS;
info->max_physmem_bits = _MAX_PHYSMEM_BITS;
info->page_offset = __PAGE_OFFSET;
if (SYMBOL(_stext) != NOT_FOUND_SYMBOL)
info->kernel_start = SYMBOL(_stext);
else {
ERRMSG("Can't get the symbol of _stext.\n");
return FALSE;
}
DEBUG_MSG("kernel_start : %lx\n", info->kernel_start);
/*
* For the compatibility, makedumpfile should run without the symbol
* vmlist and the offset of vm_struct.addr if they are not necessary.
*/
if ((SYMBOL(vmlist) == NOT_FOUND_SYMBOL)
|| (OFFSET(vm_struct.addr) == NOT_FOUND_STRUCTURE)) {
return TRUE;
}
if (!readmem(VADDR, SYMBOL(vmlist), &vmlist, sizeof(vmlist))) {
ERRMSG("Can't get vmlist.\n");
return FALSE;
}
if (!readmem(VADDR, vmlist + OFFSET(vm_struct.addr), &vmalloc_start,
sizeof(vmalloc_start))) {
ERRMSG("Can't get vmalloc_start.\n");
return FALSE;
}
info->vmalloc_start = vmalloc_start;
DEBUG_MSG("vmalloc_start: %lx\n", vmalloc_start);
return TRUE;
}
示例8: ReadSDSUCommand
int ReadSDSUCommand(void) {
int bytes;
int retVal;
if ((bytes = READ_FIFO(context->fifo[USER_DATA_FULL], (void *) &intBuf, sizeof(intBuf))) != sizeof(intBuf)) {
if (bytes > 0) {
ERRMSG("ReadSDSUCommand> ERROR - read from FIFO USER_DATA_FULL %d bytes\n", bytes);
} else if (bytes < 0) {
ERRMSG("ReadSDSUCommand> ERROR - read from FIFO USER_DATA_FULL errno %d\n", bytes);
} else {
/* When zero bytes are read this probably means the task or FIFO has been deleted */
ERRMSG("ReadSDSUCommand> read %d bytes, read from FIFO USER_DATA_FULL aborted!\n", bytes);
}
retVal = ERR_READFIFO;
} else {
DBGMSG("ReadSDSUCommand> bufphysadr=%#lx bufsize=%ld bufid=%#lx\n", intBuf.bufphysadr, intBuf.bufsize, intBuf.bufid);
retVal = NO_ERROR;
}
return retVal;
}
示例9: get_phnum_memory
int
get_phnum_memory(void)
{
int phnum;
Elf64_Ehdr ehdr64;
Elf32_Ehdr ehdr32;
if (is_elf64_memory()) { /* ELF64 */
if (!get_elf64_ehdr(fd_memory, name_memory, &ehdr64)) {
ERRMSG("Can't get ehdr64.\n");
return FALSE;
}
phnum = ehdr64.e_phnum;
} else { /* ELF32 */
if (!get_elf32_ehdr(fd_memory, name_memory, &ehdr32)) {
ERRMSG("Can't get ehdr32.\n");
return FALSE;
}
phnum = ehdr32.e_phnum;
}
return phnum;
}
示例10: camera_open
///////////////////////////////////////////////////////////////////////
// External API
///////////////////////////////////////////////////////////////////////
int camera_open(char* camname,int sensor)
{
int handle;
struct pxa_camera* camobj = NULL;
// Initialize camera object
memset(&camobj,0,sizeof(camobj));
if(camname==NULL){
camname="/dev/video0";
}
handle = open(camname, O_RDONLY);
if (handle<0) {
ERRMSG("cann't open camera %s (%d)\n",camname,errno);
ASSERT(handle>=0);
return 0;
}
if(ioctl(handle, VIDIOC_S_INPUT, &sensor)<0) {
ERRMSG("can't set input\n");
close(handle);
return 0;
}
// Initialize camera object
camobj = malloc(sizeof(struct pxa_camera));
memset(camobj,0,sizeof(struct pxa_camera));
ASSERT(camobj);
camobj->handle = handle;
camobj->status = CAM_STATUS_READY;
camobj->width = 0;
camobj->height = 0;
camobj->sensor = sensor;
ASSERT(sizeof(int)==sizeof(struct pxa_camera*));
return (int)camobj;
// return handle;
}
示例11: updateTcpInfo
void TcpConnection::write(string& s)
{
/* Assert socket health and health of TCP connection. */
//dp2p_assert(fdSocket != -1);
//assertSocketHealth();
updateTcpInfo();
if(lastTcpInfo.tcpi_state != TCP_ESTABLISHED) {
ERRMSG("Wanted to send requests but TCP connection is %s.", TcpConnectionManager::tcpState2String(lastTcpInfo.tcpi_state).c_str());
ERRMSG("Server state: %s", SourceManager::sourceState2String(srcId).c_str());
//ERRMSG("reqQueue: %s", reqQueue2String().c_str());
throw std::runtime_error("Unexpected termination of TCP connection.");
}
/* Send the request. */
while(!s.empty())
{
int retVal = ::send(fdSocket, s.c_str(), s.size(), 0);//MSG_DONTWAIT);
// TODO: react to connectivity interruptions here
dp2p_assert(retVal > 0);
s.erase(0, retVal);
}
}
示例12: stop_decoder
static int stop_decoder(aac_t *aac)
{
int i;
if(!aac->dpid) return 0;
kill(aac->dpid,SIGTERM);
for(i=0;i<10;i++){
if(!aac->dpid) return 0;
usleep(10*1000);
}
ERRMSG("decoder process can't be terminated\n");
return 0;
}
示例13: bind_socket_fd
/*! Bind a socket port on localhost. Try to be close to base_port.
* \Return
* \li listening socket file descriptor on success
* \li -1 on failure
*/
int bind_socket_fd(int base_port, int *p_port)
{
int sock_fd, port;
struct sockaddr_in sin;
int ok = 0, last_port = base_port + 50;
if ((sock_fd = make_socket_fd()) == -1) {
return (-1); /* avoids nested ifs */
}
/* Set the socket FD to close on exec */
fcntl(sock_fd, F_SETFD, FD_CLOEXEC | fcntl(sock_fd, F_GETFD));
memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
/* Try to bind a port on localhost */
for (port = base_port; port <= last_port; ++port) {
sin.sin_port = htons(port);
if ((bind(sock_fd, (struct sockaddr *)&sin, sizeof(sin))) == -1) {
if (errno == EADDRINUSE || errno == EADDRNOTAVAIL)
continue;
ERRMSG("bind_socket_fd", "bind", errno);
} else if (listen(sock_fd, QUEUE) == -1) {
ERRMSG("bind_socket_fd", "listen", errno);
} else {
*p_port = port;
ok = 1;
break;
}
}
if (port > last_port) {
MSG_ERR("Hey! Can't find an available port from %d to %d\n",
base_port, last_port);
}
return ok ? sock_fd : -1;
}
示例14: GetNextCluster
ULONG GetNextCluster(ULONG Cluster)
{
ULONG Sector = 0;
ULONG ByteOffset = 0;
PUCHAR pSectorCache = (PUCHAR)SECTOR_CACHE_START; // Sector cache is where the sector used to read the FAT cluster chains lives.
static ULONG CurrentSector = 0;
ULONG NextCluster = 0;
// If we're passed an EOF cluster, return it.
//
if (IsEOFCluster(Cluster))
return(Cluster);
// Is caller giving us a valid cluster?
//
if (!IsDataCluster(Cluster))
{
ERRMSG(MSG_BAD_CLUSTER_NUMBER, ("Bad cluster number\n"));
return(0); // 0 isn't a valid cluster number (at least for our purposes).
}
// Compute sector where our FAT entry lives.
//
Sector = Cluster << 2;
ByteOffset = Sector & ((1 << pBPB->BytesPerSector)-1);
Sector = Sector >> pBPB->BytesPerSector;
Sector += g_FATParms.FATLBA;
// If the sector we're interested in isn't in our cache, get it.
//
if (CurrentSector != Sector)
{
if (!ReadSectors( pBPB->DriveID, Sector, 1, pSectorCache))
{
// TODO: Only a message?
// SERPRINT("GetNextCluster - unable to read sector.\r\n");
}
CurrentSector = Sector;
}
// Locate next cluster number...
//
NextCluster = *(PULONG)(pSectorCache + ByteOffset);
// SERPRINT("GNC: cluster=0x%x next cluster=0x%x\r\n", Cluster, NextCluster);
// Return the next cluster value.
//
return(NextCluster);
}
示例15: DrvMountDrives
void DrvMountDrives( HWND hwnd)
{
ULONG rc = 0;
HEV hev = 0;
TID tid;
char * pErr = 0;
do {
rc = DosCreateEventSem( 0, &hev, 0, FALSE);
if (rc)
ERRMSG( "DosCreateEventSem")
tid = _beginthread( DrvMountDrivesThread, 0, 0x4000, (PVOID)hev);
if (tid == -1)
ERRMSG( "_beginthread")
rc = WinWaitEventSem( hev, 4000);
if (!rc)
break;
if (rc != ERROR_TIMEOUT)
ERRMSG( "DosWaitEventSem")
rc = CamDlgBox( hwnd, IDD_LVMHANG, hev);
printf( "DrvMountDrives - semaphore %s posted\n",
(rc ? "was" : "was not"));
} while (0);
if (hev)
DosCloseEventSem( hev);
if (pErr)
printf( "DrvMountDrives - %s - rc= 0x%lx\n", pErr, rc);
return;
}