MIDAS
Loading...
Searching...
No Matches
dio.cxx File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/io.h>
Include dependency graph for dio.cxx:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file dio.cxx.

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}
DWORD status
Definition odbhist.cxx:39
TH1X EXPRT * h1_book(const char *name, const char *title, int bins, double min, double max)
Definition rmidas.h:24
Here is the call graph for this function: