mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-03-26 16:51:46 -07:00
Catch-up merge from master sources to branch/2016-04-08/protidying.
Copied from Perforce Change: 191019 ServerID: perforce.ravenbrook.com
This commit is contained in:
commit
5ebe95c9dc
2 changed files with 37 additions and 35 deletions
|
|
@ -1,19 +1,12 @@
|
|||
/* event.c: EVENT LOGGING
|
||||
*
|
||||
* $Id$
|
||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2001-2016 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* .sources: mps.design.event
|
||||
*
|
||||
* TRANSGRESSIONS (rule.impl.trans)
|
||||
*
|
||||
* .trans.ref: The reference counting used to destroy the mps_io object
|
||||
* isn't right.
|
||||
*
|
||||
* .trans.log: The log file will be re-created if the lifetimes of
|
||||
* arenas don't overlap, but shared if they do. mps_io_create cannot
|
||||
* be called twice, but EventInit avoids this anyway.
|
||||
*
|
||||
* .trans.ifdef: This file should logically be split into two, event.c
|
||||
* (which contains NOOP definitions, for general use) and eventdl.c, which
|
||||
* is specific to the logging variety and actually does logging (maybe).
|
||||
|
|
@ -24,6 +17,7 @@
|
|||
#include "mpm.h"
|
||||
#include "event.h"
|
||||
#include "mpsio.h"
|
||||
#include "lock.h"
|
||||
|
||||
SRCID(event, "$Id$");
|
||||
|
||||
|
|
@ -34,7 +28,6 @@ SRCID(event, "$Id$");
|
|||
static Bool eventInited = FALSE;
|
||||
static Bool eventIOInited = FALSE;
|
||||
static mps_io_t eventIO;
|
||||
static Count eventUserCount;
|
||||
static Serial EventInternSerial;
|
||||
|
||||
/* Buffers in which events are recorded, from the top down. */
|
||||
|
|
@ -207,25 +200,26 @@ void EventInit(void)
|
|||
AVER(EventBufferSIZE <= EventSizeMAX);
|
||||
|
||||
/* Only if this is the first call. */
|
||||
if(!eventInited) { /* See .trans.log */
|
||||
EventKind kind;
|
||||
for (kind = 0; kind < EventKindLIMIT; ++kind) {
|
||||
AVER(EventLast[kind] == NULL);
|
||||
AVER(EventWritten[kind] == NULL);
|
||||
EventLast[kind] = EventWritten[kind] = EventBuffer[kind] + EventBufferSIZE;
|
||||
if (!eventInited) { /* See .trans.log */
|
||||
LockClaimGlobalRecursive();
|
||||
if (!eventInited) {
|
||||
EventKind kind;
|
||||
for (kind = 0; kind < EventKindLIMIT; ++kind) {
|
||||
AVER(EventLast[kind] == NULL);
|
||||
AVER(EventWritten[kind] == NULL);
|
||||
EventLast[kind] = EventWritten[kind] = EventBuffer[kind] + EventBufferSIZE;
|
||||
}
|
||||
eventInited = TRUE;
|
||||
EventKindControl = (Word)mps_lib_telemetry_control();
|
||||
EventInternSerial = (Serial)1; /* 0 is reserved */
|
||||
(void)EventInternString(MPSVersion()); /* emit version */
|
||||
EVENT7(EventInit, EVENT_VERSION_MAJOR, EVENT_VERSION_MEDIAN,
|
||||
EVENT_VERSION_MINOR, EventCodeMAX, EventNameMAX, MPS_WORD_WIDTH,
|
||||
mps_clocks_per_sec());
|
||||
/* flush these initial events to get the first ClockSync out. */
|
||||
EventSync();
|
||||
}
|
||||
eventUserCount = (Count)1;
|
||||
eventInited = TRUE;
|
||||
EventKindControl = (Word)mps_lib_telemetry_control();
|
||||
EventInternSerial = (Serial)1; /* 0 is reserved */
|
||||
(void)EventInternString(MPSVersion()); /* emit version */
|
||||
EVENT7(EventInit, EVENT_VERSION_MAJOR, EVENT_VERSION_MEDIAN,
|
||||
EVENT_VERSION_MINOR, EventCodeMAX, EventNameMAX, MPS_WORD_WIDTH,
|
||||
mps_clocks_per_sec());
|
||||
/* flush these initial events to get the first ClockSync out. */
|
||||
EventSync();
|
||||
} else {
|
||||
++eventUserCount;
|
||||
LockReleaseGlobalRecursive();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -235,11 +229,8 @@ void EventInit(void)
|
|||
void EventFinish(void)
|
||||
{
|
||||
AVER(eventInited);
|
||||
AVER(eventUserCount > 0);
|
||||
|
||||
EventSync();
|
||||
|
||||
--eventUserCount;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* noaslr.c: Disable ASLR on OS X Mavericks
|
||||
*
|
||||
* $Id: //info.ravenbrook.com/project/mps/master/code/eventcnv.c#26 $
|
||||
* Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||
* Copyright (c) 2014-2016 Ravenbrook Limited. See end of file for license.
|
||||
*
|
||||
* This is a command-line tool that runs another program with address
|
||||
* space layout randomization (ASLR) disabled.
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
* <https://llvm.org/svn/llvm-project/lldb/trunk/tools/darwin-debug/darwin-debug.cpp>
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <spawn.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -31,6 +32,7 @@ int main(int argc, char **argv)
|
|||
pid_t pid;
|
||||
posix_spawnattr_t attr;
|
||||
int res, status = 1;
|
||||
const char *program = argv[0];
|
||||
char *default_argv[] = {"/bin/sh", NULL};
|
||||
|
||||
if (argc >= 2)
|
||||
|
|
@ -39,16 +41,25 @@ int main(int argc, char **argv)
|
|||
argv = default_argv;
|
||||
|
||||
res = posix_spawnattr_init(&attr);
|
||||
if (res != 0)
|
||||
if (res != 0) {
|
||||
errno = res;
|
||||
perror(program);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = posix_spawnattr_setflags(&attr, _POSIX_SPAWN_DISABLE_ASLR);
|
||||
if (res != 0)
|
||||
if (res != 0) {
|
||||
errno = res;
|
||||
perror(program);
|
||||
return res;
|
||||
}
|
||||
|
||||
res = posix_spawn(&pid, argv[0], NULL, &attr, argv, environ);
|
||||
if (res != 0)
|
||||
if (res != 0) {
|
||||
errno = res;
|
||||
perror(program);
|
||||
return res;
|
||||
}
|
||||
|
||||
if (waitpid(pid, &status, 0) == -1)
|
||||
return 1;
|
||||
|
|
@ -62,7 +73,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* C. COPYRIGHT AND LICENSE
|
||||
*
|
||||
* Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* Copyright (C) 2014-2016 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||
* All rights reserved. This is an open source license. Contact
|
||||
* Ravenbrook for commercial licensing options.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue