Code Monkey home page Code Monkey logo

linux_logo's Issues

Doesn't work on my 1930 Model 15 Teletype

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

RAM size shown is incorrect (Debian 9.2)

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. :)

Potential Enhancement to Obtaining Memory Information via Sysinfo Syscall on Linux

Referencing two issues:

  1. (My bug report to debian) https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=839594
  2. RAM size shown is incorrect (Debian 9.2) #14

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:

Sysinfo structure ``` Until Linux 2.3.16, sysinfo() returned information in the following 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>

sysctl: Cannot allocate memory on FreeBSD 10

Output on FreeBSD 10:

  • a "sysctl: Cannot allocate memory" error message
  • the correct logo
  • an information line with RAM information missing
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

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.