Commit 2c1e50cc authored by Michael Jeanson's avatar Michael Jeanson

Update upstream source from tag 'upstream/2.10.1'

Update to upstream version '2.10.1'
with Debian dir 7914813582a1becc24d3e82c9f90fe9139f6b73b
parents 8a0226a5 cd47debc
2017-11-30 (National Mason Jar Day) lttng-ust 2.10.1
* Fix: specify SONAME in python-lttngust LoadLibrary
* Fix: ensure fd tracker is initialized when called from constructors
* Fix: fd of an elf object must be registered to the fd tracker
* Fix: liblttng-ust-fd.so: override fclose symbol
* Fix: lttng-gen-tp: only replace file extension
* Fix: move fsync after ftruncate
* Fix: sync buffer file metadata on buffer allocation
2017-08-01 (World Wide Web Day) lttng-ust 2.10.0
* lttng-ust(3): reword and fix style of `LTTNG_UST_ALLOW_BLOCKING` variable
* lttng-ust(3): specify "If set" instead of "if set to 1" for some variables
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for lttng-ust 2.10.0.
# Generated by GNU Autoconf 2.69 for lttng-ust 2.10.1.
#
# Report bugs to <mathieu dot desnoyers at efficios dot com>.
#
......@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='lttng-ust'
PACKAGE_TARNAME='lttng-ust'
PACKAGE_VERSION='2.10.0'
PACKAGE_STRING='lttng-ust 2.10.0'
PACKAGE_VERSION='2.10.1'
PACKAGE_STRING='lttng-ust 2.10.1'
PACKAGE_BUGREPORT='mathieu dot desnoyers at efficios dot com'
PACKAGE_URL='https://lttng.org'
......@@ -1421,7 +1421,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures lttng-ust 2.10.0 to adapt to many kinds of systems.
\`configure' configures lttng-ust 2.10.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1493,7 +1493,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of lttng-ust 2.10.0:";;
short | recursive ) echo "Configuration of lttng-ust 2.10.1:";;
esac
cat <<\_ACEOF
......@@ -1651,7 +1651,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
lttng-ust configure 2.10.0
lttng-ust configure 2.10.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -2371,7 +2371,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by lttng-ust $as_me 2.10.0, which was
It was created by lttng-ust $as_me 2.10.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -2727,7 +2727,7 @@ MAJOR_VERSION=2
MINOR_VERSION=10
PATCHLEVEL_VERSION=0
PATCHLEVEL_VERSION=1
# Following the numbering scheme proposed by libtool for the library version
......@@ -3375,7 +3375,7 @@ fi
# Define the identity of the package.
PACKAGE='lttng-ust'
VERSION='2.10.0'
VERSION='2.10.1'
cat >>confdefs.h <<_ACEOF
......@@ -22362,7 +22362,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by lttng-ust $as_me 2.10.0, which was
This file was extended by lttng-ust $as_me 2.10.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -22433,7 +22433,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
lttng-ust config.status 2.10.0
lttng-ust config.status 2.10.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
dnl Version infos
m4_define([V_MAJOR], [2])
m4_define([V_MINOR], [10])
m4_define([V_PATCH], [0])
m4_define([V_PATCH], [1])
dnl m4_define([V_EXTRA], [])
m4_define([V_NAME], [[KeKriek]])
m4_define([V_DESC], [[From Brasserie Dunham, a sour mashed golden wheat ale fermented with local sour cherries from Tougas orchards. Fresh sweet cherry notes with some tartness, lively carbonation with a dry finish.]])
......
......@@ -2,12 +2,12 @@
.\" Title: lttng-gen-tp
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 08/01/2017
.\" Date: 11/30/2017
.\" Manual: LTTng Manual
.\" Source: LTTng 2.10.0-
.\" Source: LTTng 2.10.1
.\" Language: English
.\"
.TH "LTTNG\-GEN\-TP" "1" "08/01/2017" "LTTng 2\&.10\&.0\-" "LTTng Manual"
.TH "LTTNG\-GEN\-TP" "1" "11/30/2017" "LTTng 2\&.10\&.1" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
......@@ -2,12 +2,12 @@
.\" Title: lttng-ust-dl
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 08/01/2017
.\" Date: 11/30/2017
.\" Manual: LTTng Manual
.\" Source: LTTng 2.10.0-
.\" Source: LTTng 2.10.1
.\" Language: English
.\"
.TH "LTTNG\-UST\-DL" "3" "08/01/2017" "LTTng 2\&.10\&.0\-" "LTTng Manual"
.TH "LTTNG\-UST\-DL" "3" "11/30/2017" "LTTng 2\&.10\&.1" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
......@@ -2,12 +2,12 @@
.\" Title: lttng-ust-dl
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 08/01/2017
.\" Date: 11/30/2017
.\" Manual: LTTng Manual
.\" Source: LTTng 2.10.0-
.\" Source: LTTng 2.10.1
.\" Language: English
.\"
.TH "LTTNG\-UST\-DL" "3" "08/01/2017" "LTTng 2\&.10\&.0\-" "LTTng Manual"
.TH "LTTNG\-UST\-DL" "3" "11/30/2017" "LTTng 2\&.10\&.1" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
......@@ -2,12 +2,12 @@
.\" Title: lttng-ust
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 08/01/2017
.\" Date: 11/30/2017
.\" Manual: LTTng Manual
.\" Source: LTTng 2.10.0-
.\" Source: LTTng 2.10.1
.\" Language: English
.\"
.TH "LTTNG\-UST" "3" "08/01/2017" "LTTng 2\&.10\&.0\-" "LTTng Manual"
.TH "LTTNG\-UST" "3" "11/30/2017" "LTTng 2\&.10\&.1" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
......@@ -2,12 +2,12 @@
.\" Title: tracef
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 08/01/2017
.\" Date: 11/30/2017
.\" Manual: LTTng Manual
.\" Source: LTTng 2.10.0-
.\" Source: LTTng 2.10.1
.\" Language: English
.\"
.TH "TRACEF" "3" "08/01/2017" "LTTng 2\&.10\&.0\-" "LTTng Manual"
.TH "TRACEF" "3" "11/30/2017" "LTTng 2\&.10\&.1" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
......@@ -2,12 +2,12 @@
.\" Title: tracelog
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.79.1 <http://docbook.sf.net/>
.\" Date: 08/01/2017
.\" Date: 11/30/2017
.\" Manual: LTTng Manual
.\" Source: LTTng 2.10.0-
.\" Source: LTTng 2.10.1
.\" Language: English
.\"
.TH "TRACELOG" "3" "08/01/2017" "LTTng 2\&.10\&.0\-" "LTTng Manual"
.TH "TRACELOG" "3" "11/30/2017" "LTTng 2\&.10\&.1" "LTTng Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
......
......@@ -24,6 +24,8 @@
* These declarations should NOT be considered stable API.
*/
#include <stdio.h>
void lttng_ust_init_fd_tracker(void);
void lttng_ust_add_fd_to_tracker(int fd);
void lttng_ust_delete_fd_from_tracker(int fd);
......@@ -31,6 +33,7 @@ void lttng_ust_lock_fd_tracker(void);
void lttng_ust_unlock_fd_tracker(void);
int lttng_ust_safe_close_fd(int fd, int (*close_cb)(int));
int lttng_ust_safe_fclose_stream(FILE *stream, int (*fclose_cb)(FILE *stream));
int lttng_ust_safe_closefrom_fd(int lowfd, int (*close_cb)(int));
#endif /* _LTTNG_UST_FD_H */
......@@ -34,6 +34,7 @@
#include <pthread.h>
#include <urcu/compiler.h>
#include <urcu/tls-compat.h>
#include <urcu/system.h>
#include <ust-fd.h>
#include <helper.h>
......@@ -71,6 +72,7 @@ static DEFINE_URCU_TLS(int, thread_fd_tracking);
static fd_set *lttng_fd_set;
static int lttng_ust_max_fd;
static int num_fd_sets;
static int init_done;
/*
* Force a read (imply TLS fixup for dlopen) of TLS variables.
......@@ -90,6 +92,9 @@ void lttng_ust_init_fd_tracker(void)
struct rlimit rlim;
int i;
if (CMM_LOAD_SHARED(init_done))
return;
memset(&rlim, 0, sizeof(rlim));
/* Get the current possible max number of fd for this process. */
if (getrlimit(RLIMIT_NOFILE, &rlim) < 0)
......@@ -113,6 +118,7 @@ void lttng_ust_init_fd_tracker(void)
abort();
for (i = 0; i < num_fd_sets; i++)
FD_ZERO((&lttng_fd_set[i]));
CMM_STORE_SHARED(init_done, 1);
}
void lttng_ust_lock_fd_tracker(void)
......@@ -143,6 +149,12 @@ void lttng_ust_unlock_fd_tracker(void)
*/
void lttng_ust_add_fd_to_tracker(int fd)
{
/*
* Ensure the tracker is initialized when called from
* constructors.
*/
lttng_ust_init_fd_tracker();
assert(URCU_TLS(thread_fd_tracking));
/* Trying to add an fd which we can not accommodate. */
assert(IS_FD_VALID(fd));
......@@ -158,6 +170,12 @@ void lttng_ust_add_fd_to_tracker(int fd)
*/
void lttng_ust_delete_fd_from_tracker(int fd)
{
/*
* Ensure the tracker is initialized when called from
* constructors.
*/
lttng_ust_init_fd_tracker();
assert(URCU_TLS(thread_fd_tracking));
/* Not a valid fd. */
assert(IS_FD_VALID(fd));
......@@ -178,6 +196,12 @@ int lttng_ust_safe_close_fd(int fd, int (*close_cb)(int fd))
lttng_ust_fixup_fd_tracker_tls();
/*
* Ensure the tracker is initialized when called from
* constructors.
*/
lttng_ust_init_fd_tracker();
/*
* If called from lttng-ust, we directly call close without
* validating whether the FD is part of the tracked set.
......@@ -197,6 +221,44 @@ int lttng_ust_safe_close_fd(int fd, int (*close_cb)(int fd))
return ret;
}
/*
* Interface allowing applications to close arbitrary streams.
* We check if it is owned by lttng-ust, and return -1, errno=EBADF
* instead of closing it if it is the case.
*/
int lttng_ust_safe_fclose_stream(FILE *stream, int (*fclose_cb)(FILE *stream))
{
int ret = 0, fd;
lttng_ust_fixup_fd_tracker_tls();
/*
* Ensure the tracker is initialized when called from
* constructors.
*/
lttng_ust_init_fd_tracker();
/*
* If called from lttng-ust, we directly call fclose without
* validating whether the FD is part of the tracked set.
*/
if (URCU_TLS(thread_fd_tracking))
return fclose_cb(stream);
fd = fileno(stream);
lttng_ust_lock_fd_tracker();
if (IS_FD_VALID(fd) && IS_FD_SET(fd, lttng_fd_set)) {
ret = -1;
errno = EBADF;
} else {
ret = fclose_cb(stream);
}
lttng_ust_unlock_fd_tracker();
return ret;
}
#ifdef __OpenBSD__
static void set_close_success(int *p)
{
......@@ -225,6 +287,12 @@ int lttng_ust_safe_closefrom_fd(int lowfd, int (*close_cb)(int fd))
lttng_ust_fixup_fd_tracker_tls();
/*
* Ensure the tracker is initialized when called from
* constructors.
*/
lttng_ust_init_fd_tracker();
if (lowfd < 0) {
/*
* NetBSD return EBADF if fd is invalid.
......
......@@ -31,6 +31,7 @@
volatile enum ust_loglevel ust_loglevel;
static int (*__lttng_ust_fd_plibc_close)(int fd);
static int (*__lttng_ust_fd_plibc_fclose)(FILE *stream);
static
int _lttng_ust_fd_libc_close(int fd)
......@@ -45,11 +46,35 @@ int _lttng_ust_fd_libc_close(int fd)
return lttng_ust_safe_close_fd(fd, __lttng_ust_fd_plibc_close);
}
static
int _lttng_ust_fd_libc_fclose(FILE *stream)
{
if (!__lttng_ust_fd_plibc_fclose) {
__lttng_ust_fd_plibc_fclose = dlsym(RTLD_NEXT, "fclose");
if (!__lttng_ust_fd_plibc_fclose) {
fprintf(stderr, "%s\n", dlerror());
return -1;
}
}
return lttng_ust_safe_fclose_stream(stream,
__lttng_ust_fd_plibc_fclose);
}
int close(int fd)
{
return _lttng_ust_fd_libc_close(fd);
}
/*
* Note: fcloseall() is not an issue because it fcloses only the
* streams it knows about, which differs from the problems caused by
* gnulib close_stdout(), which does an explicit fclose(stdout).
*/
int fclose(FILE *stream)
{
return _lttng_ust_fd_libc_fclose(stream);
}
#if defined(__sun__) || defined(__FreeBSD__)
/* Solaris and FreeBSD. */
void closefrom(int lowfd)
......
......@@ -27,6 +27,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdbool.h>
#include <ust-fd.h>
#include "lttng-tracer-core.h"
#define BUF_LEN 4096
......@@ -248,15 +249,20 @@ struct lttng_ust_elf *lttng_ust_elf_create(const char *path)
goto error;
}
elf->path = strdup(path);
if (!elf->path) {
goto error;
}
lttng_ust_lock_fd_tracker();
elf->fd = open(elf->path, O_RDONLY | O_CLOEXEC);
if (elf->fd < 0) {
lttng_ust_unlock_fd_tracker();
goto error;
}
lttng_ust_add_fd_to_tracker(elf->fd);
lttng_ust_unlock_fd_tracker();
if (lttng_ust_read(elf->fd, e_ident, EI_NIDENT) < EI_NIDENT) {
goto error;
......@@ -309,16 +315,7 @@ struct lttng_ust_elf *lttng_ust_elf_create(const char *path)
return elf;
error:
if (elf) {
free(elf->ehdr);
if (elf->fd >= 0) {
if (close(elf->fd)) {
abort();
}
}
free(elf->path);
free(elf);
}
lttng_ust_elf_destroy(elf);
return NULL;
}
......@@ -339,14 +336,25 @@ uint8_t lttng_ust_elf_is_pic(struct lttng_ust_elf *elf)
*/
void lttng_ust_elf_destroy(struct lttng_ust_elf *elf)
{
int ret;
if (!elf) {
return;
}
free(elf->ehdr);
if (close(elf->fd)) {
abort();
if (elf->fd >= 0) {
lttng_ust_lock_fd_tracker();
ret = close(elf->fd);
if (!ret) {
lttng_ust_delete_fd_from_tracker(elf->fd);
} else {
PERROR("close");
abort();
}
lttng_ust_unlock_fd_tracker();
}
free(elf->ehdr);
free(elf->path);
free(elf);
}
......
......@@ -134,6 +134,15 @@ struct shm_object *_shm_object_table_alloc_shm(struct shm_object_table *table,
PERROR("ftruncate");
goto error_ftruncate;
}
/*
* Also ensure the file metadata is synced with the storage by using
* fsync(2).
*/
ret = fsync(shmfd);
if (ret) {
PERROR("fsync");
goto error_fsync;
}
obj->shm_fd_ownership = 0;
obj->shm_fd = shmfd;
......@@ -153,6 +162,7 @@ struct shm_object *_shm_object_table_alloc_shm(struct shm_object_table *table,
return obj;
error_mmap:
error_fsync:
error_ftruncate:
error_zero_file:
error_fcntl:
......
......@@ -22,7 +22,7 @@ import ctypes
class _Handler(logging.Handler):
_LIB_NAME = 'liblttng-ust-python-agent.so'
_LIB_NAME = 'liblttng-ust-python-agent.so.0'
def __init__(self):
super(self.__class__, self).__init__(level=logging.NOTSET)
......
......@@ -79,7 +79,9 @@ class CFile:
def write(self):
outputFile = open(self.outputFilename,"w")
headerFilename = self.outputFilename.replace(".c",".h")
headerFilename = self.outputFilename
if headerFilename.endswith(".c"):
headerFilename = headerFilename[:-2] + ".h"
outputFile.write(CFile.FILE_TPL.format(
headerFilename = headerFilename))
......@@ -126,7 +128,10 @@ class ObjFile:
return cc
def write(self):
cFilename = self.outputFilename.replace(".o",".c")
cFilename = self.outputFilename
if cFilename.endswith(".o"):
cFilename = cFilename[:-2] + ".c"
cc = self._detectCC()
if cc == "":
raise RuntimeError("No C Compiler detected")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment