Merge pull request #3393 from chungy/freebsd-fixes
Add some defines to build succesfully on FreeBSD
This commit is contained in:
@@ -66,6 +66,9 @@ extern void seekdir(DIR *, long);
|
|||||||
extern int closedir(DIR *);
|
extern int closedir(DIR *);
|
||||||
|
|
||||||
# define rewinddir(dirp) seekdir(dirp, 0L)
|
# define rewinddir(dirp) seekdir(dirp, 0L)
|
||||||
|
#elif defined(__FreeBSD__)
|
||||||
|
/* FreeBSD uses dirent.h instead of sys/dir.h */
|
||||||
|
# include <dirent.h>
|
||||||
#else
|
#else
|
||||||
/* On linux and macOS, use the standard functions and types */
|
/* On linux and macOS, use the standard functions and types */
|
||||||
# include <sys/dir.h>
|
# include <sys/dir.h>
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
# define _DEFAULT_SOURCE 1
|
# define _DEFAULT_SOURCE 1
|
||||||
# define _BSD_SOURCE 1
|
# define _BSD_SOURCE 1
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
# define __BSD_VISIBLE 1
|
||||||
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -165,7 +168,7 @@ plat_serpt_set_params(void *p)
|
|||||||
term_attr.c_cflag &= CSTOPB;
|
term_attr.c_cflag &= CSTOPB;
|
||||||
if (dev->serial->lcr & 0x04)
|
if (dev->serial->lcr & 0x04)
|
||||||
term_attr.c_cflag |= CSTOPB;
|
term_attr.c_cflag |= CSTOPB;
|
||||||
#ifdef __APPLE__
|
#if defined(__APPLE__) || defined(__FreeBSD__)
|
||||||
term_attr.c_cflag &= PARENB | PARODD;
|
term_attr.c_cflag &= PARENB | PARODD;
|
||||||
#else
|
#else
|
||||||
term_attr.c_cflag &= PARENB | PARODD | CMSPAR;
|
term_attr.c_cflag &= PARENB | PARODD | CMSPAR;
|
||||||
@@ -174,7 +177,7 @@ plat_serpt_set_params(void *p)
|
|||||||
term_attr.c_cflag |= PARENB;
|
term_attr.c_cflag |= PARENB;
|
||||||
if (!(dev->serial->lcr & 0x10))
|
if (!(dev->serial->lcr & 0x10))
|
||||||
term_attr.c_cflag |= PARODD;
|
term_attr.c_cflag |= PARODD;
|
||||||
#ifndef __APPLE__
|
#if !defined(__APPLE__) && !defined(__FreeBSD__)
|
||||||
if ((dev->serial->lcr & 0x20))
|
if ((dev->serial->lcr & 0x20))
|
||||||
term_attr.c_cflag |= CMSPAR;
|
term_attr.c_cflag |= CMSPAR;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user