mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
asyncip: we only support RedHat linux
This commit is contained in:
parent
009a6b8a3a
commit
ecd996f251
4 changed files with 7 additions and 31 deletions
|
@ -13,7 +13,6 @@
|
||||||
|
|
||||||
#define UDP_PROTOCOL 1
|
#define UDP_PROTOCOL 1
|
||||||
#define TCP_PROTOCOL 2
|
#define TCP_PROTOCOL 2
|
||||||
#define EOK 0
|
|
||||||
|
|
||||||
int InitSocket(Opal_GenAsyncParam_Ctrl IconCtrlStruct);
|
int InitSocket(Opal_GenAsyncParam_Ctrl IconCtrlStruct);
|
||||||
|
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
#ifndef _UTILS_H_
|
#ifndef _UTILS_H_
|
||||||
#define _UTILS_H_
|
#define _UTILS_H_
|
||||||
|
|
||||||
#define EOK 0
|
|
||||||
|
|
||||||
int AssignProcToCpu0(void);
|
int AssignProcToCpu0(void);
|
||||||
|
|
||||||
#endif /* _UTILS_H_ */
|
#endif /* _UTILS_H_ */
|
||||||
|
|
|
@ -6,28 +6,17 @@
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
|
||||||
/* Standard ANSI C headers needed for this program */
|
/* Standard ANSI C headers needed for this program */
|
||||||
#include <errno.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/wait.h>
|
|
||||||
#include <termios.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
|
||||||
#if defined(__QNXNTO__)
|
|
||||||
#include <process.h>
|
|
||||||
#include <devctl.h>
|
|
||||||
#include <sys/dcmd_chr.h>
|
|
||||||
#elif defined(__linux__)
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
#include <time.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define RTLAB before including OpalPrint.h for messages to be sent
|
/* Define RTLAB before including OpalPrint.h for messages to be sent
|
||||||
* to the OpalDisplay. Otherwise stdout will be used. */
|
* to the OpalDisplay. Otherwise stdout will be used. */
|
||||||
#define RTLAB
|
#define RTLAB
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <sched.h>
|
||||||
|
|
||||||
/* Define RTLAB before including OpalPrint.h for messages to be sent
|
/* Define RTLAB before including OpalPrint.h for messages to be sent
|
||||||
* to the OpalDisplay. Otherwise stdout will be used. */
|
* to the OpalDisplay. Otherwise stdout will be used. */
|
||||||
|
@ -16,31 +17,20 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
#if defined(__QNXNTO__)
|
|
||||||
#include <process.h>
|
|
||||||
#include <sys/sched.h>
|
|
||||||
#include <devctl.h>
|
|
||||||
#include <sys/dcmd_chr.h>
|
|
||||||
#elif defined(__linux__)
|
|
||||||
#define _GNU_SOURCE 1
|
|
||||||
#include <sched.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int AssignProcToCpu0(void)
|
int AssignProcToCpu0(void)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
|
||||||
int ret;
|
int ret;
|
||||||
cpu_set_t bindSet;
|
cpu_set_t bindSet;
|
||||||
|
|
||||||
CPU_ZERO(&bindSet);
|
CPU_ZERO(&bindSet);
|
||||||
CPU_SET(0, &bindSet);
|
CPU_SET(0, &bindSet);
|
||||||
|
|
||||||
/* Changing process cpu affinity */
|
/* Changing process cpu affinity */
|
||||||
ret = sched_setaffinity(0, sizeof(cpu_set_t), &bindSet);
|
ret = sched_setaffinity(0, sizeof(cpu_set_t), &bindSet);
|
||||||
if (ret != 0) {
|
if (ret) {
|
||||||
OpalPrint("Unable to bind the process to CPU 0. (sched_setaffinity errno %d)\n", errno);
|
OpalPrint("Unable to bind the process to CPU 0: %d\n", errno);
|
||||||
return EINVAL;
|
return EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return EOK;
|
return 0;
|
||||||
#endif /* __linux__ */
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue