aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-02-23 09:54:49 +0100
committerGitHub <noreply@github.com>2018-02-23 09:54:49 +0100
commitbd9583a7e8108ab4fd31fc5ab6f7c1552258fa6e (patch)
treee4c88ad6280997d893f0e4aaa98b48fb3bcf3678
parent1c1b5b1b17519e945097e9ca9a8f7b5a1669a4fe (diff)
parent6ba1128a72c3779affd82719a19be643a33490a0 (diff)
Merge pull request #652 from agx/symbols-file
Add symbols file
-rw-r--r--examples/screenshot.c22
-rw-r--r--include/render/gles2.h2
-rw-r--r--include/wlr/util/log.h6
-rw-r--r--meson.build3
-rw-r--r--util/log.c2
-rw-r--r--wlroots.syms49
6 files changed, 78 insertions, 6 deletions
diff --git a/examples/screenshot.c b/examples/screenshot.c
index c163df75..7edb7327 100644
--- a/examples/screenshot.c
+++ b/examples/screenshot.c
@@ -121,12 +121,32 @@ static const struct wl_registry_listener registry_listener = {
.global_remove = handle_global_remove,
};
+static int backingfile(off_t size) {
+ static char template[] = "/tmp/wlroots-shared-XXXXXX";
+ int fd, ret;
+
+ fd = mkstemp(template);
+ if (fd < 0) {
+ return -1;
+ }
+
+ while ((ret = ftruncate(fd, size)) == EINTR) {}
+ if (ret < 0) {
+ close(fd);
+ return -1;
+ }
+
+ unlink(template);
+ return fd;
+}
+
+
static struct wl_buffer *create_shm_buffer(int width, int height,
void **data_out) {
int stride = width * 4;
int size = stride * height;
- int fd = os_create_anonymous_file(size);
+ int fd = backingfile(size);
if (fd < 0) {
fprintf(stderr, "creating a buffer file for %d B failed: %m\n", size);
return NULL;
diff --git a/include/render/gles2.h b/include/render/gles2.h
index 797c5293..e015160d 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -62,7 +62,7 @@ extern const GLchar fragment_src_external[];
bool _gles2_flush_errors(const char *file, int line);
#define gles2_flush_errors(...) \
- _gles2_flush_errors(_strip_path(__FILE__), __LINE__)
+ _gles2_flush_errors(wlr_strip_path(__FILE__), __LINE__)
#define GL_CALL(func) func; gles2_flush_errors()
diff --git a/include/wlr/util/log.h b/include/wlr/util/log.h
index 3d3f25f9..5528664b 100644
--- a/include/wlr/util/log.h
+++ b/include/wlr/util/log.h
@@ -28,13 +28,13 @@ void wlr_log_init(log_importance_t verbosity, log_callback_t callback);
void _wlr_log(log_importance_t verbosity, const char *format, ...) ATTRIB_PRINTF(2, 3);
void _wlr_vlog(log_importance_t verbosity, const char *format, va_list args) ATTRIB_PRINTF(2, 0);
-const char *_strip_path(const char *filepath);
+const char *wlr_strip_path(const char *filepath);
#define wlr_log(verb, fmt, ...) \
- _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
+ _wlr_log(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
#define wlr_vlog(verb, fmt, args) \
- _wlr_vlog(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, args)
+ _wlr_vlog(verb, "[%s:%d] " fmt, wlr_strip_path(__FILE__), __LINE__, args)
#define wlr_log_errno(verb, fmt, ...) \
wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno))
diff --git a/meson.build b/meson.build
index 2fc78d33..d5ae7863 100644
--- a/meson.build
+++ b/meson.build
@@ -140,6 +140,8 @@ wlr_deps += [
math,
]
+symbols_file = 'wlroots.syms'
+symbols_flag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), symbols_file)
lib_wlr = library(
meson.project_name(),
version: '.'.join(so_version),
@@ -147,6 +149,7 @@ lib_wlr = library(
dependencies: wlr_deps,
include_directories: wlr_inc,
install: true,
+ link_args : symbols_flag,
)
wlroots = declare_dependency(
diff --git a/util/log.c b/util/log.c
index 327402e6..2adcae2d 100644
--- a/util/log.c
+++ b/util/log.c
@@ -73,7 +73,7 @@ void _wlr_log(log_importance_t verbosity, const char *fmt, ...) {
// e.g. '/src/build/wlroots/backend/wayland/backend.c' and
// '../backend/wayland/backend.c' will both be stripped to
// 'backend/wayland/backend.c'
-const char *_strip_path(const char *filepath) {
+const char *wlr_strip_path(const char *filepath) {
static int srclen = sizeof(WLR_SRC_DIR);
if (strstr(filepath, WLR_SRC_DIR) == filepath) {
filepath += srclen;
diff --git a/wlroots.syms b/wlroots.syms
new file mode 100644
index 00000000..93d6fe51
--- /dev/null
+++ b/wlroots.syms
@@ -0,0 +1,49 @@
+WLROOTS_0_0_0 {
+ global:
+ wlr_*;
+ _wlr_log;
+ local:
+ wlr_data_device_keyboard_drag_interface;
+ wlr_data_device_pointer_drag_interface;
+ wlr_data_device_touch_drag_interface;
+ wlr_drm_backend_get_session;
+ wlr_drm_check_features;
+ wlr_drm_connector_cleanup;
+ wlr_drm_connector_start_renderer;
+ wlr_drm_event;
+ wlr_drm_get_connector_props;
+ wlr_drm_get_crtc_props;
+ wlr_drm_get_plane_props;
+ wlr_drm_get_prop;
+ wlr_drm_get_prop_blob;
+ wlr_drm_plane_surfaces_init;
+ wlr_drm_renderer_finish;
+ wlr_drm_renderer_init;
+ wlr_drm_resources_free;
+ wlr_drm_resources_init;
+ wlr_drm_restore_outputs;
+ wlr_drm_scan_connectors;
+ wlr_drm_surface_finish;
+ wlr_drm_surface_get_front;
+ wlr_drm_surface_init;
+ wlr_drm_surface_make_current;
+ wlr_drm_surface_mgpu_copy;
+ wlr_drm_surface_post;
+ wlr_drm_surface_swap_buffers;
+ wlr_egl_get_buffer_age;
+ wlr_libinput_event;
+ wlr_libinput_keyboard_create;
+ wlr_libinput_pointer_create;
+ wlr_libinput_tablet_pad_create;
+ wlr_libinput_tablet_tool_create;
+ wlr_libinput_touch_create;
+ wlr_log_stderr;
+ wlr_signal_emit_safe;
+ wlr_subsurface_destroy;
+ wlr_wl_output_for_surface;
+ wlr_wl_output_layout_get_box;
+ wlr_wl_output_move_cursor;
+ wlr_wl_output_update_cursor;
+ wlr_wl_registry_poll;
+ *;
+};