]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/utilsunx.cpp
Applied patch [ 1088717 ] (_LARGEFILE_SOURCE fix for HP-UX).
[wxWidgets.git] / src / unix / utilsunx.cpp
index 2c375b2edbae6785d1a2d5f0eedea49edd746f43..89dd3e65a85bd018a92abbcc7594f2032baee78b 100644 (file)
 // headers - please add your system here if it is the case for your OS.
 // SunOS < 5.6 (i.e. Solaris < 2.6) and DG-UX are like this.
 #if !defined(HAVE_USLEEP) && \
-    (defined(__SUN__) && !defined(__SunOs_5_6) && \
+    ((defined(__SUN__) && !defined(__SunOs_5_6) && \
                          !defined(__SunOs_5_7) && !defined(__SUNPRO_CC)) || \
-     defined(__osf__) || defined(__EMX__)
+     defined(__osf__) || defined(__EMX__))
     extern "C"
     {
         #ifdef __SUN__
@@ -200,9 +200,12 @@ void wxMilliSleep(unsigned long milliseconds)
 // process management
 // ----------------------------------------------------------------------------
 
-int wxKill(long pid, wxSignal sig, wxKillError *rc)
+int wxKill(long pid, wxSignal sig, wxKillError *rc, int flags)
 {
-    int err = kill((pid_t)pid, (int)sig);
+    int err = kill((pid_t) (flags & wxKILL_CHILDREN) ? -pid : pid, (int)sig);
+    if ( !err )
+       *rc = wxKILL_OK;
+    else
     if ( rc )
     {
         switch ( errno )
@@ -837,11 +840,20 @@ bool wxGetUserName(wxChar *buf, int sz)
 
 wxString wxGetOsDescription()
 {
-#ifndef WXWIN_OS_DESCRIPTION
-    #error WXWIN_OS_DESCRIPTION should be defined in config.h by configure
-#else
-    return wxString::FromAscii( WXWIN_OS_DESCRIPTION );
-#endif
+    FILE *f = popen("uname -s -r -m", "r");
+    if (f)
+    {
+        char buf[256];
+        size_t c = fread(buf, 1, sizeof(buf) - 1, f);
+        pclose(f);
+        // Trim newline from output.
+        if (c && buf[c - 1] == '\n')
+            --c;
+        buf[c] = '\0';
+        return wxString::FromAscii( buf );
+    }
+    wxFAIL_MSG( _T("uname failed") );
+    return _T("");
 }
 
 #endif // !__WXMAC__
@@ -1121,10 +1133,12 @@ int wxGUIAppTraits::WaitForChild(wxExecuteData& execData)
 {
     wxEndProcessData *endProcData = new wxEndProcessData;
 
+    const int flags = execData.flags;
+
     // wxAddProcessCallback is now (with DARWIN) allowed to call the
     // callback function directly if the process terminates before
     // the callback can be added to the run loop. Set up the endProcData.
-    if ( execData.flags & wxEXEC_SYNC )
+    if ( flags & wxEXEC_SYNC )
     {
         // we may have process for capturing the program output, but it's
         // not used in wxEndProcessData in the case of sync execution
@@ -1143,7 +1157,7 @@ int wxGUIAppTraits::WaitForChild(wxExecuteData& execData)
     }
 
 
-#if defined(__DARWIN__) && defined(__WXMAC__)
+#if defined(__DARWIN__) && (defined(__WXMAC__) || defined(__WXCOCOA__))
     endProcData->tag = wxAddProcessCallbackForPid(endProcData, execData.pid);
 #else
     endProcData->tag = wxAddProcessCallback
@@ -1153,12 +1167,13 @@ int wxGUIAppTraits::WaitForChild(wxExecuteData& execData)
                 );
 
     execData.pipeEndProcDetect.Close();
-#endif // defined(__DARWIN__) && defined(__WXMAC__)
+#endif // defined(__DARWIN__) && (defined(__WXMAC__) || defined(__WXCOCOA__))
 
-    if ( execData.flags & wxEXEC_SYNC )
+    if ( flags & wxEXEC_SYNC )
     {
         wxBusyCursor bc;
-        wxWindowDisabler wd;
+        wxWindowDisabler *wd = flags & wxEXEC_NODISABLE ? NULL
+                                                        : new wxWindowDisabler;
 
         // endProcData->pid will be set to 0 from GTK_EndProcessDetector when the
         // process terminates
@@ -1192,6 +1207,7 @@ int wxGUIAppTraits::WaitForChild(wxExecuteData& execData)
 
         int exitcode = endProcData->exitcode;
 
+        delete wd;
         delete endProcData;
 
         return exitcode;