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 9155397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:35:08+00:00 2026-06-17T12:35:08+00:00

I want to print all the parameter values passed to linux system calls. In

  • 0

I want to print all the parameter values passed to linux system calls. In case of ioctl(), for example, I have following prototype and print statement.

asmlinkage long our_sys_ioctl(unsigned int fd ,  unsigned int cmd , unsigned long arg)
{
    printk ("fd=%u, cmd=%u and arg=%lu \n ", fd, cmd, arg);
    return original_call_ioctl(fd , cmd , arg);
}

I understand, fd is file descriptor of driver files, cmd defines driver , ioctl number, type of operation and size of parameter. But I am confused about arg parameter either it is a pointer to memory or just an immediate value what most of the documentations call it.

By using this arg parameter, how can I get the memory content if it is passed as unsigned long arg as given above, instead of a pointer?

  • 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-06-17T12:35:09+00:00Added an answer on June 17, 2026 at 12:35 pm

    The arg parameter to the ioctl is opaque at the generic vfs level. How to interpret it is up to the driver or filesystem that actually handles it. So it may be a pointer to userspace memory, or it could be an index, a flag, whatever. It might even be unused and conventionally passed in a 0.

    For example, look at the implementation of the TCSBRKP ioctl in drivers/tty/tty_io.c:

    long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
    //...
           case TCSBRKP:   /* support for POSIX tcsendbreak() */
                return send_break(tty, arg ? arg*100 : 250);
    

    You can look at the ioctl_list(2) man page to see the parameters that various ioctls take; all of the entries on that list that have int or other non-pointer parameters are other examples.

    So you could do something like

        void __user *argp = (void __user *) arg;
    

    and then use copy_from_user() or get_user() to read the memory that arg points to, but that may fail if the parameter isn’t a pointer. And at the generic ioctl syscall, you might not really want to have a huge table of every possible ioctl.

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

Sidebar

Related Questions

I want to print values of all the types like char, long... so on
I want to print all the prime numbers between two numbers. This is my
I want to print some dynamic query to execute a procedure on all tables
I want to read a folder for all the files and programmatically print them
i have a list of posts. i want print some words of post content
I want to print an attribute value based on its name, take for example
I want to print an integer number in binary mode using following function: #include
Assume you have a function like that: def example(var1=None,var2=None,var3=None,*multi_values): print (var1,var2,var3,*multi_values) Can you get
Possible Duplicate: C# Iterating through an enum? (Indexing a System.Array) All I want to
I have a query where I want to return all the rows which are

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.