1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

296 Commits

Author SHA1 Message Date
Martine Lenders
ea4b78654f
Merge pull request #12285 from JulianHolzwarth/pr/posix/pthread/pthread_reaper_fix
sys/posix/pthread/pthread.c: fix pthread reaper
2019-10-29 18:56:36 +01:00
Benjamin Valentin
764a9e9f63 sys/pthread: check return value of malloc()
To prevent a NULL pointer dereference on a memory constrained system,
check if malloc() was actually successful.
2019-10-20 14:17:07 +02:00
Gaëtan Harter
a889e500f0 pthread: make pthread reaper stacksize configurable
new define 'CONFIG_PTHREAD_REAPER_BASE_STACKSIZE' to change pthread reaper for boards that need more stack
default value is 'THREAD_STACKSIZE_IDLE'
2019-09-25 16:14:29 +02:00
JulianHolzwarth
a4d0c8a8e7 sys/posix/pthread/pthread.c: reduce pthread reaper size 2019-09-20 15:07:49 +02:00
JulianHolzwarth
d6bc8685f7 sys/posix/pthread/pthread.c: create thread sleeping
creating the pthread sleeping and waking it up instead of THREAD_CREATE_WOUT_YIELD and then yielding(sched_switch)
2019-09-20 15:07:49 +02:00
JulianHolzwarth
28719bae37 sys/posix/pthread/pthread.c: check reaper creation
Checking whether or not the pthread reaper was created
And handeling the error when it was not created
2019-09-20 15:07:49 +02:00
JulianHolzwarth
31b3aeb48c sys/posix/pthread/pthread.c: Reaper fix
before the reaper was never created
2019-09-20 15:07:48 +02:00
Gaëtan Harter
624957252e
pthread_cond.h: use 'sys/types.h' value of 'clockid_t' for avr
This enables 'pthread' support on arduino.

avr-libc C90 'time.h' does not include 'sys/types.h' as POSIX expects it.
However, the type previously defined conflicts with the one in
'cpu/atmega_common/avr_libc_extra/include/sys/types.h' when both are
included, so include 'sys/types.h'.

Maybe it should alway be included by 'time.h' but this
would need its specific review.
2019-09-11 18:25:10 +02:00
Juan I Carrano
00e0a1cf13
Merge pull request #12056 from JulianHolzwarth/pr/posix/pthread/small_insert_fix
sys/posix/pthread/pthread.c: fix thread count limiting in pthread_create()
2019-09-11 18:22:54 +02:00
JulianHolzwarth
d76bb689d6 sys/posix/pthread/pthread.c: pthread_create fix
The function insert returns KERNEL_PID_UNDEF now because pthread_create checks for it.
In pthread_create it checks now if thread_create returns a valid pid
2019-09-06 15:54:59 +02:00
Daniele Lacamera
5cb76e521b posix_socket: set sock for returned socket on accept() 2019-08-30 21:18:25 +02:00
Martine Lenders
af5bf360a0
Merge pull request #11575 from miri64/posix_socket/fix/init-uninit-fields
posix_socket: initialize uninitialized fields
2019-08-08 15:56:48 +02:00
Martine Lenders
3bcb1ee2ef posix_socket: initialize uninitialized fields 2019-08-08 15:03:28 +02:00
998fd6bcc9
sys/pthread: deduplicate pthread group definition 2019-08-05 16:57:36 +02:00
Martine Lenders
a9ae2f4ac9 posix_sockets: set read/write permissions for socket fd 2019-05-24 15:58:50 +02:00
Olaf Bergmann
83e2932eb6 posix_sockets.c: fix send()/write() for connected UDP sockets
Calling send() or write() on a connected UDP socket raises a
kernel panic in posix_sockets.c, line 215, because _sockaddr_to_ep()
is called from socket_sendto() with address set to NULL.

This change modifies socket_sendto() to

* Check if the UDP socket is connected when the address argument
  is NULL.
* If connected, use the stored remote endpoint for sock_udp_send().
2019-04-10 11:19:13 +02:00
Juan Carrano
6b766c3cd3 sys/posix: make posix module provide only headers.
The build system contains several instances of
 INCLUDES += -I$(RIOTBASE)/sys/posix/include

This is bypassing the module management system, by directly accesing
headers without depending on a module. The module is the posix module.

That line is also added when one of the posix_* modules is requested.

According to the docs, the posix module provides headers only, but in
reality there is also inet.c.

This patch:

- Moves `inet.c` into `posix_inet`, leaving `posix` as a headers-only
  module.
- Rename `posix` as `posix_headers` to make it clear the module only
  includes headers.
- Makes `posix_*` modules depend on `posix_headers`, thus removing the
  explicit `INCLUDES+=...` in `sys/Makefile.include`.
- Ocurrences of `INCLUDES+=...` are replaced by an explicit dependency
  on `posix_headers`.
2019-03-20 12:57:13 +01:00
Jose Alamos
f2ff06c9d4 posix/pthread_rwlock: fix unsigned variable comparison 2018-08-21 13:58:39 +02:00
Gunar Schorcht
9db03537b9 core/pthread: make them compilable with g++ 2018-07-21 14:24:57 +02:00
7d013eb2b6 sys: fix doxygen grouping 2018-06-11 19:12:02 +02:00
Gaëtan Harter
ed4932362d Revert "posix/osx: fix type conflict on OSX native"
This reverts commit dcebfb11bc.
2018-04-12 17:48:27 +02:00
Gaëtan Harter
ea52528171 Revert "posix/osx: fix missing AF_LINK on OSX native"
This reverts commit b5554bcc1f.
2018-04-12 17:48:21 +02:00
Gaëtan Harter
b5554bcc1f posix/osx: fix missing AF_LINK on OSX native
netdev_tap.c uses AF_LINK when compiled on OSX native.

Preparation to remove NATIVEINCLUDES.
2018-03-20 17:50:57 +01:00
Gaëtan Harter
dcebfb11bc posix/osx: fix type conflict on OSX native
In another header file, `socklen_t` is defined to `__darwin_socklen_t` which is
an `uint32_t` and it conflicts.

Preparation to remove NATIVEINCLUDES.
2018-03-20 17:50:47 +01:00
smlng
6b0491eca2 sys/posix: fix intentional fallthrough in pthread 2018-01-16 13:21:24 +01:00
702ec4a517 sys/posix: pthread_barrier: DEBUG fix 2018-01-15 14:37:04 +01:00
c6b482d56c posix: pthread_rwlock: fix DEBUG messages 2018-01-15 14:37:04 +01:00
smlng
b283b7784c make: fix various compile errors with Wextra
pkg, nordic_softdevice_ble: disable CFLAGS to omit compiler error
        sys, pm_layered: fix casting nonscalar to the same type
        cpu, stm32_common: fix type-limits, remove always true assert
        cpu, stm32f4: fix pointer arithmetic in periph/i2c
        drivers, at86rf2xx: fix type-limits where condition always true
        saul, gpio: fix if no gpio configured for saul
        cpu, saml21: add frequency check to periph/timer
        driver, cc110x: fix unused param and type-limts errors
        boards, wsn430-common: fix old-style-declaration
        make: fix old style definition
        drivers, sdcard_spi: fix old style typedef
        driver, at30tse: remove unnecessary check
        driver, nrf24: fix type-limit
        driver, pn532: change buffer from char to uint8_t
        tests/driver_sdcard: fix type limits
        boards, feather-m0: add missing field inits
        driver, tcs37727: fix type limits
        pkg, emb6: disable some compiler warnings
        tests/emb6: disable some compiler warings
        pkg, openthread: fix sign compare and unused params
        tests/trickle: fix struct init
        tests/pthread_cooperation: fix type limits
        board, mips-malta: remove feature periph_uart
        shell: fix var size for netif command
        gnrc, netif: fix sign-compare
        gnrc, nib: fix sign-compare
        shell: fix output in netif command
        posix: fix type-limits in pthread_cond
