VirtualBox

Ignore:
Timestamp:
Nov 25, 2018 7:12:16 PM (6 years ago)
Author:
vboxsync
Message:

VBoxService/VBoxGuestR3LibGuestCtrl.cpp: Fixed mkdir with OS X guests (probably any unix guest). HGCM is a bundle of joy when signals gets into the mix. Sigh.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibGuestCtrl.cpp

    r71364 r75724  
    3737#include <VBox/HostServices/GuestControlSvc.h>
    3838
     39#ifndef RT_OS_WINDOWS
     40# include <signal.h>
     41#endif
     42
    3943#include "VBoxGuestR3LibInternal.h"
    4044
     
    99103     *       one for retriving the actual message parameters.  Not this weird
    100104     *       stuff, to put it rather bluntly.
     105     *
     106     * Note! As a result of this weird design, we are not able to correctly
     107     *       retrieve message if we're interrupted by a signal, like SIGCHLD.
     108     *       Because IPRT wants to use waitpid(), we're forced to have a handler
     109     *       installed for SIGCHLD, so when working with child processes there
     110     *       will be signals in the air and we will get VERR_INTERRUPTED returns.
     111     *       The way HGCM handles interrupted calls is to silently (?) drop them
     112     *       as they complete (see VMMDev), so the server knows little about it
     113     *       and just goes on to the next message inline.
     114     *
     115     *       So, as a "temporary" mesasure, we block SIGCHLD here while waiting,
     116     *       because it will otherwise be impossible do simple stuff like 'mkdir'
     117     *       on a mac os x guest, and probably most other unix guests.
    101118     */
    102     int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
     119#ifdef RT_OS_WINDOWS
     120    int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
     121#else
     122    sigset_t SigSet;
     123    sigemptyset(&SigSet);
     124    sigaddset(&SigSet, SIGCHLD);
     125    sigprocmask(SIG_BLOCK, &SigSet, NULL);
     126    int rc = VbglR3HGCMCall(&Msg.hdr, sizeof(Msg));
     127    sigprocmask(SIG_UNBLOCK, &SigSet, NULL);
     128#endif
    103129    if (   rc == VERR_TOO_MUCH_DATA
    104130        || RT_SUCCESS(rc))
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