IceWalkers.com - Linux Software downloads and news
Name : Password :
Linux SoftwareLinux RPMLinux HowtosLink UsAboutAdvertise

pivot_root (2)

PIVOT_ROOT(2)                    System Calls                    PIVOT_ROOT(2)



NAME
       pivot_root - change the root file system

SYNOPSIS
       #include<linux/unistd.h>

       _syscall2(int,pivot_root,constchar*,new_root,constchar*,put_old)

       intpivot_root(constchar*new_root,constchar*put_old);

DESCRIPTION
       pivot_root  moves  the  root  file system of the current process to the
       directory put_old and makes new_root the new root file  system  of  the
       current process.

       The typical use of pivot_root is during system startup, when the system
       mounts a temporary root file system (e.g. an initrd), then  mounts  the
       real root file system, and eventually turns the latter into the current
       root of all relevant processes or threads.

       pivot_root may or may not change the current root and the current work-
       ing  directory (cwd) of any processes or threads which use the old root
       directory. The caller of pivot_root must  ensure  that  processes  with
       root  or  cwd at the old root operate correctly in either case. An easy
       way to ensure this is to change their root and cwd to  new_root  before
       invoking pivot_root.

       The  paragraph  above is intentionally vague because the implementation
       of pivot_root may change  in  the  future.  At  the  time  of  writing,
       pivot_root  changes  root and cwd of each process or thread to new_root
       if they point to the old root directory. This is necessary in order  to
       prevent  kernel  threads  from keeping the old root directory busy with
       their root and cwd, even if they never access the file  system  in  any
       way.  In  the  future,  there  may be a mechanism for kernel threads to
       explicitly relinquish any access to the file  system,  such  that  this
       fairly intrusive mechanism can be removed from pivot_root.

       Note  that  this also applies to the current process: pivot_root may or
       may not affect its cwd. It is therefore recommended to call  chdir("/")
       immediately after pivot_root.

       The following restrictions apply to new_root and put_old:

       -  They must be directories.

       -  new_root and put_old must not be on the same file system as the cur-
          rent root.

       -  put_old must be underneath new_root, i.e. adding a  non-zero  number
          of  /..  to  the  string  pointed  to by put_old must yield the same
          directory as new_root.

       -  No other file system may be mounted on put_old.

       See also pivot_root(8) for additional usage examples.

       If the current root is not a  mount  point  (e.g.  after  chroot(2)  or
       pivot_root,  see also below), not the old root directory, but the mount
       point of that file system is mounted on put_old.

NOTES
       new_root does not have to be a mount point. In this case,  /proc/mounts
       will  show  the  mount  point of the file system containing new_root as
       root (/).

RETURNVALUE
       On success, zero is returned.  On error, -1 is returned, and  errno  is
       set appropriately.

ERRORS
       pivot_root may return (in errno) any of the errors returned by stat(2).
       Additionally, it may return:


       EBUSY  new_root or put_old are on the current root file  system,  or  a
              file system is already mounted on put_old.

       EINVAL put_old is not underneath new_root.

       ENOTDIR
              new_root or put_old is not a directory.

       EPERM  The  current process does not have the administrator capability.

BUGS
       pivot_root should not have to change root and cwd  of  all  other  pro-
       cesses in the system.

       Some  of the more obscure uses of pivot_root may quickly lead to insan-
       ity.

CONFORMINGTO
       pivot_root is Linux-specific and hence is not portable.

HISTORY
       pivot_root was introduced in Linux 2.3.41.

SEEALSO
       chdir(2), chroot(2), initrd(4), pivot_root(8), stat(2)



Linux                             2000-02-23                     PIVOT_ROOT(2)

