mode_t mode;
};
+struct run_as_unlink_data {
+ const char *path;
+};
+
#ifdef VALGRIND
static
int use_clone(void)
return open(data->path, data->flags, data->mode);
}
+static
+int _unlink(void *_data)
+{
+ int ret;
+ struct run_as_unlink_data *data = _data;
+
+ ret = unlink(data->path);
+ if (ret < 0) {
+ ret = -errno;
+ }
+
+ return ret;
+}
+
static
int child_run_as(void *_data)
{
data.mode = mode;
return run_as(_open, &data, uid, gid);
}
+
+LTTNG_HIDDEN
+int run_as_unlink(const char *path, uid_t uid, gid_t gid)
+{
+ struct run_as_unlink_data data;
+
+ DBG3("unlink() %s with for uid %d and gid %d",
+ path, uid, gid);
+ data.path = path;
+ return run_as(_unlink, &data, uid, gid);
+}
int run_as_mkdir_recursive(const char *path, mode_t mode, uid_t uid, gid_t gid);
int run_as_mkdir(const char *path, mode_t mode, uid_t uid, gid_t gid);
int run_as_open(const char *path, int flags, mode_t mode, uid_t uid, gid_t gid);
+int run_as_unlink(const char *path, uid_t uid, gid_t gid);
/*
* We need to lock pthread exit, which deadlocks __nptl_setxid in the