bool clsYarp::checkYarp() { if(!yarpInitiated){ usleep(100); #ifdef REQUIRE_YARP ERRMSG(("yarp failed to initialize")); #else WARNMSG(("yarp failed to initialize")); #endif } return yarpInitiated; }
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; }
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()); } } }
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; }
/*! 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; }
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; }
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; }
int parent_main(pid_t child_pid) { int epfd; int sigfd; int status; sigset_t sigs; if (sigfillset(&sigs) == -1) { ERRMSG("sigfillset() failed"); goto kill_child; } if (sigprocmask(SIG_SETMASK, &sigs, NULL) == -1) { ERRMSG("sigprocmask() failed"); goto kill_child; } if ((sigfd = signalfd(-1, &sigs, SFD_NONBLOCK)) == -1) { ERRMSG("signalfd() failed"); goto kill_child; } if ((epfd = epoll_create(1)) == -1) { ERRMSG("epoll_create() failed"); goto kill_child; } if (epoll_add(epfd, sigfd, EPOLLIN) == -1) { ERRMSG("epoll_add() failed"); goto kill_child; } if (epoll_add(epfd, STDIN_FILENO, 0) == -1) { ERRMSG("epoll_add() failed"); goto kill_child; } for (;;) { int i; enum HANDLE_RESULT handle_ret; struct epoll_event e[3]; int nfd = epoll_wait(epfd, e, sizeof(e) / sizeof(struct epoll_event), 100); if (nfd == -1) { ERRMSG("epoll_wait() failed"); goto kill_child; } if (nfd == 0) { int ret = waitpid(child_pid, &status, WNOHANG); if (ret == -1) { ERRMSG("waitpid() failed"); goto kill_child; } if (ret != 0) { goto child_exited; } continue; } for (i = 0; i < nfd; i++) { int fd = e[i].data.fd; if (fd == sigfd) { handle_ret = handle_signal(fd, child_pid); } else { handle_ret = handle_in_eof(fd, child_pid); } switch(handle_ret) { case KILL_CHILD: goto kill_child; case WAIT_CHILD_EXIT: goto wait_child_exit; } } } kill_child: if (kill(child_pid, SIGKILL) == -1) { ERR_EXIT("kill() failed"); } wait_child_exit: if (waitpid(child_pid, &status, 0) == -1) { ERR_EXIT("waitpid() failed"); } child_exited: if (WIFEXITED(status)) { return WEXITSTATUS(status); } if (WIFSIGNALED(status)) { return WTERMSIG(status) + 128; } return 1; }
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; }
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; }
/////////////////////////////////////////////////////////////////////// // 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; }
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); } }
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; }
/*! 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; }
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); }
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; }
/* * create tcp connection * as long as the socket is not non-blocking, this can block the process * nsport is network byte order */ int get_tcp_connect(int sd, struct sockaddr_in dest_addr) { if(connect(sd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr))) { SLEEP_MSEC(100L); // try one more time if(connect(sd, (struct sockaddr *)&dest_addr, sizeof(struct sockaddr))) { ERRMSG("error:get_tcp_nconnect addr=%s, port=%d\n", inet_ntoa(dest_addr.sin_addr), ntohs(dest_addr.sin_port)); return -1; } } return 0; }
/*! Establish SIGCHLD handler */ void est_dpi_sigchld(void) { struct sigaction sigact; sigset_t set; (void) sigemptyset(&set); sigact.sa_handler = dpi_sigchld; sigact.sa_mask = set; sigact.sa_flags = SA_NOCLDSTOP; if (sigaction(SIGCHLD, &sigact, NULL) == -1) { ERRMSG("est_dpi_sigchld", "sigaction", errno); exit(1); } }
/*! * Get value of msg field from dpi_tag * \Return * message on success, NULL on failure */ char *get_message(int sock_fd, char *dpi_tag) { char *msg, *d_cmd; msg = a_Dpip_get_attr(dpi_tag, "msg"); if (msg == NULL) { ERRMSG("get_message", "failed to parse msg", 0); d_cmd = a_Dpip_build_cmd("cmd=%s msg=%s", "DpiError", "Failed to parse request"); (void) CKD_WRITE(sock_fd, d_cmd); dFree(d_cmd); } return (msg); }
static int seh_probe(struct platform_device *dev) { int ret; ENTER(); seh_int_wq = create_workqueue("seh_rx_wq"); INIT_WORK(&seh_int_request, seh_int_handler_high); seh_dev = (struct seh_dev*)kzalloc(sizeof(struct seh_dev), GFP_KERNEL); if (seh_dev == NULL) { ERRMSG("seh_probe: unable to allocate memory\n"); return -ENOMEM; } init_waitqueue_head(&(seh_dev->readq)); sema_init(&seh_dev->read_sem, 1); seh_dev->dev = (struct device *)dev; ret = misc_register(&seh_miscdev); if (ret) ERRMSG("seh_probe: failed to call misc_register\n"); wake_lock_init(&seh_wakeup, WAKE_LOCK_SUSPEND, "seh_wakeups"); ret = request_irq(IRQ_COMM_WDT_ID, seh_int_handler_low, IRQF_DISABLED, seh_name, NULL); if (ret) { ERRMSG("seh_probe: cannot register the COMM WDT interrupt\n"); return ret; } LEAVE(); return ret; }
int mt6575_part_generic_read(part_dev_t *dev, u64 src, uchar *dst, int size) { int dev_id = dev->id; uchar *buf = &mt6575_part_buf[0]; block_dev_desc_t *blkdev = dev->blkdev; u64 end, part_start, part_end, part_len, aligned_start, aligned_end; ulong blknr, blkcnt; if (!blkdev) { ERRMSG("No block device registered\n"); return -ENODEV; } if (size == 0) return 0; end = src + size; part_start = src & ((u64)BLK_SIZE - 1); part_end = end & ((u64)BLK_SIZE - 1); aligned_start = src & ~((u64)BLK_SIZE - 1); aligned_end = end & ~((u64)BLK_SIZE - 1); if (part_start) { blknr = aligned_start >> BLK_BITS; part_len = BLK_SIZE - part_start; if ((blkdev->block_read(dev_id, blknr, 1, (unsigned long*)buf)) != 1) return -EIO; memcpy(dst, buf + part_start, part_len); dst += part_len; src += part_len; } aligned_start = src & ~((u64)BLK_SIZE - 1); blknr = aligned_start >> BLK_BITS; blkcnt = (aligned_end - aligned_start) >> BLK_BITS; if ((blkdev->block_read(dev_id, blknr, blkcnt, (unsigned long *)(dst))) != blkcnt) return -EIO; src += (blkcnt << BLK_BITS); dst += (blkcnt << BLK_BITS); if (part_end && src < end) { blknr = aligned_end >> BLK_BITS; if ((blkdev->block_read(dev_id, blknr, 1, (unsigned long*)buf)) != 1) return -EIO; memcpy(dst, buf, part_end); }
int auds_get_next_sample(auds_t *auds, __u8 **data, int *size) { int rval; auds_t *lauds=auds; if(auds->auds) lauds=auds->auds; switch(lauds->data_type){ case AUD_TYPE_PCM: rval=pcm_get_next_sample(lauds, data, size); break; case AUD_TYPE_NONE: ERRMSG("%s:### shouldn't come here\n",__func__); return -1; } return rval; }
analyzer_t::analyzer_t(const std::string &trace_file, analysis_tool_t **tools_in, int num_tools_in) : success(true), trace_iter(NULL), trace_end(NULL), num_tools(num_tools_in), tools(tools_in) { for (int i = 0; i < num_tools; ++i) { if (tools[i] == NULL || !*tools[i]) { success = false; ERRMSG("Tool is not successfully initialized\n"); return; } } if (!init_file_reader(trace_file)) success = false; }
int Msmpot_compute_longrng(Msmpot *msm) { int err = 0; /* permit only cubic interpolation - for now */ switch (msm->interp) { case MSMPOT_INTERP_CUBIC: err = Msmpot_compute_longrng_cubic(msm); if (err) return ERROR(err); break; default: return ERRMSG(MSMPOT_ERROR_SUPPORT, "interpolation method not implemented"); } return MSMPOT_SUCCESS; }
int main( int argc, char *argv[]) { static atm_t atm; static ctl_t ctl; double dz, t0, z, z0, z1; /* Check arguments... */ if (argc < 3) ERRMSG("Give parameters: <ctl> <atm>"); /* Read control parameters... */ read_ctl(argc, argv, &ctl); t0 = scan_ctl(argc, argv, "T0", -1, "0", NULL); z0 = scan_ctl(argc, argv, "Z0", -1, "0", NULL); z1 = scan_ctl(argc, argv, "Z1", -1, "90", NULL); dz = scan_ctl(argc, argv, "DZ", -1, "1", NULL); /* Set atmospheric grid... */ for (z = z0; z <= z1; z += dz) { atm.time[atm.np] = t0; atm.z[atm.np] = z; if ((++atm.np) >= NP) ERRMSG("Too many atmospheric grid points!"); } /* Interpolate climatological data... */ climatology(&ctl, &atm); /* Write data to disk... */ write_atm(NULL, argv[2], &ctl, &atm); return EXIT_SUCCESS; }
void Usage(char * filename) { #ifdef __FN_RFSET__ ERRMSG( "Usage: %s [-dhpq] serial_port_path\n", filename); #else ERRMSG( "Usage: %s [-dh] serial_port_path\n", filename); #endif ERRMSG( " -d : enable debugging\n"); #ifdef __FN_RFSET__ ERRMSG( " -p power : rf power setting\n"); ERRMSG( " -q state : update permit state (0:close, 1:open)\n"); ERRMSG( " -G mode : update power mode (0~3)\n"); #else #endif ERRMSG( " -h : display this message\n"); ERRMSG( "\n"); }
int WriteSDSUCommand(void) { if ( intVirBuff == NULL ) if ( (intVirBuff = (void *)memalign(SDSU_BURST_BLOCK, intBuffSize)) == NULL ) { ERRMSG("WriteSDSUCommand> ERROR allocating buffer memory.\n"); return ERR_MBUFF; } else { intPhyBuff = CACHE_DMA_VIRT_TO_PHYS(intVirBuff); /* Write command structure */ intBuf.bufphysadr = (volatile const UINT32)intPhyBuff; intBuf.bufsize = intBuffSize; intBuf.bufid = 4321; } DBGMSG("WriteSDSUCommand> bufphysadr=%#lx bufsize=%ld bufid=%#lx\n", intBuf.bufphysadr, intBuf.bufsize, intBuf.bufid); if (WRITE_FIFO(context->fifo[USER_DATA_EMPTY], (void *) &intBuf, sizeof(intBuf)) != BUFFER_OK) { ERRMSG("WriteSDSUCommand> ERROR - write to FIFO USER_DATA_EMPTY\n"); return ERR_WRITEFIFO; } return NO_ERROR; }
/** * Adds a filter with the given interface name and address family to the table. * Only adds it if it does not yet exist in the table. * * @param[in] filter_data * Filter part of policy, containing interface name and address family */ void policy_table_add_filter(policy_filter_msg_t * filter_data) { policy_table_entry_t * policy; INSIST(if_table != NULL); INSIST(filter_data != NULL); INSIST(strlen(filter_data->ifname) <= MAX_IF_NAME_LEN); junos_trace(PED_TRACEFLAG_HT, "%s: %s, af: %d", __func__, filter_data->ifname, filter_data->af); policy = get_or_create_policy(filter_data->ifname, filter_data->af); if(policy->broken) { // if the policy is broken then this whole policy // will be deleted because something's wrong with it // ...So, don't add the filter return; } if(!policy->pfd_filter) { policy->pfd_filter = apply_pfd_filter_to_interface(policy->ifname); } if(!policy->filter) { // Create filter if it doesn't exist policy->filter = (ped_policy_filter_t *)malloc(sizeof(ped_policy_filter_t)); INSIST(policy->filter != NULL); } // Update filter data memcpy(&(policy->filter->filter_data), filter_data, sizeof(policy_filter_msg_t)); policy->filter->status = FILTER_PENDING; if(apply_filters_to_interface(policy->ifname, policy->filter)) { policy->filter->status = FILTER_ADDED; } else { policy->filter->status = FILTER_FAILED; policy->broken = TRUE; // break it so it gets cleaned clean_table = TRUE; ERRMSG(PED, TRACE_LOG_ERR, "%s: Failed to apply filters" "on interface", __func__, policy->ifname); } }
cache_t* cache_simulator_t::create_cache(std::string policy) { if (policy == REPLACE_POLICY_NON_SPECIFIED || // default LRU policy == REPLACE_POLICY_LRU) // set to LRU return new cache_lru_t; if (policy == REPLACE_POLICY_LFU) // set to LFU return new cache_t; if (policy == REPLACE_POLICY_FIFO) // set to FIFO return new cache_fifo_t; // undefined replacement policy ERRMSG("Usage error: undefined replacement policy. " "Please choose " REPLACE_POLICY_LRU" or " REPLACE_POLICY_LFU".\n"); return NULL; }
int auds_close(auds_t *auds) { if(auds->stream){ switch(auds->data_type){ case AUD_TYPE_PCM: pcm_close(auds); break; case AUD_TYPE_NONE: ERRMSG("### shouldn't come here\n"); break; } } free(auds); return 0; }