summaryrefslogtreecommitdiff
path: root/nt/inc
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2016-11-19 12:17:23 +0200
committerEli Zaretskii <eliz@gnu.org>2016-11-19 12:17:23 +0200
commit4cdd14eabe5a6121691daa2d9c5e814c5f53f3e5 (patch)
treed6c342da22c57db99b6a6b65f15ed6e29b23e22f /nt/inc
parent6cdd1c333034b308e74e70c4fd10399fbb5329b9 (diff)
downloademacs-4cdd14eabe5a6121691daa2d9c5e814c5f53f3e5.tar.gz
Implement getrlimit and setrlimit for MS-Windows
* src/w32heap.c (getrlimit, setrlimit): New functions. Include w32.h. * src/emacs.c (main): Use 'rlim_t', not 'long', for values that should be compatible with 'struct rlimit' members. * nt/inc/sys/resource.h: New header file. * nt/mingw-cfg.site (ac_cv_func_getrlimit, ac_cv_func_setrlimit): Set to "yes".
Diffstat (limited to 'nt/inc')
-rw-r--r--nt/inc/sys/resource.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/nt/inc/sys/resource.h b/nt/inc/sys/resource.h
new file mode 100644
index 00000000000..dfa0318cb40
--- /dev/null
+++ b/nt/inc/sys/resource.h
@@ -0,0 +1,51 @@
+/* A limited emulation of sys/resource.h.
+
+Copyright (C) 2016 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef INC_SYS_RESOURCE_H_
+#define INC_SYS_RESOURCE_H_
+
+/* We only support RLIMIT_STACK and RLIMIT_NOFILE for now. */
+enum rlimit_resource {
+ RLIMIT_STACK = 0,
+#define RLIMIT_STACK RLIMIT_STACK
+
+ RLIMIT_NOFILE = 1,
+#define RLIMIT_NOFILE RLIMIT_NOFILE
+
+ RLIMIT_NLIMITS
+#define RLIMIT_NLIMITS RLIMIT_NLIMITS
+};
+
+typedef enum rlimit_resource rlimit_resource_t;
+
+/* We use a 64-bit data type because some values could potentially be
+ 64-bit wide even in 32-bit builds. */
+typedef long long rlim_t;
+
+#define RLIMIT_INFINITY ((rlim_t) -1)
+
+struct rlimit {
+ rlim_t rlim_cur; /* current soft limit */
+ rlim_t rlim_max; /* hard limit */
+};
+
+extern int getrlimit (rlimit_resource_t, struct rlimit *);
+extern int setrlimit (rlimit_resource_t, const struct rlimit *);
+
+#endif /* INC_SYS_RESOURCE_H_ */