Author: eadler
Date: Thu Feb 27 00:43:10 2014
New Revision: 262539
URL: http://svnweb.freebsd.org/changeset/base/262539
Log:
linprocfs: add support for /sys/kernel/random/uuid
PR: kern/186187
Submitted by: Fernando fernando.apesteg...@gmail.com
MFC After:2 weeks
Modified:
head/sys/compat/linprocfs/linprocfs.c
head/usr.bin/makewhatis/makewhatis.1
head/usr.bin/makewhatis/makewhatis.c
Modified: head/sys/compat/linprocfs/linprocfs.c
==
--- head/sys/compat/linprocfs/linprocfs.c Wed Feb 26 23:03:10 2014
(r262538)
+++ head/sys/compat/linprocfs/linprocfs.c Thu Feb 27 00:43:10 2014
(r262539)
@@ -72,6 +72,7 @@ __FBSDID($FreeBSD$);
#include sys/time.h
#include sys/tty.h
#include sys/user.h
+#include sys/uuid.h
#include sys/vmmeter.h
#include sys/vnode.h
#include sys/bus.h
@@ -1337,6 +1338,22 @@ linprocfs_dofdescfs(PFS_FILL_ARGS)
return (0);
}
+
+/*
+ * Filler function for proc/sys/kernel/random/uuid
+ */
+static int
+linprocfs_douuid(PFS_FILL_ARGS)
+{
+ struct uuid uuid;
+
+ kern_uuidgen(uuid, 1);
+ sbuf_printf_uuid(sb, uuid);
+ sbuf_printf(sb, \n);
+ return(0);
+}
+
+
/*
* Constructor
*/
@@ -1436,6 +1453,11 @@ linprocfs_init(PFS_INIT_ARGS)
pfs_create_file(dir, sem, linprocfs_dosem,
NULL, NULL, NULL, PFS_RD);
+ /* /proc/sys/kernel/random/... */
+ dir = pfs_create_dir(dir, random, NULL, NULL, NULL, 0);
+ pfs_create_file(dir, uuid, linprocfs_douuid,
+ NULL, NULL, NULL, PFS_RD);
+
return (0);
}
Modified: head/usr.bin/makewhatis/makewhatis.1
==
--- head/usr.bin/makewhatis/makewhatis.1Wed Feb 26 23:03:10 2014
(r262538)
+++ head/usr.bin/makewhatis/makewhatis.1Thu Feb 27 00:43:10 2014
(r262539)
@@ -24,12 +24,12 @@
.\
.\ $FreeBSD$
.\
-.Dd December 3, 2005
-.Dt MAKEWHATIS 1
+.Dd December 8, 2013
+.Dt MAKEWHATIS 8
.Os
.Sh NAME
.Nm makewhatis
-.Nd create whatis database
+.Nd create whatis database
.Sh SYNOPSIS
.Nm
.Op Fl a
@@ -98,9 +98,6 @@ option is used.
.It Ev MACHINE
If set, its value is used to override the current
machine type when searching machine specific subdirectories.
-.It Ev MACHINE_ARCH
-If set, its value is used to override the current
-architecture when searching architecture specific subdirectories.
.It Ev MANPATH
Determines the set of directories to be processed if none are given on
the command line.
@@ -133,4 +130,6 @@ program was originally written in Perl a
The current version of
.Nm
was rewritten in C by
-.An John Rochester .
+.An John Rochester
+with additional contributions by
+.An Franco Fichtner Aq Mt fra...@lastsummer.de .
Modified: head/usr.bin/makewhatis/makewhatis.c
==
--- head/usr.bin/makewhatis/makewhatis.cWed Feb 26 23:03:10 2014
(r262538)
+++ head/usr.bin/makewhatis/makewhatis.cThu Feb 27 00:43:10 2014
(r262539)
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2002 John Rochester
+ * Copyright (c) 2013 Franco Fichtner fra...@lastsummer.de
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,21 +25,19 @@
* 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.
+ *
+ * $FreeBSD$
*/
-#include sys/cdefs.h
-__FBSDID($FreeBSD$);
-
+#include sys/tree.h
#include sys/types.h
-#include sys/stat.h
#include sys/param.h
#include sys/queue.h
-#include sys/utsname.h
+#include sys/stat.h
#include ctype.h
#include dirent.h
#include err.h
-#include stddef.h
#include stdio.h
#include stdlib.h
#include string.h
@@ -52,16 +51,56 @@ __FBSDID($FreeBSD$);
static char blank[] = ;
/*
- * Information collected about each man page in a section.
+ * Information collected about each man page alias.
+ */
+struct page_alias {
+ RB_ENTRY(page_alias) entry;
+ char *filename;
+ char *name;
+ char *suffix;
+ int gzipped;
+};
+
+/*
+ * Information collected about each unique man page.
*/
struct page_info {
- char * filename;
- char * name;
- char * suffix;
- int gzipped;
- ino_t inode;
+ RB_HEAD(page_alias_tree, page_alias) head;
+ RB_ENTRY(page_info) entry;
+ ino_t inode;
};
+static RB_HEAD(page_info_tree, page_info) page_head =
RB_INITIALIZER(page_head);
+
+/*
+ * Sorts page info by inode number.
+ */
+static int
+infosort(const struct page_info *a, const struct page_info *b)
+{
+ return (memcmp(a-inode, b-inode, sizeof(a-inode)));
+}
+
+RB_PROTOTYPE(page_info_tree, page_info, entry, infosort);
+RB_GENERATE(page_info_tree,