Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linux/linux.c
Show All 25 Lines | |||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <opt_inet6.h> | #include <opt_inet6.h> | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/conf.h> | |||||
#include <sys/ctype.h> | #include <sys/ctype.h> | ||||
#include <sys/jail.h> | #include <sys/jail.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/malloc.h> | #include <sys/malloc.h> | ||||
#include <sys/signalvar.h> | #include <sys/signalvar.h> | ||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/socketvar.h> | #include <sys/socketvar.h> | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | static int linux_to_bsd_sigtbl[LINUX_SIGTBLSZ] = { | ||||
* FreeBSD does not have SIGPWR signal, map Linux SIGPWR signal | * FreeBSD does not have SIGPWR signal, map Linux SIGPWR signal | ||||
* to the first unused FreeBSD signal number. Since Linux supports | * to the first unused FreeBSD signal number. Since Linux supports | ||||
* signals from 1 to 64 we are ok here as our SIGRTMIN = 65. | * signals from 1 to 64 we are ok here as our SIGRTMIN = 65. | ||||
*/ | */ | ||||
SIGRTMIN, /* LINUX_SIGPWR */ | SIGRTMIN, /* LINUX_SIGPWR */ | ||||
SIGSYS /* LINUX_SIGSYS */ | 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. | * Map Linux RT signals to the FreeBSD RT signals. | ||||
*/ | */ | ||||
static inline int | static inline int | ||||
linux_to_bsd_rt_signal(int sig) | linux_to_bsd_rt_signal(int sig) | ||||
{ | { | ||||
return (SIGRTMIN + 1 + sig - LINUX_SIGRTMIN); | return (SIGRTMIN + 1 + sig - LINUX_SIGRTMIN); | ||||
▲ Show 20 Lines • Show All 378 Lines • ▼ Show 20 Lines | #endif | ||||
*sap = sa; | *sap = sa; | ||||
*len = salen; | *len = salen; | ||||
return (0); | return (0); | ||||
out: | out: | ||||
free(kosa, M_SONAME); | free(kosa, M_SONAME); | ||||
return (error); | 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, 0, "shm/.mountpoint"); | |||||
if (error != 0) { | |||||
printf("%s: failed to create device node, error %d\n", | |||||
__func__, error); | |||||
} | |||||
} | |||||
void | |||||
linux_dev_shm_destroy(void) | |||||
{ | |||||
destroy_dev(dev_shm_cdev); | |||||
} | } |