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

lseek (2)

LSEEK(2)                         System calls                         LSEEK(2)



NAME
       lseek - reposition read/write file offset

SYNOPSIS
       #include<sys/types.h>
       #include<unistd.h>

       off_tlseek(int fildes,off_t offset,int whence);

DESCRIPTION
       The lseek function repositions the offset of the file descriptor fildes
       to the argument offset according to the directive whence as follows:

       SEEK_SET
              The offset is set to offset bytes.

       SEEK_CUR
              The offset is set to its current location plus offset bytes.

       SEEK_END
              The offset is set to the size of the file plus offset bytes.

       The lseek function allows the file offset to be set beyond the  end  of
       the existing end-of-file of the file.  If data is later written at this
       point, subsequent reads of the data in the gap return  bytes  of  zeros
       (until data is actually written into the gap).

RETURNVALUE
       Upon successful completion, lseek returns the resulting offset location
       as measured in bytes from the beginning  of  the  file.   Otherwise,  a
       value  of (off_t)-1 is returned and errno is set to indicate the error.

ERRORS
       EBADF  Fildes is not an open file descriptor.

       ESPIPE Fildes is associated with a pipe, socket, or FIFO.

       EINVAL Whence is not a proper value.

CONFORMINGTO
       SVr4, POSIX, BSD 4.3

RESTRICTIONS
       Some devices are incapable of seeking and POSIX does not specify  which
       devices must support it.

       Linux  specific  restrictions:  using  lseek  on  a  tty device returns
       ESPIPE.  Other systems return the number of written  characters,  using
       SEEK_SET to set the counter.  Some devices, e.g. /dev/null do not cause
       the error ESPIPE, but return a pointer which value is undefined.

NOTES
       This document's use of whence is incorrect English, but maintained  for
       historical reasons.

       When converting old code, substitute values for whence with the follow-
       ing macros:


        old       new
       0        SEEK_SET

       1        SEEK_CUR
       2        SEEK_END
       L_SET    SEEK_SET
       L_INCR   SEEK_CUR
       L_XTND   SEEK_END

       SVR1-3 returns long instead of off_t, BSD returns int.

       Note that file descriptors created by dup(2) or fork(2) share the  cur-
       rent  file position pointer, so seeking on such files may be subject to
       race conditions.

SEEALSO
       dup(2), fork(2), open(2), fseek(3)



Linux                             2001-09-24                          LSEEK(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 


My Money 2.0.53
Personal financial software
Deluge 1.2.2
Bittorrent client written in Python and GTK+
DbVisualizer 7.0.5
The Universal Database Tool
Linux Kernel 2.6 2.6.34-rc2
Linux Kernel
Postfix 2.6.6
Alternative to the Sendmail program
ImageMagick 6.6.0-7
ImageMagick image processing studio
Phorum 5.2.15
Web based discussion software written in PHP.
Gnucash 2.3.13
A full-featured application to keep track of your finances.
Wine 1.1.41
Free implementation of Windows on Unix
NVidia driver 195.36.15
Linux unified nVidia driver
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.

Vulnerability Management for Dummies

Get all the Facts and See How to Implement a Successful Vulnerability Management Program.

Website Magazine

Has tapped premier talent in the Internet industry for our content and each and every issue will contain practical advice and insights for website owners.

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