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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:41:34+00:00 2026-05-26T22:41:34+00:00

I have a doubt. I opened the kernel and I changed the directory linux-3.1.1/fs/open.c

  • 0

I have a doubt.

I opened the kernel and I changed the directory linux-3.1.1/fs/open.c

I changed the follow code in the open.c.

SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
{
    long ret;
    printk(KERN_EMERG "Testing\n");
    ... 
}

I put this line only: printk(KERN_EMERG "Testing");

And I include the libraries:<linux/kernel.h> and <linux/printk.h>

So I compiled and rebooted my linux(Ubuntu).
During the rebooting appeared a lot of “Testing” on the screen.
So up to now its Ok.


But now I have a problem.
I created this program in c.

int main()
{
    size_t filedesc = open("testefile2.txt",O_CREAT | O_WRONLY,0640);
    printf("%d",filedesc);
}

I compiled this program and executed and works good.
But I don´t understand why the “Testing” didn’t appeared on the shell.
I mean , if when I reboot the pc appeared a lot of the word “Testing” , why this word doens´t appear when I execute the program above.
Just to add I include this libraries in this code above:

unistd.h , fcntl.h , stdio.h , stdlib.h

Thank you guys.

  • 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-26T22:41:35+00:00Added an answer on May 26, 2026 at 10:41 pm

    But I don´t understand why the “Testing” didn’t appeared on the shell.

    I think, this is effect of printk’s messages suppression. (more exactly:rate limiting)

    Check the messages log or console for

    printk: ### messages suppressed.
    

    string.

    This feature will stop printing a message, if there were a lot of messages in recent time.

    Actual code is as 3.1 kernel: http://lxr.linux.no/#linux+v3.1.1/kernel/printk.c#L1621

    1621 * printk rate limiting, lifted from the networking subsystem.
    1622 *
    1623 * This enforces a rate limit: not more than 10 kernel messages
    1624 * every 5s to make a denial-of-service attack impossible.
    1625 */
    1626 DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10);
    1627
    1628 int __printk_ratelimit(const char *func)
    

    So, As the open syscall is very-very popular (just do an strace -e open /bin/ls – I’ll get 15 open syscalls for just starting an simplest ls), the rate limiting will be in effect. It will limit your message to be printed only one time in 5 seconds; not more than 10 messages in single “burst”.

    I can only suggest to create a special user with known UID and add an UID checking before printk in your additional printk-in-open code.

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

Sidebar

Related Questions

Possible Duplicate: What is the difference between const and readonly? i have doubt in
i have a doubt. in Production Server , Sql Server properties -> opened properties
I have a doubt: - Is there any standard/convention that when should I use
I have a doubt about orkut's new URL Writing method. Earlier the home page
I have one doubt regarding casting. public void Test(out T a, out T b)
I have a doubt in layouts.I have designed one layout using group layout using
I have one doubt in string . How can we acess the memory of
I have a doubt regarding the backlog value in listen system call. From man
i have a doubt on how to show a popup???` if (machineID.Count != 0)
i have a doubt in grid view. In Data list we have a property

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.