diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs index ee5e4272295286..e02afa58e91af1 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.MountPoints.FormatInfo.cs @@ -44,6 +44,7 @@ internal enum UnixFileSystemTypes : long bdevfs = 0x62646576, bfs = 0x1BADFACE, binfmt_misc = 0x42494E4D, + bootfs = 0xA56D3FF9, btrfs = 0x9123683E, ceph = 0x00C36400, cgroupfs = 0x0027E0EB, @@ -65,6 +66,7 @@ internal enum UnixFileSystemTypes : long ext3 = 0xEF53, ext4 = 0xEF53, fat = 0x4006, + fd = 0xF00D1E, fhgfs = 0x19830326, fuse = 0x65735546, fuseblk = 0x65735546, @@ -86,6 +88,7 @@ internal enum UnixFileSystemTypes : long jffs2 = 0x72B6, jfs = 0x3153464A, kafs = 0x6B414653, + lofs = 0xEF53, /* loopback filesystem, magic same as ext2 */ logfs = 0xC97E8168, lustre = 0x0BD00BD0, minix_old = 0x137F, /* orig. minix */ @@ -227,6 +230,7 @@ private static DriveType GetDriveType(string fileSystemName) case "bdevfs": case "befs": case "bfs": + case "bootfs": case "bpf_fs": case "btrfs": case "btrfs_test": @@ -261,6 +265,7 @@ private static DriveType GetDriveType(string fileSystemName) case "jffs": case "jffs2": case "jfs": + case "lofs": case "logfs": case "lxfs": case "minix (30 char.)": @@ -384,15 +389,18 @@ private static DriveType GetDriveType(string fileSystemName) case "cgroupfs": case "cgroup2fs": case "configfs": + case "cpuset": case "cramfs": case "cramfs-wend": case "cryptkeeper": - case "cpuset": + case "ctfs": case "debugfs": + case "dev": case "devfs": case "devpts": case "devtmpfs": case "encfs": + case "fd": case "fdesc": case "fuse.gvfsd-fuse": case "fusectl": @@ -400,9 +408,11 @@ private static DriveType GetDriveType(string fileSystemName) case "hugetlbfs": case "libpam-encfs": case "ibpam-mount": + case "mntfs": + case "mqueue": case "mtpfs": case "mythtvfs": - case "mqueue": + case "objfs": case "openprom": case "openpromfs": case "pipefs": @@ -417,6 +427,7 @@ private static DriveType GetDriveType(string fileSystemName) case "securityfs": case "selinux": case "selinuxfs": + case "sharefs": case "sockfs": case "sysfs": case "tmpfs": diff --git a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs index 2edde6fbc11b0d..8933e9c3d39adb 100644 --- a/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs +++ b/src/libraries/Common/src/Interop/Unix/System.Native/Interop.SysLog.cs @@ -19,28 +19,6 @@ internal enum SysLogPriority : int LOG_NOTICE = 5, /* normal but significant condition */ LOG_INFO = 6, /* informational */ LOG_DEBUG = 7, /* debug-level messages */ - // Facilities - LOG_KERN = (0<<3), /* kernel messages */ - LOG_USER = (1<<3), /* random user-level messages */ - LOG_MAIL = (2<<3), /* mail system */ - LOG_DAEMON = (3<<3), /* system daemons */ - LOG_AUTH = (4<<3), /* authorization messages */ - LOG_SYSLOG = (5<<3), /* messages generated internally by syslogd */ - LOG_LPR = (6<<3), /* line printer subsystem */ - LOG_NEWS = (7<<3), /* network news subsystem */ - LOG_UUCP = (8<<3), /* UUCP subsystem */ - LOG_CRON = (9<<3), /* clock daemon */ - LOG_AUTHPRIV = (10<<3), /* authorization messages (private) */ - LOG_FTP = (11<<3), /* ftp daemon */ - // Between FTP and Local is reserved for system use - LOG_LOCAL0 = (16<<3), /* reserved for local use */ - LOG_LOCAL1 = (17<<3), /* reserved for local use */ - LOG_LOCAL2 = (18<<3), /* reserved for local use */ - LOG_LOCAL3 = (19<<3), /* reserved for local use */ - LOG_LOCAL4 = (20<<3), /* reserved for local use */ - LOG_LOCAL5 = (21<<3), /* reserved for local use */ - LOG_LOCAL6 = (22<<3), /* reserved for local use */ - LOG_LOCAL7 = (23<<3), /* reserved for local use */ } /// diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 76742dd715f755..f14ada69feed97 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -170,7 +170,13 @@ if(CLR_CMAKE_TARGET_UNIX) add_link_options(-Wl,-bind_at_load) else() add_compile_options($<$:-Wa,--noexecstack>) - add_link_options(-Wl,--build-id=sha1 -Wl,-z,relro,-z,now) + if(CLR_CMAKE_TARGET_SUNOS) + add_definitions(-D__EXTENSIONS__ -D_XPG4_2 -D_POSIX_PTHREAD_SEMANTICS) + else() + # -z,now is required for full relro. + # see https://www.redhat.com/en/blog/hardening-elf-binaries-using-relocation-read-only-relro + add_link_options(-Wl,--build-id=sha1 -Wl,-z,relro,-z,now) + endif() endif() endif() diff --git a/src/libraries/Native/Unix/Common/pal_config.h.in b/src/libraries/Native/Unix/Common/pal_config.h.in index c74c4c97593040..46c3dc7498435e 100644 --- a/src/libraries/Native/Unix/Common/pal_config.h.in +++ b/src/libraries/Native/Unix/Common/pal_config.h.in @@ -26,6 +26,7 @@ #cmakedefine01 HAVE_MNTINFO #cmakedefine01 HAVE_STATFS_FSTYPENAME #cmakedefine01 HAVE_STATVFS_FSTYPENAME +#cmakedefine01 HAVE_NON_LEGACY_STATFS #cmakedefine01 HAVE_STRCPY_S #cmakedefine01 HAVE_STRLCPY #cmakedefine01 HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP @@ -72,6 +73,11 @@ #cmakedefine01 HAVE_RT_MSGHDR2 #cmakedefine01 HAVE_IF_MSGHDR2 #cmakedefine01 HAVE_SYS_SYSCTL_H +#cmakedefine01 HAVE_SYS_IOCTL_H +#cmakedefine01 HAVE_SYS_FILIO_H +#cmakedefine01 HAVE_NETPACKET_PACKET_H +#cmakedefine01 HAVE_NET_IF_ARP_H +#cmakedefine01 HAVE_SYS_MNTENT_H #cmakedefine01 HAVE_NET_IFMEDIA_H #cmakedefine01 HAVE_LINUX_RTNETLINK_H #cmakedefine01 HAVE_LINUX_CAN_H @@ -102,6 +108,9 @@ #cmakedefine01 HAVE_TCP_H_TCP_KEEPALIVE #cmakedefine01 HAVE_BUILTIN_MUL_OVERFLOW #cmakedefine01 HAVE_DISCONNECTX +#cmakedefine01 HAVE_CFSETSPEED +#cmakedefine01 HAVE_CFMAKERAW +#cmakedefine01 HAVE_GETGROUPLIST // Mac OS X has stat64, but it is deprecated since plain stat now // provides the same 64-bit aware struct when targeting OS X > 10.5 diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c index ece77cbad71a75..0943826e8c871a 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c @@ -9,6 +9,9 @@ #include #include #include +#if HAVE_SYS_FILIO_H +#include +#endif /* This is dup of System/IO/Ports/NativeMethods.cs */ enum @@ -359,7 +362,12 @@ int32_t SystemIoPortsNative_TermiosSetSpeed(intptr_t handle, int32_t speed) return -1; } +#if HAVE_CFSETSPEED cfsetspeed(&term, brate); +#else // on SunOS, set input and output speeds individually + cfsetispeed(&term, brate); + cfsetospeed(&term, brate); +#endif if (tcsetattr(fd, TCSANOW, &term) < 0) { @@ -418,7 +426,15 @@ int32_t SystemIoPortsNative_TermiosReset(intptr_t handle, int32_t speed, int32_t return -1; } +#if HAVE_CFMAKERAW cfmakeraw(&term); +#else + term.c_iflag &= ~(IMAXBEL|IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON); + term.c_oflag &= ~OPOST; + term.c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); + term.c_cflag &= ~(CSIZE|PARENB); + term.c_cflag |= CS8; +#endif term.c_cflag |= (CLOCAL | CREAD); term.c_lflag &= ~((tcflag_t)(ICANON | ECHO | ECHOE | ECHOK | ECHONL | ISIG | IEXTEN )); term.c_oflag &= ~((tcflag_t)(OPOST)); @@ -495,7 +511,11 @@ int32_t SystemIoPortsNative_TermiosReset(intptr_t handle, int32_t speed, int32_t return -1; } +#if HAVE_CFSETSPEED ret = cfsetspeed(&term, brate); +#else + ret = cfsetispeed(&term, brate) & cfsetospeed(&term, brate); +#endif } if ((ret != 0) || (tcsetattr(fd, TCSANOW, &term) < 0)) diff --git a/src/libraries/Native/Unix/System.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Native/CMakeLists.txt index 2c3da0decb9fd8..e3bf2532b3ae57 100644 --- a/src/libraries/Native/Unix/System.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Native/CMakeLists.txt @@ -56,10 +56,10 @@ if (GEN_SHARED_LIB) if (CLR_CMAKE_TARGET_FREEBSD) target_link_libraries(System.Native pthread) - if (HAVE_INOTIFY) - find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib) - target_link_libraries(System.Native ${INOTIFY_LIBRARY}) - endif () + if (HAVE_INOTIFY) + find_library(INOTIFY_LIBRARY inotify HINTS /usr/local/lib) + target_link_libraries(System.Native ${INOTIFY_LIBRARY}) + endif () endif () install_with_stripped_symbols (System.Native PROGRAMS .) endif () diff --git a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c index a18257839cbf9a..7c64c54dfedb23 100644 --- a/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c +++ b/src/libraries/Native/Unix/System.Native/pal_interfaceaddresses.c @@ -20,6 +20,9 @@ #if HAVE_SYS_SYSCTL_H #include #endif +#if HAVE_SYS_IOCTL_H +#include +#endif #if HAVE_ETHTOOL_H #include #include @@ -28,11 +31,11 @@ #if defined(AF_PACKET) #include -#if defined(_WASM_) +#if HAVE_NETPACKET_PACKET_H #include -#else // _WASM_ +#else #include -#endif // _WASM_ +#endif #elif defined(AF_LINK) #include #include @@ -431,7 +434,7 @@ int32_t SystemNative_GetNetworkInterfaces(int32_t * interfaceCount, NetworkInter #endif } -#if HAVE_RT_MSGHDR +#if HAVE_RT_MSGHDR && defined(CTL_NET) int32_t SystemNative_EnumerateGatewayAddressesForInterface(uint32_t interfaceIndex, GatewayAddressFound onGatewayFound) { static struct in6_addr anyaddr = IN6ADDR_ANY_INIT; diff --git a/src/libraries/Native/Unix/System.Native/pal_maphardwaretype.c b/src/libraries/Native/Unix/System.Native/pal_maphardwaretype.c index dbd74cc21047e1..1289307d303003 100644 --- a/src/libraries/Native/Unix/System.Native/pal_maphardwaretype.c +++ b/src/libraries/Native/Unix/System.Native/pal_maphardwaretype.c @@ -9,13 +9,16 @@ #include #if defined(AF_PACKET) -#if defined(_WASM_) +#if HAVE_NETPACKET_PACKET_H #include -#include -#else // _WASM_ +#else #include +#endif +#if HAVE_NET_IF_ARP_H +#include +#else #include -#endif // _WASM_ +#endif #elif defined(AF_LINK) #include #include @@ -43,7 +46,9 @@ uint16_t MapHardwareType(uint16_t nativeType) case ARPHRD_PPP: return NetworkInterfaceType_Ppp; case ARPHRD_TUNNEL: +#ifdef ARPHRD_TUNNEL6 case ARPHRD_TUNNEL6: +#endif return NetworkInterfaceType_Tunnel; case ARPHRD_LOOPBACK: return NetworkInterfaceType_Loopback; diff --git a/src/libraries/Native/Unix/System.Native/pal_mount.c b/src/libraries/Native/Unix/System.Native/pal_mount.c index 7fe0aeeaecf24d..ce4daa7786cb29 100644 --- a/src/libraries/Native/Unix/System.Native/pal_mount.c +++ b/src/libraries/Native/Unix/System.Native/pal_mount.c @@ -15,7 +15,13 @@ #include #else #include +#if HAVE_SYS_MNTENT_H +#include +#include +#include +#else #include +#endif #define STRING_BUFFER_SIZE 8192 // Android does not define MNTOPT_RO @@ -42,8 +48,28 @@ static int32_t GetMountInfo(MountPointFound onFound) return 0; } -#else +#elif HAVE_SYS_MNTENT_H + int result = -1; + FILE* fp = fopen("/proc/mounts", MNTOPT_RO); + if (fp != NULL) + { + char buffer[STRING_BUFFER_SIZE] = {0}; + struct mnttab entry; + while(getmntent(fp, &entry) == 0) + { + onFound(entry.mnt_mountp); + } + result = fclose(fp); + assert(result == 1); // documented to always return 1 + result = + 0; // We need to standardize a success return code between our implementations, so settle on 0 for success + } + + return result; +} + +#else int result = -1; FILE* fp = setmntent("/proc/mounts", MNTOPT_RO); if (fp != NULL) @@ -78,7 +104,7 @@ int32_t SystemNative_GetSpaceInfoForMountPoint(const char* name, MountPointInfor assert(name != NULL); assert(mpi != NULL); -#if defined(HAVE_STATFS) +#if HAVE_NON_LEGACY_STATFS struct statfs stats; memset(&stats, 0, sizeof(struct statfs)); @@ -117,7 +143,7 @@ SystemNative_GetFormatInfoForMountPoint(const char* name, char* formatNameBuffer assert((formatNameBuffer != NULL) && (formatType != NULL)); assert(bufferLength > 0); -#if defined(HAVE_STATFS) +#if HAVE_NON_LEGACY_STATFS struct statfs stats; int result = statfs(name, &stats); #else @@ -142,12 +168,12 @@ SystemNative_GetFormatInfoForMountPoint(const char* name, char* formatNameBuffer SafeStringCopy(formatNameBuffer, Int32ToSizeT(bufferLength), stats.f_fstypename); *formatType = -1; } -#elif defined(HAVE_STATFS) +#elif HAVE_NON_LEGACY_STATFS assert(formatType != NULL); *formatType = (int64_t)(stats.f_type); SafeStringCopy(formatNameBuffer, Int32ToSizeT(bufferLength), ""); #else - *formatType = 0; + *formatType = 0; #endif } else diff --git a/src/libraries/Native/Unix/System.Native/pal_networking.c b/src/libraries/Native/Unix/System.Native/pal_networking.c index 08540e24b18e54..05066940fd95fe 100644 --- a/src/libraries/Native/Unix/System.Native/pal_networking.c +++ b/src/libraries/Native/Unix/System.Native/pal_networking.c @@ -56,6 +56,10 @@ #if HAVE_LINUX_CAN_H #include #endif +#if HAVE_SYS_FILIO_H +#include +#endif + #if HAVE_KQUEUE #if KEVENT_HAS_VOID_UDATA static void* GetKeventUdata(uintptr_t udata) @@ -2310,7 +2314,7 @@ static bool TryConvertProtocolTypePlatformToPal(int32_t palAddressFamily, int pl return true; default: - *palProtocolType = (int)palProtocolType; + *palProtocolType = (int32_t)(intptr_t)palProtocolType; return false; } diff --git a/src/libraries/Native/Unix/System.Native/pal_process.c b/src/libraries/Native/Unix/System.Native/pal_process.c index 93d41880092b09..2a5028558446ab 100644 --- a/src/libraries/Native/Unix/System.Native/pal_process.c +++ b/src/libraries/Native/Unix/System.Native/pal_process.c @@ -42,26 +42,6 @@ c_static_assert(PAL_LOG_WARNING == LOG_WARNING); c_static_assert(PAL_LOG_NOTICE == LOG_NOTICE); c_static_assert(PAL_LOG_INFO == LOG_INFO); c_static_assert(PAL_LOG_DEBUG == LOG_DEBUG); -c_static_assert(PAL_LOG_KERN == LOG_KERN); -c_static_assert(PAL_LOG_USER == LOG_USER); -c_static_assert(PAL_LOG_MAIL == LOG_MAIL); -c_static_assert(PAL_LOG_DAEMON == LOG_DAEMON); -c_static_assert(PAL_LOG_AUTH == LOG_AUTH); -c_static_assert(PAL_LOG_SYSLOG == LOG_SYSLOG); -c_static_assert(PAL_LOG_LPR == LOG_LPR); -c_static_assert(PAL_LOG_NEWS == LOG_NEWS); -c_static_assert(PAL_LOG_UUCP == LOG_UUCP); -c_static_assert(PAL_LOG_CRON == LOG_CRON); -c_static_assert(PAL_LOG_AUTHPRIV == LOG_AUTHPRIV); -c_static_assert(PAL_LOG_FTP == LOG_FTP); -c_static_assert(PAL_LOG_LOCAL0 == LOG_LOCAL0); -c_static_assert(PAL_LOG_LOCAL1 == LOG_LOCAL1); -c_static_assert(PAL_LOG_LOCAL2 == LOG_LOCAL2); -c_static_assert(PAL_LOG_LOCAL3 == LOG_LOCAL3); -c_static_assert(PAL_LOG_LOCAL4 == LOG_LOCAL4); -c_static_assert(PAL_LOG_LOCAL5 == LOG_LOCAL5); -c_static_assert(PAL_LOG_LOCAL6 == LOG_LOCAL6); -c_static_assert(PAL_LOG_LOCAL7 == LOG_LOCAL7); // Validate that out PriorityWhich values are correct for the platform c_static_assert(PAL_PRIO_PROCESS == (int)PRIO_PROCESS); @@ -546,12 +526,21 @@ static int32_t ConvertRLimitResourcesPalToPlatform(RLimitResources value) return RLIMIT_CORE; case PAL_RLIMIT_AS: return RLIMIT_AS; +#ifdef RLIMIT_RSS case PAL_RLIMIT_RSS: return RLIMIT_RSS; +#endif +#ifdef RLIMIT_MEMLOCK case PAL_RLIMIT_MEMLOCK: return RLIMIT_MEMLOCK; +#elif defined(RLIMIT_VMEM) + case PAL_RLIMIT_MEMLOCK: + return RLIMIT_VMEM; +#endif +#ifdef RLIMIT_NPROC case PAL_RLIMIT_NPROC: return RLIMIT_NPROC; +#endif case PAL_RLIMIT_NOFILE: return RLIMIT_NOFILE; } @@ -656,7 +645,7 @@ int32_t SystemNative_GetSid(int32_t pid) void SystemNative_SysLog(SysLogPriority priority, const char* message, const char* arg1) { - syslog((int)priority, message, arg1); + syslog((int)(LOG_USER | priority), message, arg1); } int32_t SystemNative_WaitIdAnyExitedNoHangNoWait() diff --git a/src/libraries/Native/Unix/System.Native/pal_process.h b/src/libraries/Native/Unix/System.Native/pal_process.h index d75f25bcb43199..7ad8007aa70294 100644 --- a/src/libraries/Native/Unix/System.Native/pal_process.h +++ b/src/libraries/Native/Unix/System.Native/pal_process.h @@ -95,28 +95,6 @@ typedef enum PAL_LOG_NOTICE = 5, /* normal but significant condition */ PAL_LOG_INFO = 6, /* informational */ PAL_LOG_DEBUG = 7, /* debug-level messages */ - // Facilities - PAL_LOG_KERN = (0 << 3), /* kernel messages */ - PAL_LOG_USER = (1 << 3), /* random user-level messages */ - PAL_LOG_MAIL = (2 << 3), /* mail system */ - PAL_LOG_DAEMON = (3 << 3), /* system daemons */ - PAL_LOG_AUTH = (4 << 3), /* authorization messages */ - PAL_LOG_SYSLOG = (5 << 3), /* messages generated internally by syslogd */ - PAL_LOG_LPR = (6 << 3), /* line printer subsystem */ - PAL_LOG_NEWS = (7 << 3), /* network news subsystem */ - PAL_LOG_UUCP = (8 << 3), /* UUCP subsystem */ - PAL_LOG_CRON = (9 << 3), /* clock daemon */ - PAL_LOG_AUTHPRIV = (10 << 3), /* authorization messages (private) */ - PAL_LOG_FTP = (11 << 3), /* ftp daemon */ - // Between FTP and Local is reserved for system use - PAL_LOG_LOCAL0 = (16 << 3), /* reserved for local use */ - PAL_LOG_LOCAL1 = (17 << 3), /* reserved for local use */ - PAL_LOG_LOCAL2 = (18 << 3), /* reserved for local use */ - PAL_LOG_LOCAL3 = (19 << 3), /* reserved for local use */ - PAL_LOG_LOCAL4 = (20 << 3), /* reserved for local use */ - PAL_LOG_LOCAL5 = (21 << 3), /* reserved for local use */ - PAL_LOG_LOCAL6 = (22 << 3), /* reserved for local use */ - PAL_LOG_LOCAL7 = (23 << 3), /* reserved for local use */ } SysLogPriority; /** diff --git a/src/libraries/Native/Unix/System.Native/pal_uid.c b/src/libraries/Native/Unix/System.Native/pal_uid.c index 166465bccd4435..41053d326dccef 100644 --- a/src/libraries/Native/Unix/System.Native/pal_uid.c +++ b/src/libraries/Native/Unix/System.Native/pal_uid.c @@ -112,6 +112,73 @@ uint32_t SystemNative_GetUid() static pthread_mutex_t s_groupLock = PTHREAD_MUTEX_INITIALIZER; #endif +#if !HAVE_GETGROUPLIST +int getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *groupCount) +{ + int ngroups = 1; + int maxgroups = *groupCount; + + if (groups) + { + groups[ngroups] = agroup; + } + if (maxgroups > 1) + { + if (groups) + groups[ngroups++] = agroup; + else + ngroups++; + } + + setgrent(); + + int i; + int result = 0; + const struct group *group; + + while ((group = getgrent()) != NULL) + { + if (groups) + { + bool found = false; + for (i = 0; i < ngroups; i++) + { + if (group->gr_gid == groups[i]) + { + found = true; + break; + } + } + if (found) + break; + } + + for (i = 0; group->gr_mem[i]; i++) + { + if (!strcmp(group->gr_mem[i], uname)) + { + if (ngroups >= maxgroups) + { + result = -1; + break; + } + + if (groups) + groups[ngroups++] = group->gr_gid; + else + ngroups++; + + break; + } + } + } + + endgrent(); + *groupCount = ngroups; + return result; +} +#endif + int32_t SystemNative_GetGroupList(const char* name, uint32_t group, uint32_t* groups, int32_t* ngroups) { assert(name != NULL); diff --git a/src/libraries/Native/Unix/configure.cmake b/src/libraries/Native/Unix/configure.cmake index c043cedebb0319..8faaf1f56444a4 100644 --- a/src/libraries/Native/Unix/configure.cmake +++ b/src/libraries/Native/Unix/configure.cmake @@ -7,7 +7,6 @@ include(CheckStructHasMember) include(CheckSymbolExists) include(CheckTypeSize) - if (CLR_CMAKE_TARGET_ANDROID) set(PAL_UNIX_NAME \"ANDROID\") elseif (CLR_CMAKE_TARGET_ARCH_WASM) @@ -36,7 +35,7 @@ elseif (CLR_CMAKE_TARGET_SUNOS) set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} /opt/local/lib) include_directories(SYSTEM /opt/local/include) else () - message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.") + message(FATAL_ERROR "Unknown platform. Cannot define PAL_UNIX_NAME, used by RuntimeInformation.") endif () # We compile with -Werror, so we need to make sure these code fragments compile without warnings. @@ -232,6 +231,16 @@ check_symbol_exists( "termios.h" HAVE_TCSANOW) +check_symbol_exists( + cfsetspeed + termios.h + HAVE_CFSETSPEED) + +check_symbol_exists( + cfmakeraw + termios.h + HAVE_CFMAKERAW) + check_struct_has_member( "struct utsname" domainname @@ -303,8 +312,7 @@ set(CMAKE_EXTRA_INCLUDE_FILES ${STATFS_INCLUDES}) check_symbol_exists( "statfs" ${STATFS_INCLUDES} - HAVE_STATFS -) + HAVE_STATFS) check_type_size( "struct statfs" @@ -578,8 +586,7 @@ check_c_source_compiles( return 0; } " - BIND_ADDRLEN_UNSIGNED -) + BIND_ADDRLEN_UNSIGNED) check_c_source_compiles( " @@ -594,8 +601,7 @@ check_c_source_compiles( return 0; } " - IPV6MR_INTERFACE_UNSIGNED -) + IPV6MR_INTERFACE_UNSIGNED) check_include_files( "sys/inotify.h" @@ -630,6 +636,13 @@ check_prototype_definition( "sys/types.h;sys/event.h" KEVENT_REQUIRES_INT_PARAMS) +check_prototype_definition( + statfs + "int statfs(const char *path, struct statfs *buf)" + 0 + ${STATFS_INCLUDES} + HAVE_NON_LEGACY_STATFS) + check_c_source_compiles( " #include @@ -671,8 +684,7 @@ check_c_source_compiles( #include int main(void) { return 0; } " - HAVE_NETINET_TCP_VAR_H -) + HAVE_NETINET_TCP_VAR_H) check_c_source_compiles( " @@ -686,8 +698,7 @@ check_c_source_compiles( #include int main(void) { return 0; } " - HAVE_NETINET_UDP_VAR_H -) + HAVE_NETINET_UDP_VAR_H) check_c_source_compiles( " @@ -699,8 +710,7 @@ check_c_source_compiles( #include int main(void) { return 0; } " - HAVE_NETINET_IP_VAR_H -) + HAVE_NETINET_IP_VAR_H) check_c_source_compiles( " @@ -713,8 +723,7 @@ check_c_source_compiles( #include int main(void) { return 0; } " - HAVE_NETINET_ICMP_VAR_H -) + HAVE_NETINET_ICMP_VAR_H) check_include_files( sys/cdefs.h @@ -734,16 +743,19 @@ check_c_source_compiles( #include int main(void) { int x = TCP_ESTABLISHED; return x; } " - HAVE_TCP_H_TCPSTATE_ENUM -) + HAVE_TCP_H_TCPSTATE_ENUM) set(CMAKE_REQUIRED_DEFINITIONS) check_symbol_exists( TCPS_ESTABLISHED "netinet/tcp_fsm.h" - HAVE_TCP_FSM_H -) + HAVE_TCP_FSM_H) + +check_symbol_exists( + getgrouplist + "unistd.h;grp.h" + HAVE_GETGROUPLIST) if(CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) set(HAVE_IOS_NET_ROUTE_H 1) @@ -773,6 +785,26 @@ check_include_files( "sys/types.h;sys/sysctl.h" HAVE_SYS_SYSCTL_H) +check_include_files( + "sys/ioctl.h" + HAVE_SYS_IOCTL_H) + +check_include_files( + "sys/filio.h" + HAVE_SYS_FILIO_H) + +check_include_files( + "sys/types.h;netpacket/packet.h" + HAVE_NETPACKET_PACKET_H) + +check_include_files( + "net/if_arp.h" + HAVE_NET_IF_ARP_H) + +check_include_files( + "sys/mntent.h" + HAVE_SYS_MNTENT_H) + check_include_files( "stdint.h;net/if_media.h" HAVE_NET_IFMEDIA_H) @@ -816,8 +848,7 @@ check_c_source_compiles( return 0; } " - HAVE_GETDOMAINNAME_SIZET -) + HAVE_GETDOMAINNAME_SIZET) set (CMAKE_REQUIRED_FLAGS ${PREVIOUS_CMAKE_REQUIRED_FLAGS}) set (PREVIOUS_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.Unix.cs index 55dcaffa0ea3bf..4ae912cdda52ce 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.Unix.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/DebugProvider.Unix.cs @@ -54,7 +54,7 @@ private static void WriteToDebugger(string message) } else { - Interop.Sys.SysLog(Interop.Sys.SysLogPriority.LOG_USER | Interop.Sys.SysLogPriority.LOG_DEBUG, "%s", message); + Interop.Sys.SysLog(Interop.Sys.SysLogPriority.LOG_DEBUG, "%s", message); } }