Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/sockif: add si_getsockopt and si_setsockopt to simply getsockopt and setsockopt #7651

Merged
merged 2 commits into from Nov 23, 2022

Conversation

Donny9
Copy link
Contributor

@Donny9 Donny9 commented Nov 22, 2022

Summary

  1. net/sockif: add si_getsockopt and si_setsockopt to simply getsockopt and setsockopt
  2. support SO_PEERCRED for local socket.

Impact

simply code

Testing

local test

@Donny9 Donny9 force-pushed the sensor branch 6 times, most recently from 6fcca62 to 629da68 Compare November 22, 2022 07:49
net/bluetooth/bluetooth_sockif.c Outdated Show resolved Hide resolved
include/sys/socket.h Outdated Show resolved Hide resolved
@Donny9 Donny9 force-pushed the sensor branch 3 times, most recently from bd561fd to db5b4a4 Compare November 22, 2022 14:28
@Donny9 Donny9 force-pushed the sensor branch 2 times, most recently from 55db27a to f457f82 Compare November 23, 2022 03:22
…sockopt

move private option to protocol sockif

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
the credentials of the peer process connected to this socket.
refs:https://man7.org/linux/man-pages/man7/unix.7.html

Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
@masayuki2009
Copy link
Contributor

masayuki2009 commented Nov 23, 2022

@Donny9 @xiaoxiang781216
Hmm, telnetd does not work with spresense:wifi now.

AEG

NuttShell (NSH) NuttX-10.4.0
nsh>
nsh> ps
  PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
    0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000468  46.8%  CPU0 IDLE
    1     1   1   0 FIFO     Kthread N-- Assigned           00000000 001000 000228  22.8%  CPU1 IDLE
    2     2   0 224 RR       Kthread --- Running            00000000 001992 000540  27.1%  hpwork 0x2d06044c
    3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000308  15.4%  lpwork 0x2d060464
    5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000488  50.0%  cxd56_pm_task
    6     6   1 100 RR       Task    --- Running            00000000 003024 001240  41.0%  spresense_main
nsh> gs2200m raspi3-g wifi-test-24g &
gs2200m [7:50]
nsh> ps
  PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
    0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000468  46.8%  CPU0 IDLE
    1     1   1   0 FIFO     Kthread N-- Assigned           00000000 001000 000228  22.8%  CPU1 IDLE
    2     2 --- 224 RR       Kthread --- Waiting  Semaphore 00000000 001992 000668  33.5%  hpwork 0x2d06044c
    3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000308  15.4%  lpwork 0x2d060464
    5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000488  50.0%  cxd56_pm_task
    6     6   0 100 RR       Task    --- Running            00000000 003024 001556  51.4%  spresense_main
    7     7   1  50 RR       Task    --- Running            00000000 001976 001288  65.1%  gs2200m raspi3-g wifi-test-24g
nsh> telnetd
nsh> ps
  PID GROUP CPU PRI POLICY   TYPE    NPX STATE    EVENT     SIGMASK   STACK   USED  FILLED COMMAND
    0     0   0   0 FIFO     Kthread N-- Assigned           00000000 001000 000468  46.8%  CPU0 IDLE
    1     1   1   0 FIFO     Kthread N-- Running            00000000 001000 000228  22.8%  CPU1 IDLE
    2     2 --- 224 RR       Kthread --- Waiting  Semaphore 00000000 001992 000668  33.5%  hpwork 0x2d06044c
    3     3 ---  60 RR       Kthread --- Waiting  Semaphore 00000000 001992 000308  15.4%  lpwork 0x2d060464
    5     5 --- 200 RR       Task    --- Waiting  MQ empty  00000000 000976 000488  50.0%  cxd56_pm_task
    6     6   0 100 RR       Task    --- Running            00000000 003024 001556  51.4%  spresense_main
    7     7 ---  50 RR       Task    --- Waiting  Semaphore 00000000 001976 001436  72.6%  gs2200m raspi3-g wifi-test-24g

@masayuki2009
Copy link
Contributor

@Donny9 @xiaoxiang781216

sim:usrsocktest also failed.

