im going crazy trying to look for examples of unix domain socket usage on bash. I'm starting to think if it is possible at all, and thenI find people using them for netowrk stuff, i wanting merely for IPC locally, can someone facilitate me some example, resources, guidance or at least if its possible at all?
Is this so deep in the kernel that it can only be programmed C for example... I;ve seen some Python stuff i think tho...
Thanks.
I've decided to go off using bash, it would be a big big task and i dont have any real constrains, I have learn a lot of how linux works tho, in essence to be able to implement this would have to probaly modify some parts of the kernel...
Thanks everyone.
Related
I'd like to write a x11 terminal emulator, but I don't know how I should spawn and communicate with the shell, is there any basic (pseudo- or C) code for that? like what sort of PTY to create, how to bind the shell to it, what signals I have to catch or send, etc. don't really feel like sorting through the whole xterm sources.
EDIT: oh and I want to implement a way of communicating with any applications in it, how shall I do the feature discovery? some hidden ansi sequence in the "clients", hoping it's not colliding with other terminal emulators? some environment variable, hoping it's not colliding with the "clients" or removed by the shell?
YAT (yet another terminal) https://github.com/jorgen/yat is suitable for embedding in Qt Quick programs. Contributions for improvement are welcome. (Disclaimer: a friend started that project, and I work on it sometimes.) It takes a mostly correct approach (e.g. it uses a Linux pseudo-terminal properly, something I didn't know about before my friend was explaining that), and has a lot of features; however the parser is written from scratch and is not feature-complete or bug-free yet.
Unfortunately most terminal implementations so far have been starting from scratch, or with a one-off monolithic fork (from rxvt for example), which is a lot of work and results in all of them being incomplete. So I think a better alternative would be to use a reusable logic-only library called libvterm: http://www.leonerd.org.uk/code/libvterm/ or to base your terminal on one which already uses that. That way if you find bugs and fix them, you'll improve the whole ecosystem.
https://github.com/timmoorhouse/imgui-terminal is interesting, and works (at least somewhat) but is a prime candidate to be rewritten with libvterm, IMO. If you are into immediate-mode rendering in OpenGL, it might be a good choice anyway.
http://41j.com/hterm/ does use libvterm, and adds a few features which libvterm doesn't have, for inline graphics rendering (ReGIS and PNG). But the code is not elegant enough or portable enough, IMO, and the graphics rendering "floats" over the text rather than being truly inline. It still might be an adequate starting point for some use cases. In my fork https://github.com/ec1oud/hackterm I got it to build with mostly modern system libraries, however it still depends on an outdated version of SDL, which is included.
OK, if anyone also need this, and is using lua, I found the http://www.tset.de/lpty library works fine. still testing ansi escapes and stuff, but should work.
I'm a newbie on Linux programming and I don't know exactly where I can get information of functions for example. There is a directory Documentations in my sources. But I can't find semaphore stuff there for example. Is there a documentation for all the function somewhere in the sources? Or not obligatorily?
The Linux Kernel Newbies site is a good point to start.
And, of course, the kernel itself is the best reference. To get started. Also have a look at kernel.org/doc. For semaphores, look at this page here.
I am a normal user and does not have strong background in programming.
I have a 64 bit, dual core machine (Dell Vostro 3400) and I think I can run multithreaded program with this machine (yes?)
The program that I think could be convert into multithreaded program is this:
http://code.google.com/p/malwarecookbook/source/browse/trunk/3/8/pescanner.py
Is possible to do so?
If yes, which part should being edited so that it will work?
Thanks.
Multithreading is not an easy subject.
I suggest you read up on some tutorials, see:
http://www.tutorialspoint.com/python/python_multithreading.htm
http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/
http://www.artfulcode.net/articles/multi-threading-python/
To answer the general part of your question, you can run multithreaded code an any machine newer than say 2000.
Your question is too broad though to answer without going into details on the code.
My suggestion
I suggest you try the tutorials first and write same sample programs, ask a specific question with sourcecode! if you get stuck.
That's a road I'd recommend rather than taking someone else's code and rewriting it without detailed knowledge of threads.
I need some opinions pointers on creating pseudo-filesystems for linux/*nix systems.
Firstly when I say pseudo-filesystem I mean something like /proc where the structure within does not represent actual files on disks or such but the state of the kernel. I would like to try something similar as an interface to an application.
As an example you could say, mount a ftp url to your filesystem and your browser app could then allow you to interact with the remote system doing ls et al on it and translating the standard filesystem requests into ftp ones.
So the first question is: how does one go about doing that? I have read a bit about it and it looks like you need to implement a new kernel module. If possible I would like to avoid that - my thinking being that someone may have already provided a tool for doing this sort of thing and provided the module to assist already.
My second question is: does anyone have a good list of examples of applications/services/whatever using this sort of technique to provide a filesystem based interface.
Lastly if anyone has any opinions on why this might be a good/bad idea to do such a thing on a generic level I would like to hear it.
A userspace filesystem via fuse would probably be your best way to go.
Regarding the next part of your question (which applications use this method), there is the window manager wmii, it uses the 9p filesystem via v9fs, which is a port of 9p to Linux. There are many examples on plan9, most notably acme. I suggested fuse because it seems more actively developed and mainstream in the Linux world, but plan9 is pretty much the reference for this approach as far as I know.
I want to develop multimedia encoder for Linux.
I want to make use of ready command line codecs like ffmpeg.
I want to build nice GUI for that & pass arguments to command line encoders.
I am thinking to use Qt. (Is it possible?)
I don't know anything about Linux programming, but I have been an Ubuntu user for 8 months.
Please provide me with links to tutorials. (I've tried the Ubuntu forums but it's all beginners stuff in there!)
I am in need of tips from you guys. I am ready to learn everything about it!
I am ready to learn new languages.
Thank you!
Funny story, actually. Two years ago, I developed this for a GTK frontend. You can grab the code at vive.sourceforge.net. I since abandoned it when nobody was using it and I had no need for it, anymore, but the code is still there and you're absolutely free to go tear it apart, laugh at my mistakes, and take what you can from it.
I will warn you, that code is fairly laughable. I was learning C and GTK at the time, so be easy on me :)
If you'd like to take it over, I'd be glad to turn it over!
It looked like this: