FreeCalypso > hg > freecalypso-tools
comparison libserial-posix/openport.c @ 661:fd7b447b99e3
libserial rename
The version that was previously named libserial-newlnx is now libserial-linux,
and the version that was previosly named libserial-orig is now libserial-posix.
This new naming is more in line with the objective reality of the difference,
moving away from naming based on our project history.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 05 Mar 2020 19:54:31 +0000 |
parents | libserial-orig/openport.c@cb1ba53a1106 |
children |
comparison
equal
deleted
inserted
replaced
660:b34384991094 | 661:fd7b447b99e3 |
---|---|
1 /* | |
2 * This module implements the basic serial port opening operation. | |
3 */ | |
4 | |
5 #include <sys/types.h> | |
6 #include <sys/file.h> | |
7 #include <sys/ioctl.h> | |
8 #include <stdio.h> | |
9 #include <stdlib.h> | |
10 #include <unistd.h> | |
11 | |
12 int target_fd; | |
13 | |
14 open_serial_port(ttyport) | |
15 char *ttyport; | |
16 { | |
17 target_fd = open(ttyport, O_RDWR|O_NONBLOCK); | |
18 if (target_fd < 0) { | |
19 perror(ttyport); | |
20 exit(1); | |
21 } | |
22 ioctl(target_fd, TIOCEXCL); | |
23 return 0; | |
24 } |