2017-11-28 18:31:43 +01:00
3e4e3d261f sys/posix: factor inet_*to* from header into .c file 2017-11-15 23:01:56 +01:00
Martine Lenders
0a0bb86f4a posix: move time functions to their own module 2017-11-12 19:55:57 +01:00
Lucas Jenss
6998ffbb14 cppcheck: Provide consistent reason formatting for all cppcheck-suppresses 2017-10-10 10:25:20 -07:00
smlng
1ed6f84992 doc: fix whitespaces 2017-09-06 08:49:05 +02:00
162478cd6d spelling: s/initialise/initialize/ 2017-09-05 11:04:25 +02:00
Joakim Nohlgård
da4f2f6e6e Merge pull request #6892 from neiljay/pr/mips-newlib-v2
cpu/mips: Integrate better with RIOT newlib layer (v2)
2017-07-20 00:27:51 +02:00
smlng
d2fd406e60 posix: fix pthread_cond_wait and pthread_cond_timedwait 2017-06-24 20:28:52 +02:00
smlng
8253510f0b posix: replace timex in pthread_rwlock 2017-06-21 11:35:27 +02:00
smlng
29d84a6865 posix: replace timex in pthread_cond 2017-06-21 11:24:22 +02:00
Francisco Acosta
3af1fe5675 Merge pull request #7134 from smlng/macos/fix/posix/clockid_t
posix: fix redefined clockid_t on macOS
2017-06-13 17:48:20 +02:00
smlng
16bd7db5dc posix: fix redefined clockid_t on macOS 2017-06-13 17:32:21 +02:00
Joakim Nohlgård
91d930c574 cpu/mips32r2_common: ifdef __attribute__((optimize))
Causes compilation error on Clang
2017-06-02 10:24:44 +01:00
0fcc7d3834 cleanup: apply headerguard script output 2017-05-24 17:54:02 +02:00
Sam Kumar
331c60409e posix_sockets: fix use of fd_new 2017-05-17 08:01:54 -07:00
185c7ac11b some (ptr == 0) -> (ptr == NULL) fixes (found by coccinelle) 2017-04-20 23:31:32 +02:00
smlng
3a6cb0dc71 sys, posix: fix cppcheck warnings and errors in posix_socket 2017-04-19 17:20:48 +02:00
cfd10c394a adapt to changed byteorder.h 2017-04-13 11:35:35 +02:00
Martine Lenders
1caa024038 posix: remove fd subsystem
Fixes #637.

This only provides a subset of vfs while being incompatible with it.
Since POSIX sockets don't use this module anymore it can be removed.
2017-04-04 19:53:12 +02:00
Martine Lenders
ac7671762d Merge pull request #6778 from miri64/posix_sockets/enh/port-to-vfs
posix_sockets: port to vfs for file descriptors
2017-04-04 19:51:51 +02:00
Martine Lenders
8b5eda9020 posix_sockets: port to vfs for file descriptors 2017-04-03 20:23:14 +02:00
Hauke Petersen
76bae4b111 Merge pull request #6066 from neiljay/pr/add_mips-pic32_mz
cpu: Add PIC32MZ support
2017-03-29 12:53:47 +02:00
Neil Jones
becfd63b00 sys: Extend MIPS temporary work around to all mips targets.
Extened the temporary workaround for mips boards to all mips boards
until pr#6639 is merged.
2017-03-28 16:25:32 +01:00
Francois Berder
c787638696 posix: sockets: Implement SO_RCVTIMEO option in setsockopt
AwaLWM2M needs to be polled regularly to check for incoming data.
Since RIOT only supports timeout at the GNRC sock layer while
the network abstraction for RIOT in AwaLWM2M uses the posix layer,
this causes RIOT to be blocked waiting for data that never arrive.

This commit implements only the SO_RCVTIMEO option in setsockopt to
allow users to set a receive timeout for a socket at the posix layer.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-23 09:59:46 +00:00
Sebastian Meiling
4730933117 Merge pull request #6763 from miri64/posix/fix/unistd
posix: fix close() if fd_obj was closed already
2017-03-20 16:13:21 +01:00
Martine Lenders
bac4118d68 posix: fix close() if fd_obj was closed already 2017-03-20 09:43:55 +01:00
Martine Lenders
465f8e42a1 posix_sockets: fix assertion on close 2017-03-20 09:37:26 +01:00
Martine Lenders
4a51d1b433 Merge pull request #6697 from francois-berder-imgtec/awalwm2m
posix: sockets: Small fixes for listen and recvfrom functions
2017-03-11 19:22:35 +01:00
Oleg Hahm
d48330acbb doc: posix: fix doxygen complaints 2017-03-10 14:56:28 +01:00
Joakim Nohlgård
887cc72365 Merge pull request #5616 from gebart/pr/vfs
vfs: file system abstraction
2017-03-09 09:44:56 +01:00
Joakim Nohlgård
89ba41c79e sys/posix: Add sys/statvfs.h 2017-03-07 17:59:57 +01:00
Francois Berder
27dec749e8 posix: sockets: Fix return value of recvfrom and sendto
_bind_connect already sets errno and returns -1 or 0.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-07 16:42:21 +00:00
Francois Berder
8d2ec19be6 posix: sockets: Fix timeout regression of recvfrom
Commit de41971aab sets the default
timeout to 0. This change should not have been part of the commit.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-07 11:07:16 +00:00
Francois Berder
8f839fbc31 posix: sockets: address was not set in recvfrom
The address is an optional parameter of recvfrom. If it is
not null, recvfrom must store the address of the sender.
However this was only allowed if res was equal to 0, which
is wrong since res contains the number of bytes received
or -1.
This commit ensures that the address is set only if no
previous errors happened before.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-07 11:06:01 +00:00
Joakim Nohlgård
03d9f0f3d8 sys/posix: Add fcntl.h 2017-03-07 10:21:53 +01:00
Oleg Hahm
6022760fc6 posix: missing closing parenthesis 2017-03-06 22:37:28 +01:00
Francois Berder
2936a69a1b posix: sockets: Fix return value of listen function
If an error happens, listen was returning 1 instead of -1.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-06 13:26:51 +00:00
Francois Berder
a5003e8311 posix: in: Fix sockaddr_in6 structure
The sin6_family member was an int. This caused the structure to
take 32 bytes which was greater than sockaddr_storage size (28
bytes).
Using the type sa_family_t for sin6_family member fixes this
issue.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-03 16:49:54 +00:00
Francois Berder
de41971aab posix: sockets: Fix return value of sendto and recvfrom
The return value of these functions was not always correct
in case of errors: they were not returning -1 and setting
errno.

Signed-off-by: Francois Berder <francois.berder@imgtec.com>
2017-03-03 15:52:22 +00:00
Joakim Nohlgård
f055137e02 sys/posix: Add missing Doxygen comment on spinlock flag member 2017-02-08 16:23:51 +01:00
Joakim Nohlgård
597db0358d sys/posix/pthread: Use C11 atomic instead of atomic.h 2017-02-08 16:23:49 +01:00
Martine Lenders
4f5d046622 doc: net: replace doc references of conn with sock 2017-02-07 13:32:20 +01:00
Martine Lenders
1ccdc4643f posix_sockets: port to sock 2017-01-24 15:17:15 +01:00
Oleg Hahm
3c6678b037 *: fix mismatching endifs for header guards 2017-01-19 18:30:53 +01:00
Oleg Hahm
7ee7801c10 *: remove trailing underscores from header guards 2017-01-19 18:30:53 +01:00
Oleg Hahm
4f4214235b timex: unambiguous time conversion macros 2017-01-19 13:18:08 +01:00
Victor Arino
066db5857a sys/posix: adapt semaphore to new implementation 2017-01-19 08:59:17 +01:00
Philippe Coval
20c3aaa448 sys: Fix pthread includes to support avr-libs
Missing malloc.h and clock_id_t were causing issues to build.

It was tested with this configuration:

- linux ubuntu 14.04.5
- arduino-mega2560 board
- avr-libc-1.8.0-4.1

