Bug 220459 - lio_listio(2) doesn't support SIGEV_THREAD
Summary: lio_listio(2) doesn't support SIGEV_THREAD
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-03 22:07 UTC by Alan Somers
Modified: 2017-12-01 16:22 UTC (History)
2 users (show)

See Also:
asomers: mfc-stable11+
asomers: mfc-stable10-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer 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 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 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 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