Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jan 2014 11:15:41 GMT
From:      Fernando <fernando.apesteguia@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/186187: [linprocfs] [patch] emulate /proc/sys/kernel/random/uuid
Message-ID:  <201401281115.s0SBFfFp096892@oldred.freebsd.org>
Resent-Message-ID: <201401281120.s0SBK0xQ068182@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         186187
>Category:       kern
>Synopsis:       [linprocfs] [patch] emulate /proc/sys/kernel/random/uuid
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 28 11:20:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator:     Fernando
>Release:        9.1-RELEASE
>Organization:
>Environment:
>Description:
This patch implements /proc/sys/kernel/random/uuid for the linuxulator.

This is related to kern/183615 but the original submitter of the PR doesn't seem to be interested...
>How-To-Repeat:
Try to open that file under compat linux
>Fix:
Apply the attached patch.

Patch attached with submission follows:

--- compat/linprocfs/linprocfs.c.orig	2013-11-06 18:59:41.000000000 +0100
+++ compat/linprocfs/linprocfs.c	2013-11-06 23:56:22.000000000 +0100
@@ -72,6 +72,7 @@
 #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>
@@ -1347,6 +1348,23 @@
 	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
  */
@@ -1445,6 +1463,8 @@
 	    NULL, NULL, NULL, PFS_RD);
 	pfs_create_file(dir, "sem", &linprocfs_dosem,
 	    NULL, NULL, NULL, PFS_RD);
+	pfs_create_file(dir, "random", &linprocfs_douuid,
+	    NULL, NULL, NULL, PFS_RD);
 
 	return (0);
 }


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401281115.s0SBFfFp096892>