Giter VIP home page Giter VIP logo

procfs's Introduction

System Requirements
===================

  * Mac OS X 10.5+ (10.4 is no longer supported)

  * pcre (specifically, the C++ wrapper for pcre)

    ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

Usage
=====

  You can mount procfs as:

  $ sudo mkdir /proc
  $ sudo chown root:admin /proc
  $ sudo ./procfs /proc -f

  For certain things to work (and not crash procfs), you must either run
  procfs foregrounded (through the -f option), or use the procfs.plist
  file to run procfs through launchd.

procfs's People

Contributors

0x09 avatar alexchandel avatar bfleischer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

procfs's Issues

Fix screenshots and replace CGDisplayBaseAddress

Apple deprecated some useful CG display functions in the 64-bit transition, including CGDisplayBaseAddress() which we use to get a pointer to the display. The horrible hack to fix the build is just to redeclare the deprecated symbols in our header. This works (for now) for the size_t functions, but calling CGDisplayBaseAddress() results in this warning getting printed:

Apr 22 14:23:18  procfs[10539] <Warning>: CGDisplayBaseAddress is obsolete and returning an empty buffer for display 0x4280500

So screenshots (i.e. cat /proc/system/hardware/displays/0/screenshot.png > ~/Desktop/scn.png) don't work, and result in some variant of Resource busy for the client.

We need to find a new way to get the display buffer. For screenshot purposes, using CGDisplayCreateImage to copy the framebuffer should suffice. (However, for users wanting to do this, we should also find a new way to stomp on the framebuffer directly)

Fixes to build under High Sierra

Had to do the following (I'm using the command line developer tools)...

diff --git a/Makefile b/Makefile
index 81774fe..a102c0b 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@
 CC  ?= gcc
 CXX ?= g++

-CFLAGS_OSXFUSE=-D_FILE_OFFSET_BITS=64 -O -I/usr/local/include/osxfuse -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -Wall
+CFLAGS_OSXFUSE=-D_FILE_OFFSET_BITS=64 -O -I/usr/local/include/osxfuse -arch x86_64 # -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -Wall
 CFLAGS  :=$(CFLAGS_OSXFUSE) $(CFLAGS)
 CXXFLAGS:=$(CFLAGS_OSXFUSE) $(CXXFLAGS)
 LDFLAGS=-L/usr/local/lib -losxfuse -framework Carbon -framework IOKit -framework ApplicationServices -framework Accelerate -framework OpenGL -weak-lproc
diff --git a/procfs.cc b/procfs.cc
index 57ce86f..0a3e7eb 100755
--- a/procfs.cc
+++ b/procfs.cc
@@ -48,6 +48,8 @@
 #include "procfs_tpm.h"
 #endif /* OSXFUSE_PROCFS_ENABLE_TPM */

+using std::string;
+
 static int procfs_ui = 0;
 #define PROCFS_DEFAULT_FILE_SIZE 65536

The OSXFUSE file system is not available

I got procfs built for macOS 10.12. However trying to use it with FUSE for macOS v3.5.4 results in the below error:

mount_osxfuse: the OSXFUSE file system is not available (255)

Edit: I also have the compatibility layer installed.

Fix Camera capture and replace stubbed SequenceGrabber

Part of fixing the build for x86_64 involved stubbing the old SequenceGrabber API calls, which were removed along with the rest of the QuickTime C API in the transition to 64-bit.

The current hack is to just stub our functions and do nothing. No idea if that causes problems for other components. It probably does.

This all means that camera capture doesn't work.

We need to find out how to enumerate cameras with a 64-bit API.

Missing PIDs

For some reason, the vast majority of PIDs don't show up. For example, with ~280 processes running:

ls /proc
10539  371    373    388    4690   4691   56117  byname system

No idea why this is, but it also happened in the old 32-bit version.

More features from Plan 9 and Linux

As of 48023bb, where PID, CPUID, and DISPID are numbers, PNAME is the process name, and WID is the window id, the current layout is something like this:

/proc/PID
/proc/PID/carbon/
/proc/PID/carbon/name
/proc/PID/carbon/psn
/proc/PID/cmdline
/proc/PID/jobc
/proc/PID/paddr
/proc/PID/pcred/
/proc/PID/pcred/rgid
/proc/PID/pcred/ruid
/proc/PID/pcred/svgid
/proc/PID/pcred/svgid
/proc/PID/pgid
/proc/PID/ppid
/proc/PID/task/  # lots of subfiles
/proc/PID/tdev
/proc/PID/tpgid
/proc/PID/ucred/
/proc/PID/ucred/groups
/proc/PID/ucred/uid
/proc/PID/wchan
/proc/PID/windows/
/proc/PID/windows/all
/proc/PID/windows/identify
/proc/PID/windows/onscreen
/proc/PID/windows/screenshots/
/proc/PID/windows/screenshots/WID.png
/proc/byname/
/proc/byname/PNAME
/proc/system/
/proc/system/firmware/
/proc/system/firmware/variables
/proc/system/hardware/
/proc/system/hardware/camera/screenshot.tiff
/proc/system/hardware/cpus/CPUID/data
/proc/system/hardware/displays/DISPID/info
/proc/system/hardware/displays/DISPID/screenshot.png
/proc/system/hardware/lightsensor/data
/proc/system/hardware/motionsensor/data
/proc/system/hardware/mouse/data

We have unique things, but we're also missing lots of stuff, like from Linux

/proc/PID/cmdline
/proc/PID/cwd
/proc/PID/environ
/proc/PID/exe
/proc/PID/fd/
/proc/PID/fdinfo/
/proc/PID/maps
/proc/PID/mem
/proc/PID/root
/proc/PID/status

which let you access the process's environment variables and file descriptors.

There's also cooler stuff from Plan 9, like

/proc/trace
/proc/PID/ctl
/proc/PID/note
/proc/PID/noteid
/proc/PID/notepg
/proc/PID/ns
/proc/PID/regs
/proc/PID/segment
/proc/PID/status
/proc/PID/wait

which allow sending control messages to the process (like start, stop, trace), sending notes (i.e. arbitrary string signals that Plan 9 replaced the BSD signals like SIGINT with), tracing any process that has had trace written to its ctl, accessing the register values of a process, and other things.

All of this (except maybe notes, which are even too cool for Linux) should be implementable on OS X.

There's also our /proc/system/, which should have more in common with sysfs and Plan 9's /dev.

Update readme

The current README was taken from https://github.com/osxfuse/filesystems unchanged. The system requirements should be updated, and it should list the current capabilities and limitations of procfs. In particular, the differences between this and Linux's procfs should be listed.

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.