Page MenuHomeFreeBSD

D20333.1795248426.diff
No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None

D20333.1795248426.diff

Index: sys/compat/linux/linux.h
===================================================================
--- sys/compat/linux/linux.h
+++ sys/compat/linux/linux.h
@@ -140,4 +140,7 @@
int linux_to_bsd_signal(int sig);
int bsd_to_linux_signal(int sig);
+void linux_dev_shm_create(void);
+void linux_dev_shm_destroy(void);
+
#endif /* _LINUX_MI_H_ */
Index: sys/compat/linux/linux.c
===================================================================
--- sys/compat/linux/linux.c
+++ sys/compat/linux/linux.c
@@ -31,6 +31,7 @@
#include <sys/param.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <sys/ctype.h>
#include <sys/jail.h>
#include <sys/lock.h>
@@ -126,6 +127,12 @@
SIGSYS /* LINUX_SIGSYS */
};
+static struct cdev *dev_shm_cdev;
+static struct cdevsw dev_shm_cdevsw = {
+ .d_version = D_VERSION,
+ .d_name = "dev_shm",
+};
+
/*
* Map Linux RT signals to the FreeBSD RT signals.
*/
@@ -520,4 +527,24 @@
out:
free(kosa, M_SONAME);
return (error);
+}
+
+void
+linux_dev_shm_create(void)
+{
+ int error;
+
+ error = make_dev_p(MAKEDEV_CHECKNAME | MAKEDEV_WAITOK, &dev_shm_cdev,
+ &dev_shm_cdevsw, NULL, UID_ROOT, GID_WHEEL, 0600, "shm/shm");
+ if (error != 0) {
+ printf("%s: failed to create device node, error %d",
+ __func__, error);
+ }
+}
+
+void
+linux_dev_shm_destroy(void)
+{
+
+ destroy_dev(dev_shm_cdev);
}
Index: sys/compat/linux/linux_common.c
===================================================================
--- sys/compat/linux/linux_common.c
+++ sys/compat/linux/linux_common.c
@@ -38,6 +38,7 @@
#include <sys/sx.h>
#include <sys/sysctl.h>
+#include <compat/linux/linux.h>
#include <compat/linux/linux_emul.h>
#include <compat/linux/linux_ioctl.h>
#include <compat/linux/linux_mib.h>
@@ -59,7 +60,6 @@
static eventhandler_tag linux_thread_dtor_tag;
static eventhandler_tag linux_exit_tag;
-
static int
linux_common_modevent(module_t mod, int type, void *data)
{
@@ -67,6 +67,7 @@
switch(type) {
case MOD_LOAD:
+ linux_dev_shm_create();
linux_osd_jail_register();
linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
linux_proc_exit, NULL, 1000);
@@ -78,6 +79,7 @@
linux_device_register_handler(*ldhp);
break;
case MOD_UNLOAD:
+ linux_dev_shm_destroy();
linux_osd_jail_deregister();
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
Index: sys/i386/linux/linux_sysvec.c
===================================================================
--- sys/i386/linux/linux_sysvec.c
+++ sys/i386/linux/linux_sysvec.c
@@ -1007,6 +1007,7 @@
linux_get_machine(&linux_kplatform);
linux_szplatform = roundup(strlen(linux_kplatform) + 1,
sizeof(char *));
+ linux_dev_shm_create();
linux_osd_jail_register();
stclohz = (stathz ? stathz : hz);
if (bootverbose)
@@ -1032,6 +1033,7 @@
EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
+ linux_dev_shm_destroy();
linux_osd_jail_deregister();
if (bootverbose)
printf("Linux ELF exec handler removed\n");

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 21, 8:07 AM (22 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41885119
Default Alt Text
D20333.1795248426.diff (3 KB)

Event Timeline