rtProcInitExePath-solaris.cpp revision 92453c7e11969eccff568c08178524f057247426
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * IPRT - rtProcInitName, Solaris.
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * Copyright (C) 2006-2008 Oracle Corporation
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * available from http://www.virtualbox.org. This file is free software;
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * you can redistribute it and/or modify it under the terms of the GNU
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * General Public License (GPL) as published by the Free Software
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * The contents of this file may alternatively be used under the terms
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * of the Common Development and Distribution License Version 1.0
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * VirtualBox OSE distribution, in which case the provisions of the
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * CDDL are applicable instead of those of the GPL.
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * You may elect to license modified versions of this file under the
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * terms and conditions of either the GPL or the CDDL or both.
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync/*******************************************************************************
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync* Header Files *
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync*******************************************************************************/
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsyncDECLHIDDEN(int) rtProcInitExePath(char *pszPath, size_t cchPath)
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync * Read the /proc/<pid>/path/a.out link, convert to native and return it.
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync RTStrPrintf(szProcFile, sizeof(szProcFile), "/proc/%ld/path/a.out", (long)getpid());
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync int cchLink = readlink(szProcFile, pszPath, cchPath - 1);
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync char const *pszTmp;
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync AssertMsgRCReturn(rc, ("rc=%Rrc pszLink=\"%s\"\nhex: %.*Rhxs\n", rc, pszPath, cchLink, pszPath), rc);
38ae7e4efe803ea78b6499cd05a394db32623e41vboxsync AssertMsgFailed(("rc=%Rrc err=%d cchLink=%d\n", rc, err, cchLink));