Bug 209229

Summary: [PATCH] shmget(2) missing includes
Product: Documentation Reporter: Marko Turk <mt-bugs>
Component: Books & ArticlesAssignee: Sevan Janiyan <sevan>
Status: Closed FIXED    
Severity: Affects Only Me CC: sevan
Priority: --- Keywords: patch
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://reviews.freebsd.org/D12007
Attachments:
Description Flags
patch for shmget(2) none

Description Marko Turk 2016-05-03 09:37:01 UTC
Created attachment 169907 [details]
patch for shmget(2)

Hi,

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.

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

can anybody confirm this?

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

-Marko
Comment 2 Sevan Janiyan freebsd_committer freebsd_triage 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 freebsd_triage 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

Log:
  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

Changes:
  head/lib/libc/sys/shmget.2
Comment 4 Sevan Janiyan freebsd_committer freebsd_triage 2017-08-12 17:49:04 UTC
Committed, thanks for the patch & apologies for the delay.