'\" te .\" Copyright 1989 AT&T. Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved. .TH plock 3C "22 Mar 2004" "SunOS 5.11" "Standard C Library Functions" .SH NAME plock \- lock or unlock into memory process, text, or data .SH SYNOPSIS .LP .nf #include \fBint\fR \fBplock\fR(\fBint\fR \fIop\fR); .fi .SH DESCRIPTION .sp .LP The \fBplock()\fR function allows the calling process to lock or unlock into memory its text segment (text lock), its data segment (data lock), or both its text and data segments (process lock). Locked segments are immune to all routine swapping. The effective user ID of the calling process must be super-user to use this call. .sp .LP The \fBplock()\fR function performs the function specified by \fIop\fR: .sp .ne 2 .mk .na \fB\fBPROCLOCK\fR\fR .ad .RS 12n .rt Lock text and data segments into memory (process lock). .RE .sp .ne 2 .mk .na \fB\fBTXTLOCK\fR\fR .ad .RS 12n .rt Lock text segment into memory (text lock). .RE .sp .ne 2 .mk .na \fB\fBDATLOCK\fR\fR .ad .RS 12n .rt Lock data segment into memory (data lock). .RE .sp .ne 2 .mk .na \fB\fBUNLOCK\fR\fR .ad .RS 12n .rt Remove locks. .RE .SH RETURN VALUES .sp .LP Upon successful completion, \fB0\fR is returned. Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the error. .SH ERRORS .sp .LP The \fBplock()\fR function fails and does not perform the requested operation if: .sp .ne 2 .mk .na \fB\fBEAGAIN\fR\fR .ad .RS 10n .rt Not enough memory. .RE .sp .ne 2 .mk .na \fB\fBEINVAL\fR\fR .ad .RS 10n .rt The \fIop\fR argument is equal to \fBPROCLOCK\fR and a process lock, a text lock, or a data lock already exists on the calling process; the \fIop\fR argument is equal to \fBTXTLOCK\fR and a text lock or a process lock already exists on the calling process; the \fIop\fR argument is equal to \fBDATLOCK\fR and a data lock or a process lock already exists on the calling process; or the \fIop\fR argument is equal to \fBUNLOCK\fR and no lock exists on the calling process. .RE .sp .ne 2 .mk .na \fB\fBEPERM\fR\fR .ad .RS 10n .rt The {\fBPRIV_PROC_LOCK_MEMORY\fR} privilege is not asserted in the effective set of the calling process. .RE .SH USAGE .sp .LP The \fBmlock\fR(3C) and \fBmlockall\fR(3C) functions are the preferred interfaces for process locking. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBexec\fR(2), \fBexit\fR(2), \fBfork\fR(2), \fBmemcntl\fR(2), \fBmlock\fR(3C), \fBmlockall\fR(3C), \fBattributes\fR(5)