unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob d39692fd577f7dc16796a73dac6a9438b3f319c1 3804 bytes (raw)
name: src/sysdep1.c 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
 
/* Interfaces to system-dependent kernel and library entries.
   Copyright (C) 1985-1988, 1993-1995, 1999-2022 Free Software
   Foundation, Inc.

This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or (at
your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */

#include <config.h>

#include <execinfo.h>
#include "sysstdio.h"
#ifdef HAVE_PWD_H
#include <pwd.h>
#include <grp.h>
#endif /* HAVE_PWD_H */
#include <limits.h>
#include <stdlib.h>
#include <sys/random.h>
#include <unistd.h>

#include <c-ctype.h>
#include <close-stream.h>
#include <pathmax.h>
#include <utimens.h>

#include "lisp.h"
#include "sheap.h"
#include "sysselect.h"
#include "blockinput.h"

#ifdef HAVE_LINUX_FS_H
# include <linux/fs.h>
# include <sys/syscall.h>
#endif

#ifdef CYGWIN
# include <cygwin/fs.h>
#endif

#if defined DARWIN_OS || defined __FreeBSD__ || defined __OpenBSD__
# include <sys/sysctl.h>
#endif

#if defined __OpenBSD__
# include <sys/proc.h>
#endif

#ifdef DARWIN_OS
# include <libproc.h>
#endif

#ifdef __FreeBSD__
/* Sparc/ARM machine/frame.h has 'struct frame' which conflicts with Emacs's
   'struct frame', so rename it.  */
# define frame freebsd_frame
# include <sys/user.h>
# undef frame

# include <math.h>
#endif

#ifdef HAVE_SOCKETS
#include <sys/socket.h>
#include <netdb.h>
#endif /* HAVE_SOCKETS */

#ifdef WINDOWSNT
#define read sys_read
#define write sys_write
#ifndef STDERR_FILENO
#define STDERR_FILENO fileno(GetStdHandle(STD_ERROR_HANDLE))
#endif
#include "w32.h"
#endif /* WINDOWSNT */

#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>

/* Get SI_SRPC_DOMAIN, if it is available.  */
#ifdef HAVE_SYS_SYSTEMINFO_H
#include <sys/systeminfo.h>
#endif

#ifdef MSDOS	/* Demacs 1.1.2 91/10/20 Manabu Higashida, MW Aug 1993 */
#include "msdos.h"
#endif

#include <sys/param.h>
#include <sys/file.h>
#include <fcntl.h>

#include "syssignal.h"
#include "systime.h"
#include "systty.h"
#include "syswait.h"

#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif

#ifdef HAVE_SYS_UTSNAME_H
# include <sys/utsname.h>
# include <memory.h>
#endif

#include "keyboard.h"
#include "frame.h"
#include "termhooks.h"
#include "termchar.h"
#include "termopts.h"
#include "process.h"
#include "cm.h"

#ifndef MAX_RW_COUNT
#define MAX_RW_COUNT (INT_MAX >> 18 << 18)
#endif

/* Read from FD to a buffer BUF with size NBYTE.
   If interrupted, process any quits and pending signals immediately
   if INTERRUPTIBLE, and then retry the read unless quitting.
   Return the number of bytes read, which might be less than NBYTE.
   On error, set errno to a value other than EINTR, and return -1.  */
static ptrdiff_t
emacs_intr_read (int fd, void *buf, ptrdiff_t nbyte, bool interruptible)
{
  /* No caller should ever pass a too-large size to emacs_read.  */
  eassert (nbyte <= MAX_RW_COUNT);

  ssize_t result;

  do
    {
      if (interruptible)
	maybe_quit ();
      result = read (fd, buf, nbyte);
    }
  while (result < 0 && errno == EINTR);

  return result;
}

ptrdiff_t
emacs_read (int fd, void *buf, ptrdiff_t nbyte)
{
  return emacs_intr_read (fd, buf, nbyte, false);
}

/* Like emacs_read, but also process quits and pending signals.  */
ptrdiff_t
emacs_read_quit (int fd, void *buf, ptrdiff_t nbyte)
{
  return emacs_intr_read (fd, buf, nbyte, true);
}

debug log:

solving d39692fd577 ...
found d39692fd577 in https://yhetil.org/emacs-bugs/AS4PR10MB6110FCB28196AF3278B4528DE32FA@AS4PR10MB6110.EURPRD10.PROD.OUTLOOK.COM/

applying [1/1] https://yhetil.org/emacs-bugs/AS4PR10MB6110FCB28196AF3278B4528DE32FA@AS4PR10MB6110.EURPRD10.PROD.OUTLOOK.COM/
diff --git a/src/sysdep1.c b/src/sysdep1.c
new file mode 100644
index 00000000000..d39692fd577

Checking patch src/sysdep1.c...
Applied patch src/sysdep1.c cleanly.

index at:
100644 d39692fd577f7dc16796a73dac6a9438b3f319c1	src/sysdep1.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).