Code Monkey home page Code Monkey logo

Comments (6)

uranusjr avatar uranusjr commented on August 20, 2024

I wonder if it is a good idea to use /proc whenever it is available. Solution is up in #5 that should work on both Linux and Cygwin, but I wonder if it would break systems such as FreeBSD. Do they all have compatible /proc? I’ll need to find out.

from shellingham.

badboybeyer avatar badboybeyer commented on August 20, 2024

It looks like the BSD4.4 children use /proc/$PID/status instead of /proc/$PID/stat.

old openbsd man page

modern freebsd manpage

Maybe write the module to:

try:
   proc()
except:
   ps()

from shellingham.

uranusjr avatar uranusjr commented on August 20, 2024

Urrgh! Yeah I guess I need to revise the logic. A try-except is a good idea (but probably not a bare one).

from shellingham.

techalchemy avatar techalchemy commented on August 20, 2024

Just handle the different structures of proc. There are only like 3 filesystems. It’s a finite space.

from shellingham.

uranusjr avatar uranusjr commented on August 20, 2024

Okay I think we have two. What’s the third /facepalm

from shellingham.

uranusjr avatar uranusjr commented on August 20, 2024

I decided to

  1. Try /proc (detect if it is Linux and BSD styles)
  2. If that fails, try ps
  3. If ps also fails, raise an error

We can add compatibility to more uncommon formats when someone actually wants them.

from shellingham.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.