Bug 209229 - [PATCH] shmget(2) missing includes
Summary: [PATCH] shmget(2) missing includes
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Documentation (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Sevan Janiyan
URL: https://reviews.freebsd.org/D12007
Keywords: patch
Depends on:
Reported: 2016-05-03 09:37 UTC by Marko Turk
Modified: 2017-08-12 17:49 UTC (History)
1 user (show)

See Also:

patch for shmget(2) (283 bytes, text/plain)
2016-05-03 09:37 UTC, Marko Turk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marko Turk 2016-05-03 09:37:01 UTC
Created attachment 169907 [details]
patch for shmget(2)


shmget(2) man page says to include sys/types.h which is not necessary. Instead
sys/stat.h should be used because it contains S_IRUSR (and others).

Without sys/stat.h the compiler throws an error:
sgt.c:7:37: error: use of undeclared identifier 'S_IRUSR'

I have attached the patch.

Comment 1 Marko Turk 2016-07-29 18:21:36 UTC

can anybody confirm this?

Maybe the definitions of S_IRUSR (and others) should be moved to some other include file?

Comment 2 Sevan Janiyan freebsd_committer 2017-08-12 16:24:25 UTC
(In reply to mt from comment #1)
You're right, sys/stat.h is needed. But sys/types.h is also needed.
It's defined in the correct location as per http://pubs.opengroup.org/onlinepubs/7908799/xsh/sysstat.h.html
Comment 3 commit-hook freebsd_committer 2017-08-12 17:47:08 UTC
A commit references this bug:

Author: sevan
Date: Sat Aug 12 17:46:51 UTC 2017
New revision: 322432
URL: https://svnweb.freebsd.org/changeset/base/322432

  Add missing header.
  S_IRUSR is defined in sys/stat.h

  PR:		209229
  Submitted by:	<mt AT markoturk DOT info>
  Approved by:	bcr (mentor)
  MFC after:	5 days
  Differential Revision:	https://reviews.freebsd.org/D12007

Comment 4 Sevan Janiyan freebsd_committer 2017-08-12 17:49:04 UTC
Committed, thanks for the patch & apologies for the delay.