NuttShell (NSH) NuttX-10.4.0
nsh> uname -a
NuttX  10.4.0 ccf0c3566e Nov 23 2022 17:30:48 sim sim
nsh> usrsocktest
Starting unit-tests...
Testing group "char_dev" =>
	Group "char_dev": [OK]
Testing group "no_daemon" =>
	Group "no_daemon": [OK]
Testing group "basic_daemon" =>
	Group "basic_daemon": [OK]
Testing group "basic_connect" =>
	Group "basic_connect": [OK]
Testing group "basic_connect_delay" =>
	Group "basic_connect_delay": [OK]
Testing group "no_block_connect" =>
	Group "no_block_connect": [OK]
Testing group "basic_send" =>
	Group "basic_send": [OK]
Testing group "no_block_send" =>
	Group "no_block_send": [OK]
Testing group "block_send" =>
	Group "block_send": [OK]
Testing group "no_block_recv" =>
	Group "no_block_recv": [OK]
Testing group "block_recv" =>
	Group "block_recv": [OK]
Testing group "remote_disconnect" =>
	Group "remote_disconnect": [OK]
Testing group "basic_setsockopt" =>
	[TEST ASSERT FAILED!]
		In function "basic_setsockopt_open":
		line 103: Assertion `(ssize_t)((ret)) == (ssize_t)((0))' failed.
			got value: -1
			should be: 0
	Group "basic_setsockopt": [FAILED]
Testing group "basic_getsockopt" =>
	[TEST ASSERT FAILED!]
		In function "basic_getsockopt_open":
		line 89: Assertion `(ssize_t)((usrsocktest_daemon_start(dconf))) == (ssize_t)((OK))' failed.
			got value: -114
			should be: 0
	Group "basic_getsockopt": [FAILED]
Testing group "basic_getsockname" =>
	[TEST ASSERT FAILED!]
		In function "basic_getsockname_open":
		line 94: Assertion `(ssize_t)((usrsocktest_daemon_start(dconf))) == (ssize_t)((OK))' failed.
			got value: -114
			should be: 0
	Group "basic_getsockname": [FAILED]
Testing group "wake_with_signal" =>
	[TEST ASSERT FAILED!]
		In function "do_wake_test":
		line 517: Assertion `(ssize_t)((usrsocktest_daemon_start(&usrsocktest_daemon_config))) == (ssize_t)((OK))' failed.
			got value: -114
			should be: 0
	Group "wake_with_signal": [FAILED]
Testing group "multithread" =>
	[TEST ASSERT FAILED!]
		In function "usrsocktest_test_multithread_open_close":
		line 210: Assertion `(ssize_t)((usrsocktest_daemon_start(&usrsocktest_daemon_config))) == (ssize_t)((OK))' failed.
			got value: -114
			should be: 0
	Group "multithread": [FAILED]
Unit-test groups done... OK:12, FAILED:5, TOTAL:17
 -- number of checks made: 2522

@masayuki2009
Copy link
Contributor

@xiaoxiang781216
May I revert this PR until the issue has been fixed?

@jerpelea
Copy link
Contributor

+1 for revert

@xiaoxiang781216
Copy link
Contributor

xiaoxiang781216 commented Nov 23, 2022

@Donny9 will take a look in the next couple hours, I am interesting why citest report usrsocktest pass here:

https://github.com/apache/incubator-nuttx/actions/runs/3529252426/jobs/5920152512
test_example/test_example.py::test_hello PASSED                          [  8%]
test_example/test_example.py::test_helloxx PASSED                        [ 16%]
test_example/test_example.py::test_pipe PASSED                           [ 25%]
test_example/test_example.py::test_popen PASSED                          [ 33%]
test_example/test_example.py::test_usrsocktest PASSED                    [ 41%]
test_os/test_os.py::test_ostest PASSED                                   [ 50%]
test_os/test_os.py::test_mm PASSED                                       [ 58%]
test_os/test_os.py::test_cxxtest PASSED                                  [ 66%]
test_os/test_os.py::test_scanftest PASSED                                [ 75%]
test_os/test_os.py::test_getprime PASSED                                 [ 83%]
test_os/test_os.py::test_fs_test PASSED                                  [ 91%]
test_os/test_os.py::test_psram_test PASSED                               [100%]

@ttnie could you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants