Lighweight pup_event_frontend_d Replacement
- Iguleder
- Posts: 2026
- Joined: Tue 11 Aug 2009, 09:36
- Location: Israel, somewhere in the beautiful desert
- Contact:
Lighweight pup_event_frontend_d Replacement
Hello guys, here's something I wrote: part-hotplug-handler.
As you know, I hate pup_event_frontend_d and want it to be replaced with a lightweight, udev-based replacement written in C.
So ... here's an example!
Currently, it detects partitions well, but the desktop icons are created in an endless column starting at (32, 32)
The architecture is modular:
- part-hotplug-handler is a process that should run once the user logs in. Build it with gcc -ludev part-hotplug-handler.c -o part-hotplug-handler. Whenever a partition is added or removed, it runs part-icon. It knows when things happen using udev's API.
- part-icon is a simple script that creates or removes desktop icons using ROX-Filer's XML RPC.
- mount-and-open is nothing but a script executed once the user clicks a desktop icon created by part-icon. This script mounts the partition and opens a ROX-Filer window.
Comments, ideas, anyone?
As you know, I hate pup_event_frontend_d and want it to be replaced with a lightweight, udev-based replacement written in C.
So ... here's an example!
Currently, it detects partitions well, but the desktop icons are created in an endless column starting at (32, 32)
The architecture is modular:
- part-hotplug-handler is a process that should run once the user logs in. Build it with gcc -ludev part-hotplug-handler.c -o part-hotplug-handler. Whenever a partition is added or removed, it runs part-icon. It knows when things happen using udev's API.
- part-icon is a simple script that creates or removes desktop icons using ROX-Filer's XML RPC.
- mount-and-open is nothing but a script executed once the user clicks a desktop icon created by part-icon. This script mounts the partition and opens a ROX-Filer window.
Comments, ideas, anyone?
- Attachments
-
- part-hotplug-handler.tar.bz2
- (2.63 KiB) Downloaded 551 times
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
Nice, how does this differ from the 'pup-volume-monitor' and its 'desktop-icons' util..? Can you provide a comparison?
[b][url=https://bit.ly/2KjtxoD]Pkg[/url], [url=https://bit.ly/2U6dzxV]mdsh[/url], [url=https://bit.ly/2G49OE8]Woofy[/url], [url=http://goo.gl/bzBU1]Akita[/url], [url=http://goo.gl/SO5ug]VLC-GTK[/url], [url=https://tiny.cc/c2hnfz]Search[/url][/b]
- Iguleder
- Posts: 2026
- Joined: Tue 11 Aug 2009, 09:36
- Location: Israel, somewhere in the beautiful desert
- Contact:
- Previous solutions are polling, this one isn't. They just sleep for a given amount of time (a few seconds), then check /sys or whatever to find new partitions.
- Previous solutions are nothing but shell scripts. They do that polling using executables (for example, find, grep, cut, whatever), which is waaaaay heavier than using a function. This rule is true for any programming language (e.g in Python, using cat and popen() instead of of opening a file and reading it, is much slower).
- udev already knows which partitions exist, so previous solutions just "learn" this information again. This is incredibly inefficient and ugly. If udev knows all this, why don't we just ask it?
- This thingy doesn't replace pup-volume-monitor, which is makes it possible to see partitions in file manager. It only creates desktop icons, but you could merge the two.
- Previous solutions are nothing but shell scripts. They do that polling using executables (for example, find, grep, cut, whatever), which is waaaaay heavier than using a function. This rule is true for any programming language (e.g in Python, using cat and popen() instead of of opening a file and reading it, is much slower).
- udev already knows which partitions exist, so previous solutions just "learn" this information again. This is incredibly inefficient and ugly. If udev knows all this, why don't we just ask it?
- This thingy doesn't replace pup-volume-monitor, which is makes it possible to see partitions in file manager. It only creates desktop icons, but you could merge the two.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
pup_event_frontend_d had cost me some teeth, too :BIG LOL:
Iguleder,
looking at it, mount-and-open should replace drive_all .
Not sure if mountpoint is included in Puppies by default, probably a busybox applet ?
A small hint : Never had any problems with mount to automatically detect the fs type until recent times, but shortly had some troubles with partitions being incorrectly assumed (jfs,ext4) .
Iguleder,
looking at it, mount-and-open should replace drive_all .
Not sure if mountpoint is included in Puppies by default, probably a busybox applet ?
A small hint : Never had any problems with mount to automatically detect the fs type until recent times, but shortly had some troubles with partitions being incorrectly assumed (jfs,ext4) .
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
- Iguleder
- Posts: 2026
- Joined: Tue 11 Aug 2009, 09:36
- Location: Israel, somewhere in the beautiful desert
- Contact:
You can always use mount and grep ... but we're after a clean and efficient solution, aren't we?
And yes - I agree; recent versions of mount are pretty good at guessing. guess_fstype, disktype and all those crappy hacks can be dropped.
And yes - I agree; recent versions of mount are pretty good at guessing. guess_fstype, disktype and all those crappy hacks can be dropped.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
already since Lupu 1.16 http://busybox.net/oldnews.htmlmountpoint: btrfs fix. By Vladimir Dronnikov (dronnikov AT gmail.com)
There should be a enable everything busybox in the initrd.lz and be copied like the kernel drivers into the /pup_new/bin directory. At least I will do that if I manage to kick my ass, which rarely happens .
Your squeeze-pup 005 from anno 2010 has the mountpoint full binary as I found out . Still runs on atom D525 . Very Happy .Iguleder wrote:... but we're after a clean and efficient solution, aren't we? Very Happy
-
- Posts: 229
- Joined: Wed 25 Aug 2010, 15:38
- Location: ISM Dhanbad, Jharkhand, India
- Iguleder
- Posts: 2026
- Joined: Tue 11 Aug 2009, 09:36
- Location: Israel, somewhere in the beautiful desert
- Contact:
Nope, cannot do this - I want the process to be blocked by a system call until an event occurs (e.g so the process gets skipped by the scheduler, instead of wasting CPU cycles - that's the main benefit compared to a script).
I tried to set O_ASYNC on the file descriptor, but for some reason it does not emit SIGIO.
I tried to set O_ASYNC on the file descriptor, but for some reason it does not emit SIGIO.
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
-
- Posts: 229
- Joined: Wed 25 Aug 2010, 15:38
- Location: ISM Dhanbad, Jharkhand, India
On removing select() stuff, udev_monitor_receive_device() does the blocking job when there's no data to read. That way you do the same task in just one system call than two system calls.Iguleder wrote: Nope, cannot do this - I want the process to be blocked by a system call until an event occurs (e.g so the process gets skipped by the scheduler, instead of wasting CPU cycles - that's the main benefit compared to a script).
There's no wastage of CPU cycles, there's conservation instead
Strange. Probably that's due to BSD features have problems with netlink sockets.Iguleder wrote: I tried to set O_ASYNC on the file descriptor, but for some reason it does not emit SIGIO.
But anyways udev doesn't seem to support asynchronous reading of events. You cannot wait for anything more other than udev events in same thread.
Nice contribution as usual, Iguleder.
Just a question - since we already have udevd running in puppy anyway, why don't just use udev rules to create all these Rox icons? That's what I did in earlier Fatdogs.
Just a question - since we already have udevd running in puppy anyway, why don't just use udev rules to create all these Rox icons? That's what I did in earlier Fatdogs.
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
-
- Posts: 229
- Joined: Wed 25 Aug 2010, 15:38
- Location: ISM Dhanbad, Jharkhand, India
That'll work better if daemon isn't storing any long-term useful information in memory.jamesbond wrote:Nice contribution as usual, Iguleder.
Just a question - since we already have udevd running in puppy anyway, why don't just use udev rules to create all these Rox icons? That's what I did in earlier Fatdogs.
I'm now wondering whether there's a fuel-efficient way of arranging icons so that they don't collide with each other.
The logic is complex enough to drive me away from idea of desktop drive icons.
- Iguleder
- Posts: 2026
- Joined: Tue 11 Aug 2009, 09:36
- Location: Israel, somewhere in the beautiful desert
- Contact:
So inefficient!
The second pipe is redundant.
The second pipe is redundant.
Code: Select all
grep "$MntPt" /proc/mounts | cut -f 1 -d ' '
[url=http://dimakrasner.com/]My homepage[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
[url=https://github.com/dimkr]My GitHub profile[/url]
And problematic if spaces in filename
Code: Select all
mount-FULL /dev/sda3 /mnt/"s d a 3"
grep 'sda3' /proc/mounts
/dev/sda3 /mnt/s\040d\040a\0403 ext4 rw,relatime,barrier=1,data=ordered 0 0
grep 's d a 3' /proc/mounts
busybox mountpoint /mnt/"s d a 3"
/mnt/s d a 3 is a mountpoint
First Success in Compiling on Puppy-4.3 :
http://pkgs.fedoraproject.org/repo/pkgs ... 56d59ddd5/
141 was missing udev_monitor_filter_add_match_subsystem_devtype
http://pkgs.fedoraproject.org/repo/pkgs ... 56d59ddd5/
141 was missing udev_monitor_filter_add_match_subsystem_devtype
Code: Select all
# gcc -DLIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE -ludev part-hotplug-handler.c -o part-hotplug-handler
part-hotplug-handler.c:194:2: warning: no newline at end of file
# ldd part-hotplug-handler
linux-gate.so.1 => (0xffffe000)
libudev.so.0 => /lib/libudev.so.0 (0xb7f45000)
libc.so.6 => /lib/libc.so.6 (0xb7e4a000)
/lib/ld-linux.so.2 (0xb7f51000)
# ls -s --block-size=kB !$
ls -s --block-size=kB part-hotplug-handler
8kB part-hotplug-handler
first snap as frontend?d renamed fronend?d.sh and part-what cp as /sbin/pup_event_frontgend_d, restarted new udevd, restarted X, plugged in sd card in usb-reader .
Nice. probably let it be as it is . Needs the add part of rc.sysinit to show internal drives I guess.
Nice. probably let it be as it is . Needs the add part of rc.sysinit to show internal drives I guess.
- Attachments
-
- part-what.jpg
- (21.19 KiB) Downloaded 704 times
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Nope,myself wrote:Needs the add part of rc.sysinit to show internal drives I guess.
did not work ( kernel 2.6.30.5 ) to trigger pdeskdrived which I think would be a good name for part-hotplug-handler to show all internal and external drives .
For now it is a partial drive handler .
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Run this after you run the handler. You should get all the internal drives displayed.Karl Godt wrote:Nope,myself wrote:Needs the add part of rc.sysinit to show internal drives I guess.
did not work ( kernel 2.6.30.5 ) to trigger pdeskdrived which I think would be a good name for part-hotplug-handler to show all internal and external drives .
For now it is a partial drive handler .
Code: Select all
for p in $(ls /sys/class/block | grep -Ev ^ram|^loop); do
udevadm trigger --action=add --sysname-match=$p
done
Fatdog64 forum links: [url=http://murga-linux.com/puppy/viewtopic.php?t=117546]Latest version[/url] | [url=https://cutt.ly/ke8sn5H]Contributed packages[/url] | [url=https://cutt.ly/se8scrb]ISO builder[/url]
142 complains about trigger: unrecognized option `--sysname-match='
what works is something like udevadm trigger /block/sda
Looking good so far . Just needs the Icons
what works is something like udevadm trigger /block/sda
Looking good so far . Just needs the Icons
- Attachments
-
- udevadm_trigger.jpg
- (35.92 KiB) Downloaded 620 times