本文整理汇总了C++中print_exit_status函数的典型用法代码示例。如果您正苦于以下问题:C++ print_exit_status函数的具体用法?C++ print_exit_status怎么用?C++ print_exit_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_exit_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unionfs_fsync
static int unionfs_fsync(struct file *file, struct dentry *dentry, int datasync)
{
int err;
struct file *hidden_file = NULL;
print_entry_location();
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
PASSERT(ftopd(file));
hidden_file = ftohf(file);
err = -EINVAL;
if (!hidden_file->f_op || !hidden_file->f_op->fsync)
goto out;
down(&hidden_file->f_dentry->d_inode->i_sem);
err = hidden_file->f_op->fsync(hidden_file, hidden_file->f_dentry,
datasync);
up(&hidden_file->f_dentry->d_inode->i_sem);
out:
print_exit_status(err);
return err;
}
示例2: unionfs_ioctl_branchcount
int unionfs_ioctl_branchcount(struct file *file, unsigned int cmd,
unsigned long arg)
{
int err = 0;
int bstart, bend;
int i;
struct super_block *sb = file->f_dentry->d_sb;
print_entry_location();
bstart = sbstart(sb);
bend = sbend(sb);
err = bend + 1;
if (!arg)
goto out;
for (i = bstart; i <= bend; i++) {
if (put_user(branch_count(sb, i), ((int *)arg) + i)) {
err = -EFAULT;
goto out;
}
}
out:
print_exit_status(err);
return err;
}
示例3: base0fs_readlink
STATIC int
base0fs_readlink(struct dentry *dentry, char *buf, int bufsiz)
{
int err;
struct dentry *lower_dentry;
print_entry_location();
lower_dentry = base0fs_lower_dentry(dentry);/* CPW: Moved below print_entry_location */
fist_print_dentry("base0fs_readlink IN", dentry);
if (!lower_dentry->d_inode->i_op ||
!lower_dentry->d_inode->i_op->readlink) {
err = -EINVAL;
goto out;
}
err = lower_dentry->d_inode->i_op->readlink(lower_dentry,
buf,
bufsiz);
if (err > 0)
fist_copy_attr_atime(dentry->d_inode, lower_dentry->d_inode);
out:
print_exit_status(err);
return err;
}
示例4: unionfs_read
ssize_t unionfs_read(struct file * file, char *buf, size_t count, loff_t * ppos)
{
int err = -EINVAL;
struct file *hidden_file = NULL;
loff_t pos = *ppos;
print_entry_location();
if ((err = unionfs_file_revalidate(file, 0)))
goto out;
fist_print_file("entering read()", file);
PASSERT(ftopd(file));
hidden_file = ftohf(file);
PASSERT(hidden_file);
if (!hidden_file->f_op || !hidden_file->f_op->read)
goto out;
err = hidden_file->f_op->read(hidden_file, buf, count, &pos);
*ppos = pos;
if (err >= 0) {
/* atime should also be updated for reads of size zero or more */
fist_copy_attr_atime(file->f_dentry->d_inode,
hidden_file->f_dentry->d_inode);
}
memcpy(&(file->f_ra), &(hidden_file->f_ra),
sizeof(struct file_ra_state));
out:
fist_print_file("leaving read()", file);
print_exit_status(err);
return err;
}
示例5: base0fs_mknod
STATIC int
base0fs_mknod(inode_t *dir, struct dentry *dentry, int mode, dev_t dev)
{
int err;
struct dentry *lower_dentry;
struct dentry *lower_dir_dentry;
print_entry_location();
lower_dentry = base0fs_lower_dentry(dentry); /* CPW: Moved below print_entry_location */
fist_checkinode(dir, "base0fs_mknod-dir");
lower_dir_dentry = base0fs_lock_parent(lower_dentry);
err = VFS_MKNOD(lower_dir_dentry->d_inode,
lower_dentry,
mode,
dev);
if (err || !lower_dentry->d_inode)
goto out;
err = base0fs_interpose(lower_dentry, dentry, dir->i_sb, 0);
if (err)
goto out;
fist_copy_attr_timesizes(dir, lower_dir_dentry->d_inode);
out:
unlock_dir(lower_dir_dentry);
if (!dentry->d_inode)
d_drop(dentry);
fist_checkinode(dir, "post base0fs_mknod-dir");
print_exit_status(err);
return err;
}
示例6: kdb3fs_d_delete
int
kdb3fs_d_delete(dentry_t *dentry)
{
dentry_t *hidden_dentry;
int err = 0;
print_entry_location();
#if 0
/* this could be a negative dentry, so check first */
if (!dtopd(dentry)) {
fist_dprint(6, "dentry without private data: %*s", dentry->d_name.len, dentry->d_name.name);
goto out;
}
if (!(hidden_dentry = dtohd(dentry))) {
fist_dprint(6, "dentry without hidden_dentry: %*s", dentry->d_name.len, dentry->d_name.name);
goto out;
}
// fist_print_dentry("D_DELETE IN", dentry);
/* added b/c of changes to dput(): it calls d_drop on us */
if (hidden_dentry->d_op &&
hidden_dentry->d_op->d_delete) {
err = hidden_dentry->d_op->d_delete(hidden_dentry);
}
#endif
out:
print_exit_status(err);
return err;
}
示例7: unionfs_mmap
/* FIST-LITE special version of mmap */
static int unionfs_mmap(struct file *file, struct vm_area_struct *vma)
{
int err = 0;
struct file *hidden_file = NULL;
int willwrite;
print_entry_location();
/* This might could be deferred to mmap's writepage. */
willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
if ((err = unionfs_file_revalidate(file, willwrite)))
goto out;
PASSERT(ftopd(file));
hidden_file = ftohf(file);
err = -ENODEV;
if (!hidden_file->f_op || !hidden_file->f_op->mmap)
goto out;
PASSERT(hidden_file);
PASSERT(hidden_file->f_op);
PASSERT(hidden_file->f_op->mmap);
vma->vm_file = hidden_file;
err = hidden_file->f_op->mmap(hidden_file, vma);
get_file(hidden_file); /* make sure it doesn't get freed on us */
fput(file); /* no need to keep extra ref on ours */
out:
print_exit_status(err);
return err;
}
示例8: base0fs_setattr
STATIC int
base0fs_setattr(struct dentry *dentry, struct iattr *ia)
{
int err = 0;
struct dentry *lower_dentry;
inode_t *inode;
inode_t *lower_inode;
print_entry_location();
lower_dentry = base0fs_lower_dentry(dentry);
inode = dentry->d_inode;
lower_inode = INODE_TO_LOWER(inode);
fist_checkinode(inode, "base0fs_setattr");
err = notify_change(lower_dentry,
#ifdef HAVE_3_ARG_NOTIFY_CHANGE
DENTRY_TO_LVFSMNT(dentry),
#endif
ia);
#if defined(FIST_FILTER_DATA) || defined(FIST_FILTER_SCA)
out:
#endif /* FIST_FILTER_DATA || FIST_FILTER_SCA */
/*
* The lower file system might has changed the attributes, even if
* notify_change above resulted in an error(!) so we copy the
* lower_inode's attributes (and a few more) to our inode.
*/
fist_copy_attr_all(inode, lower_inode);
fist_checkinode(inode, "post base0fs_setattr");
print_exit_status(err);
return err;
}
示例9: base0fs_listxattr
/*
* BKL held by caller.
* dentry->d_inode->i_{sem,mutex} down
*/
STATIC ssize_t
base0fs_listxattr(struct dentry *dentry, char *list, size_t size)
{
struct dentry *lower_dentry = NULL;
int err = -ENOTSUPP;
char *encoded_list = NULL;
print_entry_location();
lower_dentry = DENTRY_TO_LOWER(dentry);
BUG_ON(!lower_dentry);
BUG_ON(!lower_dentry->d_inode);
BUG_ON(!lower_dentry->d_inode->i_op);
if (lower_dentry->d_inode->i_op->listxattr) {
encoded_list = list;
lock_inode(lower_dentry->d_inode);
/* lock_kernel() already done by caller. */
err = lower_dentry->d_inode->i_op->listxattr(lower_dentry, encoded_list, size);
/* unlock_kernel() will be done by caller. */
unlock_inode(lower_dentry->d_inode);
}
out:
print_exit_status(err);
return err;
}
示例10: unionfs_poll
static unsigned int unionfs_poll(struct file *file, poll_table * wait)
{
unsigned int mask = DEFAULT_POLLMASK;
struct file *hidden_file = NULL;
print_entry_location();
if (unionfs_file_revalidate(file, 0)) {
/* We should pretend an error happend. */
mask = POLLERR | POLLIN | POLLOUT;
goto out;
}
if (ftopd(file) != NULL)
hidden_file = ftohf(file);
if (!hidden_file->f_op || !hidden_file->f_op->poll)
goto out;
mask = hidden_file->f_op->poll(hidden_file, wait);
out:
print_exit_status(mask);
return mask;
}
示例11: base0fs_removexattr
/*
* BKL held by caller.
* dentry->d_inode->i_{sem,mutex} down
*/
STATIC int
base0fs_removexattr(struct dentry *dentry, const char *name)
{
struct dentry *lower_dentry = NULL;
int err = -ENOTSUPP;
char *encoded_name;
print_entry_location();
lower_dentry = DENTRY_TO_LOWER(dentry);
BUG_ON(!lower_dentry);
BUG_ON(!lower_dentry->d_inode);
BUG_ON(!lower_dentry->d_inode->i_op);
fist_dprint(18, "removexattr: name=\"%s\"\n", name);
if (lower_dentry->d_inode->i_op->removexattr) {
encoded_name = (char *)name;
lock_inode(lower_dentry->d_inode);
/* lock_kernel() already done by caller. */
err = lower_dentry->d_inode->i_op->removexattr(lower_dentry, encoded_name);
/* unlock_kernel() will be done by caller. */
unlock_inode(lower_dentry->d_inode);
}
out:
print_exit_status(err);
return err;
}
示例12: base0fs_permission
STATIC int
base0fs_permission(inode_t *inode, int mask, struct nameidata* nd)
{
inode_t *lower_inode;
int err;
struct dentry *lower_dentry;
struct vfsmount *lower_mount;
FIST_ND_DECLARATIONS;
print_entry_location();
lower_inode = INODE_TO_LOWER(inode);
if(nd)
{
BUG_ON(!NAMEIDATA_TO_DENTRY(nd)); /* needed to find lower_dentry */
lower_dentry = base0fs_lower_dentry(NAMEIDATA_TO_DENTRY(nd));
lower_mount = DENTRY_TO_LVFSMNT(NAMEIDATA_TO_DENTRY(nd));
BUG_ON(!SUPERBLOCK_TO_PRIVATE(NAMEIDATA_TO_DENTRY(nd)->d_sb)); /* needed in FIST_ND_SAVE_ARGS macro */
FIST_ND_SAVE_ARGS(NAMEIDATA_TO_DENTRY(nd), lower_dentry, lower_mount);
}
err = permission(lower_inode, mask, nd);
if(nd)
{
FIST_ND_RESTORE_ARGS;
}
out:
print_exit_status(err);
return err;
}
示例13: unionfs_file_readdir
static int unionfs_file_readdir(struct file *file, void *dirent,
filldir_t filldir)
{
int err = -ENOTDIR;
print_entry_location();
print_exit_status(err);
return err;
}
示例14: main
int
main(int argc, char *argv[])
{
int retc = 0;
int opt;
int errflg = 0;
if ((command = strrchr(argv[0], '/')) != NULL)
command++;
else
command = argv[0];
while ((opt = getopt(argc, argv, "F")) != EOF) {
switch (opt) {
case 'F': /* force grabbing (no O_EXCL) */
Fflag = PGRAB_FORCE;
break;
default:
errflg = 1;
break;
}
}
argc -= optind;
argv += optind;
if (errflg || argc <= 0) {
(void) fprintf(stderr, "usage: %s pid ...\n", command);
(void) fprintf(stderr, " (Reap a defunct process by forcing "
"its parent to wait(2) for it)\n");
exit(2);
}
/* catch signals from terminal */
if (sigset(SIGHUP, SIG_IGN) == SIG_DFL)
(void) sigset(SIGHUP, intr);
if (sigset(SIGINT, SIG_IGN) == SIG_DFL)
(void) sigset(SIGINT, intr);
if (sigset(SIGPIPE, SIG_IGN) == SIG_DFL)
(void) sigset(SIGPIPE, intr);
if (sigset(SIGQUIT, SIG_IGN) == SIG_DFL)
(void) sigset(SIGQUIT, intr);
(void) sigset(SIGTERM, intr);
while (--argc >= 0 && !interrupt) {
pid_t pid;
int wstat, r;
retc += r = reap(*argv++, &pid, &wstat);
if (r == 0)
print_exit_status(pid, wstat);
}
if (interrupt && retc == 0)
retc++;
return (retc == 0 ? 0 : 1);
}
示例15: unionfs_write
/* this unionfs_write() does not modify data pages! */
ssize_t unionfs_write(struct file * file, const char *buf, size_t count,
loff_t * ppos)
{
int err = -EINVAL;
struct file *hidden_file = NULL;
struct inode *inode;
struct inode *hidden_inode;
loff_t pos = *ppos;
int bstart, bend;
print_entry_location();
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
inode = file->f_dentry->d_inode;
bstart = fbstart(file);
bend = fbend(file);
ASSERT(bstart != -1);
PASSERT(ftopd(file));
PASSERT(ftohf(file));
hidden_file = ftohf(file);
hidden_inode = hidden_file->f_dentry->d_inode;
if (!hidden_file->f_op || !hidden_file->f_op->write)
goto out;
/* adjust for append -- seek to the end of the file */
if (file->f_flags & O_APPEND)
pos = inode->i_size;
err = hidden_file->f_op->write(hidden_file, buf, count, &pos);
/*
* copy ctime and mtime from lower layer attributes
* atime is unchanged for both layers
*/
if (err >= 0)
fist_copy_attr_times(inode, hidden_inode);
*ppos = pos;
/* update this inode's size */
if (pos > inode->i_size)
inode->i_size = pos;
out:
print_exit_status(err);
return err;
}