• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ LwMapErrnoToLwError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LwMapErrnoToLwError函数的典型用法代码示例。如果您正苦于以下问题:C++ LwMapErrnoToLwError函数的具体用法?C++ LwMapErrnoToLwError怎么用?C++ LwMapErrnoToLwError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了LwMapErrnoToLwError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: PrintPamConfig

DWORD
PrintPamConfig(
    FILE *fp,
    PLSA_PAM_CONFIG pConfig
)
{
    DWORD dwError = 0;

    if (fputs(
                "[HKEY_THIS_MACHINE\\Services\\lsass\\Parameters\\PAM]\n",
                fp) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
    }
    BAIL_ON_UP_ERROR(dwError);

    dwError = UpPrintString(fp, "LogLevel", pConfig->pszLogLevel);
    BAIL_ON_UP_ERROR(dwError);

    dwError = UpPrintBoolean(fp, "DisplayMotd", pConfig->bLsaPamDisplayMOTD);
    BAIL_ON_UP_ERROR(dwError);

    dwError = UpPrintString(fp, "UserNotAllowedError", pConfig->pszAccessDeniedMessage);
    BAIL_ON_UP_ERROR(dwError);

    if (fputs("\n", fp) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
    }
    BAIL_ON_UP_ERROR(dwError);

error:
    return dwError;
}
开发者ID:numberer6,项目名称:likewise-open-1,代码行数:34,代码来源:pam-config.c


示例2: DJAppendNameValuePair

