Giter Club home page Giter Club logo

Comments (2)

jevinskie avatar jevinskie commented on September 17, 2024

Ah-ha! This is what I couldn’t remember what I wanted to try epoll-shim on to fix, thank you! It may need some Python configure.ac massaging though, I’m not sure.

from m1n1.

jevinskie avatar jevinskie commented on September 17, 2024

Try branch jev/smol-clean-macos.

Build:

cmake -W Dev -G Ninja ../git/epoll-shim -DCMAKE_INSTALL_PREFIX=/opt/homebrew/Cellar/epoll-shim/git -DCMAKE_BUILD_TYPE=RelWithDebugInfo --fresh -DBUILD_SHARED_LIBS=OFF -DCMAKE_OSX_ARCHITECTURES="arm64e;arm64;x86_64;x86_64h"
ninja install
brew link epoll-shim

ctest for interposer will fail when built statically.

Build Python with shim using pyenv:

env PYTHON_CONFIGURE_OPTS="--enable-shared" CPPFLAGS="-I/opt/homebrew/opt/epoll-shim/include/libepoll-shim" CFLAGS="-I/opt/homebrew/opt/epoll-shim/include/libepoll-shim" CXXFLAGS="-I/opt/homebrew/opt/epoll-shim/include/libepoll-shim" LDFLAGS="-L/opt/homebrew/opt/epoll-shim/lib -lepoll-shim" pyenv install -v 3.11

I don't have a machine with m1n1 set up right now but this stupid test seems to indicate some life:

#!/usr/bin/env python3

import os
import selectors
import time

class Foo:
    def __init__(self):
        self.efd = os.eventfd(0, flags=os.EFD_CLOEXEC | os.EFD_NONBLOCK)
        self.selector = selectors.DefaultSelector()
        self.selector.register(self.efd, selectors.EVENT_READ)

    def wait_shell(self):
        try:
            os.eventfd_read(self.efd)
            print("os.eventfd_read pass")
        except BlockingIOError:
            print("os.eventfd_read fail")
            pass

    def notify_in_shell(self):
        os.eventfd_write(self.efd, 1)


foo = Foo()

while True:
    foo.wait_shell()
    time.sleep(0.1)
    foo.notify_in_shell()

Results:

 ->  % ./epoll-shim-eventfd.py
os.eventfd_read fail
os.eventfd_read pass
os.eventfd_read pass
os.eventfd_read pass
os.eventfd_read pass

More testing needs to be done...

from m1n1.

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.