diff --git a/examples/ccn-lite-client/HOWTO b/examples/ccn-lite-client/HOWTO index 7d038ac4d86fe312b22fc59c02bca41f23973388..010ac451bbcff4dc0ebd86d3bce6ac9a9b9dd97f 100644 --- a/examples/ccn-lite-client/HOWTO +++ b/examples/ccn-lite-client/HOWTO @@ -4,7 +4,7 @@ simple appserver (all in one shell) 0. create tap devices: *./cpu/native/tapsetup.sh create 3* 1. build ccn-lite-client: *make -B clean all-valgrind* 2. start: *./bin/native/ccn-lite-client.elf tap0* (valgrind support included) -3. optinonal: *config 20* [enter] (this sets the content store size) +3. optional: *config 20* [enter] (this sets the content store size) 4. start appserver thread: *appserver* [enter] (this starts the userland appserver, which registers for "/riot/appserver/" 5. request content: *interest /riot/appserver/test* [enter] (ask the relay for this "file", userland code splits this up in chunks and requests them from the relay. In the relay the name "/riot/appserver" is registered to the RIOT MSG face with diff --git a/sys/include/fd.h b/sys/include/fd.h index 9ba52b260d600b154364c89511e6a66c309b1c26..e03b16aa25afa7c504a7b065194081f431dd6b6b 100644 --- a/sys/include/fd.h +++ b/sys/include/fd.h @@ -34,13 +34,13 @@ extern "C" { */ typedef struct { /** private status of this fd_t */ - int __active; + int internal_active; - /** the internal filedescriptor */ - int fd; + /** Stores the RIOT internal value for the file descriptor (not POSIX). */ + int internal_fd; /** - * Read *n* into *buf* from *fd*. Return the + * Read *n* bytes into *buf* from *fd*. Return the * number read, -1 for errors or 0 for EOF. */ ssize_t (*read)(int fd, void *buf, size_t n); diff --git a/sys/posix/fd.c b/sys/posix/fd.c index 9acc595139bdbcef81f3e160a10898f199d136a3..8f40bbda354ed6ecac257820e87061eaad44c972 100644 --- a/sys/posix/fd.c +++ b/sys/posix/fd.c @@ -43,8 +43,8 @@ int fd_init(void) #ifdef MODULE_UART0 posix_open(uart0_handler_pid, 0); fd_t fd = { - .__active = 1, - .fd = (int)uart0_handler_pid, + .internal_active = 1, + .internal_fd = (int)uart0_handler_pid, .read = (ssize_t ( *)(int, void *, size_t))posix_read, .write = (ssize_t ( *)(int, const void *, size_t))posix_write, .close = posix_close @@ -61,7 +61,7 @@ static int fd_get_next_free(void) for (int i = 0; i < FD_MAX; i++) { fd_t *cur = &fd_table[i]; - if (!cur->__active) { + if (!cur->internal_active) { return i; } } @@ -77,8 +77,8 @@ int fd_new(int internal_fd, ssize_t (*internal_read)(int, void *, size_t), if (fd >= 0) { fd_t *fd_s = fd_get(fd); - fd_s->__active = 1; - fd_s->fd = internal_fd; + fd_s->internal_active = 1; + fd_s->internal_fd = internal_fd; fd_s->read = internal_read; fd_s->write = internal_write; fd_s->close = internal_close; diff --git a/sys/posix/pnet/sys_socket.c b/sys/posix/pnet/sys_socket.c index 781ca8576487f4ed6e228668226bafb3a2da985e..924acbe9052522bc1be33d7548d4fede74dc6cba 100644 --- a/sys/posix/pnet/sys_socket.c +++ b/sys/posix/pnet/sys_socket.c @@ -45,7 +45,7 @@ int socket(int domain, int type, int protocol) #define sock_func_wrapper(func, sockfd, ...) \ ((fd_get(sockfd)) ? \ - func(fd_get(sockfd)->fd, __VA_ARGS__) : \ + func(fd_get(sockfd)->internal_fd, __VA_ARGS__) : \ (errno = EBADF, -1)) int accept(int socket, struct sockaddr *restrict address, diff --git a/sys/posix/unistd.c b/sys/posix/unistd.c index 6b6f1e2ff198179c4b5a535612593cb901b01fc7..d55ea298f25c08f9e621cb30d87a0a199cf0d7d1 100644 --- a/sys/posix/unistd.c +++ b/sys/posix/unistd.c @@ -27,12 +27,12 @@ int close(int fildes) return -1; } - if (fd_obj->close(fd_obj->fd) < 0) { + if (fd_obj->close(fd_obj->internal_fd) < 0) { errno = EIO; // EINTR may not occur since RIOT has no signals yet. return -1; } - fd_destroy(fd_obj->fd); + fd_destroy(fd_obj->internal_fd); return 0; }