当前位置: 首页>>代码示例>>C++>>正文


C++ LwMapErrnoToLwError函数代码示例

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


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


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