SYS_DEV

This driver provides details about the currently installed operating system.

Details

define SYS_VERSION

define SYS_IOC_CHAR

define I_SYS_GETVERSION

define I_SYS_GETINFO

define I_SYS_26_GETINFO

define I_SYS_23_GETINFO

define I_SYS_SETATTR

define I_SYS_SETACTION

define I_SYS_GETTASK

This request gets the information about the specified task.

sys_task_t task;
task.tid = 1;
ioctl(fd, I_SYS_GETTASK, &task);

define I_SYS_KILL

This request sends a signal to all the tasks in the specified process group.


define I_SYS_PTHREADKILL

This request sends a signal to a single task (thread)


define I_SYS_GETID

Read the system ID’s globally unique cloud identifier


define I_SYS_GETPROCESS

This requests checks to see if the named process is currently running.

sys_process_t p;
strcpy(p.name, "hello");
ioctl(fd, I_SYS_ISRUNNING, &p);
if( p.pid < 0 ){
     //process is not running
}

define I_SYS_SUDO

define I_SYS_GETBOARDCONFIG

This copies the sos_board_config_t data that is set by the board support package.

sos_board_config_t config;
ioctl(core_fd, I_SYS_GETBOARDCONFIG, &config);

define I_SYS_GETRANDOM

This gets a 256-bit random number that can be used with I_SYS_AUTH to authenticate the calling thread.


define I_SYS_AUTH

This sends a challenge based on a shared secret key and a random number. It also reads the response so that the challenger can also validate that the system is authentic.

Once the calling thread is authenticated, it will be placed in root access mode.

Executing I_SYS_AUTH with an invalid value will remove root access mode from the calling thread.

The system must have a kernel API for CRYPT_ROOT_SHA256_API_REQUEST and set the SYS_FLAG_IS_KEYED flag and appened a secret key to the end of the binary. Without both of these, all calls to I_SYS_AUTH will result in the calling thread having root access.


define I_SYS_TOTAL

enum sys_flags
  • SYS_FLAG_IS_STDIO_FIFO Indicates STDIO are independent FIFOs (board config flag)
  • SYS_FLAG_IS_STDIO_VCP Deprecated (board config flag)
  • SYS_FLAG_IS_WDT_DISABLED Disables the WDT (board config flag)
  • SYS_FLAG_IS_REQUEST Deprecated (board config flag)
  • SYS_FLAG_IS_TRACE Deprecated (board config flag)
  • SYS_FLAG_IS_STDIO_CFIFO STDIO is a with channels 0:stdout 1:stdin 2: stderr (board config flag)
  • SYS_FLAG_IS_STDIO_CFIFO_SHARE_OUTERR Used with SYS_FLAG_IS_STDIO_CFIFO to indicate stderr and stdout are the same channel (0) (board config flag)
  • SYS_FLAG_IS_ACTIVE_ON_IDLE Don’t stop the CPU when the system is idle (board config flag)
  • SYS_FLAG_IS_KEYED Binary has a 256-bit secret key appended to the end (before HASH if present).
  • SYS_FLAG_IS_HASHED Binary has a 256-bit SHA256 hash appended to the end (after secret key if present)

SYS flags used with sys_attr_t.o_flags and I_SYS_SETATTR.


enum sys_memory_flags
  • SYS_FLAG_SET_MEMORY_REGION
  • SYS_FLAG_IS_READ_ALLOWED
  • SYS_FLAG_IS_WRITE_ALLOWED
  • SYS_FLAG_IS_FLASH
  • SYS_FLAG_IS_EXTERNAL

struct::sys_info_t

char kernel_version

The OS (kernel) Version

char sys_version

The System (board) Version

char arch

The target architecture (v7m, v7em, v7em_f4ss, v7em_f4sh, v7em_f5ss, v7em_f5sh, v7em_f5ds, v7em_f5dh)

u32 signature

Ths OS library signature used to ensure proper build system is used for applications

u32 security

Security flags

u32 cpu_freq

The CPU clock frequency

u32 sys_mem_size

The number of bytes in RAM shared across OS and other processes

char stdout_name

Default value for the standard output

char stdin_name

Default value for the standard output

char name

Device Name

char id

Globally unique Cloud Kernel ID value

mcu_sn_t serial

Device Serial number

u32 o_flags

System flags

u32 hardware_id

Hardware ID of the board

char trace_name

Name of device used for tracing

char bsp_git_hash

Git Hash for the board support package

char sos_git_hash

Git Hash for the SOS build

char mcu_git_hash

Git Hash for the linked MCU library

u32 o_mcu_board_config_flags

Flags set by mcu board configuration

u32 resd

struct::sys_26_info_t

This structure defines the system attributes.

char kernel_version

The OS (kernel) Version

char sys_version

The System (board) Version

char arch

The target architecture (lpc17xx, lpc13xx, etc)

u32 signature

Ths OS library signature used to ensure proper build system is used for applications

u32 security

Security flags

u32 cpu_freq

The CPU clock frequency

u32 sys_mem_size

The number of bytes in RAM shared across OS and other processes

char stdout_name

Default value for the standard output

char stdin_name

Default value for the standard output

char name

Device Name

char id

Globally unique Cloud Kernel ID value

mcu_sn_t serial

Device Serial number

u32 o_flags

System flags

u32 hardware_id

Hardware ID of the board


struct::sys_23_info_t

char version

The OS (kernel) Version

char sys_version

The System (board) Version

char arch

The target architecture (lpc17xx, lpc13xx, etc)

u32 signature

Ths OS library signature used to ensure proper build system is used for applications

u32 security

Security flags

u32 cpu_freq

The CPU clock frequency

u32 sys_mem_size

The number of bytes in RAM shared across OS and other processes

char stdout_name

Default value for the standard output

char stdin_name

Default value for the standard output

char name

Device Name

mcu_sn_t serial

Device Serial number

u32 o_flags

System flags


struct::sys_id_t

char id

Globally unique Cloud Kernel ID value


struct::sys_attr_t

u32 o_flags

Flags used with I_SYS_SETATTR

u32 address

u32 size

u16 region

u16 resd16

u32 resd

struct::sys_taskattr_t

This structure contains the task attributes used with I_SYS_GETTASK.

u32 pid

u32 tid

u64 timer

u32 mem_loc

u32 mem_size

u32 malloc_loc

u32 stack_ptr

u8 prio

u8 prio_ceiling

u8 is_active

u8 is_thread

u8 is_enabled

char name

struct::sys_killattr_t

This structure is used with the I_SYS_KILL and I_SYS_PHTHREADKILL requests.

u32 id

u32 si_signo

s32 si_sigcode

s32 si_sigvalue

struct::sys_process_t

This structure is used for checking the status of a named process. It is used with the I_SYS_GETPROCESS request.

char name

s32 pid

s32 pthread_id

struct::sys_auth_t

This data structure is used with I_SYS_UNLOCK. A successful request will unlock the security features (see security in sys_info_t) of the device giving access to certain parts of the device.

u8 key

X

Thanks for Coming!

Subscribe to news and updates