No kernel handles in userspace; Domain creation.

This commit is contained in:
Florian Pose
2008-10-02 10:19:02 +00:00
parent 6c484fa19a
commit cd4bb0a38b
9 changed files with 247 additions and 32 deletions
+9 -15
View File
@@ -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;
}
/*****************************************************************************/