deater / linux_logo Goto Github PK
View Code? Open in Web Editor NEWPrints an ASCII logo and some system info
Home Page: http://www.deater.net/weave/vmwprod/linux_logo
License: GNU General Public License v2.0
Prints an ASCII logo and some system info
Home Page: http://www.deater.net/weave/vmwprod/linux_logo
License: GNU General Public License v2.0
Attachments: see video at https://youtu.be/2XLZ4Z8LpEE
Symptoms: When I try to print the linux_logo, it uses newfangled ASCII characters that are not compatible with the Baudot set on my 1930 vintage Model 15 Teletype which I use as a terminal. It also uses the newfangled ultra-wide 80 columns format, which overflows the standard 74 column width of The True Teletype.
Expected result: should be backwards compatible with 1930 technology, and print this Baudot/RTTY friendly logo instead:
$$$$$
$$$$$$$
$ $$O$O$$
$$$$$$ $$$ $VVVVV$
$$ $ $$ VVV $$
$$ $$$ $$$ $$$$ $$$ $$$ $$$$$ $$$$$ $ $$
$$ $ $$ $$$ $$ $$ $$ $$ $$ $ $$
$$ $ $$ $$ $$ $$ $$ $$$ $ $$$
$$ $$$ $$ $$ $$ $$ $$$ QQ$ $$Q
$$ $ $$$ $$ $$ $$ $$ $$ $$ QQQQQQ$ $QQQQQQ
$$ $$ $$$ $ $$ $$ $$$ $$$ $$ $$ QQQQQQQ$ $QQQQQQQ
$$$$$$$$$$ $$$ $$$$ $$$$ $$$$ $$$ $$$$$ $$$$$ QQQQQ$$$$$$$QQQQQ
Estimated numbers of users affected by this: 1
therefore Importance = critical
I am OK if this would only work with the -curiousmarc option :-)
Cheers, keep up the good Linux software!
Marc
Linux Version 4.9.0-4-amd64, Compiled #1 SMP Debian 4.9.51-1 (2017-09-28)
Four 2.13GHz Intel Atom Processors, 128TB RAM, 17068 Bogomips Total
The display above is from a machine with only 3GB RAM,
Linux Version 4.9.0-4-amd64, Compiled #1 SMP Debian 4.9.51-1 (2017-09-28)
Eight 800MHz Intel i7 Processors, 128TB RAM, 67207 Bogomips Total
And this one has 32GB RAM.
Thank you. :)
Output on FreeBSD 10:
FreeBSD Version 10.0-RELEASE, Compiled FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014
Zero Intel(R) Atom(TM) CPU C2750 @ 2.40GHz Processors, 0M RAM, -1.00 Bogomips Total
ysul.nasqueron.org
Referencing two issues:
The problem was that Linus Torvalds wanted to remove privileged kernel memory information from
/proc/iomem -- but found that it broke a lot of system utilities and decided to only expose the information
to privleged users.
/proc/iomem: only expose physical resource addresses to privileged users
https://lore.kernel.org/patchwork/patch/1006236/
As the general conclusion (in issue #14 and Debian bug 839594) was that /proc/meminfo is available
to unprivileged users for getting memory size information.
However, instead of accessing /proc/meminfo directly why not use the sysinfo(&struct) call on Linux systems?
The structure used by sysinfo should not change (at least not very often) and it would provide a layer of abstraction
between linux_logo and the memory information.
Granted the information returned by sysinfo() can be obtained through /proc/meminfo -- but I think the abstraction provided
by the syscall (returning data in the common structure) means that we wouldn't have to deal with manually accessing the
raw information and would be better moving forward.
The man page for sysinfo(): https://man7.org/linux/man-pages/man2/sysinfo.2.html
Example usage: https://www.informit.com/articles/article.aspx?p=23618&seqNum=15
It seems that code for linux_logo already uses code from libsysinfo and sysinfo.h....so why not do the following:
const double megabyte = 1024 * 1024;
/* Obtain system statistics. */
struct sysinfo si;
sysinfo (&si);
printf ("total RAM : %5.1f MB\n", si.totalram / megabyte);
printf ("free RAM : %5.1f MB\n", si.freeram / megabyte);
// if mem_unit is needed (on later kernels -- see below)
printf ("total RAM : %5.1f MB\n", (si.totalram * si.mem_unit) / megabyte);
printf ("free RAM : %5.1f MB\n", (si.freeram * si.mem_unit) / megabyte);
There will need a check to determine if the kernel version is 2.3.16, 2.3.23 (i386), or 2.3.48 (all architectures).
Kernel 2.3.16 (and earlier): the sizes of the memory and swap fields are given in bytes
Since Kernel 2.3.23 (i386) & 2.3.48 (all architectures): sizes of the memory and swap fields are given as multiples of mem_unit bytes.
More information on the sysinfo structure:
struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* Swap space still available */
unsigned short procs; /* Number of current processes */
char _f[22]; /* Pads structure to 64 bytes */
};
In the above structure, the sizes of the memory and swap fields
are given in bytes.
Since Linux 2.3.23 (i386) and Linux 2.3.48 (all architectures)
the structure is:
struct sysinfo {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned long totalswap; /* Total swap space size */
unsigned long freeswap; /* Swap space still available */
unsigned short procs; /* Number of current processes */
unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
char _f[20-2*sizeof(long)-sizeof(int)];
/* Padding to 64 bytes */
};
In the above structure, sizes of the memory and swap fields are
given as multiples of mem_unit bytes.
</details>
Just found this, and it's pretty cool. Would be fun to have some Fedora logos.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.