Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/sys EV_SET(2) - simplify description



details:   https://anonhg.NetBSD.org/src/rev/18fd1959eee5
branches:  trunk
changeset: 824512:18fd1959eee5
user:      kamil <kamil%NetBSD.org@localhost>
date:      Wed Jun 07 20:54:59 2017 +0000

description:
EV_SET(2) - simplify description

Note only the information that it does not evaluate multiple times its
parameters.

Suggested by <wiz>.

diffstat:

 lib/libc/sys/kqueue.2 |  18 ++++--------------
 1 files changed, 4 insertions(+), 14 deletions(-)

diffs (38 lines):

diff -r 163e3f7d0af5 -r 18fd1959eee5 lib/libc/sys/kqueue.2
--- a/lib/libc/sys/kqueue.2     Wed Jun 07 15:24:50 2017 +0000
+++ b/lib/libc/sys/kqueue.2     Wed Jun 07 20:54:59 2017 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: kqueue.2,v 1.44 2017/06/07 05:26:19 abhinav Exp $
+.\"    $NetBSD: kqueue.2,v 1.45 2017/06/07 20:54:59 kamil Exp $
 .\"
 .\" Copyright (c) 2000 Jonathan Lemon
 .\" All rights reserved.
@@ -156,18 +156,7 @@
 .Pp
 .Fn EV_SET
 is a macro which is provided for ease of initializing a kevent structure.
-It wraps an internal static inline function to prevent preprocessor misuse.
-In the past this code would behave incorrectly and damage process's memory,
-if incrementation or decrementation would be used as the first argument.
-This example has been taken from LLDB, that caused the memory corruption and
-inspired the
-.Nx
-developers for improving the implementation.
-.Bd -literal -offset indent
-EV_SET(&in_events[i++], fd.first, EVFILT_READ, EV_ADD, 0, 0, 0);
-.Ed
-.Pp
-This macro is now safe in all major BSDs.
+This macro does not evaluate its parameters multiple times.
 .Pp
 The
 .Va kevent
@@ -681,6 +670,7 @@
 function first appeared in
 .Nx 6.0 .
 .Pp
+The
 .Fn EV_SET
-was converted from a macro implementation to the macro wrapping a static inline function in
+macro was protected from evaluating multiple times the first argument in
 .Nx 8.0 .



Home | Main Index | Thread Index | Old Index