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

  • Home
  • SEARCH
  • 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 9248935
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:04:15+00:00 2026-06-18T10:04:15+00:00

I am doing kernel module programming using ioctl calls to communicate between userspace and

  • 0

I am doing kernel module programming using ioctl calls to communicate between userspace and kernel space.
I plan on making the userspace api in python.

To pass data between kernel and userspace ioctl calls utilizes address, and data is copied using copy_to_user, or copy_from_user. The address here is given by unsigned long arg.

int ioctl(struct inode *inode,struct file *filp,unsigned int cmd,unsigned long arg)

In C userspace programming it is trivial to pass address.
What I want to do, is to use struct of python to create a structure which is compatible with the structure which i have defined in the kernel module, and pass the populated python struct, using ioctl from fcntl module of python.

Is it possible?
If it is possible, how do i pass the address of python struct in the ioctl call?

I do not want to use ctypes, or extend python with c. Pure python code, is what i would like.

  • 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-18T10:04:18+00:00Added an answer on June 18, 2026 at 10:04 am

    The fcntl docs show you examples how to do this. They use struct and array, but you can also use plain strings. If you pass a mutable buffer and mutate_flag is True, the actual backing buffer will be passed to the OS call. If it is unmutable, a copy will be passed and the resulting change in buffer will be returned by the call. See the documentation for fcntl.ioctl().

    So you don’t have to care about the address of the buffer backing the struct. Just pass it as a struct or string.

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

Sidebar

Related Questions

New to Linux programming in general. I am trying to communicate with a kernel
I am doing some Linux module development, restricting me to only kernel-available libraries, and
I have a main kernel module with which other kernel modules communicate. I have
I am beginning some experimentation in writing a kernel and having fun doing it.
Doing an ajax get request works as expected using the following code: $.ajax({ type:
I am compiling a kernel module and it has many compilation errors in it.
I'm trying to write a Linux kernel module, but I'm stuck just writing some
I recently compared 2 kinds of doing kernel runtime measuring and I see some
In kernel space, I have the following: char * myData[MAX_BUF_SIZE][2]; I need to define
I am doing some analysis of a multi-threaded application using the Apple Instruments tools,

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.