_Exitgetsockoptoutwshmat
_exitgettidoutw_pshmctl
_llseekgettimeofdaypauseshmdt
_newselectgetuidpersonalityshmget
_sysctlgttypipeshmop
acceptidlepivot_rootshutdown
accessinbpollsigaction
acctinb_pprctlsigaltstack
adjtimexinlpreadsigblock
afs_syscallinl_pprofsiggetmask
alarminsbpselectsigmask
alloc_hugepagesinslptracesignal
arch_prctlinswpwritesigpause
bdflushintroquotactlsigpending
bindinwreadsigprocmask
breakinw_preaddirsigqueue
brkioctlreadlinksigreturn
cacheflushioctl_listreadvsigsetmask
capgetiopermrebootsigsuspend
capsetioplrecvsigtimedwait
chdiripcrecvfromsigvec
chmodkillrecvmsgsigwaitinfo
chownkillpgrenamesocket
chrootlchownrmdirsocketcall
clonelinksbrksocketpair
closelistensched_get_priority_maxssetmask
connectllseeksched_get_priority_minstat
creatlocksched_getaffinitystatfs
duplseeksched_getparamstime
dup2lstatsched_getschedulerstty
execvemadvisesched_rr_get_intervalswapoff
exitmincoresched_setaffinityswapon
fchdirmkdirsched_setparamsymlink
fchmodmknodsched_setschedulersync
fchownmlocksched_yieldsyscall
fcntlmlockallselectsyscalls
fdatasyncmmapselect_tutsysctl
flockmmap2semctlsysfs
forkmodify_ldtsemgetsysinfo
free_hugepagesmountsemopsyslog
fstatmprotectsendtime
fstatfsmpxsendfiletimes
fsyncmremapsendmsgtkill
ftruncatemsgctlsendtotruncate
futexmsggetsetcontextumask
getcontextmsgopsetdomainnameumount
getdentsmsgrcvsetegidumount2
getdomainnamemsgsndseteuiduname
getdtablesizemsyncsetfsgidundocumented
getegidmunlocksetfsuidunimplemented
geteuidmunlockallsetgidunlink
getgidmunmapsetgroupsuselib
getgroupsnanosleepsethostidustat
gethostidnfsservctlsethostnameutime
gethostnamenicesetitimerutimes
getitimerobsoletesetpgidvfork
getpagesizeoldfstatsetpgrpvhangup
getpeernameoldlstatsetpriorityvm86
getpgidoldoldunamesetregidwait
getpgrpoldstatsetresgidwait3
getpidoldunamesetresuidwait4
getppidopensetreuidwaitpid
getpriorityoutbsetrlimitwrite
getresgidoutb_psetsidwritev
getresuidoutlsetsockopt 
getrlimitoutl_psettimeofday 
getrusageoutsbsetuid 
getsidoutslsetup 


The Gimp 2.6.3
GNU Image Manipulation Program
Linux Kernel 2.6 2.6.27.7
Linux Kernel
Battle for Wesnoth 1.4.6
Fantasy Turn-Based Strategy Game
DeleGate 9.9.0-pre8
Proxy server which runs on multiple platforms
Safesquid proxy server 4.2.2.RC8.14B
Antivirus and content filtering proxy server
Thunderbird 2.0.0.18
An email and newsgroup client with powerful, new junk mail controls
Wine 1.1.9
Free implementation of Windows on Unix
WebGUI 7.5.34
A fully featured content management system.
KOffice 2.0 beta3
Integrated office suite for KDE
LimeWire 4.18.8
Gnutella Client
Free IT Magazines, White Papers, eBooks, and more !
Oracle Magazine

Contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more.

eWeek

The essential technology information source for builders of e-business.

BusinessWeek (Digital Edition)

Provides readers a deeper understanding of the trends that drive growth, and what best practices keep them ahead of the competition.

Linux Software Map
Find Linux RPM
Best Rated Linux Software
Most Rated Linux Software
Linux Distributions
Linux Howtos
Quick Survey

Please take our survey and help us improve our website to serve you better.

Thank you.
Linux Software
Linux / IT Resources
Site Resources
Google
Privacy Policy
Contact Us
Submit Software
Advertising info