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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T21:57:35+00:00 2026-05-29T21:57:35+00:00

I am writing a small tool in which I require to find per-user File-system-memory-usage.

  • 0

I am writing a small tool in which I require to find per-user File-system-memory-usage.

I have to do some clean up activity if file-system usage is crossing certain threshold value. What is the system call that I can use, so that I could be able to find per user memory usage?

  • 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-29T21:57:37+00:00Added an answer on May 29, 2026 at 9:57 pm

    Maybe you are interested in disk quotas (which are supported by some, but not all, filesystems). The low-level system call is quotactl(2). Perhaps using the existing tools quota(1) and quotacheck, edquota, warnquota, quotaon etc…. might be enough.

    If you want to know the memory used by a given process, consider the getrusage(2) syscall. You can also read pseudo-files under /proc/self/ or /proc/1234 for pid 1234. You can also scan the /proc/ (using usual directory scanning routines: opendir(3), looping on readdir(3) with stat(2), closing with closedir…) for numerical directories (since /proc/1234/ describes the process of pid 1234). Read more about proc(5) (e.g. /proc/self/maps or /proc/1234/smaps and /proc/1234/status etc). Tou can query the virtual address space of process 1234 by reading the /proc/1234/status and /proc/1234/maps pseudo-files. Try for example cat /proc/$$/status and cat /proc/$$/maps in a terminal to query info for your current shell process.

    Of course, consider also the du(1) and df(1) commands (perhaps invoke them carefully thru popen(3) if you want to get their output). If for whatever reasons you want to recursively scan a file tree (e.g. to count its cumulated used size like du does), consider using the nftw(3) functions. See also stat(2) and statfs(2) syscalls.

    Remember that other processes can (and often do) write to the filesystem while your program is exploring or querying it. And your user could start new processes (perhaps indirectly, e.g. with crontab(5), system(3), fork(2) and execve(2), at, batch, ssh …) at any time.

    Read also a good Linux programming book, perhaps the old Advanced Linux Programming, and syscalls(2)

    I am writing a small tool in which I require to find per-user File-system-memory-usage.

    If you are coding in C on Linux, consider using your clever mix of nftw(3) and stat(2) and statfs(2).

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

Sidebar

Related Questions

I'm writing a small tool in C# which will need to send and receive
I am writing a small glue tool for doing some testing and I would
I'm writing a small tool to do some manipulation of SWF files, using Delphi
when writing small functions I often have the case that some parameters are given
I'm writing a small tool for experimenting with ELF-64 object code which is intended
I'm writing a small visualization tool in wpf, the idea is that average users
I'm writing a small free tool. It's currently in Beta testing using .NET 3.5
I have an application where I am reading and writing small blocks of data
I'm writing a small application in VB.NET and I would like some of the
Writing a small command line tool, it would be nice to output in different

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.