Bug 220459

Summary: lio_listio(2) doesn't support SIGEV_THREAD
Product: Base System Reporter: Alan Somers <asomers>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Some People CC: cem, jhb
Priority: --- Flags: asomers: mfc-stable11+
asomers: mfc-stable10-
Version: CURRENT   
Hardware: Any   
OS: Any   

Description Alan Somers freebsd_committer freebsd_triage 2017-07-03 22:07:26 UTC
lio_listio(2) returns EINVAL when its sig->sigev_notify is SIGEV_THREAD.  That error gets returned from kern_lio_listio.  The lio_listio(2) man page makes no mention of this limitation.  In fact, it says that SIGEV_THREAD _is_ supported.  For other aio(4) functions, SIGEV_THREAD is handled in librt and implemented using SIGEV_THREAD_ID, which is what the kernel actually sees.  But lio_listio doesn't go through librt.  Instead, it's a direct syscall.

Either the man page should be updated, or lio_listio should gain a librt wrapper just like aio_read(2) and friends.
Comment 1 John Baldwin freebsd_committer freebsd_triage 2017-07-04 14:05:45 UTC
Adding another wrapper for lio_listio in librt/aio.c should be fine.  It's also true for all of the other air system calls that they are direct system calls, and it's only because of the librt symbols overriding the symbols in libc that SIGEV_THREAD works.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-07-17 18:33:51 UTC
A commit references this bug:

Author: asomers
Date: Mon Jul 17 18:33:31 UTC 2017
New revision: 321082
URL: https://svnweb.freebsd.org/changeset/base/321082

Log:
  Add regression tests for bugs 220459 and 220398

  Bug 220398 - lio_listio(2) never sends asynchronous notification if nent==0
  Bug 220459 - lio_listio(2) doesn't support SIGEV_THREAD

  PR:		220459
  PR:		220398
  Reviewed by:	cem, jhb
  MFC after:	3 weeks
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D11470

Changes:
  head/tests/sys/aio/Makefile
  head/tests/sys/aio/lio_test.c
Comment 3 Alan Somers freebsd_committer freebsd_triage 2017-07-21 15:11:44 UTC
Fixed in head by 321332

 Implement SIGEV_THREAD notifications for lio_listio(2)

  Our man pages have always indicated that this was supported, but in fact the
  feature was never implemented for lio_listio(2).

  Reviewed by:  jhb, kib (earlier version)
  MFC after:    20 days
  Sponsored by: Spectra Logic Corp
  Differential Revision:        https://reviews.freebsd.org/D11680

Modified:
  head/lib/librt/Symbol.map
  head/lib/librt/aio.c
  head/tests/sys/aio/lio_test.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2017-08-25 14:38:12 UTC
A commit references this bug:

Author: asomers
Date: Fri Aug 25 14:37:23 UTC 2017
New revision: 322891
URL: https://svnweb.freebsd.org/changeset/base/322891

Log:
  MFC r321082:

  Add regression tests for bugs 220459 and 220398

  Bug 220398 - lio_listio(2) never sends asynchronous notification if nent==0
  Bug 220459 - lio_listio(2) doesn't support SIGEV_THREAD

  PR:		220459
  PR:		220398
  Reviewed by:	cem, jhb
  Sponsored by:	Spectra Logic Corp
  Differential Revision:	https://reviews.freebsd.org/D11470

Changes:
_U  stable/11/
  stable/11/tests/sys/aio/Makefile
  stable/11/tests/sys/aio/lio_test.c