mirror of
https://github.com/apache/nuttx.git
synced 2026-06-07 09:18:00 +08:00
Changing NuttX fixed size type names to C99 standard names -- things will be broken for awhile
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2351 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/poll/host.c
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -37,9 +37,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/poll/net_listener.c
|
||||
*
|
||||
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -39,12 +39,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -89,7 +90,7 @@ struct net_listener_s
|
||||
* Name: net_closeclient
|
||||
****************************************************************************/
|
||||
|
||||
static boolean net_closeclient(struct net_listener_s *nls, int sd)
|
||||
static bool net_closeclient(struct net_listener_s *nls, int sd)
|
||||
{
|
||||
message("net_listener: Closing host side connection sd=%d\n", sd);
|
||||
close(sd);
|
||||
@@ -97,18 +98,18 @@ static boolean net_closeclient(struct net_listener_s *nls, int sd)
|
||||
|
||||
/* If we just closed the max SD, then search downward for the next biggest SD. */
|
||||
|
||||
while (FD_ISSET(nls->mxsd, &nls->master) == FALSE)
|
||||
while (FD_ISSET(nls->mxsd, &nls->master) == false)
|
||||
{
|
||||
nls->mxsd -= 1;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_incomingdata
|
||||
****************************************************************************/
|
||||
|
||||
static inline boolean net_incomingdata(struct net_listener_s *nls, int sd)
|
||||
static inline bool net_incomingdata(struct net_listener_s *nls, int sd)
|
||||
{
|
||||
char *ptr;
|
||||
int nbytes;
|
||||
@@ -130,7 +131,7 @@ static inline boolean net_incomingdata(struct net_listener_s *nls, int sd)
|
||||
if (errno != EAGAIN)
|
||||
{
|
||||
net_closeclient(nls, sd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,7 +139,7 @@ static inline boolean net_incomingdata(struct net_listener_s *nls, int sd)
|
||||
{
|
||||
message("net_listener: Client connection lost sd=%d\n", sd);
|
||||
net_closeclient(nls, sd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -156,7 +157,7 @@ static inline boolean net_incomingdata(struct net_listener_s *nls, int sd)
|
||||
{
|
||||
message("net_listener: Send failed sd=%d: \n", sd, errno);
|
||||
net_closeclient(nls, sd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -174,7 +175,7 @@ static inline boolean net_incomingdata(struct net_listener_s *nls, int sd)
|
||||
* Name: net_connection
|
||||
****************************************************************************/
|
||||
|
||||
static inline boolean net_connection(struct net_listener_s *nls)
|
||||
static inline bool net_connection(struct net_listener_s *nls)
|
||||
{
|
||||
int sd;
|
||||
|
||||
@@ -193,7 +194,7 @@ static inline boolean net_connection(struct net_listener_s *nls)
|
||||
|
||||
if (errno != EINTR)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -207,17 +208,17 @@ static inline boolean net_connection(struct net_listener_s *nls)
|
||||
{
|
||||
nls->mxsd = sd;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_mksocket
|
||||
****************************************************************************/
|
||||
|
||||
static inline boolean net_mksocket(struct net_listener_s *nls)
|
||||
static inline bool net_mksocket(struct net_listener_s *nls)
|
||||
{
|
||||
int value;
|
||||
int ret;
|
||||
@@ -229,7 +230,7 @@ static inline boolean net_mksocket(struct net_listener_s *nls)
|
||||
if (nls->listensd < 0)
|
||||
{
|
||||
message("net_listener: socket failed: %d\n", errno);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Configure the socket */
|
||||
@@ -240,7 +241,7 @@ static inline boolean net_mksocket(struct net_listener_s *nls)
|
||||
{
|
||||
message("net_listener: setsockopt failed: %d\n", errno);
|
||||
close(nls->listensd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Set the socket to non-blocking */
|
||||
@@ -251,7 +252,7 @@ static inline boolean net_mksocket(struct net_listener_s *nls)
|
||||
{
|
||||
message("net_listener: ioctl failed: %d\n", errno);
|
||||
close(nls->listensd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -266,7 +267,7 @@ static inline boolean net_mksocket(struct net_listener_s *nls)
|
||||
{
|
||||
message("net_listener: bind failed: %d\n", errno);
|
||||
close(nls->listensd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Mark the socket as a listener */
|
||||
@@ -276,10 +277,10 @@ static inline boolean net_mksocket(struct net_listener_s *nls)
|
||||
{
|
||||
message("net_listener: bind failed: %d\n", errno);
|
||||
close(nls->listensd);
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@@ -290,7 +291,7 @@ static void net_configure(void)
|
||||
{
|
||||
struct in_addr addr;
|
||||
#if defined(CONFIG_EXAMPLE_POLL_NOMAC)
|
||||
ubyte mac[IFHWADDRLEN];
|
||||
uint8_t mac[IFHWADDRLEN];
|
||||
#endif
|
||||
|
||||
/* Configure uIP */
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* examples/poll/net_reader.c
|
||||
*
|
||||
* Copyright (C) 2008, 2009 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <sys/select.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -83,7 +84,7 @@ static void net_configure(void)
|
||||
{
|
||||
struct in_addr addr;
|
||||
#if defined(CONFIG_EXAMPLE_POLL_NOMAC)
|
||||
ubyte mac[IFHWADDRLEN];
|
||||
uint8_t mac[IFHWADDRLEN];
|
||||
#endif
|
||||
|
||||
/* Configure uIP */
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -93,8 +93,8 @@ void *poll_listener(pthread_addr_t pvarg)
|
||||
struct pollfd fds[NPOLLFDS];
|
||||
char buffer[64];
|
||||
ssize_t nbytes;
|
||||
boolean timeout;
|
||||
boolean pollin;
|
||||
bool timeout;
|
||||
bool pollin;
|
||||
int nevents;
|
||||
int fd;
|
||||
int ret;
|
||||
@@ -128,8 +128,8 @@ void *poll_listener(pthread_addr_t pvarg)
|
||||
fds[FIFONDX].events = POLLIN;
|
||||
fds[FIFONDX].revents = 0;
|
||||
|
||||
timeout = FALSE;
|
||||
pollin = FALSE;
|
||||
timeout = false;
|
||||
pollin = false;
|
||||
|
||||
ret = poll(fds, NPOLLFDS, POLL_LISTENER_DELAY);
|
||||
|
||||
@@ -141,7 +141,7 @@ void *poll_listener(pthread_addr_t pvarg)
|
||||
else if (ret == 0)
|
||||
{
|
||||
message("poll_listener: Timeout\n");
|
||||
timeout = TRUE;
|
||||
timeout = true;
|
||||
}
|
||||
else if (ret > NPOLLFDS)
|
||||
{
|
||||
@@ -149,7 +149,7 @@ void *poll_listener(pthread_addr_t pvarg)
|
||||
}
|
||||
else
|
||||
{
|
||||
pollin = TRUE;
|
||||
pollin = true;
|
||||
}
|
||||
|
||||
nevents = 0;
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
@@ -83,8 +83,8 @@ void *select_listener(pthread_addr_t pvarg)
|
||||
struct timeval tv;
|
||||
char buffer[64];
|
||||
ssize_t nbytes;
|
||||
boolean timeout;
|
||||
boolean ready;
|
||||
bool timeout;
|
||||
bool ready;
|
||||
int fd;
|
||||
int ret;
|
||||
|
||||
@@ -112,8 +112,8 @@ void *select_listener(pthread_addr_t pvarg)
|
||||
tv.tv_sec = SELECT_LISTENER_DELAY;
|
||||
tv.tv_usec = 0;
|
||||
|
||||
timeout = FALSE;
|
||||
ready = FALSE;
|
||||
timeout = false;
|
||||
ready = false;
|
||||
|
||||
ret = select(fd+1, (FAR fd_set*)&rfds, (FAR fd_set*)NULL, (FAR fd_set*)NULL, &tv);
|
||||
message("\nselect_listener: select returned: %d\n", ret);
|
||||
@@ -125,7 +125,7 @@ void *select_listener(pthread_addr_t pvarg)
|
||||
else if (ret == 0)
|
||||
{
|
||||
message("select_listener: Timeout\n");
|
||||
timeout = TRUE;
|
||||
timeout = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -135,7 +135,7 @@ void *select_listener(pthread_addr_t pvarg)
|
||||
}
|
||||
else
|
||||
{
|
||||
ready = TRUE;
|
||||
ready = true;
|
||||
}
|
||||
|
||||
if (!FD_ISSET(fd, rfds))
|
||||
@@ -176,8 +176,8 @@ void *select_listener(pthread_addr_t pvarg)
|
||||
message("select_listener: Read '%s' (%d bytes)\n", buffer, nbytes);
|
||||
}
|
||||
|
||||
timeout = FALSE;
|
||||
ready = FALSE;
|
||||
timeout = false;
|
||||
ready = false;
|
||||
}
|
||||
while (nbytes > 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user