Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
struct stat
{
mode_t st_mode;
ino_t st_ino;
dev_t st_dev;
dev_t st_rdev;
nlink_t st_nlink;
uid_t st_uid;
gid_t st_gid;
off_t st_size;
struct timspec st_atim;
struct timspec st_mtim;
struct timspec st_ctim;
blksize_t st_blksize;
blkcnt_t st_blocks;
};
Description
Field Description
int fildes The file descriptor that you are attempting to create an alias for.
dup returns the value of the new file descriptor that it has created (which will always be
return value the smallest available file descriptor). A negative return value means that an error
occured.
DUP-2
Sujit Shinde
• The dup2() system call performs the same task as
dup(), but instead of using the lowest-numbered
unused file descriptor, it uses the file descriptor
number specified in newfd.
• If the file descriptor newfd was previously open, it
is silently closed before being reused.
• The steps of closing and reusing the file descriptor
newfd are performed atomically.
Syntax:
int dup2(int fildes, int fildes2);
Field Description
int fildes The source file descriptor. This remains open after the call to dup2.
The destination file descriptor. This file descriptor will point to the same file as filedes after
int fildes2
this call returns.
dup2 returns the value of the second parameter (fildes2) upon success. A negative return
return value
value means that an error occured.
MOUNT
Vrund Shah
• Unix systems have a single directory tree.
• All accessible storage must have an associated
location in this single directory tree.
• This is unlike Windows where (in the most common
syntax for file paths) there is one directory tree per
storage component (drive).
• Mounting is the act of associating a storage device to
a particular location in the directory tree. For example,
when the system boots, a particular storage device
(commonly called the root partition) is associated with
the root of the directory tree, i.e., that storage device is
mounted on / (the root directory).
Syntax
• mount [-lhV]
• mount -a [-fFnrsvw] [-t vfstype] [-O optlist]
• mount [-fnrsvw] [-o option[,option]...]
device|dir
• mount [-fnrsvw] [-t vfstype] [-o options]
device|dir
Options
-V, --version
Output version.
-h, --help
Print a help message.
-v, --verbose
Verbose mode.
-a, --all
Mount all filesystems (of the given types) mentioned in fstab.
-F, --fork
(Used in conjunction with -a.) Fork off a new incarnation of mount for each
device.
-f, --fake
Causes everything to be done except for the actual system call; if it's not
obvious, this ''fakes'' mounting the filesystem.
-i, --internal-only
Don't call the /sbin/mount.<filesystem> helper even if it exists.
-l
Add the labels in the mount output..
-n, --no-mtab
Mount without writing in /etc/mtab. This is necessary for example when /etc is on a read-only
filesystem.
--no-canonicalize
Don't canonicalize paths. The mount command canonicalizes all paths (from command line
or fstab) and stores canonicalized paths to the /etc/mtab file.
-p, --pass-fd num
In case of a loop mount with encryption, read the passphrase from file descriptor num instead
of from the terminal.
-s
Tolerate sloppy mount options rather than failing. This will ignore mount options not supported
by a filesystem type. Not all filesystems support this option.
-r, --read-only
Mount the filesystem read-only. A synonym is -o ro.
-w, --rw
Mount the filesystem read/write. This is the default. A synonym is -o rw.
-L label
Mount the partition that has the specified label.
-U uuid
Mount the partition that has the specified uuid.
UNMOUNT
SHEFALI DSOUZA
• The umount command detaches the
specified file system(s) from the file hierarchy.
• A file system is specified by giving the
directory where it has been mounted.
• Giving the special device on which the file
system lives may also work, but is an obsolete
method, mainly because it will fail in case this
device was mounted on more than one
directory.
Syntax
umount [-hV]
umount -a [-dflnrv] [-t vfstype] [-O
options]
umount [-dflnrv] {dir|device}...
Options
a, --all
All of the file systems described in /etc/mtab are unmounted.
-A, --all-targets
Unmount all mountpoints in the current namespace for the specified filesystem.
-d, --detach-loop
When the unmounted device was a loop device, also free this loop device.
--fake
Causes everything to be done except for the actual system call; this 'fakes'
unmounting the filesystem.
-f, --force
Force unmount (in case of an unreachable NFS system)
-i, --internal-only
Do not call the /sbin/umount.<filesystem> helper even if it exists. By default
/sbin/umount.<filesystem> helper is called if one exists.
-n, --no-mtab
Unmount without writing in /etc/mtab.
-l, --lazy
Lazy unmount.
-O, --test-opts options,list
Indicate that the actions should only be taken on file systems with the
specified options in /etc/fstab. More than one option type may be
specified in a comma separated list. Each option can be prefixed
withno to specify options for which no action should be taken.
-R, --recursive
Recursively unmount each directory specified.
-r, --read-only
In case unmounting fails, try to remount read-only.
-t, --types vfstype,ext2,ext3
Indicate that the actions should only be taken on file systems of the
specified type.
-v, --verbose
Verbose mode.
-h, --help
Print help message and exit.
-V, --version
Print version and exit.