summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2015-12-01 13:24:16 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2015-12-01 13:24:16 +0000
commitdf8b2ecb441fd555e09f53d05d7b0eef394cdb82 (patch)
treeaae9af9fc466b1af60ac42e17f45358d151d8f0e
parent5ed34374469b5ce6d22bf3b6545327d341b158b5 (diff)
parentcbff3abd8ecaa7b8e6a47457e0a5e562dbfc2cad (diff)
downloadillumos-joyent-df8b2ecb441fd555e09f53d05d7b0eef394cdb82.tar.gz
[illumos-gate merge]
commit cbff3abd8ecaa7b8e6a47457e0a5e562dbfc2cad 6457 ucopystr can't find its way home commit 7a5aac98bc37534537d4896efd4efd30627d221e 3252 Need a proper flock() implementation Conflicts: usr/src/uts/common/os/flock.c usr/src/man/man3c/flock.3c usr/src/man/man2/fcntl.2 usr/src/lib/libbc/libc/sys/common/flock.c
-rw-r--r--usr/src/lib/libbc/libc/sys/common/flock.c7
-rw-r--r--usr/src/lib/libc/port/llib-lc1
-rw-r--r--usr/src/lib/libc/port/mapfile-vers6
-rw-r--r--usr/src/man/man2/fcntl.29
-rw-r--r--usr/src/man/man3c/flock.3c6
-rw-r--r--usr/src/man/man3c/lockf.3c6
-rw-r--r--usr/src/pkg/manifests/system-library.man3c.inc1
-rw-r--r--usr/src/uts/common/os/flock.c2
8 files changed, 13 insertions, 25 deletions
diff --git a/usr/src/lib/libbc/libc/sys/common/flock.c b/usr/src/lib/libbc/libc/sys/common/flock.c
index 9c5f17e77d..db3525236a 100644
--- a/usr/src/lib/libbc/libc/sys/common/flock.c
+++ b/usr/src/lib/libbc/libc/sys/common/flock.c
@@ -28,7 +28,8 @@
#include <sys/file.h>
#include <sys/fcntl.h>
-int flock(fd, operation)
+int
+flock(fd, operation)
int fd, operation;
{
struct flock fl;
@@ -44,7 +45,7 @@ int fd, operation;
fl.l_type |= F_RDLCK;
if (operation & LOCK_EX)
fl.l_type |= F_WRLCK;
- if (operation & LOCK_NB)
+ if (operation & LOCK_NB)
cmd = F_FLOCK;
- return(bc_fcntl(fd, cmd, &fl));
+ return (bc_fcntl(fd, cmd, &fl));
}
diff --git a/usr/src/lib/libc/port/llib-lc b/usr/src/lib/libc/port/llib-lc
index 41c7ecf879..d887a44f37 100644
--- a/usr/src/lib/libc/port/llib-lc
+++ b/usr/src/lib/libc/port/llib-lc
@@ -27,6 +27,7 @@
* Copyright 2014 Garrett D'Amore <garrett@damore.org>
* Copyright 2015 Joyent, Inc.
* Copyright 2015 Circonus, Inc. All rights reserved.
+ * Copyright 2015 Joyent, Inc.
*/
/* LINTLIBRARY */
diff --git a/usr/src/lib/libc/port/mapfile-vers b/usr/src/lib/libc/port/mapfile-vers
index 4388dcc00d..5c1cfa05d5 100644
--- a/usr/src/lib/libc/port/mapfile-vers
+++ b/usr/src/lib/libc/port/mapfile-vers
@@ -93,6 +93,11 @@ $if _x86 && _ELF64
$add amd64
$endif
+SYMBOL_VERSION ILLUMOS_0.19 { # flock
+ protected:
+ flock;
+} ILLUMOS_0.18;
+
SYMBOL_VERSION ILLUMOS_0.18 { # signalfd
protected:
signalfd;
@@ -2888,7 +2893,6 @@ $endif
_findiop;
__fini_daemon_priv;
_finite;
- flock;
_fork1 { FLAGS = NODYNSORT };
_forkall { FLAGS = NODYNSORT };
_fpclass;
diff --git a/usr/src/man/man2/fcntl.2 b/usr/src/man/man2/fcntl.2
index 2e9685d0a6..3f7f1797ba 100644
--- a/usr/src/man/man2/fcntl.2
+++ b/usr/src/man/man2/fcntl.2
@@ -25,7 +25,6 @@ fcntl \- file control
.fi
.SH DESCRIPTION
-.sp
.LP
The \fBfcntl()\fR function provides for control over open files. The
\fIfildes\fR argument is an open file descriptor.
@@ -389,6 +388,7 @@ return from the process' signal handler, \fBfcntl()\fR will return \fB\(mi1\fR
with \fBerrno\fR set to \fBEINTR\fR, and the lock operation will not be done.
.RE
+.SH FILE LOCKING
.sp
.ne 2
.na
@@ -427,7 +427,6 @@ Remove an existing share reservation.
.RE
.SH FILE LOCKING
-.sp
.LP
Two types of file locks are supported: POSIX-style and OFD-style. OFD-style
locks are associated with the open file description (not descriptor) instead
@@ -583,7 +582,6 @@ and error value apply only to POSIX-style locks. No deadlock detection is
performed when attempting to set an OFD-style lock.
.SH SHARE RESERVATIONS
-.sp
.LP
File share reservations are an advisory form of access control among
cooperating processes, on both local and remote machines. They are most often
@@ -695,7 +693,6 @@ Do not deny read or write access to any other process.
.RE
.SH RETURN VALUES
-.sp
.LP
Upon successful completion, the value returned depends on \fIcmd\fR as follows:
.sp
@@ -914,7 +911,6 @@ Value other than \fB\(mi1\fR\&.
Otherwise, \fB\(mi1\fR is returned and \fBerrno\fR is set to indicate the
error.
.SH ERRORS
-.sp
.LP
The \fBfcntl()\fR function will fail if:
.sp
@@ -1111,7 +1107,6 @@ detected.
.RE
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -1129,7 +1124,6 @@ MT-Level Async-Signal Safe
.TE
.SH SEE ALSO
-.sp
.LP
\fBlockd\fR(1M), \fBchmod\fR(2), \fBclose\fR(2), \fBcreat\fR(2), \fBdup\fR(2),
\fBexec\fR(2), \fBfork\fR(2), \fBmmap\fR(2), \fBopen\fR(2), \fBpipe\fR(2),
@@ -1140,7 +1134,6 @@ MT-Level Async-Signal Safe
.LP
\fIProgramming Interfaces Guide\fR
.SH NOTES
-.sp
.LP
In the past, the variable \fBerrno\fR was set to \fBEACCES\fR rather than
\fBEAGAIN\fR when a section of a file is already locked by another process.
diff --git a/usr/src/man/man3c/flock.3c b/usr/src/man/man3c/flock.3c
index a0953f67f9..66e9bedde3 100644
--- a/usr/src/man/man3c/flock.3c
+++ b/usr/src/man/man3c/flock.3c
@@ -26,7 +26,6 @@ flock \- OFD(open file description)-style file locking
.fi
.SH DESCRIPTION
-.sp
.LP
The \fBflock()\fR function allows advisory locks to be applied to and removed
from a file. Calls to \fBflock()\fR from callers that attempt to lock
@@ -79,12 +78,10 @@ Sleeping on a resource is interrupted with any signal. The \fBalarm\fR(2)
function may be used to provide a timeout facility in applications that require
this facility.
.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 \fBflock()\fR function will fail if:
.sp
@@ -165,7 +162,6 @@ supported.
.RE
.SH USAGE
-.sp
.LP
File-locking should not be used in combination with the \fBfopen\fR(3C),
\fBfread\fR(3C), \fBfwrite\fR(3C) and other \fBstdio\fR functions. Instead,
@@ -184,7 +180,6 @@ Locks created by this facility conflict with those created by the
removed OFD-style locks; see \fBfcntl\fR(2) for information about the
interaction between OFD-style and POSIX-style file locks.
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -202,7 +197,6 @@ MT-Level MT-Safe
.TE
.SH SEE ALSO
-.sp
.LP
\fBIntro\fR(2), \fBalarm\fR(2), \fBchmod\fR(2), \fBclose\fR(2), \fBcreat\fR(2),
\fBfcntl\fR(2), \fBmmap\fR(2), \fBopen\fR(2), \fBread\fR(2), \fBwrite\fR(2),
diff --git a/usr/src/man/man3c/lockf.3c b/usr/src/man/man3c/lockf.3c
index 818dab24a2..53d607a4f1 100644
--- a/usr/src/man/man3c/lockf.3c
+++ b/usr/src/man/man3c/lockf.3c
@@ -20,7 +20,6 @@ lockf \- POSIX-style record locking on files
.fi
.SH DESCRIPTION
-.sp
.LP
The \fBlockf()\fR function allows sections of a file to be locked; advisory or
mandatory write locks depending on the mode bits of the file (see
@@ -120,12 +119,10 @@ Sleeping on a resource is interrupted with any signal. The \fBalarm\fR(2)
function may be used to provide a timeout facility in applications that require
this facility.
.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 \fBlockf()\fR function will fail if:
.sp
@@ -234,7 +231,6 @@ supported.
.RE
.SH USAGE
-.sp
.LP
Record-locking should not be used in combination with the \fBfopen\fR(3C),
\fBfread\fR(3C), \fBfwrite\fR(3C) and other \fBstdio\fR functions. Instead,
@@ -251,7 +247,6 @@ applications requiring it.
The \fBlockf()\fR function has a transitional interface for 64-bit file
offsets. See \fBlf64\fR(5).
.SH ATTRIBUTES
-.sp
.LP
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp
@@ -269,7 +264,6 @@ MT-Level MT-Safe
.TE
.SH SEE ALSO
-.sp
.LP
\fBIntro\fR(2), \fBalarm\fR(2), \fBchmod\fR(2), \fBclose\fR(2), \fBcreat\fR(2),
\fBfcntl\fR(2), \fBmmap\fR(2), \fBopen\fR(2), \fBread\fR(2), \fBwrite\fR(2),
diff --git a/usr/src/pkg/manifests/system-library.man3c.inc b/usr/src/pkg/manifests/system-library.man3c.inc
index 30999ee484..cfe418f7cf 100644
--- a/usr/src/pkg/manifests/system-library.man3c.inc
+++ b/usr/src/pkg/manifests/system-library.man3c.inc
@@ -126,6 +126,7 @@ file path=usr/share/man/man3c/fgetc.3c
file path=usr/share/man/man3c/fgetpos.3c
file path=usr/share/man/man3c/fgetwc.3c
file path=usr/share/man/man3c/floating_to_decimal.3c
+file path=usr/share/man/man3c/flock.3c
file path=usr/share/man/man3c/flockfile.3c
file path=usr/share/man/man3c/fmtmsg.3c
file path=usr/share/man/man3c/fnmatch.3c
diff --git a/usr/src/uts/common/os/flock.c b/usr/src/uts/common/os/flock.c
index 25321c4a2b..884de65fe8 100644
--- a/usr/src/uts/common/os/flock.c
+++ b/usr/src/uts/common/os/flock.c
@@ -525,7 +525,7 @@ ofdcleanlock(file_t *fp)
*
* Because these locks are only assoiciated with a pid they are per-process.
* This is why any close will drop the lock and is also why once the process
- * forks then the lock is no long related to the new process. These locks can
+ * forks then the lock is no longer related to the new process. These locks can
* be considered as pid-ful.
*
* See ofdlock() for the implementation of a similar but improved locking