Skip to content

Commit 0a43ccc

Browse files
committed
Fix mmapmodule.c
Cleanup also other <unistd.h> includes.
1 parent 6aede60 commit 0a43ccc

10 files changed

+22
-24
lines changed

Modules/_ctypes/malloc_closure.c

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#ifndef Py_BUILD_CORE_BUILTIN
22
# define Py_BUILD_CORE_MODULE 1
33
#endif
4+
45
#include <Python.h>
56
#include <ffi.h>
67
#ifdef MS_WIN32
7-
#include <windows.h>
8+
# include <windows.h>
89
#else
9-
#include <sys/mman.h>
10-
#include <unistd.h>
11-
# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
12-
# define MAP_ANONYMOUS MAP_ANON
13-
# endif
10+
# include <sys/mman.h>
11+
# include <unistd.h>
12+
# if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
13+
# define MAP_ANONYMOUS MAP_ANON
14+
# endif
1415
#endif
1516
#include "ctypes.h"
1617

Modules/_posixsubprocess.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
#include "pycore_pystate.h"
99
#include "pycore_signal.h" // _Py_RestoreSignals()
1010
#if defined(HAVE_PIPE2) && !defined(_GNU_SOURCE)
11-
# define _GNU_SOURCE
11+
# define _GNU_SOURCE
1212
#endif
13-
#include <unistd.h>
13+
#include <unistd.h> // close()
1414
#include <fcntl.h>
1515
#ifdef HAVE_SYS_TYPES_H
1616
#include <sys/types.h>

Modules/_testcapimodule.c

-3
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
#include <float.h> // FLT_MAX
2525
#include <signal.h>
2626
#include <stddef.h> // offsetof()
27-
#ifndef MS_WINDOWS
28-
# include <unistd.h>
29-
#endif
3027

3128
#ifdef HAVE_SYS_WAIT_H
3229
# include <sys/wait.h> // W_STOPCODE

Modules/mmapmodule.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
#include "pycore_fileutils.h" // _Py_stat_struct
2929

3030
#include <stddef.h> // offsetof()
31-
#include <unistd.h> // close()
31+
#ifndef MS_WINDOWS
32+
# include <unistd.h> // close()
33+
#endif
3234

3335
// to support MS_WINDOWS_SYSTEM OpenFileMappingA / CreateFileMappingA
3436
// need to be replaced with OpenFileMappingW / CreateFileMappingW

Modules/posixmodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ corresponding Unix manual entries for more information on calls.");
289289
#endif
290290

291291
#ifdef HAVE_COPY_FILE_RANGE
292-
# include <unistd.h>
292+
# include <unistd.h> // copy_file_range()
293293
#endif
294294

295295
#if !defined(CPU_ALLOC) && defined(HAVE_SCHED_SETAFFINITY)

Modules/pwdmodule.c

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#include <pwd.h> // getpwuid()
88
#include <unistd.h> // sysconf()
99

10-
1110
#include "clinic/pwdmodule.c.h"
1211
/*[clinic input]
1312
module pwd

Modules/resource.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
21
#include "Python.h"
3-
#include <sys/resource.h>
2+
#include <errno.h> // errno
3+
#include <string.h>
4+
#include <sys/resource.h> // getrusage()
45
#ifdef HAVE_SYS_TIME_H
5-
#include <sys/time.h>
6+
# include <sys/time.h>
67
#endif
78
#include <time.h>
8-
#include <string.h>
9-
#include <errno.h>
109
#include <unistd.h>
1110

1211
/* On some systems, these aren't in any header file.

Modules/socketmodule.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ shutdown(how) -- shut down traffic in one or both directions\n\
269269
#ifdef HAVE_NETDB_H
270270
# include <netdb.h>
271271
#endif
272-
# include <unistd.h>
272+
#include <unistd.h> // close()
273273

274274
/* Headers needed for inet_ntoa() and inet_addr() */
275275
# include <arpa/inet.h>

Programs/_freeze_module.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include <sys/types.h>
2020
#include <sys/stat.h>
2121
#ifndef MS_WINDOWS
22-
#include <unistd.h>
22+
# include <unistd.h>
2323
#endif
2424

2525
uint32_t _Py_next_func_version = 1;

Python/dup2.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
* Return fd2 if all went well; return BADEXIT otherwise.
1212
*/
1313

14-
#include <errno.h>
15-
#include <fcntl.h>
16-
#include <unistd.h>
14+
#include <errno.h> // errno
15+
#include <fcntl.h> // fcntl()
16+
#include <unistd.h> // close()
1717

1818
#define BADEXIT -1
1919

0 commit comments

Comments
 (0)