]> git.pld-linux.org Git - packages/man-pages.git/commitdiff
- orphaned, outdated
authorJan Rękorajski <baggins@pld-linux.org>
Fri, 21 Apr 2006 23:41:32 +0000 (23:41 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    semget.2 -> 1.2
    shmctl.2 -> 1.2
    shmop.2 -> 1.2
    truncate.2 -> 1.2

semget.2 [deleted file]
shmctl.2 [deleted file]
shmop.2 [deleted file]
truncate.2 [deleted file]

diff --git a/semget.2 b/semget.2
deleted file mode 100644 (file)
index a23c016..0000000
--- a/semget.2
+++ /dev/null
@@ -1,271 +0,0 @@
-.\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
-.\"
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
-.\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one
-.\" 
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\" 
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\"
-.\" Modified Tue Oct 22 17:54:56 1996 by Eric S. Raymond <esr@thyrsus.com>
-.\" Modified 1 Jan 2002, Martin Schulze <joey@infodrom.org>
-.\" Modified 4 Jan 2002, Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
-.\"
-.TH SEMGET 2 2002-01-04 "Linux 2.5" "Linux Programmer's Manual" 
-.SH NAME
-semget \- get a semaphore set identifier
-.SH SYNOPSIS
-.nf
-.B
-#include <sys/types.h>
-.B
-#include <sys/ipc.h>
-.B
-#include <sys/sem.h>
-.fi
-.sp
-.BI "int semget(key_t " key ,
-.BI "int " nsems ,
-.BI "int " semflg );
-.SH DESCRIPTION
-This function returns the semaphore set identifier
-associated with the argument
-.IR key .
-A new set of
-.I nsems
-semaphores is created if
-.I key
-has the value
-.B IPC_PRIVATE
-or if no existing semaphore set is associated to
-.I key
-and
-.B IPC_CREAT
-is asserted in
-.I semflg
-(i.e.
-.IR semflg " &"
-.B IPC_CREAT
-isn't zero).
-.PP
-The presence in
-.I semflg
-of the fields
-.B IPC_CREAT
-and
-.B IPC_EXCL
-plays the same role, with respect to the existence
-of the semaphore set, as the presence
-of
-.B O_CREAT
-and
-.B O_EXCL
-in the mode argument of the
-.BR open (2)
-system call: i.e. the
-.B semget
-function fails if
-.I semflg
-asserts both
-.B IPC_CREAT
-and
-.B IPC_EXCL
-and a semaphore set already exists for
-.IR key .
-.PP
-Upon creation, the low-order 9 bits of the argument
-.I semflg
-define the access permissions (for owner, group and others)
-for the semaphore set.
-These bits have the same format, and the same
-meaning, as the mode argument in the
-.BR open (2)
-or
-.BR creat (2)
-system calls (though the execute permissions are
-not meaningful for semaphores, and write permissions mean permission
-to alter semaphore values).
-.PP
-When creating a new semaphore set,
-.B semget
-initializes the semaphore set's associated data structure
-.B semid_ds
-as follows:
-.IP
-.B sem_perm.cuid
-and
-.B sem_perm.uid
-are set to the effective user\-ID of the calling process.
-.IP
-.B sem_perm.cgid
-and
-.B sem_perm.gid
-are set to the effective group\-ID of the calling process.
-.IP
-The low-order 9 bits of
-.B sem_perm.mode
-are set to the low-order 9 bits of
-.IR semflg .
-.IP
-.B sem_nsems
-is set to the value of
-.IR nsems .
-.IP
-.B sem_otime
-is set to 0.
-.IP
-.B sem_ctime
-is set to the current time.
-.PP
-The argument
-.I nsems
-can be
-.B 0
-(a don't care)
-when a semaphore set is not being created.
-Otherwise
-.I nsems
-must be greater than
-.B 0
-and less than or equal to the maximum number of semaphores per semaphore set
-.RB ( SEMMSL ).
-.PP
-If the semaphore set already exists, the access permissions are
-verified.
-.\" and a check is made to see if it is marked for destruction.
-.SH "RETURN VALUE"
-If successful, the return value will be the semaphore set identifier
-(a nonnegative integer), otherwise
-.B \-1
-is returned, with
-.I errno
-indicating the error.
-.SH ERRORS
-On failure
-.I errno
-will be set to one of the following:
-.TP 11
-.B EACCES
-A semaphore set exists for
-.IR key ,
-but the calling process does not have permission to access the set.
-.TP
-.B EEXIST
-A semaphore set exists for
-.B key
-and
-.I semflg
-was asserting both
-.B IPC_CREAT
-and
-.BR IPC_EXCL .
-.\" .TP
-.\" .B EIDRM
-.\" The semaphore set is marked to be deleted.
-.TP
-.B ENOENT
-No semaphore set exists for
-.I key
-and
-.I semflg
-wasn't asserting
-.BR IPC_CREAT .
-.TP
-.B EINVAL
-.IR nsems
-is less than 0 or greater than the limit on the number
-of semaphores per semaphore set
-.RB ( SEMMSL ),
-or a semaphore set corresponding to
-.I key
-already exists, and
-.I nsems
-is larger than the number of semaphores in that set.
-.TP
-.B ENOMEM
-A semaphore set has to be created but the system has not enough memory for
-the new data structure.
-.TP
-.B ENOSPC
-A semaphore set has to be created but the system limit for the maximum
-number of semaphore sets
-.RB ( SEMMNI ),
-or the system wide maximum number of semaphores
-.RB ( SEMMNS ),
-would be exceeded.
-.SH NOTES
-.B IPC_PRIVATE
-isn't a flag field but a
-.B key_t
-type.
-If this special value is used for
-.IR key ,
-the system call ignores everything but the low-order 9 bits of
-.I semflg
-and creates a new semaphore set (on success).
-.PP
-The followings are limits on semaphore set resources affecting a
-.B semget
-call:
-.TP 11
-.B SEMMNI
-System wide maximum number of semaphore sets: policy dependent.
-.TP
-.B SEMMSL
-Maximum number of semaphores per semid: implementation dependent
-(500 currently).
-.TP
-.B SEMMNS
-System wide maximum number of semaphores: policy dependent.
-Values greater than
-.B SEMMSL * SEMMNI
-makes it irrelevant.
-.SH BUGS
-Use of
-.B IPC_PRIVATE
-doesn't inhibit to other processes the access to the allocated
-semaphore set.
-.PP
-As for the files, there is currently no intrinsic way for a process to ensure
-exclusive access to a semaphore set.
-Asserting both
-.B IPC_CREAT
-and
-.B IPC_EXCL
-in
-.I semflg
-only ensures (on success) that a new semaphore set will be created,
-it doesn't imply exclusive access to the semaphore set.
-.PP
-The data structure associated with each semaphore in the set
-isn't initialized by the system call.
-In order to initialize those data structures, one has to execute a
-subsequent call to
-.BR semctl (2)
-to perform a
-.B SETVAL
-or a
-.B SETALL
-command on the semaphore set.
-.SH "CONFORMING TO"
-SVr4, SVID.
-SVr4 documents additional error conditions EFBIG, E2BIG, EAGAIN,
-ERANGE, EFAULT.
-.SH "SEE ALSO"
-.BR ftok (3),
-.BR ipc (5),
-.BR semctl (2),
-.BR semop (2)
diff --git a/shmctl.2 b/shmctl.2
deleted file mode 100644 (file)
index 1e408d6..0000000
--- a/shmctl.2
+++ /dev/null
@@ -1,185 +0,0 @@
-.\" Copyright (c) 1993 Luigi P. Bai (lpb@softint.com) July 28, 1993
-.\"
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
-.\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one
-.\" 
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\" 
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\"
-.\" Modified Wed Jul 28 11:03:24 1993, Rik Faith <faith@cs.unc.edu>
-.\" Modified Sun Nov 28 16:43:30 1993, Rik Faith <faith@cs.unc.edu>
-.\"          with material from Giorgio Ciucci <giorgio@crcc.it>
-.\" Portions Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
-.\" Modified Fri Jan 31 17:24:31 1997 by Eric S. Raymond <esr@thyrsus.com>
-.\" Modified Sun Feb 18 01:59:29 2001 by Andries Brouwer <aeb@cwi.nl>
-.\" Modified 5 Jan 2002 Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
-.\"
-.TH SHMCTL 2 2002-01-05 "Linux 2.4.1" "Linux Programmer's Manual"
-.SH NAME
-shmctl \- shared memory control
-.SH SYNOPSIS
-.ad l
-.B #include <sys/ipc.h>
-.sp
-.B #include <sys/shm.h>
-.sp
-.BI "int shmctl(int " shmid ", int " cmd ", struct shmid_ds *" buf );
-.ad b
-.SH DESCRIPTION
-\fBshmctl()\fP
-allows the user to receive information on a shared memory segment,
-set the owner, group, and permissions of a shared memory segment,
-or destroy a segment. The information about the segment identified by
-\fIshmid\fP is returned in a \fIshmid_ds\fP
-structure:
-.PP
-.in +4n
-.nf
-struct shmid_ds {
-    struct ipc_perm shm_perm;  /* operation perms */
-    int shm_segsz;             /* size of segment (bytes) */
-    time_t shm_atime;          /* last attach time */
-    time_t shm_dtime;          /* last detach time */
-    time_t shm_ctime;          /* last change time */
-    unsigned short shm_cpid;   /* pid of creator */
-    unsigned short shm_lpid;   /* pid of last operator */
-    short shm_nattch;          /* no. of current attaches */
-    ...
-};
-.fi
-.in -4n
-.PP
-The highlighted fields in the member \fIshm_perm\fP can be set:
-.PP
-.in +4n
-.nf
-struct ipc_perm {
-    key_t  key;
-    \fBushort uid\fP;   /* \fBowner\fP euid and egid */
-    \fBushort gid\fP;
-    ushort cuid;  /* creator euid and egid */
-    ushort cgid;
-    \fBushort mode\fP;  /* lower 9 bits of access modes */
-    ushort seq;   /* sequence number */
-};
-.fi
-.in -4n
-.PP
-The following \fIcmds\fP are available:
-.br
-.TP 12
-.B IPC_STAT
-is used to copy the information about the shared memory segment into
-the buffer \fIbuf\fP. The user must have \fBread\fP access to the
-shared memory segment.
-.TP
-.B IPC_SET
-is used to apply the changes the user has made to the \fIuid\fP, \fIgid\fP,
-or \fImode\fP members of the \fIshm_perms\fP field.  Only the lowest 9 bits
-of \fImode\fP are used.  The
-.I shm_ctime
-member is also updated.  The user must be the owner, creator, or the
-super-user.
-.TP
-.B IPC_RMID
-is used to mark the segment as destroyed. It will actually be destroyed
-after the last detach.  (I.e., when the
-.I shm_nattch
-member of the associated structure
-.I shmid_ds
-is zero.)  The user must be the owner, creator, or the super-user.
-.PP
-The user \fImust\fP ensure that a segment is eventually destroyed; otherwise
-its pages that were faulted in will remain in memory or swap.
-.PP
-In addition, the \fBsuper-user\fP can prevent or allow swapping of a shared
-memory segment with the following \fIcmds\fP: (Linux only)
-.br
-.TP 12
-.B SHM_LOCK
-prevents swapping of a shared memory segment. The user must fault in
-any pages that are required to be present after locking is enabled.
-.TP
-.B SHM_UNLOCK
-allows the shared memory segment to be swapped out.
-.PP
-The
-.BR IPC_INFO ,
-.BR SHM_STAT
-and
-.B SHM_INFO
-control calls are used by the
-.BR ipcs (8)
-program to provide information on allocated resources.  In the future,
-these may be modified as needed or moved to a proc file system interface.
-.SH "RETURN VALUE"
-0 is returned on success, \-1 on error.
-.SH ERRORS
-On error,
-.B errno
-will be set to one of the following:
-.TP 12
-.B EACCES
-is returned if \fBIPC_STAT\fP is requested and
-\fIshm_perm.modes\fP does not allow read access for
-.IR msqid .
-.TP
-.B EFAULT
-The argument
-.I cmd
-has value
-.B IPC_SET
-or
-.B IPC_STAT
-but the address pointed to by
-.I buf
-isn't accessible.
-.TP
-.B EINVAL
-is returned if \fIshmid\fP is not a valid identifier, or \fIcmd\fP
-is not a valid command.
-.TP
-.B EIDRM
-is returned if \fIshmid\fP points to a removed identifier.
-.TP
-.B EPERM
-is returned if \fBIPC_SET\fP or \fBIPC_RMID\fP is attempted, and the
-effective user ID of the calling process is not the creator
-(as found in
-.IR shm_perm.cuid ),
-the owner
-(as found in
-.IR shm_perm.uid ),
-or the super-user.
-.TP
-.B EOVERFLOW
-is returned if \fBIPC_STAT\fP is attempted, and the gid or uid value
-is too large to be stored in the structure pointed to by
-.IR buf . 
-.SH NOTE
-Various fields in a \fIstruct shmid_ds\fP were shorts under Linux 2.2
-and have become longs under Linux 2.4. To take advantage of this,
-a recompilation under glibc-2.1.91 or later should suffice.
-(The kernel distinguishes old and new calls by a IPC_64 flag in
-.IR cmd .)
-.SH "CONFORMING TO"
-SVr4, SVID.  SVr4 documents additional error conditions EINVAL,
-ENOENT, ENOSPC, ENOMEM, EEXIST.  Neither SVr4 nor SVID documents
-an EIDRM error condition.
-.SH "SEE ALSO"
-.BR shmget (2),
-.BR shmop (2)
diff --git a/shmop.2 b/shmop.2
deleted file mode 100644 (file)
index a42c77f..0000000
--- a/shmop.2
+++ /dev/null
@@ -1,252 +0,0 @@
-.\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
-.\"
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
-.\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one
-.\" 
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\" 
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\"
-.\" Modified Sun Nov 28 17:06:19 1993, Rik Faith (faith@cs.unc.edu)
-.\"          with material from Luigi P. Bai (lpb@softint.com)
-.\" Portions Copyright 1993 Luigi P. Bai
-.\" Modified Tue Oct 22 22:04:23 1996 by Eric S. Raymond <esr@thyrsus.com>
-.\" Modified, 5 Jan 2002, Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
-.\"
-.TH SHMOP 2 2002-01-05 "Linux 2.5" "Linux Programmer's Manual" 
-.SH NAME
-shmop \- shared memory operations
-.SH SYNOPSIS
-.nf
-.B
-#include <sys/types.h>
-.B
-#include <sys/shm.h>
-.fi
-.sp
-.BI "void *shmat(int " shmid ,
-.BI "const void *" shmaddr ,
-.BI "int " shmflg );
-.sp
-.BI "int shmdt(const void *" shmaddr );
-.SH DESCRIPTION
-The function
-.B shmat
-attaches the shared memory segment identified by
-.B shmid
-to the address space of the calling process.
-The attaching address is specified by
-.I shmaddr
-with one of the following criteria:
-.LP
-If
-.I shmaddr
-is
-.BR NULL ,
-the system chooses a suitable (unused) address at which to attach
-the segment.
-.LP
-If
-.I shmaddr
-isn't
-.B NULL
-and
-.B SHM_RND
-is asserted in
-.IR shmflg ,
-the attach occurs at the address equal to
-.I shmaddr
-rounded down to the nearest multiple of
-.BR SHMLBA .
-Otherwise
-.I shmaddr
-must be a page aligned address at which the attach occurs.
-.PP
-If
-.B SHM_RDONLY
-is asserted in
-.IR shmflg ,
-the segment is attached for reading and the process must have
-read permission for the segment.
-Otherwise the segment is attached for read and write
-and the process must have read and write permission for the segment.
-There is no notion of write-only shared memory segment.
-.PP
-The
-.B brk
-value of the calling process is not altered by the attach.
-The segment will automatically be detached at process exit.
-The same segment may be attached as a read and as a read-write
-one, and more than once, in the process's address space.
-.PP
-On a successful
-.B shmat
-call the system updates the members of the
-.B shmid_ds
-structure associated to the shared memory segment as follows:
-.IP
-.B shm_atime
-is set to the current time.
-.IP
-.B shm_lpid
-is set to the process-ID of the calling process.
-.IP
-.B shm_nattch
-is incremented by one.
-.PP
-Note that the attach succeeds also if the shared memory segment is
-marked to be deleted.
-.PP
-The function
-.B shmdt
-detaches the shared memory segment located at the address specified by
-.I shmaddr
-from the address space of the calling process.
-The to\-be\-detached segment must be currently
-attached with
-.I shmaddr
-equal to the value returned by the its attaching
-.B shmat
-call.
-.PP
-On a successful
-.B shmdt
-call the system updates the members of the
-.B shmid_ds
-structure associated with the shared memory segment as follows:
-.IP
-.B shm_dtime
-is set to the current time.
-.IP
-.B shm_lpid
-is set to the process-ID of the calling process.
-.IP
-.B shm_nattch
-is decremented by one.
-If it becomes 0 and the segment is marked for deletion,
-the segment is deleted.
-.PP
-The occupied region in the user space of the calling process is
-unmapped.
-.SH "SYSTEM CALLS"
-.TP
-.B fork()
-After a
-.B fork()
-the child inherits the attached shared memory segments.
-.TP
-.B exec()
-After an
-.B exec()
-all attached shared memory segments are detached from the process.
-.TP
-.B exit()
-Upon
-.B exit()
-all attached shared memory segments are detached from the process.
-.SH "RETURN VALUE"
-On failure both functions return
-.B \-1
-with
-.I errno
-indicating the error.
-On success
-.B shmat
-returns the address of the attached shared memory segment, and
-.B shmdt
-returns
-.BR 0 .
-.SH ERRORS
-When
-.B shmat
-fails,
-.I errno
-is set to one of the following:
-.TP 11
-.B EACCES
-The calling process has no access permissions for the requested attach
-type.
-.TP
-.B EINVAL
-Invalid
-.I shmid
-value, unaligned (i.e., not page-aligned and \fBSHM_RND\fP was not
-specified) or invalid
-.I shmaddr
-value, or failing attach at
-.BR brk .
-.TP
-.B ENOMEM
-Could not allocate memory for the descriptor or for the page tables.
-.PP
-The function
-.B shmdt
-can fail only if there is no shared memory segment attached at
-.IR shmaddr ,
-in such a case at return
-.I errno
-will be set to
-.BR EINVAL .
-.\" Actually the above is what *should* be done, according to POSIX.
-.\" However as at kernel 2.2.19, and 2.4.15, shmdt() never returns an 
-.\" error, even if shmaddr is invalid.  (MTK, Jan 2002)
-.SH NOTES
-Using
-.B shmat
-with
-.I shmaddr
-equal to
-.B NULL
-is the preferred, portable way of attaching a shared memory segment.
-Be aware that the shared memory segment attached in this way
-may be attached at different addresses in different processes.
-Therefore, any pointers maintained within the shared memory must be
-made relative (typically to the starting address of the segment),
-rather than absolute.
-.LP
-The following system parameter affects a
-.B shmat
-system call:
-.TP 11
-.B SHMLBA
-Segment low boundary address multiple.
-Must be page aligned.
-For the current implementation the
-.B SHMBLA
-value is
-.BR PAGE_SIZE .
-.PP
-The implementation has no intrinsic limit to the per\-process maximum
-number of shared memory segments
-.RB ( SHMSEG )
-.SH "CONFORMING TO"
-SVr4, SVID.  SVr4 documents an additional error condition EMFILE.
-In SVID-v4 the type of the \fIshmaddr\fP argument was changed from
-.B "char *"
-into
-.BR "const void *" ,
-and the returned type of \fIshmat\fP() from
-.B "char *"
-into
-.BR "void *" .
-(Linux libc4 and libc5 have the
-.B "char *"
-prototypes; glibc2 has
-.BR "void *" .)
-.SH "SEE ALSO"
-.BR ipc (5),
-.BR shmctl (2),
-.BR shmget (2)
diff --git a/truncate.2 b/truncate.2
deleted file mode 100644 (file)
index 4ab316f..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-.\" Copyright (c) 1983, 1991 The Regents of the University of California.
-.\" All rights reserved.
-.\"
-.\" Redistribution and use in source and binary forms, with or without
-.\" modification, are permitted provided that the following conditions
-.\" are met:
-.\" 1. Redistributions of source code must retain the above copyright
-.\"    notice, this list of conditions and the following disclaimer.
-.\" 2. Redistributions in binary form must reproduce the above copyright
-.\"    notice, this list of conditions and the following disclaimer in the
-.\"    documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\"    must display the following acknowledgement:
-.\"    This product includes software developed by the University of
-.\"    California, Berkeley and its contributors.
-.\" 4. Neither the name of the University nor the names of its contributors
-.\"    may be used to endorse or promote products derived from this software
-.\"    without specific prior written permission.
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-.\" SUCH DAMAGE.
-.\"
-.\"     @(#)truncate.2 6.9 (Berkeley) 3/10/91
-.\"
-.\" Modified Sat Jul 24 12:46:33 1993 by Rik Faith <faith@cs.unc.edu>
-.\" Modified Tue Oct 22 22:36:33 1996 by Eric S. Raymond <esr@thyrsus.com>
-.\" Modified Mon Dec 21 13:37:05 1998 by Andries Brouwer <aeb@cwi.nl>
-.\" Modified 7 Jan 2002, Michael Kerrisk <mtk16@ext.canterbury.ac.nz>
-.\"
-.TH TRUNCATE 2 1998-12-21 "" "Linux Programmer's Manual"
-.SH NAME
-truncate, ftruncate \- truncate a file to a specified length
-.SH SYNOPSIS
-.B #include <unistd.h>
-.sp
-.BI "int truncate(const char *" path ", off_t " length );
-.br
-.BI "int ftruncate(int " fd ", off_t " length );
-.SH DESCRIPTION
-The
-.B truncate
-and
-.B ftruncate
-functions cause the regular file named by
-.I path
-or referenced by
-.I fd
-to be truncated to a size of precisely
-.I length
-bytes.
-.LP
-If the file previously was larger than this size, the extra data is lost. 
-If the file previously was shorter, it is extended, and
-the extended part reads as zero bytes.
-.LP
-The file pointer is not changed.
-.LP
-With
-.BR ftruncate ,
-the file must be open for writing; with
-.BR truncate ,
-the file must be writable.
-.SH "RETURN VALUE"
-On success, zero is returned.  On error, \-1 is returned, and
-.I errno
-is set appropriately.
-.SH ERRORS
-For
-.BR truncate :
-.TP
-.B EACCES
-Search permission is denied for a component of the path prefix,
-or the named file is not writable by the user.
-.TP
-.B EFAULT
-.I Path
-points outside the process's allocated address space.
-.TP
-.B EFBIG
-The argument
-.I length
-is larger than the maximum file size. (XSI)
-.TP
-.B EINTR
-A signal was caught during execution.
-.TP
-.B EINVAL
-The argument
-.I length
-is negative or larger than the maximum file size.
-.TP
-.B EIO
-An I/O error occurred updating the inode.
-.TP
-.B EISDIR
-The named file is a directory.
-.TP
-.B ELOOP
-Too many symbolic links were encountered in translating the pathname.
-.TP
-.B ENAMETOOLONG
-A component of a pathname exceeded 255 characters,
-or an entire path name exceeded 1023 characters.
-.TP
-.B ENOENT
-The named file does not exist.
-.TP
-.B ENOTDIR
-A component of the path prefix is not a directory.
-.TP
-.B EROFS
-The named file resides on a read-only file system.
-.TP
-.B ETXTBSY
-The file is a pure procedure (shared text) file that is being executed.
-.PP
-For
-.B ftruncate
-the same errors apply, but instead of things that can be wrong with
-.IR path ,
-we now have things that can be wrong with
-.IR fd :
-.TP
-.B EBADF
-The
-.I fd
-is not a valid descriptor.
-.TP
-.BR EBADF " or " EINVAL
-The
-.I fd
-is not open for writing.
-.TP
-.B EINVAL
-The
-.I fd
-does not reference a regular file.
-.SH "CONFORMING TO"
-4.4BSD, SVr4 (these function calls first appeared in BSD 4.2).
-POSIX 1003.1-1996 has
-.BR ftruncate .
-POSIX 1003.1-2001 also has
-.IR truncate ,
-as an XSI extension.
-.LP
-SVr4 documents additional
-.B truncate
-error conditions EMFILE, EMULTIHP, ENFILE, ENOLINK.  SVr4 documents for
-.B ftruncate
-an additional EAGAIN error condition.
-.SH NOTES
-The above description is for XSI-compliant systems.
-For non-XSI-compliant systems, the POSIX standard allows
-two behaviours for
-.B ftruncate
-when
-.I length
-exceeds the file length
-(note that
-.B truncate
-is not specified at all in such an environment):
-either returning an error, or extending the file.
-(Most Unices follow the XSI requirement.)
-.\" At the very least: OSF/1, Solaris 7, and FreeBSD conform, mtk, Jan 2002
-.SH "SEE ALSO"
-.BR open (2)
This page took 0.072331 seconds and 4 git commands to generate.