Changeset 30439 in vbox
- Timestamp:
- Jun 24, 2010 3:53:22 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3Lib.cpp
r30392 r30439 5 5 6 6 /* 7 * Copyright (C) 2007 -2010Oracle Corporation7 * Copyright (C) 2007 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 44 44 # if defined(RT_OS_LINUX) /** @todo check this on solaris+freebsd as well. */ 45 45 # include <sys/ioctl.h> 46 # endif47 # if defined(RT_OS_SOLARIS) && !defined(VBOX_VBGLR3_XFREE86)48 # define VBGL_DO_MASK_SIGNALS49 # include <signal.h>50 46 # endif 51 47 # include <errno.h> … … 293 289 294 290 295 /*296 * Helper macros for blocking and restoring signals.297 */298 #ifdef VBGL_DO_MASK_SIGNALS299 # define BLOCK_SIGNALS(Prf) \300 int Prf##_rcSig; \301 sigset_t Prf##_SigSetOld; \302 do \303 { \304 sigset_t Prf##_SigSetNew; \305 sigfillset(& Prf##_SigSetNew); \306 sigdelset(& Prf##_SigSetNew, SIGTERM); \307 sigdelset(& Prf##_SigSetNew, SIGINT); \308 sigdelset(& Prf##_SigSetNew, SIGHUP); \309 sigdelset(& Prf##_SigSetNew, SIGABRT); \310 sigdelset(& Prf##_SigSetNew, SIGKILL); \311 Prf##_rcSig = pthread_sigmask(SIG_BLOCK, & Prf##_SigSetNew, & Prf##_SigSetOld); \312 } while (0)313 314 # define RESTORE_SIGNALS(Prf) \315 do \316 { \317 if (Prf##_rcSig == 0) \318 { \319 int Prf##_err = errno; /* paranoia */ \320 pthread_sigmask(SIG_SETMASK, & Prf##_SigSetOld, NULL); \321 errno = Prf##_err; \322 } \323 } while (0)324 325 #else326 # define BLOCK_SIGNALS(Prf) do { } while (0)327 # define RESTORE_SIGNALS(Prf) do { } while (0)328 #endif329 330 331 291 /** 332 292 * Internal wrapper around various OS specific ioctl implemenations. … … 385 345 * header with an error code return field (much better alternative 386 346 * actually). */ 387 BLOCK_SIGNALS(SigPrefix);388 347 int rc = ioctl((int)g_File, iFunction, &Hdr); 389 RESTORE_SIGNALS(SigPrefix);390 348 if (rc == -1) 391 349 { … … 396 354 397 355 #elif defined(RT_OS_LINUX) 398 BLOCK_SIGNALS(SigPrefix);399 356 # ifdef VBOX_VBGLR3_XFREE86 400 357 int rc = xf86ioctl((int)g_File, iFunction, pvData); … … 402 359 int rc = ioctl((int)g_File, iFunction, pvData); 403 360 # endif 404 RESTORE_SIGNALS(SigPrefix);405 361 if (RT_LIKELY(rc == 0)) 406 362 return VINF_SUCCESS; … … 421 377 /* PORTME - This is preferred over the RTFileIOCtl variant below, just be careful with the (int). */ 422 378 /** @todo test status code passing! */ 423 BLOCK_SIGNALS(SigPrefix);424 379 int rc = xf86ioctl(g_File, iFunction, pvData); 425 RESTORE_SIGNALS(SigPrefix);426 380 if (rc == -1) 427 381 return VERR_FILE_IO_ERROR; /* This is purely legacy stuff, it has to work and no more. */ … … 431 385 /* Default implementation - PORTME: Do not use this without testings that passing errors works! */ 432 386 /** @todo test status code passing! */ 433 BLOCK_SIGNALS(SigPrefix);434 387 int rc2 = VERR_INTERNAL_ERROR; 435 388 int rc = RTFileIoCtl(g_File, (int)iFunction, pvData, cbData, &rc2); 436 RESTORE_SIGNALS(SigPrefix);437 389 if (RT_SUCCESS(rc)) 438 390 rc = rc2;
Note:
See TracChangeset
for help on using the changeset viewer.