X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..578dc95029e761a59911b7c1bc09f59384d64ddf:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 59fb259624..fd816cb920 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -28,30 +28,32 @@ #include "wx/wfstream.h" +// not only the statfs syscall is called differently depending on platform, but +// one of its incarnations, statvfs(), takes different arguments under +// different platforms and even different versions of the same system (Solaris +// 7 and 8): if you want to test for this, don't forget that the problems only +// appear if the large files support is enabled #ifdef HAVE_STATFS -# ifdef __BSD__ -# include -# include -# else -# include -# endif + #ifdef __BSD__ + #include + #include + #else // !__BSD__ + #include + #endif // __BSD__/!__BSD__ + + #define wxStatfs statfs #endif // HAVE_STATFS -// not only the statfs syscall is called differently depending on platform, but -// we also can't use "struct statvfs" under Solaris because it breaks down if -// HAVE_LARGEFILE_SUPPORT == 1 and we must use statvfs_t instead #ifdef HAVE_STATVFS #include - #define statfs statvfs -# ifdef __HPUX__ - #define wxStatFs struct statvfs -# else - #define wxStatFs statvfs_t -# endif -#elif HAVE_STATFS - #define wxStatFs struct statfs -#endif // HAVE_STAT[V]FS + #define wxStatfs statvfs +#endif // HAVE_STATVFS + +#if defined(HAVE_STATFS) || defined(HAVE_STATVFS) + // WX_STATFS_T is detected by configure + #define wxStatfs_t WX_STATFS_T +#endif #if wxUSE_GUI #include "wx/unix/execute.h" @@ -201,6 +203,16 @@ long wxExecute( const wxString& command, int flags, wxProcess *process ) { wxCHECK_MSG( !command.IsEmpty(), 0, wxT("can't exec empty command") ); +#if wxUSE_THREADS + // fork() doesn't mix well with POSIX threads: on many systems the program + // deadlocks or crashes for some reason. Probably our code is buggy and + // doesn't do something which must be done to allow this to work, but I + // don't know what yet, so for now just warn the user (this is the least we + // can do) about it + wxASSERT_MSG( wxThread::IsMain(), + _T("wxExecute() can be called only from the main thread") ); +#endif // wxUSE_THREADS + int argc = 0; wxChar *argv[WXEXECUTE_NARGS]; wxString argument; @@ -642,6 +654,11 @@ long wxExecute(wxChar **argv, execvp (*mb_argv, mb_argv); + fprintf(stderr, "execvp("); + for ( char **ppc = mb_argv; *ppc; ppc++ ) + fprintf(stderr, "%s%s", ppc == mb_argv ? "" : ", ", *ppc); + fprintf(stderr, ") failed with error %d!\n", errno); + // there is no return after successful exec() _exit(-1); @@ -1024,8 +1041,8 @@ bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) { #if defined(HAVE_STATFS) || defined(HAVE_STATVFS) // the case to "char *" is needed for AIX 4.3 - wxStatFs fs; - if ( statfs((char *)(const char*)path.fn_str(), &fs) != 0 ) + wxStatfs_t fs; + if ( wxStatfs((char *)(const char*)path.fn_str(), &fs) != 0 ) { wxLogSysError( wxT("Failed to get file system statistics") );