mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-09-21 17:44:04 +08:00
No kernel handles in userspace; Domain creation.
This commit is contained in:
+9
-15
@@ -38,14 +38,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "include/ecrt.h"
|
||||
#include "master.h"
|
||||
#include "master/ioctl.h"
|
||||
|
||||
struct ec_master {
|
||||
int fd;
|
||||
void *handle;
|
||||
};
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned int ecrt_version_magic(void)
|
||||
{
|
||||
return ECRT_VERSION_MAGIC;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -55,7 +58,6 @@ ec_master_t *ecrt_request_master(unsigned int master_index)
|
||||
{
|
||||
char path[MAX_PATH_LEN];
|
||||
ec_master_t *master;
|
||||
ec_ioctl_request_t data;
|
||||
|
||||
master = malloc(sizeof(ec_master_t));
|
||||
if (!master) {
|
||||
@@ -72,7 +74,7 @@ ec_master_t *ecrt_request_master(unsigned int master_index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ioctl(master->fd, EC_IOCTL_REQUEST, &data) == -1) {
|
||||
if (ioctl(master->fd, EC_IOCTL_REQUEST, NULL) == -1) {
|
||||
fprintf(stderr, "Failed to request master %u: %s\n",
|
||||
master_index, strerror(errno));
|
||||
close(master->fd);
|
||||
@@ -80,7 +82,6 @@ ec_master_t *ecrt_request_master(unsigned int master_index)
|
||||
return 0;
|
||||
}
|
||||
|
||||
master->handle = data.handle;
|
||||
return master;
|
||||
}
|
||||
|
||||
@@ -93,10 +94,3 @@ void ecrt_release_master(ec_master_t *master)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
unsigned int ecrt_version_magic(void)
|
||||
{
|
||||
return ECRT_VERSION_MAGIC;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user