Changeset 4d8f9e6 in rtems-libbsd
- Timestamp:
- 09/17/18 07:47:20 (6 years ago)
- Branches:
- 5, 5-freebsd-12, 6-freebsd-12, master
- Children:
- ed40c80
- Parents:
- 48cbe6c
- git-author:
- Sebastian Huber <sebastian.huber@…> (09/17/18 07:47:20)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (09/19/18 06:24:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mDNSResponder/mDNSPosix/mDNSPosix.c
r48cbe6c r4d8f9e6 41 41 #include <arpa/inet.h> 42 42 #include <time.h> // platform support for UTC time 43 #ifdef __rtems__ 44 #include <sys/param.h> 45 #include <rtems/libio_.h> 46 #endif /* __rtems__ */ 43 47 44 48 #if USES_NETLINK … … 76 80 77 81 // Note that static data is initialized to zero in (modern) C. 82 #ifndef __rtems__ 78 83 static fd_set gEventFDs; 84 #else /* __rtems__ */ 85 static fd_set *gAllocatedEventFDs; 86 #define gEventFDs (*gAllocatedEventFDs) 87 #endif /* __rtems__ */ 79 88 static int gMaxFD; // largest fd in gEventFDs 80 89 static GenLinkedList gEventSources; // linked list of PosixEventSource's … … 1157 1166 { 1158 1167 IfChangeRec *pChgRec = (IfChangeRec*) context; 1168 #ifndef __rtems__ 1159 1169 fd_set readFDs; 1170 #else /* __rtems__ */ 1171 fd_set bigEnoughReadFDs[howmany(rtems_libio_number_iops, sizeof(fd_set) * 8)]; 1172 #define readFDs (*(&bigEnoughReadFDs[0])) 1173 #endif /* __rtems__ */ 1160 1174 mDNSu32 changedInterfaces = 0; 1161 1175 struct timeval zeroTimeout = { 0, 0 }; … … 1164 1178 (void)filter; // Unused 1165 1179 1180 #ifndef __rtems__ 1166 1181 FD_ZERO(&readFDs); 1182 #else /* __rtems__ */ 1183 memset(bigEnoughReadFDs, 0, sizeof(bigEnoughReadFDs)); 1184 #endif /* __rtems__ */ 1167 1185 FD_SET(pChgRec->NotifySD, &readFDs); 1168 1186 … … 1242 1260 mDNS_SetFQDN(m); 1243 1261 #ifdef __rtems__ 1262 if (err == mStatus_NoError) { 1263 gAllocatedEventFDs = calloc(1, howmany(rtems_libio_number_iops, sizeof(fd_set) * 8)); 1264 if (gAllocatedEventFDs == NULL) err = mStatus_NoMemoryErr; 1265 } 1244 1266 if (err == mStatus_NoError) err = pthread_mutexattr_init(&attr); 1245 1267 if (err == mStatus_NoError) err = pthread_mutexattr_setprotocol(&attr, PTHREAD_PRIO_INHERIT); … … 1686 1708 InitLinkedList(&gEventSources, offsetof(PosixEventSource, Next)); 1687 1709 1710 #ifndef __rtems__ 1688 1711 if (fd >= (int) FD_SETSIZE || fd < 0) 1689 1712 return mStatus_UnsupportedErr; 1713 #endif /* __rtems__ */ 1690 1714 if (callback == NULL) 1691 1715 return mStatus_BadParamErr; … … 1767 1791 sigset_t *pSignalsReceived, mDNSBool *pDataDispatched) 1768 1792 { 1793 #ifndef __rtems__ 1769 1794 fd_set listenFDs = gEventFDs; 1795 #else /* __rtems__ */ 1796 fd_set bigEnoughListenFDs[howmany(rtems_libio_number_iops, sizeof(fd_set) * 8)]; 1797 #define listenFDs (*(&bigEnoughListenFDs[0])) 1798 memcpy(bigEnoughListenFDs, gAllocatedEventFDs, sizeof(bigEnoughListenFDs)); 1799 #endif /* __rtems__ */ 1770 1800 int fdMax = 0, numReady; 1771 1801 struct timeval timeout = *pTimeout;
Note: See TracChangeset
for help on using the changeset viewer.