本文整理汇总了C++中os_error函数的典型用法代码示例。如果您正苦于以下问题:C++ os_error函数的具体用法?C++ os_error怎么用?C++ os_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了os_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vmem_unmapfile
void vmem_unmapfile()
{
dbg_printf("vmem_unmapfile()\n");
vmem_decommit(preserve,preserve_size);
vmem_release(preserve,preserve_size);
preserve = NULL;
preserve_size = 0;
#if 0
if (pview)
{ int i;
i = UnmapViewOfFile(pview);
dbg_printf("i = x%x\n",i);
if (i == FALSE)
os_error();
}
#else
// Note that under Windows 95, UnmapViewOfFile() seems to return random
// values, not TRUE or FALSE.
if (pview && UnmapViewOfFile(pview) == FALSE)
os_error();
#endif
pview = NULL;
if (hFileMap != NULL && CloseHandle(hFileMap) != TRUE)
os_error();
hFileMap = NULL;
if (hFile != INVALID_HANDLE_VALUE && CloseHandle(hFile) != TRUE)
os_error();
hFile = INVALID_HANDLE_VALUE;
}
示例2: vmem_setfilesize
void vmem_setfilesize(unsigned long size)
{
if (hFile != INVALID_HANDLE_VALUE)
{ if (SetFilePointer(hFile,size,NULL,FILE_BEGIN) == 0xFFFFFFFF)
os_error();
if (SetEndOfFile(hFile) == FALSE)
os_error();
}
}
示例3: rt_stk_check
__weak void rt_stk_check (void) {
/* Check for stack overflow. */
if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) ||
(os_tsk.run->stack[0] != MAGIC_WORD)) {
os_error (OS_ERR_STK_OVF);
}
}
示例4: os_heapterm
void os_heapterm()
{
if (hHeap)
{ if (HeapDestroy(hHeap) == FALSE)
os_error();
}
}
示例5: os_mbx_psh
void os_mbx_psh (P_MCB p_CB, void *p_msg) {
/* Store the message to the mailbox queue or pass it to task directly. */
P_TCB p_TCB;
/* Check if this was an 'isr_mbx_receive ()' post service request. */
if (p_CB->p_lnk != NULL && p_CB->isr_st == 2) {
/* A task is waiting to send message, remove it from the waiting list. */
p_CB->isr_st = 0;
p_TCB = os_get_first ((P_XCB)p_CB);
p_TCB->ret_val = OS_R_OK;
goto rdy;
}
/* A task is waiting for message, pass the message to task directly. */
if (p_CB->p_lnk != NULL && p_CB->count == 0) {
p_TCB = os_get_first ((P_XCB)p_CB);
p_TCB->p_msg = p_msg;
p_TCB->ret_val = OS_R_MBX;
rdy:p_TCB->state = READY;
os_rmv_dly (p_TCB);
os_put_prio (&os_rdy, p_TCB);
}
else {
/* No task is waiting for message, store it to the mailbox queue. */
if (p_CB->count < p_CB->size) {
p_CB->msg[p_CB->first] = p_msg;
_incw (&p_CB->count);
if (++p_CB->first == p_CB->size) {
p_CB->first = 0;
}
}
else {
os_error (OS_ERR_MBX_OVF);
}
}
}
示例6: vmem_decommit
void vmem_decommit(void *ptr,unsigned long size)
{
dbg_printf("vmem_decommit(ptr = %p, size = x%lx)\n",ptr,size);
if (ptr)
{ if (!VirtualFree(ptr, size, MEM_DECOMMIT))
os_error();
}
}
示例7: tell_position
long tell_position (FILE *file)
{
long size;
if ((size = ftell (file)) < 0) {
os_error();
}
return size;
}
示例8: fc_strdup_notrim
char *
fc_strdup_notrim (const char *src, gfc_charlen_type src_len)
{
char *p = strndup (src, src_len);
if (!p)
os_error ("Memory allocation failed in fc_strdup");
return p;
}
示例9: auto_codec_open_decoder
void auto_codec_open_decoder(const auto_codec & context, AVCodecID codec_id)
{
boost::mutex::scoped_lock lock(avcodec_mutex);
AVCodec * codec = avcodec_find_decoder(codec_id);
if (!codec)
throw os_error("avcodec_find_decoder", ENOENT);
os_check_error("avcodec_open", -avcodec_open2(context.get(), codec, NULL));
}
示例10: make_os_error
static os_error make_os_error(int err, const std::string& text = "")
{
std::stringstream msg;
msg << "errno: " << err;
if (!text.empty())
msg << " - " << text;
return os_error(err, msg.str());
}
示例11: os_freelibrary
void os_freelibrary()
{
if (hdll)
{
if (FreeLibrary(hdll) != TRUE)
os_error();
hdll = NULL;
}
}
示例12: vmem_release
void vmem_release(void *ptr,unsigned long size)
{
dbg_printf("vmem_release(ptr = %p, size = x%lx)\n",ptr,size);
if (ptr)
{
if (!VirtualFree(ptr, 0, MEM_RELEASE))
os_error();
}
}
示例13: assert
void *os_getprocaddress(const char *funcname)
{ void *fp;
//printf("getprocaddress('%s')\n",funcname);
assert(hdll);
fp = (void *)GetProcAddress(hdll,(LPCSTR)funcname);
if (!fp)
os_error();
return fp;
}
示例14: os_term
void os_term()
{
if (hHeap)
{ if (HeapDestroy(hHeap) == FALSE)
{ hHeap = NULL;
os_error();
}
hHeap = NULL;
}
os_freelibrary();
}
示例15: rt_stk_check
/*--------------------------- rt_stk_check ----------------------------------*/
__weak void rt_stk_check (void) {
/* Check for stack overflow. */
if (os_tsk.run->task_id == 0x01) {
// TODO: For the main thread the check should be done against the main heap pointer
} else {
if ((os_tsk.run->tsk_stack < (U32)os_tsk.run->stack) ||
(os_tsk.run->stack[0] != MAGIC_WORD)) {
os_error (OS_ERR_STK_OVF);
}
}
}