Sponsored Content
Full Discussion: Specify the inode of a file?
Operating Systems Solaris Specify the inode of a file? Post 302894480 by bartus11 on Tuesday 25th of March 2014 04:01:44 PM
Old 03-25-2014
Put this into "fake_inode.d":
Code:
syscall::stat64:entry, syscall::lstat64:entry
/strstr(copyinstr(arg0), "passwd") != NULL/
{
  self->statptr = arg1;
}

syscall::stat64:return, syscall::lstat64:return
/self->statptr != NULL && curpsinfo->pr_dmodel == PR_MODEL_ILP32/
{
  self->st64_32 = (struct stat64_32 *)copyin(self->statptr, sizeof(struct stat64_32));
  self->st64_32->st_ino = 100000000000;
  copyout(self->st64_32, self->statptr, sizeof(struct stat64_32));
}

syscall::stat64:return, syscall::lstat64:return
/self->statptr != NULL && curpsinfo->pr_dmodel == PR_MODEL_LP64/
{
  self->st64 = (struct stat64 *)copyin(self->statptr, sizeof(struct stat64));
  self->st64->st_ino = 100000000000;
  copyout(self->st64, self->statptr, sizeof(struct stat64));
}

Replace "passwd" with whatever filename you want to fake inode for. Then run:
Code:
dtrace -w -s fake_inode.d

In the other terminal run:
Code:
ls -li /etc/passwd

Change the filename of the file that you are checking with "ls", if you changed the filename in the "fake_inode.d" script. This should produce:
Code:
# ls -li /etc/passwd
100000000000 -rw-r--r--   1 root     sys         1972 Jun 13  2013 /etc/passwd

These 4 Users Gave Thanks to bartus11 For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file access inode update

When is a file "accessed" according to UNIX? For example: gzipping a file will not change the access time. (1 Reply)
Discussion started by: dangral
1 Replies

2. Ubuntu

fd.file-max against inode

Hi, If inodes need to be 3-4 times greater than fd.file-max. Can you modify the current inode in the filesystem? Can you modify it on the fly? Or only in the creation of FS. I'm using redhat ent 4. Thank you for any comment you may add. (1 Reply)
Discussion started by: itik
1 Replies

3. Filesystems, Disks and Memory

Recreating a deleted hardlink to a file if I know the inode number

At risk of twisting the rules to nearly the point of breaking (if you think this goes too far mods, I apologise and accept that this should be deleted), I'm hoping someone might be able to cast a little light on the following problem regarding hard links to files. ... (6 Replies)
Discussion started by: Smiling Dragon
6 Replies

4. Shell Programming and Scripting

Read from file specific place in file using inode

Hello, I am using tcsh on AIX. I would like to write a script that does the following: 1. given an inode, how do I find exactly the name of the file? I know I could do this using ls -i | grep <inode> but it returns: <inode> <filename>. I need some string manipulation or something to... (1 Reply)
Discussion started by: lastZenMaster
1 Replies

5. Shell Programming and Scripting

Modifying a file without changing inode number

Hi all, I am struggling to change the content of a file without changing the inode number. The exact issue is as below. I have a file name test.bak which has 100 lines of text. I am trying to to delete the first 90 lines of the text in the file. I know that using sed/awk/head/tail I can... (3 Replies)
Discussion started by: sathishkmrv
3 Replies

6. Shell Programming and Scripting

changing a file when the inode modified time of the other file changes

i have a requirement where i needed to change variable values in a properties file(first file) whenever there is change to Release details file(second file). My question is do i have to create a daemon process that always checks the modified time/inode change of the second file and then change the... (1 Reply)
Discussion started by: saikiran_1984
1 Replies

7. Red Hat

Inode number changes for a file in Redhat Linux

Hi, I have created a file abc.log in Redhat Linux. Inode number for a file get changes every time i update the file using vi editor. Is there any setting that can be made , such that inode number never gets changed? Or if we cannot restrict from inode number getting changed , is... (9 Replies)
Discussion started by: raghu.amilineni
9 Replies

8. UNIX for Advanced & Expert Users

remove file/inode entry

