Fossil

Check-in [64def88f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Automatically detect the presence of the pledge() system interface and use it if it is available.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:64def88f8bd8e2856a1becc1d7c014d63cc3e6a05688774ca7cf80ab0833944f
User & Date: drh 2018-01-17 19:04:31
Context
2018-01-17
19:22
Show the HAVE_PLEDGE configuration parameter in the output of "version -v". check-in: 4471e93c user: drh tags: trunk
19:04
Automatically detect the presence of the pledge() system interface and use it if it is available. check-in: 64def88f user: drh tags: trunk
01:11
Merge the latest Ardoise skin updates. check-in: 6e694cd3 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Makefile.in.

34
35
36
37
38
39
40

41
42
43
44
45
46
47
TCC = @CC@

#### Tcl shell for use in running the fossil testsuite.  If you do not
#    care about testing the end result, this can be blank.
#
TCLSH = tclsh


LIB =	@LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
BCCFLAGS =	@CPPFLAGS@ @CFLAGS@
TCCFLAGS =	@EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
INSTALLDIR = $(DESTDIR)@prefix@/bin
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
USE_LINENOISE = @USE_LINENOISE@
USE_SEE = @USE_SEE@







>







34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
TCC = @CC@

#### Tcl shell for use in running the fossil testsuite.  If you do not
#    care about testing the end result, this can be blank.
#
TCLSH = tclsh

CFLAGS = @CFLAGS@
LIB =	@LDFLAGS@ @EXTRA_LDFLAGS@ @LIBS@
BCCFLAGS =	@CPPFLAGS@ @CFLAGS@
TCCFLAGS =	@EXTRA_CFLAGS@ @CPPFLAGS@ @CFLAGS@ -DHAVE_AUTOCONFIG_H -D_HAVE_SQLITE_CONFIG_H
INSTALLDIR = $(DESTDIR)@prefix@/bin
USE_SYSTEM_SQLITE = @USE_SYSTEM_SQLITE@
USE_LINENOISE = @USE_LINENOISE@
USE_SEE = @USE_SEE@

Changes to auto.def.

471
472
473
474
475
476
477

478
479
480
481
482
483
484
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
}
cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul


# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
if {![cc-check-functions getloadavg]} {
  define FOSSIL_OMIT_LOAD_AVERAGE 1
  msg-result "Load average support unavailable"
}








>







471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
    if {[is_mingw]} {
        define-append LIBS -lwsock32
    }
}
cc-check-functions utime
cc-check-functions usleep
cc-check-functions strchrnul
cc-check-functions pledge

# Check for getloadavg(), and if it doesn't exist, define FOSSIL_OMIT_LOAD_AVERAGE
if {![cc-check-functions getloadavg]} {
  define FOSSIL_OMIT_LOAD_AVERAGE 1
  msg-result "Load average support unavailable"
}

Changes to src/config.h.

257
258
259
260
261
262
263
264
265
266
267
268
269
#define count(X) (sizeof(X)/sizeof(X[0]))

/*
** The pledge() interface is currently only available on OpenBSD 5.9
** and later.  Make calls to fossil_pledge() no-ops on all platforms
** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
*/
#if !defined(FOSSIL_HAVE_PLEDGE)
# define fossil_pledge(A,B)
#endif


#endif /* _RC_COMPILE_ */







|





257
258
259
260
261
262
263
264
265
266
267
268
269
#define count(X) (sizeof(X)/sizeof(X[0]))

/*
** The pledge() interface is currently only available on OpenBSD 5.9
** and later.  Make calls to fossil_pledge() no-ops on all platforms
** that omit the FOSSIL_HAVE_PLEDGE configuration parameter.
*/
#if !defined(HAVE_PLEDGE)
# define fossil_pledge(A,B)
#endif


#endif /* _RC_COMPILE_ */

Changes to src/util.c.

482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
    x.rlim_cur = origStack;
  }
  setrlimit(RLIMIT_STACK, &x);
#endif /* defined(RLIMIT_STACK) */
#endif /* defined(__unix__) */
}

#if defined(FOSSIL_HAVE_PLEDGE)
/*
** Interface to pledge() on OpenBSD 5.9 and later.
**
** On platforms that have pledge(), use this routine.
** On all other platforms, this routine does not exist, but instead
** a macro defined in config.h is used to provide a no-op.
*/
void fossil_pledge(const char *promises, const char *execpromises){
  if( pledge(promises, execpromises) ){
    fossil_fatal("pledge(\"%s\",\"%s\") fails with errno=%d",
       promises, execpromises, (int)errno);
  }
}
#endif /* defined(FOSSIL_HAVE_PLEDGE) */







|













|
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
    x.rlim_cur = origStack;
  }
  setrlimit(RLIMIT_STACK, &x);
#endif /* defined(RLIMIT_STACK) */
#endif /* defined(__unix__) */
}

#if defined(HAVE_PLEDGE)
/*
** Interface to pledge() on OpenBSD 5.9 and later.
**
** On platforms that have pledge(), use this routine.
** On all other platforms, this routine does not exist, but instead
** a macro defined in config.h is used to provide a no-op.
*/
void fossil_pledge(const char *promises, const char *execpromises){
  if( pledge(promises, execpromises) ){
    fossil_fatal("pledge(\"%s\",\"%s\") fails with errno=%d",
       promises, execpromises, (int)errno);
  }
}
#endif /* defined(HAVE_PLEDGE) */