MIDAS
Loading...
Searching...
No Matches
dio.cxx
Go to the documentation of this file.
1
/********************************************************************
2
3
Name: dio.c
4
Created by: Pierre Amaudruz
5
6
Contents: ioperm() wrapper for frontends which access CAMAC
7
directly under Linux. Compile dio.c, change owner
8
to root and set setuid-bit (chmod a+s dio). Then
9
start the frontend with
10
11
dio frontend
12
13
$Id:$
14
15
\********************************************************************/
16
17
#include <stdio.h>
18
#include <stdlib.h>
19
#include <string.h>
20
#include <unistd.h>
21
#include <sys/io.h>
22
23
int
main
(
int
argc
,
char
**
argv
)
24
{
25
int
status
;
26
27
/* Grant access to the device's ioports */
28
status
=
iopl
(3);
29
if
(
status
< 0) {
30
perror
(
"iopl()"
);
31
exit(2);
32
}
33
34
/* Surrender root privileges - the exec()ed program will keep IO
35
access to the IO ports (see "man 2 iopl") */
36
if
(
setuid
(
getuid
()) < 0) {
37
perror
(
"setuid()"
);
38
exit(2);
39
}
40
41
/* Check command arguments */
42
if
(
argc
< 2) {
43
fprintf
(
stderr
,
"Usage: %s program [arguments]\n"
,
argv
[0]);
44
exit(1);
45
}
46
47
/* Execute the program (with any supplied command line args) */
48
if
(
execvp
(
argv
[1], &
argv
[1]) < 0) {
49
perror
(
argv
[1]);
50
exit(2);
51
}
52
return
0;
53
}
main
int main()
Definition
hwtest.cxx:23
status
DWORD status
Definition
odbhist.cxx:39
h1_book
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition
rmidas.h:24
progs
dio.cxx
Generated on Sat May 3 2025 05:01:05 for MIDAS by
1.9.8