本文整理汇总了C++中rpath函数的典型用法代码示例。如果您正苦于以下问题:C++ rpath函数的具体用法?C++ rpath怎么用?C++ rpath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rpath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: local_statfs
static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
return statfs(rpath(s, path, buffer), stbuf);
}
示例2: local_truncate
static int local_truncate(FsContext *ctx, V9fsPath *fs_path, off_t size)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
return truncate(rpath(ctx, path, buffer), size);
}
示例3: GetTempPathA
std::string Sys::GetTempPath() {
char path[EE_MAX_CFG_PATH_LEN];
#if EE_PLATFORM == EE_PLATFORM_WIN
DWORD dwRetVal = GetTempPathA(EE_MAX_CFG_PATH_LEN, path);
if ( 0 <= dwRetVal || dwRetVal > EE_MAX_CFG_PATH_LEN ) {
return std::string( "C:\\WINDOWS\\TEMP\\" );
}
#elif EE_PLATFORM == EE_PLATFORM_ANDROID
if ( NULL != Window::cEngine::instance() ) {
String::StrCopy( path, Window::cEngine::instance()->GetCurrentWindow()->GetInternalStoragePath().c_str(), EE_MAX_CFG_PATH_LEN );
} else {
String::StrCopy( path, "/tmp", EE_MAX_CFG_PATH_LEN );
}
#else
char * tmpdir = getenv("TMPDIR");
if ( NULL != tmpdir ) {
String::StrCopy( path, tmpdir, EE_MAX_CFG_PATH_LEN );
} else {
String::StrCopy( path, "/tmp", EE_MAX_CFG_PATH_LEN );
}
#endif
std::string rpath( path );
FileSystem::DirPathAddSlashAtEnd( rpath );
return rpath;
}
示例4: local_post_create_passthrough
static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,
FsCred *credp)
{
char *buffer;
buffer = rpath(fs_ctx, path);
if (lchown(buffer, credp->fc_uid, credp->fc_gid) < 0) {
/*
* If we fail to change ownership and if we are
* using security model none. Ignore the error
*/
if ((fs_ctx->export_flags & V9FS_SEC_MASK) != V9FS_SM_NONE) {
goto err;
}
}
if (chmod(buffer, credp->fc_mode & 07777) < 0) {
goto err;
}
g_free(buffer);
return 0;
err:
g_free(buffer);
return -1;
}
示例5: mp_pacl_setxattr
static int mp_pacl_setxattr(FsContext *ctx, const char *path, const char *name,
void *value, size_t size, int flags)
{
char buffer[PATH_MAX];
return lsetxattr(rpath(ctx, path, buffer), MAP_ACL_ACCESS, value,
size, flags);
}
示例6: local_mknod
static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path,
const char *name, FsCred *credp)
{
char *path;
int err = -1;
int serrno = 0;
V9fsString fullname;
char buffer[PATH_MAX];
v9fs_string_init(&fullname);
v9fs_string_sprintf(&fullname, "%s/%s", dir_path->data, name);
path = fullname.data;
/* Determine the security model */
if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
err = mknod(rpath(fs_ctx, path, buffer),
SM_LOCAL_MODE_BITS|S_IFREG, 0);
if (err == -1) {
goto out;
}
err = local_set_xattr(rpath(fs_ctx, path, buffer), credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
} else if ((fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) {
err = mknod(rpath(fs_ctx, path, buffer), credp->fc_mode,
credp->fc_rdev);
if (err == -1) {
goto out;
}
err = local_post_create_passthrough(fs_ctx, path, credp);
if (err == -1) {
serrno = errno;
goto err_end;
}
}
goto out;
err_end:
remove(rpath(fs_ctx, path, buffer));
errno = serrno;
out:
v9fs_string_free(&fullname);
return err;
}
示例7: local_post_create_passthrough
static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,
FsCred *credp)
{
if (chmod(rpath(fs_ctx, path), credp->fc_mode & 07777) < 0) {
return -1;
}
if (lchown(rpath(fs_ctx, path), credp->fc_uid, credp->fc_gid) < 0) {
/*
* If we fail to change ownership and if we are
* using security model none. Ignore the error
*/
if (fs_ctx->fs_sm != SM_NONE) {
return -1;
}
}
return 0;
}
示例8: local_chown
static int local_chown(FsContext *fs_ctx, V9fsPath *fs_path, FsCred *credp)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
if ((credp->fc_uid == -1 && credp->fc_gid == -1) ||
(fs_ctx->export_flags & V9FS_SM_PASSTHROUGH) ||
(fs_ctx->export_flags & V9FS_SM_NONE)) {
return lchown(rpath(fs_ctx, path, buffer),
credp->fc_uid, credp->fc_gid);
} else if (fs_ctx->export_flags & V9FS_SM_MAPPED) {
return local_set_xattr(rpath(fs_ctx, path, buffer), credp);
} else if (fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) {
return local_set_mapped_file_attr(fs_ctx, path, credp);
}
return -1;
}
示例9: local_utimensat
static int local_utimensat(FsContext *s, V9fsPath *fs_path,
const struct timespec *buf)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
return qemu_utimens(rpath(s, path, buffer), buf);
}
示例10: local_utimensat
static int local_utimensat(FsContext *s, V9fsPath *fs_path,
const struct timespec *buf)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
return qemu_utimensat(AT_FDCWD, rpath(s, path, buffer), buf,
AT_SYMLINK_NOFOLLOW);
}
示例11: root_name
static boost::filesystem::path root_name( const boost::filesystem::path& path ) {
boost::filesystem::path rpath( path );
if ( boost::filesystem::is_regular_file( path ) ) {
rpath = path.parent_path();
if ( boost::filesystem::is_directory( rpath ) && rpath.extension() == L".d" )
return rpath;
}
return rpath;
}
示例12: local_open
static int local_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
char buffer[PATH_MAX];
char *path = fs_path->data;
fs->fd = open(rpath(ctx, path, buffer), flags | O_NOFOLLOW);
return fs->fd;
}
示例13: dosbox
void dosman::Entry::run()
{
std::string dosbox("dosbox ");
std::string conf(" -conf ");
std::string cpath(getConfPath());
std::string rpath(getRunConfPath());
std::string line = dosbox + conf + cpath + conf + rpath;
system(line.c_str());
}
示例14: local_remove
static int local_remove(FsContext *ctx, const char *path)
{
int err;
struct stat stbuf;
char buffer[PATH_MAX];
if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
err = lstat(rpath(ctx, path, buffer), &stbuf);
if (err) {
goto err_out;
}
/*
* If directory remove .virtfs_metadata contained in the
* directory
*/
if (S_ISDIR(stbuf.st_mode)) {
sprintf(buffer, "%s/%s/%s", ctx->fs_root, path, VIRTFS_META_DIR);
err = remove(buffer);
if (err < 0 && errno != ENOENT) {
/*
* We didn't had the .virtfs_metadata file. May be file created
* in non-mapped mode ?. Ignore ENOENT.
*/
goto err_out;
}
}
/*
* Now remove the name from parent directory
* .virtfs_metadata directory
*/
err = remove(local_mapped_attr_path(ctx, path, buffer));
if (err < 0 && errno != ENOENT) {
/*
* We didn't had the .virtfs_metadata file. May be file created
* in non-mapped mode ?. Ignore ENOENT.
*/
goto err_out;
}
}
return remove(rpath(ctx, path, buffer));
err_out:
return err;
}
示例15: v9fs_list_xattr
/*
* Get the list and pass to each layer to find out whether
* to send the data or not
*/
ssize_t v9fs_list_xattr(FsContext *ctx, const char *path,
void *value, size_t vsize)
{
ssize_t size = 0;
char *buffer;
void *ovalue = value;
XattrOperations *xops;
char *orig_value, *orig_value_start;
ssize_t xattr_len, parsed_len = 0, attr_len;
/* Get the actual len */
buffer = rpath(ctx, path);
xattr_len = llistxattr(buffer, value, 0);
if (xattr_len <= 0) {
g_free(buffer);
return xattr_len;
}
/* Now fetch the xattr and find the actual size */
orig_value = g_malloc(xattr_len);
xattr_len = llistxattr(buffer, orig_value, xattr_len);
g_free(buffer);
/* store the orig pointer */
orig_value_start = orig_value;
while (xattr_len > parsed_len) {
xops = get_xattr_operations(ctx->xops, orig_value);
if (!xops) {
goto next_entry;
}
if (!value) {
size += xops->listxattr(ctx, path, orig_value, value, vsize);
} else {
size = xops->listxattr(ctx, path, orig_value, value, vsize);
if (size < 0) {
goto err_out;
}
value += size;
vsize -= size;
}
next_entry:
/* Got the next entry */
attr_len = strlen(orig_value) + 1;
parsed_len += attr_len;
orig_value += attr_len;
}
if (value) {
size = value - ovalue;
}
err_out:
g_free(orig_value_start);
return size;
}