本文整理汇总了C++中rpath函数的典型用法代码示例。如果您正苦于以下问题:C++ rpath函数的具体用法?C++ rpath怎么用?C++ rpath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rpath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:dariaphoebe,项目名称:qemu-1,代码行数:7,代码来源:virtio-9p-local.c
示例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);
}
开发者ID:dorlaor,项目名称:qemu,代码行数:7,代码来源:virtio-9p-local.c
示例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;
}
开发者ID:dogtwelve,项目名称:eepp,代码行数:31,代码来源:sys.cpp
示例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;
}
开发者ID:pbhide,项目名称:qemu-rocker,代码行数:26,代码来源:virtio-9p-local.c
示例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);
}
开发者ID:Grace-Liu,项目名称:dpdk-ovs,代码行数:7,代码来源:virtio-9p-posix-acl.c
示例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;
}
开发者ID:dorlaor,项目名称:qemu,代码行数:47,代码来源:virtio-9p-local.c
示例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;
}
开发者ID:MegabytePhreak,项目名称:qemu-mcf5307,代码行数:17,代码来源:virtio-9p-local.c
示例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;
}
开发者ID:01org,项目名称:KVMGT-qemu,代码行数:17,代码来源:virtio-9p-local.c
示例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);
}
开发者ID:01org,项目名称:KVMGT-qemu,代码行数:8,代码来源:virtio-9p-local.c
示例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);
}
开发者ID:dorlaor,项目名称:qemu,代码行数:9,代码来源:virtio-9p-local.c
示例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;
}
开发者ID:hermixy,项目名称:qtplatz,代码行数:9,代码来源:datafile.cpp
示例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;
}
开发者ID:01org,项目名称:KVMGT-qemu,代码行数:9,代码来源:virtio-9p-local.c
示例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());
}
开发者ID:Marneus68,项目名称:DOSMAN,代码行数:9,代码来源:Entry.cpp
示例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;
}
开发者ID:01org,项目名称:KVMGT-qemu,代码行数:43,代码来源:virtio-9p-local.c
示例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;
}
开发者ID:32bitmicro,项目名称:riscv-qemu,代码行数:59,代码来源:virtio-9p-xattr.c
示例16: local_rename
static int local_rename(FsContext *ctx, const char *oldpath,
const char *newpath)
{
char *tmp;
int err;
tmp = qemu_strdup(rpath(ctx, oldpath));
err = rename(tmp, rpath(ctx, newpath));
if (err == -1) {
int serrno = errno;
qemu_free(tmp);
errno = serrno;
} else {
qemu_free(tmp);
}
return err;
}
开发者ID:MegabytePhreak,项目名称:qemu-mcf5307,代码行数:20,代码来源:virtio-9p-local.c
示例17: local_post_create_passthrough
static int local_post_create_passthrough(FsContext *fs_ctx, const char *path,
FsCred *credp)
{
char buffer[PATH_MAX];
if (chmod(rpath(fs_ctx, path, buffer), credp->fc_mode & 07777) < 0) {
return -1;
}
if (lchown(rpath(fs_ctx, path, 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) {
return -1;
}
}
return 0;
}
开发者ID:dorlaor,项目名称:qemu,代码行数:20,代码来源:virtio-9p-local.c
示例18: local_rename
static int local_rename(FsContext *ctx, const char *oldpath,
const char *newpath)
{
int err;
char buffer[PATH_MAX], buffer1[PATH_MAX];
if (ctx->export_flags & V9FS_SM_MAPPED_FILE) {
err = local_create_mapped_attr_dir(ctx, newpath);
if (err < 0) {
return err;
}
/* rename the .virtfs_metadata files */
err = rename(local_mapped_attr_path(ctx, oldpath, buffer),
local_mapped_attr_path(ctx, newpath, buffer1));
if (err < 0 && errno != ENOENT) {
return err;
}
}
return rename(rpath(ctx, oldpath, buffer), rpath(ctx, newpath, buffer1));
}
开发者ID:01org,项目名称:KVMGT-qemu,代码行数:20,代码来源:virtio-9p-local.c
示例19: local_statfs
static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
{
char *buffer;
int ret;
char *path = fs_path->data;
buffer = rpath(s, path);
ret = statfs(buffer, stbuf);
g_free(buffer);
return ret;
}
开发者ID:pbhide,项目名称:qemu-rocker,代码行数:11,代码来源:virtio-9p-local.c
示例20: local_open
static int local_open(FsContext *ctx, V9fsPath *fs_path,
int flags, V9fsFidOpenState *fs)
{
char *buffer;
char *path = fs_path->data;
buffer = rpath(ctx, path);
fs->fd = open(buffer, flags | O_NOFOLLOW);
g_free(buffer);
return fs->fd;
}
开发者ID:pbhide,项目名称:qemu-rocker,代码行数:11,代码来源:virtio-9p-local.c
注:本文中的rpath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论