VirtualBox

Changeset 31867 in vbox


Ignore:
Timestamp:
Aug 23, 2010 3:21:58 PM (14 years ago)
Author:
vboxsync
Message:

VBoxService/VMInfo: Added utmpx support for Solaris (and later FreeBSD 9).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo.cpp

    r31037 r31867  
    3636# include <net/if.h>
    3737# include <unistd.h>
    38 # ifndef RT_OS_FREEBSD /* The header does not exist anymore since FreeBSD 9-current */
    39 #  include <utmp.h>
     38# ifndef RT_OS_FREEBSD
     39#  include <utmpx.h> /* @todo FreeBSD 9 should have this. */
    4040# endif
    4141# ifdef RT_OS_SOLARIS
     
    215215static int vboxserviceVMInfoWriteUsers(void)
    216216{
    217     int rc;
     217    int rc = VINF_SUCCESS;
    218218    char *pszUserList = NULL;
    219219    uint32_t cUsersInList = 0;
     
    227227
    228228#elif defined(RT_OS_FREEBSD)
    229     /** @todo FreeBSD: Port logged on user info retrival. */
     229    /** @todo FreeBSD: Port logged on user info retrival.
     230     *                 However, FreeBSD 9 supports utmpx, so we could use the code
     231     *                 block below (?). */
    230232    rc = VERR_NOT_IMPLEMENTED;
    231233
     
    235237
    236238#else
    237     /** @todo Add utmpx support? */
    238     rc = utmpname(UTMP_FILE);
    239 # ifdef RT_OS_SOLARIS
    240     if (rc != 1)
    241 # else
    242     if (rc != 0)
    243 # endif
    244     {
    245         VBoxServiceError("VMInfo/Users: Could not set UTMP file! Error: %ld\n", errno);
    246         rc = VERR_GENERAL_FAILURE;
    247     }
    248     else
    249         rc = VINF_SUCCESS;
    250 
    251     setutent();
    252     utmp *ut_user;
     239    setutxent();
     240    utmpx *ut_user;
    253241    uint32_t cListSize = 32;
    254242
     
    259247
    260248    /* Process all entries in the utmp file. */
    261     while (   (ut_user = getutent())
     249    while (   (ut_user = getutxent())
    262250           && RT_SUCCESS(rc))
    263251    {
     
    316304    RTMemFree(papszUsers);
    317305
    318     endutent(); /* Close utmp file. */
     306    endutxent(); /* Close utmpx file. */
    319307#endif
    320308    Assert(RT_FAILURE(rc) || cUsersInList == 0 || (pszUserList && *pszUserList));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette