Fossil SCM

Automatically detect the presence of the pledge() system interface and use it if it is available.

drh 2018-01-17 19:04 trunk
Commit 64def88f8bd8e2856a1becc1d7c014d63cc3e6a05688774ca7cf80ab0833944f
--- Makefile.in
+++ Makefile.in
@@ -36,10 +36,11 @@
3636
#### Tcl shell for use in running the fossil testsuite. If you do not
3737
# care about testing the end result, this can be blank.
3838
#
3939
TCLSH = tclsh
4040
41
+CFLAGS = @CFLAGS@
4142
LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
4243
BCCFLAGS = @CPPFLAGS@ @CFLAGS@
4344
TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
4445
INSTALLDIR = $(DESTDIR)@prefix@/bin
4546
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
4647
--- Makefile.in
+++ Makefile.in
@@ -36,10 +36,11 @@
36 #### Tcl shell for use in running the fossil testsuite. If you do not
37 # care about testing the end result, this can be blank.
38 #
39 TCLSH = tclsh
40
 
41 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
42 BCCFLAGS = @CPPFLAGS@ @CFLAGS@
43 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
44 INSTALLDIR = $(DESTDIR)@prefix@/bin
45 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
46
--- Makefile.in
+++ Makefile.in
@@ -36,10 +36,11 @@
36 #### Tcl shell for use in running the fossil testsuite. If you do not
37 # care about testing the end result, this can be blank.
38 #
39 TCLSH = tclsh
40
41 CFLAGS = @CFLAGS@
42 LIB = @LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
43 BCCFLAGS = @CPPFLAGS@ @CFLAGS@
44 TCCFLAGS = @EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
45 INSTALLDIR = $(DESTDIR)@prefix@/bin
46 USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
47
+1
--- auto.def
+++ auto.def
@@ -473,10 +473,11 @@
473473
}
474474
}
475475
cc-check-functions utime
476476
cc-check-functions usleep
477477
cc-check-functions strchrnul
478
+cc-check-functions pledge
478479
479480
# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
480481
if {![cc-check-functions getloadavg]} {
481482
define FOSSIL_OMIT_LOAD_AVERAGE 1
482483
msg-result "Load average support unavailable"
483484
--- auto.def
+++ auto.def
@@ -473,10 +473,11 @@
473 }
474 }
475 cc-check-functions utime
476 cc-check-functions usleep
477 cc-check-functions strchrnul
 
478
479 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
480 if {![cc-check-functions getloadavg]} {
481 define FOSSIL_OMIT_LOAD_AVERAGE 1
482 msg-result "Load average support unavailable"
483
--- auto.def
+++ auto.def
@@ -473,10 +473,11 @@
473 }
474 }
475 cc-check-functions utime
476 cc-check-functions usleep
477 cc-check-functions strchrnul
478 cc-check-functions pledge
479
480 # Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
481 if {![cc-check-functions getloadavg]} {
482 define FOSSIL_OMIT_LOAD_AVERAGE 1
483 msg-result "Load average support unavailable"
484
+1 -1
--- src/config.h
+++ src/config.h
@@ -259,11 +259,11 @@
259259
/*
260260
** The pledge() interface is currently only available on OpenBSD 5.9
261261
** and later. Make calls to fossil_pledge() no-ops on all platforms
262262
** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
263263
*/
264
-#if !defined(FOSSIL_HAVE_PLEDGE)
264
+#if !defined(HAVE_PLEDGE)
265265
# define fossil_pledge(A,B)
266266
#endif
267267
268268
269269
#endif /* _RC_COMPILE_ */
270270
--- src/config.h
+++ src/config.h
@@ -259,11 +259,11 @@
259 /*
260 ** The pledge() interface is currently only available on OpenBSD 5.9
261 ** and later. Make calls to fossil_pledge() no-ops on all platforms
262 ** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
263 */
264 #if !defined(FOSSIL_HAVE_PLEDGE)
265 # define fossil_pledge(A,B)
266 #endif
267
268
269 #endif /* _RC_COMPILE_ */
270
--- src/config.h
+++ src/config.h
@@ -259,11 +259,11 @@
259 /*
260 ** The pledge() interface is currently only available on OpenBSD 5.9
261 ** and later. Make calls to fossil_pledge() no-ops on all platforms
262 ** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
263 */
264 #if !defined(HAVE_PLEDGE)
265 # define fossil_pledge(A,B)
266 #endif
267
268
269 #endif /* _RC_COMPILE_ */
270
+2 -2
--- src/util.c
+++ src/util.c
@@ -484,11 +484,11 @@
484484
setrlimit(RLIMIT_STACK, &x);
485485
#endif /* defined(RLIMIT_STACK) */
486486
#endif /* defined(__unix__) */
487487
}
488488
489
-#if defined(FOSSIL_HAVE_PLEDGE)
489
+#if defined(HAVE_PLEDGE)
490490
/*
491491
** Interface to pledge() on OpenBSD 5.9 and later.
492492
**
493493
** On platforms that have pledge(), use this routine.
494494
** On all other platforms, this routine does not exist, but instead
@@ -498,6 +498,6 @@
498498
if( pledge(promises, execpromises) ){
499499
fossil_fatal("pledge(\"%s\",\"%s\") fails with errno=%d",
500500
promises, execpromises, (int)errno);
501501
}
502502
}
503
-#endif /* defined(FOSSIL_HAVE_PLEDGE) */
503
+#endif /* defined(HAVE_PLEDGE) */
504504
--- src/util.c
+++ src/util.c
@@ -484,11 +484,11 @@
484 setrlimit(RLIMIT_STACK, &x);
485 #endif /* defined(RLIMIT_STACK) */
486 #endif /* defined(__unix__) */
487 }
488
489 #if defined(FOSSIL_HAVE_PLEDGE)
490 /*
491 ** Interface to pledge() on OpenBSD 5.9 and later.
492 **
493 ** On platforms that have pledge(), use this routine.
494 ** On all other platforms, this routine does not exist, but instead
@@ -498,6 +498,6 @@
498 if( pledge(promises, execpromises) ){
499 fossil_fatal("pledge(\"%s\",\"%s\") fails with errno=%d",
500 promises, execpromises, (int)errno);
501 }
502 }
503 #endif /* defined(FOSSIL_HAVE_PLEDGE) */
504
--- src/util.c
+++ src/util.c
@@ -484,11 +484,11 @@
484 setrlimit(RLIMIT_STACK, &x);
485 #endif /* defined(RLIMIT_STACK) */
486 #endif /* defined(__unix__) */
487 }
488
489 #if defined(HAVE_PLEDGE)
490 /*
491 ** Interface to pledge() on OpenBSD 5.9 and later.
492 **
493 ** On platforms that have pledge(), use this routine.
494 ** On all other platforms, this routine does not exist, but instead
@@ -498,6 +498,6 @@
498 if( pledge(promises, execpromises) ){
499 fossil_fatal("pledge(\"%s\",\"%s\") fails with errno=%d",
500 promises, execpromises, (int)errno);
501 }
502 }
503 #endif /* defined(HAVE_PLEDGE) */
504

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button