STM32 core 3.0.1-dev
Arduino core for STM32 based boards: API reference
← STM32duino documentation
Loading...
Searching...
No Matches
syscalls.c File Reference

Implementation of newlib syscall. More...

#include "stm32_def.h"
#include <errno.h>

Functions

caddr_t _sbrk (int incr)
 Increase the program data space (heap) used by malloc.
 
int _close (int file)
 Close a file.
 
int _fstat (int file, struct stat *st)
 Get file status.
 
int _isatty (int file)
 Check whether a file descriptor refers to a terminal.
 
int _lseek (int file, int ptr, int dir)
 Set the file position.
 
int _read (int file, char *ptr, int len)
 Read from a file.
 
void _exit (int status)
 Terminate the program.
 
int _kill (int pid, int sig)
 Send a signal to a process.
 
int _getpid (void)
 Get the process ID.
 

Variables

int errno
 

Detailed Description

Implementation of newlib syscall.

Function Documentation

◆ _close()

int _close ( int  file)

Close a file.

Not supported, always fails.

Parameters
fileFile descriptor to close.
Returns
-1.

◆ _exit()

void _exit ( int  status)

Terminate the program.

Loops forever.

Parameters
statusExit status (ignored).

◆ _fstat()

int _fstat ( int  file,
struct stat *  st 
)

Get file status.

Reports every file as a character device.

Parameters
fileFile descriptor.
stBuffer that receives the file status.
Returns
0.

◆ _getpid()

int _getpid ( void  )

Get the process ID.

Always returns 1.

Returns
1.

◆ _isatty()

int _isatty ( int  file)

Check whether a file descriptor refers to a terminal.

Always reports a terminal.

Parameters
fileFile descriptor.
Returns
1.

◆ _kill()

int _kill ( int  pid,
int  sig 
)

Send a signal to a process.

Not supported, always fails.

Parameters
pidProcess ID.
sigSignal number.
Returns
-1 with errno set to EINVAL.

◆ _lseek()

int _lseek ( int  file,
int  ptr,
int  dir 
)

Set the file position.

Not supported, always returns 0.

Parameters
fileFile descriptor.
ptrOffset.
dirSeek direction.
Returns
0.

◆ _read()

int _read ( int  file,
char *  ptr,
int  len 
)

Read from a file.

Not supported, always returns 0 bytes read.

Parameters
fileFile descriptor.
ptrBuffer to fill.
lenMaximum number of bytes to read.
Returns
0.

◆ _sbrk()

caddr_t _sbrk ( int  incr)

Increase the program data space (heap) used by malloc.

Parameters
incrNumber of bytes to add to the heap.
Returns
Previous heap end on success, or (caddr_t)-1 with errno set to ENOMEM.