diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2013-02-14 22:35:54 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2013-02-14 22:35:54 -0800 |
commit | 648e5523fbfc3dfbce58f66437112bc442470c87 (patch) | |
tree | 6ead7871ba1026168c7f7c4d1f4cffa5241f864b /src | |
parent | dec2a322921d74de8f251a54931d4c50ab00713d (diff) | |
parent | 974c7646ec5b2985a50007c9d599154d667df349 (diff) | |
download | emacs-648e5523fbfc3dfbce58f66437112bc442470c87.tar.gz |
Merge from emacs-24; up to 2012-12-19T13:01:16Z!michael.albinus@gmx.de
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 20 | ||||
-rw-r--r-- | src/lisp.h | 4 | ||||
-rw-r--r-- | src/w32.c | 21 | ||||
-rw-r--r-- | src/w32proc.c | 27 |
4 files changed, 64 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8b1c429e406..00cb40df9e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,23 @@ +2013-02-15 Paul Eggert <eggert@cs.ucla.edu> + + Fix AIX port (Bug#13650). + * lisp.h (XPNTR) [!USE_LSB_TAG && DATA_SEG_BITS]: + Fix bug introduced in 2012-07-27 change. DATA_SEG_BITS, if set, + was #undeffed earlier, so it cannot be used as a macro here. + Use the constant and not the macro. + +2013-02-15 Eli Zaretskii <eliz@gnu.org> + + * w32proc.c (new_child): If no vacant slots are found in + child_procs[], make another pass looking for slots whose process + has exited or died. (Bug#13546) + + * w32.c (sys_pipe): When failing due to file descriptors above + MAXDESC, set errno to EMFILE. + (_sys_read_ahead): Update cp->status when failing to read serial + communications input, so that the status doesn't stay at + STATUS_READ_IN_PROGRESS. (Bug#13546) + 2013-02-14 Jan Djärv <jan.h.d@swipnet.se> * gtkutil.c (tb_size_cb): New function. diff --git a/src/lisp.h b/src/lisp.h index 37d2b45e85b..da1531cc1be 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -505,13 +505,9 @@ static EMACS_INT const VALMASK (XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \ + ((intptr_t) (ptr) & VALMASK))) -#if DATA_SEG_BITS /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers which were stored in a Lisp_Object. */ #define XPNTR(a) ((uintptr_t) ((XLI (a) & VALMASK)) | DATA_SEG_BITS)) -#else -#define XPNTR(a) ((uintptr_t) (XLI (a) & VALMASK)) -#endif #endif /* not USE_LSB_TAG */ diff --git a/src/w32.c b/src/w32.c index 8b89bd3e660..03e65bf9431 100644 --- a/src/w32.c +++ b/src/w32.c @@ -6800,6 +6800,7 @@ sys_pipe (int * phandles) { _close (phandles[0]); _close (phandles[1]); + errno = EMFILE; rc = -1; } else @@ -6873,19 +6874,31 @@ _sys_read_ahead (int fd) /* Configure timeouts for blocking read. */ if (!GetCommTimeouts (hnd, &ct)) - return STATUS_READ_ERROR; + { + cp->status = STATUS_READ_ERROR; + return STATUS_READ_ERROR; + } ct.ReadIntervalTimeout = 0; ct.ReadTotalTimeoutMultiplier = 0; ct.ReadTotalTimeoutConstant = 0; if (!SetCommTimeouts (hnd, &ct)) - return STATUS_READ_ERROR; + { + cp->status = STATUS_READ_ERROR; + return STATUS_READ_ERROR; + } if (!ReadFile (hnd, &cp->chr, sizeof (char), (DWORD*) &rc, ovl)) { if (GetLastError () != ERROR_IO_PENDING) - return STATUS_READ_ERROR; + { + cp->status = STATUS_READ_ERROR; + return STATUS_READ_ERROR; + } if (!GetOverlappedResult (hnd, ovl, (DWORD*) &rc, TRUE)) - return STATUS_READ_ERROR; + { + cp->status = STATUS_READ_ERROR; + return STATUS_READ_ERROR; + } } } else if (fd_info[fd].flags & FILE_SOCKET) diff --git a/src/w32proc.c b/src/w32proc.c index 8bf57602927..ce1474c7323 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -803,6 +803,33 @@ new_child (void) if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess == NULL) goto Initialize; if (child_proc_count == MAX_CHILDREN) + { + DebPrint (("new_child: No vacant slots, looking for dead processes\n")); + for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--) + if (!CHILD_ACTIVE (cp) && cp->procinfo.hProcess) + { + DWORD status = 0; + + if (!GetExitCodeProcess (cp->procinfo.hProcess, &status)) + { + DebPrint (("new_child.GetExitCodeProcess: error %lu for PID %lu\n", + GetLastError (), cp->procinfo.dwProcessId)); + status = STILL_ACTIVE; + } + if (status != STILL_ACTIVE + || WaitForSingleObject (cp->procinfo.hProcess, 0) == WAIT_OBJECT_0) + { + DebPrint (("new_child: Freeing slot of dead process %d\n", + cp->procinfo.dwProcessId)); + CloseHandle (cp->procinfo.hProcess); + cp->procinfo.hProcess = NULL; + CloseHandle (cp->procinfo.hThread); + cp->procinfo.hThread = NULL; + goto Initialize; + } + } + } + if (child_proc_count == MAX_CHILDREN) return NULL; cp = &child_procs[child_proc_count++]; |