static
DWORD
DJAppendNameValuePair(
    PSTR pszFilePath,
    PSTR pszName,
    PSTR pszValue
    )
{
    DWORD ceError = ERROR_SUCCESS;
    FILE* fp = NULL;

    if ((fp = fopen(pszFilePath, "a")) == NULL) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    if (fprintf(fp, "\n%s=%s\n", pszName, pszValue) < 0) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    fclose(fp); fp = NULL;

error:

    if (fp)
        fclose(fp);

    return ceError;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:30,代码来源:djhostinfo.c


示例3: EventLogShutdownRPCServer

static
VOID
EventLogShutdownRPCServer(
    VOID
    )
{
    DWORD dwError = 0;

    dwError = EventLogStopRpcServer();
    BAIL_ON_VMEVENT_ERROR(dwError);

    if (gEventLogServerGlobals.pRPCServerThread)
    {
        dwError = LwMapErrnoToLwError(
                        dcethread_interrupt(
                                gEventLogServerGlobals.pRPCServerThread));
        BAIL_ON_VMEVENT_ERROR(dwError);

        dwError = LwMapErrnoToLwError(
                        dcethread_join(
                                gEventLogServerGlobals.pRPCServerThread,
                                NULL));
        BAIL_ON_VMEVENT_ERROR(dwError);

        gEventLogServerGlobals.pRPCServerThread = NULL;
    }

error:

    return;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:31,代码来源:service.c


示例4: LwSmWaitSignals

static
DWORD
LwSmWaitSignals(
    int* pSig
    )
{
    DWORD dwError = 0;
    sigset_t set;
    static int waitSignals[] =
    {
        SIGTERM,
        SIGHUP,
        -1
    };
    int sig = -1;
    int i = 0;

    if (sigemptyset(&set) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_ERROR(dwError);
    }

    for (i = 0; waitSignals[i] != -1; i++)
    {
        if (sigaddset(&set, waitSignals[i]) < 0)
        {
            dwError = LwMapErrnoToLwError(errno);
            BAIL_ON_ERROR(dwError); 
        }
    }

    for (;;)
    {
        if (sigwait(&set, &sig) < 0)
        {
            dwError = LwMapErrnoToLwError(errno);
            BAIL_ON_ERROR(dwError);
        }

        switch (sig)
        {
        case SIGTERM:
        case SIGHUP:
            *pSig = sig;
            goto cleanup;
        default:
            break;
        }
    }

cleanup:

    return dwError;

error:

    goto cleanup;
};
开发者ID:twistround,项目名称:pbis,代码行数:59,代码来源:main.c


示例5: LwSmConfigureSignals

static
DWORD
LwSmConfigureSignals(
    VOID
    )
{
    DWORD dwError = 0;
    sigset_t set;
    static int blockSignals[] =
    {
        SIGTERM,
        SIGCHLD,
        SIGHUP,
        -1
    };
    int i = 0;
    struct sigaction intAction;

    memset(&intAction, 0, sizeof(intAction));

    if (sigemptyset(&set) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_ERROR(dwError);
    }

    for (i = 0; blockSignals[i] != -1; i++)
    {
        if (sigaddset(&set, blockSignals[i]) < 0)
        {
            dwError = LwMapErrnoToLwError(errno);
            BAIL_ON_ERROR(dwError); 
        }
    }

    dwError = LwMapErrnoToLwError(pthread_sigmask(SIG_SETMASK, &set, NULL));
    BAIL_ON_ERROR(dwError); 

    intAction.sa_handler = LwSmHandleSigint;
    intAction.sa_flags = 0;

    if (sigaction(SIGINT, &intAction, NULL) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_ERROR(dwError);
    }

cleanup:

    return dwError;

error:

    goto cleanup;
}
开发者ID:twistround,项目名称:pbis,代码行数:55,代码来源:main.c


示例6: CTMatchProgramToPID

DWORD
CTMatchProgramToPID(
    PCSTR pszProgramName,
    pid_t    pid
    )
{
    DWORD ceError = ERROR_SUCCESS;
    CHAR szBuf[PATH_MAX+1];
    FILE* pFile = NULL;

#if defined(__LWI_DARWIN__) || defined(__LWI_FREEBSD__)
    sprintf(szBuf, "ps -p %d -o command= | grep %s", pid, pszProgramName);
#elif defined(__LWI_SOLARIS__) || defined(__LWI_HP_UX__) || defined(__LWI_AIX__)
    sprintf(szBuf, "PS=ps; [ -x /bin/ps ] && PS=/bin/ps; UNIX95=1 $PS -p %ld -o comm= | grep %s", (long)pid, pszProgramName);
#else
    sprintf(szBuf, "UNIX95=1 ps -p %ld -o cmd= | grep %s", (long)pid, pszProgramName);
#endif

    pFile = popen(szBuf, "r");
    if (pFile == NULL) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    /* Assume that we won't find the process we are looking for */
    ceError = ERROR_PROC_NOT_FOUND;

    while (TRUE) {

        if (NULL == fgets(szBuf, PATH_MAX, pFile)) {
            if (feof(pFile)) {
                break;
            } else {
                ceError = LwMapErrnoToLwError(errno);
                BAIL_ON_CENTERIS_ERROR(ceError);
            }
        }

        CTStripWhitespace(szBuf);
        if (!IsNullOrEmptyString(szBuf)) {
            /* Well what do you know, it was found! */
            ceError = ERROR_SUCCESS;
            break;
        }

    }

error:

    if (pFile)
        pclose(pFile);

    return ceError;
}
开发者ID:Brainiarc7,项目名称:pbis,代码行数:54,代码来源:ctprocutils.c


示例7: LwSmTableAddEntry

DWORD
LwSmTableAddEntry(
    PLW_SERVICE_INFO pInfo,
    PSM_TABLE_ENTRY* ppEntry
    )
{
    DWORD dwError = 0;
    BOOL bLocked = TRUE;
    PSM_TABLE_ENTRY pEntry = NULL;

    dwError = LwAllocateMemory(sizeof(*pEntry), OUT_PPVOID(&pEntry));
    BAIL_ON_ERROR(dwError);

    LwSmLinkInit(&pEntry->link);
    LwSmLinkInit(&pEntry->waiters);

    pEntry->bValid = TRUE;

    dwError = LwSmCopyServiceInfo(pInfo, &pEntry->pInfo);
    
    dwError = LwMapErrnoToLwError(pthread_mutex_init(&pEntry->lock, NULL));
    BAIL_ON_ERROR(dwError);
    pEntry->pLock = &pEntry->lock;

    dwError = LwMapErrnoToLwError(pthread_cond_init(&pEntry->event, NULL));
    BAIL_ON_ERROR(dwError);
    pEntry->pEvent = &pEntry->event;

    dwError = LwSmTableReconstructEntry(pEntry);
    BAIL_ON_ERROR(dwError);

    LOCK(bLocked, gServiceTable.pLock);

    LwSmLinkInsertBefore(&gServiceTable.entries, &pEntry->link);

    pEntry->dwRefCount++;

    UNLOCK(bLocked, gServiceTable.pLock);

    *ppEntry = pEntry;

cleanup:

    return dwError;

error:

    if (pEntry)
    {
        LwSmTableFreeEntry(pEntry);
    }

    goto cleanup;
}
开发者ID:twistround,项目名称:pbis,代码行数:54,代码来源:table.c


示例8: EVTSvcmStop

NTSTATUS
EVTSvcmStop(
    PLW_SVCM_INSTANCE pInstance
    )
{
    DWORD dwError = 0;

    EVT_LOG_INFO("Eventlog Service exiting...");

    gbExitNow = TRUE;

    if (gbRegisteredTcpIp)
    {
        dwError = EVTUnregisterAllEndpoints();
        BAIL_ON_EVT_ERROR(dwError);

        dwError = EVTStopListen();
        BAIL_ON_EVT_ERROR(dwError);
    }

    dwError = LwmEvtSrvStopListenThread();
    BAIL_ON_EVT_ERROR(dwError);

    if (gbRegisteredTcpIp)
    {
        dwError = LwMapErrnoToLwError(dcethread_interrupt(gNetworkThread));
        BAIL_ON_EVT_ERROR(dwError);

        dwError = LwMapErrnoToLwError(dcethread_join(gNetworkThread, NULL));
        BAIL_ON_EVT_ERROR(dwError);
    }

 cleanup:

    LwEvtDbShutdownEventDatabase();

    EVTSetConfigDefaults();
    EVTFreeSecurityDescriptor(gServerInfo.pAccess);
    gServerInfo.pAccess = NULL;

    return LwWin32ErrorToNtStatus(dwError);

error:

    EVT_LOG_ERROR("Eventlog exiting due to error [code:%d]", dwError);

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:likewise-open,代码行数:48,代码来源:main.c


示例9: CTGetFileTimeStamps

DWORD
CTGetFileTimeStamps(
    PCSTR pszFilePath,
    time_t *patime,   /* time of last access */
    time_t *pmtime,   /* time of last modification */
    time_t *pctime )  /* time of last status change */
{
    DWORD ceError = ERROR_SUCCESS;
    struct stat statbuf;

    memset(&statbuf, 0, sizeof(struct stat));

    if (stat(pszFilePath, &statbuf) < 0) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    if ( patime ) {
        *patime = statbuf.st_atime;
    }

    if ( pmtime ) {
        *pmtime = statbuf.st_mtime;
    }

    if ( pctime ) {
        *pctime = statbuf.st_ctime;
    }
error:

    return ceError;
}
开发者ID:aleksey-novikov,项目名称:pbis,代码行数:32,代码来源:ctfileutils.c


示例10: CTGetOwnerAndPermissions

DWORD
CTGetOwnerAndPermissions(
    PCSTR pszSrcPath,
    uid_t * uid,
    gid_t * gid,
    mode_t * mode
    )
{
    DWORD ceError = ERROR_SUCCESS;
    struct stat statbuf;

    memset(&statbuf, 0, sizeof(struct stat));

    if (stat(pszSrcPath, &statbuf) < 0) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    *uid = statbuf.st_uid;
    *gid = statbuf.st_gid;
    *mode = statbuf.st_mode;

error:

    return ceError;
}
开发者ID:aleksey-novikov,项目名称:pbis,代码行数:26,代码来源:ctfileutils.c


示例11: CTCheckFileExists

DWORD
CTCheckFileExists(
    PCSTR pszPath,
    PBOOLEAN pbFileExists
    )
{
    DWORD ceError = ERROR_SUCCESS;

    struct stat statbuf;

    memset(&statbuf, 0, sizeof(struct stat));

    while (1) {
        if (stat(pszPath, &statbuf) < 0) {
            if (errno == EINTR)
            {
                continue;
            }
            else if (errno == ENOENT || errno == ENOTDIR)
            {
                *pbFileExists = FALSE;
                break;
            }
            ceError = LwMapErrnoToLwError(errno);
            BAIL_ON_CENTERIS_ERROR(ceError);
        } else {
            *pbFileExists = (((statbuf.st_mode & S_IFMT) == S_IFREG) ? TRUE : FALSE);
            break;
        }
    }

error:

    return ceError;
}
开发者ID:aleksey-novikov,项目名称:pbis,代码行数:35,代码来源:ctfileutils.c


示例12: InitializeRPCServer

static
DWORD
InitializeRPCServer(
    VOID
    )
{
    DWORD dwError = 0;

    dwError  = EventLogStartRpcServer();
    BAIL_ON_VMEVENT_ERROR(dwError);

    dwError = LwMapErrnoToLwError(
                    dcethread_create(
                            &gEventLogServerGlobals.pRPCServerThread,
                            NULL,
                            EventLogListenRpcServer,
                            NULL));
    BAIL_ON_VMEVENT_ERROR(dwError);

    while (!EventLogCheckRPCServerIsActive())
    {
        // Wait for RPC Server to come up.
    }

error:

    return dwError;
}
开发者ID:Dan-McGee,项目名称:lightwave,代码行数:28,代码来源:service.c


示例13: LwSmNotify

static
DWORD
LwSmNotify(
    DWORD Error
    )
{
    DWORD dwError = 0;
    int ret = 0;

    do 
    {
        ret = write(gState.notifyPipe[1], &Error, sizeof(Error));
    } while (ret < 0 && errno == EINTR);

    if (ret < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_ERROR(dwError);
    }

cleanup:

    close(gState.notifyPipe[1]);

    return dwError;

error:

    goto cleanup;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:30,代码来源:main.c


示例14: CTChangeOwner

DWORD
CTChangeOwner(
    PCSTR pszPath,
    uid_t uid,
    gid_t gid
    )
{
    DWORD ceError = ERROR_SUCCESS;

    while (1) {
        if (chown(pszPath, uid, gid) < 0) {
            if (errno == EINTR) {
                continue;
            }
            ceError = LwMapErrnoToLwError(errno);
            BAIL_ON_CENTERIS_ERROR(ceError);
        } else {
            break;
        }
    }

error:

    return ceError;
}
开发者ID:aleksey-novikov,项目名称:pbis,代码行数:25,代码来源:ctfileutils.c


示例15: DJGetComputerName

DWORD
DJGetComputerName(
    PSTR* ppszComputerName
    )
{
    DWORD ceError = ERROR_SUCCESS;
    CHAR szBuf[256+1];
    PSTR pszTmp = NULL;

    if (gethostname(szBuf, 256) < 0) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    pszTmp = szBuf;
    while (*pszTmp != '\0') {
        if (*pszTmp == '.') {
            *pszTmp = '\0';
            break;
        }
        pszTmp++;
    }

    if (IsNullOrEmptyString(szBuf)) {
        ceError = ERROR_INVALID_COMPUTERNAME;
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    ceError = CTAllocateString(szBuf, ppszComputerName);
    BAIL_ON_CENTERIS_ERROR(ceError);

error:

    return ceError;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:35,代码来源:djhostinfo.c


示例16: CTGetCurrentDirectoryPath

DWORD
CTGetCurrentDirectoryPath(
    PSTR* ppszPath
    )
{
    DWORD ceError = ERROR_SUCCESS;
    CHAR szBuf[PATH_MAX+1];
    PSTR pszPath = NULL;

    if (getcwd(szBuf, PATH_MAX) == NULL) {
        ceError = LwMapErrnoToLwError(errno);
        BAIL_ON_CENTERIS_ERROR(ceError);
    }

    ceError = CTAllocateString(szBuf, &pszPath);
    BAIL_ON_CENTERIS_ERROR(ceError);

    *ppszPath = pszPath;

    return ceError;

error:

    if (pszPath) {
        CTFreeString(pszPath);
    }

    return ceError;
}
开发者ID:aleksey-novikov,项目名称:pbis,代码行数:29,代码来源:ctfileutils.c


示例17: LwChangeOwner

DWORD
LwChangeOwner(
    PCSTR pszPath,
    uid_t uid,
    gid_t gid
    )
{
    DWORD dwError = 0;

    while (1)
    {

        if (lchown(pszPath, uid, gid) < 0) {
            if (errno == EINTR) {
                continue;
            }
            dwError = LwMapErrnoToLwError(errno);
            BAIL_ON_LW_ERROR(dwError);
        } else {
            break;
        }
    }

error:

    return dwError;
}
开发者ID:bhanug,项目名称:likewise-open,代码行数:27,代码来源:lwfile.c


示例18: CTGetTerminalWidth

DWORD CTGetTerminalWidth(int terminalFid, int *width)
{
    DWORD ceError = ERROR_SUCCESS;
#ifdef TIOCGWINSZ
    struct winsize size = {0};
    const char *fromEnv = getenv("COLUMNS");

    if(ioctl(terminalFid, TIOCGWINSZ, &size) == -1 || size.ws_col == 0)
    {
        if(fromEnv != NULL)
        {
            size.ws_col = atoi(fromEnv);
        }
        else
        {
            ceError = LwMapErrnoToLwError(errno);
            CLEANUP_ON_DWORD(ceError);
        }
    }

    if(size.ws_col < 1)
    {
        ceError = ERROR_INVALID_OPERATION;
        CLEANUP_ON_DWORD(ceError);
    }
    *width = size.ws_col;
#else
    *width = -1;
#endif

cleanup:
    return ceError;
}
开发者ID:virtual-void,项目名称:pbis,代码行数:33,代码来源:ctstrutils.c


示例19: LsaGetCurrentTimeSeconds

// This function is just a wrapper to getting the current time as a time_t.
DWORD
LsaGetCurrentTimeSeconds(
    OUT time_t* pTime
    )
{
    DWORD dwError = 0;
    struct timeval current_tv;

    // ISSUE-2008/10/30-dalmeida -- Is gettimeofday() any better worse than time()?
    // Preserve gettimeofday() since the code we are replacing currently uses that.
    if (gettimeofday(&current_tv, NULL) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_LSA_ERROR(dwError);
    }

    *pTime = current_tv.tv_sec;

cleanup:
    return dwError;

error:
    *pTime = 0;
    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:26,代码来源:lsatime.c


示例20: LwKrb5SetProcessDefaultCachePath

DWORD
LwKrb5SetProcessDefaultCachePath(
    PCSTR pszCachePath
    )
{
    DWORD dwError = 0;
    PSTR pszEnvironmentEntry = NULL;
    static volatile PSTR pszSavedEnvironmentEntry = NULL;
    static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
    BOOLEAN bLocked = FALSE;

    dwError = pthread_mutex_lock(&lock);
    if (dwError)
    {
        dwError = LwMapErrnoToLwError(dwError);
        BAIL_ON_LW_ERROR(dwError);
    }
    bLocked = TRUE;

    dwError = LwAllocateStringPrintf(&pszEnvironmentEntry,
                                      "KRB5CCNAME=%s",
                                      pszCachePath);
    BAIL_ON_LW_ERROR(dwError);

    /*
     * putenv requires that the buffer not be free'd.
     */
    if (putenv(pszEnvironmentEntry) < 0)
    {
        dwError = LwMapErrnoToLwError(errno);
        BAIL_ON_LW_ERROR(dwError);
    }

    LW_SAFE_FREE_STRING(pszSavedEnvironmentEntry);
    pszSavedEnvironmentEntry = pszEnvironmentEntry;
    pszEnvironmentEntry = NULL;

error:
    LW_SAFE_FREE_STRING(pszEnvironmentEntry);
    
    if (bLocked)
    {
        pthread_mutex_unlock(&lock);
    }
    
    return dwError;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:47,代码来源:lwkrb5.c



注:本文中的LwMapErrnoToLwError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LwNtStatusToWin32Error函数代码示例发布时间:2022-05-30
下一篇:
C++ LwFreeMemory函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap