void rust_kernel::fail() { // FIXME (#908): On windows we're getting "Application has // requested the Runtime to terminate it in an unusual way" when // trying to shutdown cleanly. set_exit_status(PROC_FAIL_CODE); #if defined(__WIN32__) exit(rval); #endif // I think this only needs to be done by one task ever; as it is, // multiple tasks invoking kill_all might get here. Currently libcore // ensures only one task will ever invoke it, but this would really be // fine either way, so I'm leaving it as it is. -- bblum // Copy the list of schedulers so that we don't hold the lock while // running kill_all_tasks. Refcount to ensure they stay alive. std::vector<rust_scheduler*> scheds; { scoped_lock with(sched_lock); // All schedulers created after this flag is set will be doomed. killed = true; for (sched_map::iterator iter = sched_table.begin(); iter != sched_table.end(); iter++) { iter->second->ref(); scheds.push_back(iter->second); } } for (std::vector<rust_scheduler*>::iterator iter = scheds.begin(); iter != scheds.end(); iter++) { (*iter)->kill_all_tasks(); (*iter)->deref(); } }
void errprintf(const char* format, ...) { va_list args; va_start(args, format); veprintf(format, args); va_end(args); set_exit_status(EXIT_FAILURE); }
static BOOL WINAPI signal_handler(DWORD type lzma_attribute((__unused__))) { // Since we don't get a signal number which we could raise() at // signals_exit() like on POSIX, just set the exit status to // indicate an error, so that we cannot return with zero exit status. set_exit_status(E_ERROR); user_abort = true; return TRUE; }
void file_removed_diag (const char *name, bool top_level, void (*diagfn) (char const *name)) { if (!top_level && errno == ENOENT) { WARNOPT (WARN_FILE_REMOVED, (0, 0, _("%s: File removed before we read it"), quotearg_colon (name))); set_exit_status (TAREXIT_DIFFERS); } else diagfn (name); }
/* Sigh about something that differs by writing a MESSAGE to stdlis, given MESSAGE is nonzero. Also set the exit status if not already. */ void report_difference (struct tar_stat_info *st, const char *fmt, ...) { if (fmt) { va_list ap; fprintf (stdlis, "%s: ", quotearg_colon (st->file_name)); va_start (ap, fmt); vfprintf (stdlis, fmt, ap); va_end (ap); fprintf (stdlis, "\n"); } set_exit_status (TAREXIT_DIFFERS); }
extern void signals_exit(void) { const int sig = exit_signal; if (sig != 0) { #if defined(TUKLIB_DOSLIKE) || defined(__VMS) // Don't raise(), set only exit status. This avoids // printing unwanted message about SIGINT when the user // presses C-c. set_exit_status(E_ERROR); #else struct sigaction sa; sa.sa_handler = SIG_DFL; sigfillset(&sa.sa_mask); sa.sa_flags = 0; sigaction(sig, &sa, NULL); raise(exit_signal); #endif } return; }