Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4009278
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:51:29+00:00 2026-05-20T08:51:29+00:00

I have been going through header files and I’m not able to find any

  • 0

I have been going through header files and I’m not able to find any file with status flag definitions (like O_RDONLY).

Thanks,
John

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T08:51:30+00:00Added an answer on May 20, 2026 at 8:51 am

    Summary

    If you’re on Linux, it should be in /usr/include/bits/fcntl.h.

    #define O_RDONLY 00
    

    You can find it using rgrep, or ctags and Vim, or cpp, or cwhere.


    rgrep

    The simplest way is to use rgrep, a.k.a. grep -R.

    $ rgrep O_WRONLY .
    ./X11/Xw32defs.h:#  define O_WRONLY    _O_WRONLY
    ./linux/fs.h: * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
    ./linux/smbno.h:#define SMB_O_WRONLY    0x0001
    ./asm-generic/fcntl.h:#define O_WRONLY  00000001
    ./security/_pam_macros.h:    if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_NOFOLLOW|O_APPEND)) != -1) {
    ./security/_pam_macros.h:    if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_APPEND)) != -1) {
    ./security/_pam_macros.h:    if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_NOFOLLOW|O_APPEND)) != -1) {
    ./security/_pam_macros.h:    if ((fd = open(_PAM_LOGFILE, O_WRONLY|O_APPEND)) != -1) {
    ./bits/fcntl.h:#define O_WRONLY      01
    

    ctags

    Or, you could run ctags -R in /usr/include and then run vim -t O_WRONLY.

    Or, a bit better, but more typing:

    find . /usr/include -name "*.h" | 
    ctags -f - -L - |
    grep "^O_WRONLY   " |
    cut -d "    " -f 1,2,3 |
    sed -e 's# /\^#    #;s#\$/\;"$##'
    

    cpp

    The best way I have found is using cpp.

    Assuming you have a source file called YOUR_SOURCE_FILE with the necessary #includes, try running:

    cpp -dD YOUR_SOURCE_FILE | less
    

    Then search for your #define, e.g. /O_WRONLY, then scroll up to find the first file name above it. In this case:

    # 27 "/usr/include/bits/fcntl.h" 2 3 4
    

    means that O_WRONLY is being picked up from /usr/include/bits/fcntl.h if you include the three header files mentioned in man fcntl.


    cwhere

    I have a script called cwhere to automate running cpp:

    $ cwhere O_WRONLY sys/types.h sys/stat.h fcntl.h
    /usr/include/bits/fcntl.h: #define O_WRONLY 01
    

    Download cwhere here

    If desc is installed, you can just type the name of the function that uses that #define, e.g.

    $ cwhere O_WRONLY 'fcntl()'
    /usr/include/bits/fcntl.h: #define O_WRONLY 01
    

    Download desc here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been going through the jqGrid wiki and havent been able to find
I have been going through the core jQuery code and had a few why
Recently, I have been going through search trees and I encountered red-black trees, the
I have been tasked with going through a number of ColdFusion sites that have
I have been going through the docs and source code looking for something without
I have been going through and re-creating Apple's Advanced Table View Cells example to
We have been going through a big memory leak analysis and have found one
I have been going through the book Learning WCF trying to get my head
Possible Duplicate: Mongo interface I have been going through the GUI tools available for
I'm interested in becoming more fluent in Java so I have been going through

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.