This change was needed to build iotivity example

Bug: https://github.com/RIOT-OS/RIOT/issues/6241
Change-Id: I82ce246093b3467dfe9746f999bcc9335dbb65f6
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
2017-01-17 19:44:22 +01:00
2121c6effd sys: posix: remove not needed strings.h 2016-12-22 12:25:31 +01:00
Joakim Nohlgård
7c48c891a0 xtimer: Update xtimer usage to match API changes 2016-11-29 20:44:31 +01:00
Laurent Navet
5fe337bc6c sys: fix include headers guards 2016-10-26 21:53:58 +02:00
7718f114cb all: remove pointer casts for msg.content.ptr 2016-06-02 23:13:42 +02:00
DipSwitch
21edec412a posix: Remove _t from struct names 2016-04-11 21:46:54 +02:00
f626ee5969 Merge pull request #4557 from kaspar030/introduce_intrusive_singly_linked_list
core: mutex: several optimizations
2016-03-29 22:25:43 +02:00
c0f39bb55f sys: posix: pthread: fix mutex usage 2016-03-29 21:50:17 +02:00
Yonezawa-T2
1ce140d910 debug: fix compilation error for %p formatter 2016-03-29 11:46:29 +09:00
kYc0o
f92b025b85 vtimer: get rid of 2016-03-24 17:10:54 +01:00
DipSwitch
0bb4748a94 core: Fix/refactor function naming in core/incude/irq.h 2016-03-20 16:47:34 +01:00
Oleg Hahm
bdcf8879fd core: merged kernel_macros.h and attributes.h
Merged into new kernel_defines.h and updated all includes.
2016-03-09 22:29:06 +01:00
Oleg Hahm
b61b8e9f00 sockets: add documentation about implicite binding 2016-03-08 19:48:20 +01:00
c3fe4615bd sys: posix: posix_semaphore: adapt to thread.h 2016-03-05 18:20:17 +01:00
2b010b5337 core: rename tcb_t -> thread_t, move into thread.h 2016-03-05 18:20:17 +01:00
Martine Lenders
327f7c442c Merge pull request #4816 from kaspar030/rename_genrand
sys: random: rename genrand_* to random_*
2016-03-01 13:58:39 +01:00
ded39b461e sys: random: rename genrand_* to random_* 2016-02-29 21:33:17 +01:00
9082273746 core: header cleanup 2016-02-28 22:46:28 +01:00
Oleg Hahm
94231241ec posix sockets: missing includes for conn 2016-02-25 10:42:50 +01:00
Oleg Hahm
35074a6ad1 posix socket: align size of sa_family_t with Linux
Linux defines `sa_family_t` as `unsigned short int`. In order to be compatible with Linux code, RIOT should define it the same way.
2016-01-07 11:12:35 +01:00
Oleg Hahm
c811380440 Merge pull request #4468 from cgundogan/pr/posix_sockets/close_fd_fix
posix_sockets: fix overflowing fd in close()
2015-12-12 12:13:51 +01:00
Cenk Gündoğan
0ddfffc0c2 posix_sockets: fix overflowing fd in close() 2015-12-12 04:24:23 +01:00
Cenk Gündoğan
6f92b056f9 posix_sockets: do not use the address of best_match 2015-12-12 02:51:00 +01:00
Oleg Hahm
e8ed9fbe83 Merge pull request #4386 from OlegHahm/posix_sockets_stream_fixes
POSIX sockets: implicit bind for connect()
2015-12-08 16:35:29 +01:00
Oleg Hahm
11add4d8fd sockets: implicit bind for connect()
According to
http://pubs.opengroup.org/onlinepubs/009695399/functions/connect.html
for a "socket [that] has not already been bound to a local address,
connect() shall bind it to an address which, unless the socket's address
family is AF_UNIX, is an unused local address."
2015-12-08 11:57:20 +01:00
Hauke Petersen
41979b64cd sys: adapted to renamed THREAD FLAGS 2015-12-07 22:09:47 +01:00