aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2012-11-26 21:17:07 -0800
committerPaul Eggert2012-11-26 21:17:07 -0800
commit22626a856b520e4b092b2e4132f57adf8aaf7227 (patch)
treeabc3470fbae12b661ff438341ae52f829421afc1
parent5c9cf0a3f9817220ed0f907637951f5cdf1a9614 (diff)
downloademacs-22626a856b520e4b092b2e4132f57adf8aaf7227.tar.gz
emacs-22626a856b520e4b092b2e4132f57adf8aaf7227.zip
Assume POSIX 1003.1-1988 or later for errno.h.
* lib-src/movemail.c (main): Assume EAGAIN and EBUSY. * src/dired.c (directory_files_internal, file_name_completion): Assume EAGAIN and EINTR are defined. * src/fileio.c (Fcopy_file): Assume EISDIR is defined. * src/gmalloc.c (ENOMEM, EINVAL): Assume they're defined. * src/gnutls.c (emacs_gnutls_write): Assume EAGAIN is defined. * src/lread.c (readbyte_from_file): Assume EINTR is defined. * src/process.c (wait_reading_process_output, send_process) [subprocesses]: Assume EIO and EAGAIN are defined. * src/unexcoff.c (write_segment): Assume EFAULT is defined. Fixes: debbugs:12968
-rw-r--r--lib-src/ChangeLog5
-rw-r--r--lib-src/movemail.c18
-rw-r--r--src/ChangeLog13
-rw-r--r--src/dired.c42
-rw-r--r--src/fileio.c2
-rw-r--r--src/gmalloc.c8
-rw-r--r--src/gnutls.c14
-rw-r--r--src/keyboard.c5
-rw-r--r--src/lread.c2
-rw-r--r--src/process.c13
-rw-r--r--src/unexcoff.c6
11 files changed, 44 insertions, 84 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index b85ba12a5b2..a74d4b90b9f 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,8 @@
12012-11-27 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968).
4 * movemail.c (main): Assume EAGAIN and EBUSY.
5
12012-11-23 Paul Eggert <eggert@cs.ucla.edu> 62012-11-23 Paul Eggert <eggert@cs.ucla.edu>
2 7
3 movemail: treat EACCES etc. failures as permanent 8 movemail: treat EACCES etc. failures as permanent
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 264b3d292c6..f2b2484c8e3 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -430,22 +430,10 @@ main (int argc, char **argv)
430 for certain failure codes. */ 430 for certain failure codes. */
431 if (status < 0) 431 if (status < 0)
432 { 432 {
433 if (++lockcount <= 5) 433 if (++lockcount <= 5 && (errno == EAGAIN || errno == EBUSY))
434 { 434 {
435#ifdef EAGAIN 435 sleep (1);
436 if (errno == EAGAIN) 436 goto retry_lock;
437 {
438 sleep (1);
439 goto retry_lock;
440 }
441#endif
442#ifdef EBUSY
443 if (errno == EBUSY)
444 {
445 sleep (1);
446 goto retry_lock;
447 }
448#endif
449 } 437 }
450 438
451 pfatal_with_name (inname); 439 pfatal_with_name (inname);
diff --git a/src/ChangeLog b/src/ChangeLog
index d841812bceb..0594f73540b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12012-11-27 Paul Eggert <eggert@cs.ucla.edu>
2
3 Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968).
4 * dired.c (directory_files_internal, file_name_completion):
5 Assume EAGAIN and EINTR are defined.
6 * fileio.c (Fcopy_file): Assume EISDIR is defined.
7 * gmalloc.c (ENOMEM, EINVAL): Assume they're defined.
8 * gnutls.c (emacs_gnutls_write): Assume EAGAIN is defined.
9 * lread.c (readbyte_from_file): Assume EINTR is defined.
10 * process.c (wait_reading_process_output, send_process) [subprocesses]:
11 Assume EIO and EAGAIN are defined.
12 * unexcoff.c (write_segment): Assume EFAULT is defined.
13
12012-11-27 Eli Zaretskii <eliz@gnu.org> 142012-11-27 Eli Zaretskii <eliz@gnu.org>
2 15
3 * fontset.c (Finternal_char_font): Return nil on non-GUI frames. 16 * fontset.c (Finternal_char_font): Return nil on non-GUI frames.
diff --git a/src/dired.c b/src/dired.c
index 3530b74ecb4..54bdc083f70 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -193,19 +193,15 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full,
193 193
194 errno = 0; 194 errno = 0;
195 dp = readdir (d); 195 dp = readdir (d);
196 196 if (!dp)
197 if (dp == NULL && (0 197 {
198#ifdef EAGAIN 198 if (errno == EAGAIN || errno == EINTR)
199 || errno == EAGAIN 199 {
200#endif 200 QUIT;
201#ifdef EINTR 201 continue;
202 || errno == EINTR 202 }
203#endif 203 break;
204 )) 204 }
205 { QUIT; continue; }
206
207 if (dp == NULL)
208 break;
209 205
210 len = dirent_namelen (dp); 206 len = dirent_namelen (dp);
211 name = finalname = make_unibyte_string (dp->d_name, len); 207 name = finalname = make_unibyte_string (dp->d_name, len);
@@ -480,17 +476,15 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
480 476
481 errno = 0; 477 errno = 0;
482 dp = readdir (d); 478 dp = readdir (d);
483 if (dp == NULL && (0 479 if (!dp)
484# ifdef EAGAIN 480 {
485 || errno == EAGAIN 481 if (errno == EAGAIN || errno == EINTR)
486# endif 482 {
487# ifdef EINTR 483 QUIT;
488 || errno == EINTR 484 continue;
489# endif 485 }
490 )) 486 break;
491 { QUIT; continue; } 487 }
492
493 if (!dp) break;
494 488
495 len = dirent_namelen (dp); 489 len = dirent_namelen (dp);
496 490
diff --git a/src/fileio.c b/src/fileio.c
index 442c66550d3..98b27035597 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1995,10 +1995,8 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */)
1995 { 1995 {
1996 if (!(S_ISREG (st.st_mode)) && !(S_ISLNK (st.st_mode))) 1996 if (!(S_ISREG (st.st_mode)) && !(S_ISLNK (st.st_mode)))
1997 { 1997 {
1998#if defined (EISDIR)
1999 /* Get a better looking error message. */ 1998 /* Get a better looking error message. */
2000 errno = EISDIR; 1999 errno = EISDIR;
2001#endif /* EISDIR */
2002 report_file_error ("Non-regular file", Fcons (file, Qnil)); 2000 report_file_error ("Non-regular file", Fcons (file, Qnil));
2003 } 2001 }
2004 } 2002 }
diff --git a/src/gmalloc.c b/src/gmalloc.c
index dc584955661..c325ca79910 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1645,14 +1645,6 @@ memalign (size_t alignment, size_t size)
1645 return result; 1645 return result;
1646} 1646}
1647 1647
1648#ifndef ENOMEM
1649#define ENOMEM 12
1650#endif
1651
1652#ifndef EINVAL
1653#define EINVAL 22
1654#endif
1655
1656int 1648int
1657posix_memalign (void **memptr, size_t alignment, size_t size) 1649posix_memalign (void **memptr, size_t alignment, size_t size)
1658{ 1650{
diff --git a/src/gnutls.c b/src/gnutls.c
index e3d84a0b61b..03f753fa8cc 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -359,12 +359,7 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
359 359
360 if (proc->gnutls_initstage != GNUTLS_STAGE_READY) 360 if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
361 { 361 {
362#ifdef EWOULDBLOCK
363 errno = EWOULDBLOCK;
364#endif
365#ifdef EAGAIN
366 errno = EAGAIN; 362 errno = EAGAIN;
367#endif
368 return 0; 363 return 0;
369 } 364 }
370 365
@@ -384,14 +379,7 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte)
384 appropriately so that send_process retries the 379 appropriately so that send_process retries the
385 correct way instead of erroring out. */ 380 correct way instead of erroring out. */
386 if (rtnval == GNUTLS_E_AGAIN) 381 if (rtnval == GNUTLS_E_AGAIN)
387 { 382 errno = EAGAIN;
388#ifdef EWOULDBLOCK
389 errno = EWOULDBLOCK;
390#endif
391#ifdef EAGAIN
392 errno = EAGAIN;
393#endif
394 }
395 break; 383 break;
396 } 384 }
397 } 385 }
diff --git a/src/keyboard.c b/src/keyboard.c
index 0ad6d18c044..60e6d71cdff 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -6960,10 +6960,7 @@ tty_read_avail_input (struct terminal *terminal,
6960 an EAGAIN error. Does anybody know of a situation 6960 an EAGAIN error. Does anybody know of a situation
6961 where a retry is actually needed? */ 6961 where a retry is actually needed? */
6962#if 0 6962#if 0
6963 nread < 0 && (errno == EAGAIN 6963 nread < 0 && (errno == EAGAIN || errno == EFAULT
6964#ifdef EFAULT
6965 || errno == EFAULT
6966#endif
6967#ifdef EBADSLT 6964#ifdef EBADSLT
6968 || errno == EBADSLT 6965 || errno == EBADSLT
6969#endif 6966#endif
diff --git a/src/lread.c b/src/lread.c
index 6d0ff9f780e..6647382a254 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -440,7 +440,6 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
440 block_input (); 440 block_input ();
441 c = getc (instream); 441 c = getc (instream);
442 442
443#ifdef EINTR
444 /* Interrupted reads have been observed while reading over the network. */ 443 /* Interrupted reads have been observed while reading over the network. */
445 while (c == EOF && ferror (instream) && errno == EINTR) 444 while (c == EOF && ferror (instream) && errno == EINTR)
446 { 445 {
@@ -450,7 +449,6 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
450 clearerr (instream); 449 clearerr (instream);
451 c = getc (instream); 450 c = getc (instream);
452 } 451 }
453#endif
454 452
455 unblock_input (); 453 unblock_input ();
456 454
diff --git a/src/process.c b/src/process.c
index 0036ce595f5..b23f06fd025 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4432,14 +4432,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4432 total_nread += nread; 4432 total_nread += nread;
4433 got_some_input = 1; 4433 got_some_input = 1;
4434 } 4434 }
4435#ifdef EIO 4435 else if (nread == -1 && (errno == EIO || errno == EAGAIN))
4436 else if (nread == -1 && EIO == errno)
4437 break; 4436 break;
4438#endif
4439#ifdef EAGAIN
4440 else if (nread == -1 && EAGAIN == errno)
4441 break;
4442#endif
4443#ifdef EWOULDBLOCK 4437#ifdef EWOULDBLOCK
4444 else if (nread == -1 && EWOULDBLOCK == errno) 4438 else if (nread == -1 && EWOULDBLOCK == errno)
4445 break; 4439 break;
@@ -5517,13 +5511,10 @@ send_process (Lisp_Object proc, const char *buf, ptrdiff_t len,
5517 5511
5518 if (rv < 0) 5512 if (rv < 0)
5519 { 5513 {
5520 if (0 5514 if (errno == EAGAIN
5521#ifdef EWOULDBLOCK 5515#ifdef EWOULDBLOCK
5522 || errno == EWOULDBLOCK 5516 || errno == EWOULDBLOCK
5523#endif 5517#endif
5524#ifdef EAGAIN
5525 || errno == EAGAIN
5526#endif
5527 ) 5518 )
5528 /* Buffer is full. Wait, accepting input; 5519 /* Buffer is full. Wait, accepting input;
5529 that may allow the program 5520 that may allow the program
diff --git a/src/unexcoff.c b/src/unexcoff.c
index 966dd58cb6e..6e29951a962 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -332,11 +332,7 @@ write_segment (int new, const char *ptr, const char *end)
332 a gap between the old text segment and the old data segment. 332 a gap between the old text segment and the old data segment.
333 This gap has probably been remapped into part of the text segment. 333 This gap has probably been remapped into part of the text segment.
334 So write zeros for it. */ 334 So write zeros for it. */
335 if (ret == -1 335 if (ret == -1 && errno == EFAULT)
336#ifdef EFAULT
337 && errno == EFAULT
338#endif
339 )
340 { 336 {
341 /* Write only a page of zeros at once, 337 /* Write only a page of zeros at once,
342 so that we don't overshoot the start 338 so that we don't overshoot the start