Hello all, I am on hpux itanium 11.31...and we run a oracle DB on it. I am testing some backup and restore situation.... first i select some data from the DB.....now i remove some files from the DB where my data is being selected from.....now i select the same data from the DB but i still get... (5 Replies)
Discussion started by: abdul.irfan2
5 Replies

9. Solaris

Retreive deleted file name if you having inode number

Some one please help me to find deleted file name, if I am having inode number in Solaris without using any 3rd party tool. Thanks :) (3 Replies)
Discussion started by: aksijain
3 Replies

10. Linux

Inode number changes for a file in Redhat Linux

Hi, I have created a file a.txt in Redhat Linux. Inode number for a file changes every time i update the file using vi editor , gedit etc. Is there any setting that can be made , such that inode number never changes as that is supposed to be the expected behavior? Or if we cannot... (13 Replies)
Discussion started by: srirammanohar
13 Replies
RFIO_STAT(3)						      Rfio Library Functions						      RFIO_STAT(3)

NAME
rfio_stat - get information about a file or directory SYNOPSIS
#include <sys/types.h> #include "rfio_api.h" int rfio_stat (const char *path, struct stat *statbuf); int rfio_fstat (int s, struct stat *statbuf); int rfio_lstat (const char *path, struct stat *statbuf); int rfio_mstat (const char *path, struct stat *statbuf); int rfio_mstat_reset (); int rfio_end (); Under Linux, for large files: #define _LARGEFILE64_SOURCE #include <sys/types.h> #include "rfio_api.h" int rfio_stat64 (const char *path, struct stat64 *statbuf); int rfio_fstat64 (int s, struct stat64 *statbuf); int rfio_lstat64 (const char *path, struct stat64 *statbuf); int rfio_mstat64 (const char *path, struct stat64 *statbuf); For large files, under other systems: #include <sys/types.h> #include "rfio_api.h" int rfio_stat64 (const char *path, struct stat64 *statbuf); int rfio_fstat64 (int s, struct stat64 *statbuf); int rfio_lstat64 (const char *path, struct stat64 *statbuf); int rfio_mstat64 (const char *path, struct stat64 *statbuf); DESCRIPTION
rfio_stat gets information about a file or directory. rfio_lstat is identical to rfio_stat except for symbolic links. In this case, the link itself is statted and not followed. rfio_fstat is identical to rfio_stat but works on the file descriptor s returned by rfio_open. rfio_mstat is identical to rfio_stat but keeps the connection open to the server unless there are more than MAXMCON connections already opened. This is useful when issuing a series of stat calls. The last rfio_mstat call should be followed by a call to rfio_end. rfio_mstat_reset is to be used when your program is forking. In such a case the permanent connections opened with rfio_mstat become shared between the parent and the child. Use rfio_mstat_reset to perform the necessary reset and close of the socket file descriptor in the parent or the child in order to be sure that only of them will receice an answer from the RFIO daemon. See NOTES section below. path specifies the logical pathname relative to the current directory or the full pathname. statbuf is a pointer to a stat structure, receiving result of your query. The 64 bits functions must be used for large files. They have the same syntax as the normal stat functions except that they use a stat64 structure. RETURN VALUE
This routine returns 0 if the operation was successful or -1 if the operation failed. In the latter case, serrno is set appropriately. NOTES
Multiple connections using rfio_mstat are thread-safe but not process-wide, therefore a forked child can share file descriptors opened with rfio_mstat by its parent. Use rfio_mstat_reset in such case. Multiple connections behaviour is undefined if you work in a multi-threaded environment and with threads not created using the LCG's Cthread interface. ERRORS
ENOENT The named file/directory does not exist or is a null pathname. EBADF s is not a valid file descriptor. EACCES Search permission is denied on a component of the path prefix. EFAULT path or statbuf is a NULL pointer. ENOTDIR A component of path prefix is not a directory. ENAMETOOLONG The length of path exceeds CA_MAXPATHLEN or the length of a path component exceeds CA_MAXNAMELEN. SENOSHOST Host unknown. SENOSSERV Service unknown. SECOMERR Communication error. SEE ALSO
Castor_limits(4), rfio_chmod(3), rfio_chown(3), Cthread(3) AUTHOR
LCG Grid Deployment Team LCG
$Date: 2005/03/31 13:13:03 $ RFIO_STAT(3)
All times are GMT -4. The time now is 10:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy