X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8c03f242ce0c73c76f0fb7d292b59b1647baf967..a7c8e710e944fc12a81a19d06fe415a92e86bb13:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index fbf5377f76..da7aa73531 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -29,7 +29,7 @@ #include "wx/stream.h" #ifdef HAVE_STATFS -# ifdef __DARWIN__ +# ifdef __BSD__ # include # include # else @@ -37,6 +37,12 @@ # endif #endif // HAVE_STATFS +#ifdef HAVE_STATVFS + #include + + #define statfs statvfs +#endif // HAVE_STATVFS + #if wxUSE_GUI #include "wx/unix/execute.h" #endif @@ -288,32 +294,12 @@ bool wxShell(const wxString& command, wxArrayString& output) void wxHandleProcessTermination(wxEndProcessData *proc_data) { - int pid = (proc_data->pid > 0) ? proc_data->pid : -(proc_data->pid); - - // waitpid is POSIX so should be available everywhere, however on older - // systems wait() might be used instead in a loop (until the right pid - // terminates) - int status = 0; - int rc; - - // wait for child termination and if waitpid() was interrupted, try again - do - { - rc = waitpid(pid, &status, 0); - } - while ( rc == -1 && errno == EINTR ); - // notify user about termination if required if ( proc_data->process ) { - proc_data->process->OnTerminate - ( - proc_data->pid, - (rc == 0) && WIFEXITED(status) - ? WEXITSTATUS(status) - : -1 - ); + proc_data->process->OnTerminate(proc_data->pid, proc_data->exitcode); } + // clean up if ( proc_data->pid > 0 ) { @@ -321,9 +307,7 @@ void wxHandleProcessTermination(wxEndProcessData *proc_data) } else { - // wxExecute() will know about it - proc_data->exitcode = status; - + // let wxExecute() know that the process has terminated proc_data->pid = 0; } } @@ -964,6 +948,7 @@ bool wxGetUserName(wxChar *buf, int sz) return FALSE; } +#ifndef __WXMAC__ wxString wxGetOsDescription() { #ifndef WXWIN_OS_DESCRIPTION @@ -972,6 +957,7 @@ wxString wxGetOsDescription() return WXWIN_OS_DESCRIPTION; #endif } +#endif // this function returns the GUI toolkit version in GUI programs, but OS // version in non-GUI ones @@ -1029,16 +1015,19 @@ long wxGetFreeMemory() bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) { -#ifdef HAVE_STATFS - +#if defined(HAVE_STATFS) || defined(HAVE_STATVFS) + // the case to "char *" is needed for AIX 4.3 struct statfs fs; - if ( statfs(path, &fs) != 0 ) + if ( statfs((char *)path.fn_str(), &fs) != 0 ) { wxLogSysError("Failed to get file system statistics"); return FALSE; } + // under Solaris we might have to use fs.f_frsize instead as I think it + // may be a multiple of the block size in general (TODO) + if ( pTotal ) { *pTotal = wxLongLong(fs.f_blocks) * fs.f_bsize; @@ -1077,8 +1066,10 @@ bool wxGetEnv(const wxString& var, wxString *value) bool wxSetEnv(const wxString& variable, const wxChar *value) { #if defined(HAVE_SETENV) - return setenv(variable.mb_str(), value ? wxString(value).mb_str().data() - : NULL, 1 /* overwrite */) == 0; + return setenv(variable.mb_str(), + value ? (const char *)wxString(value).mb_str() + : NULL, + 1 /* overwrite */) == 0; #elif defined(HAVE_PUTENV) wxString s = variable; if ( value ) @@ -1105,7 +1096,7 @@ bool wxSetEnv(const wxString& variable, const wxChar *value) #include -static void wxFatalSignalHandler(wxTYPE_SA_HANDLER) +extern "C" void wxFatalSignalHandler(wxTYPE_SA_HANDLER) { if ( wxTheApp ) { @@ -1174,6 +1165,8 @@ bool wxHandleFatalExceptions(bool doit) // error and debug output routines (deprecated, use wxLog) // ---------------------------------------------------------------------------- +#if WXWIN_COMPATIBILITY_2_2 + void wxDebugMsg( const char *format, ... ) { va_list ap; @@ -1200,3 +1193,5 @@ void wxFatalError( const wxString &msg, const wxString &title ) exit(3); // the same exit code as for abort() } +#endif // WXWIN_COMPATIBILITY_2_2 +