Initial documentation for system calls
This commit is contained in:
		
							parent
							
								
									2029279601
								
							
						
					
					
						commit
						065b782951
					
				
					 1 changed files with 110 additions and 32 deletions
				
			
		
							
								
								
									
										142
									
								
								user/user.h
									
										
									
									
									
								
							
							
						
						
									
										142
									
								
								user/user.h
									
										
									
									
									
								
							|  | @ -4,43 +4,121 @@ | ||||||
| 
 | 
 | ||||||
| struct stat; | struct stat; | ||||||
| 
 | 
 | ||||||
| // system calls
 | /**
 | ||||||
| int   fork(void); |  * System calls | ||||||
| int   exit(int) __attribute__((noreturn)); |  */ | ||||||
| int   wait(int *); |  | ||||||
| int   pipe(int *); |  | ||||||
| int   write(int, const void *, int); |  | ||||||
| int   read(int, void *, int); |  | ||||||
| int   close(int); |  | ||||||
| int   kill(int); |  | ||||||
| int   exec(const char *, char **); |  | ||||||
| int   open(const char *, int); |  | ||||||
| int   mknod(const char *, short, short); |  | ||||||
| int   unlink(const char *); |  | ||||||
| int   fstat(int fd, struct stat *); |  | ||||||
| int   link(const char *, const char *); |  | ||||||
| int   mkdir(const char *); |  | ||||||
| int   chdir(const char *); |  | ||||||
| int   dup(int); |  | ||||||
| int   getpid(void); |  | ||||||
| char *sbrk(int); |  | ||||||
| int   sleep(int); |  | ||||||
| int   uptime(void); |  | ||||||
| int   trace(int); |  | ||||||
| 
 | 
 | ||||||
| // ulib.c
 | /** Create a child process */ | ||||||
| int   stat(const char *, struct stat *); | int fork(void); | ||||||
|  | 
 | ||||||
|  | /** Exit (terminate) the calling process */ | ||||||
|  | int exit(int) __attribute__((noreturn)); | ||||||
|  | 
 | ||||||
|  | /** Blocks the calling process until child process terminates. */ | ||||||
|  | int wait(int *); | ||||||
|  | 
 | ||||||
|  | /** pipe */ | ||||||
|  | int pipe(int *); | ||||||
|  | 
 | ||||||
|  | /** write */ | ||||||
|  | int write(int, const void *, int); | ||||||
|  | 
 | ||||||
|  | /** read */ | ||||||
|  | int read(int, void *, int); | ||||||
|  | 
 | ||||||
|  | /** close */ | ||||||
|  | int close(int); | ||||||
|  | 
 | ||||||
|  | /** kill */ | ||||||
|  | int kill(int); | ||||||
|  | 
 | ||||||
|  | /** exec */ | ||||||
|  | int exec(const char *, char **); | ||||||
|  | 
 | ||||||
|  | /** open */ | ||||||
|  | int open(const char *, int); | ||||||
|  | 
 | ||||||
|  | /** mknod */ | ||||||
|  | int mknod(const char *, short, short); | ||||||
|  | 
 | ||||||
|  | /** unlink */ | ||||||
|  | int unlink(const char *); | ||||||
|  | 
 | ||||||
|  | /** fstat */ | ||||||
|  | int fstat(int fd, struct stat *); | ||||||
|  | 
 | ||||||
|  | /** link */ | ||||||
|  | int link(const char *, const char *); | ||||||
|  | 
 | ||||||
|  | /** mkdir */ | ||||||
|  | int mkdir(const char *); | ||||||
|  | 
 | ||||||
|  | /** chdir */ | ||||||
|  | int chdir(const char *); | ||||||
|  | 
 | ||||||
|  | /** dup */ | ||||||
|  | int dup(int); | ||||||
|  | 
 | ||||||
|  | /** getpid */ | ||||||
|  | int getpid(void); | ||||||
|  | 
 | ||||||
|  | /** sbrk */ | ||||||
|  | char *sbrk(int); | ||||||
|  | 
 | ||||||
|  | /** sleep */ | ||||||
|  | int sleep(int); | ||||||
|  | 
 | ||||||
|  | /** uptime */ | ||||||
|  | int uptime(void); | ||||||
|  | 
 | ||||||
|  | /** trace */ | ||||||
|  | int trace(int); | ||||||
|  | 
 | ||||||
|  | /**
 | ||||||
|  |  * Library functions (ulib.c) | ||||||
|  |  */ | ||||||
|  | 
 | ||||||
|  | /** stat */ | ||||||
|  | int stat(const char *, struct stat *); | ||||||
|  | 
 | ||||||
|  | /** strcpy */ | ||||||
| char *strcpy(char *, const char *); | char *strcpy(char *, const char *); | ||||||
|  | 
 | ||||||
|  | /** memmove */ | ||||||
| void *memmove(void *, const void *, int); | void *memmove(void *, const void *, int); | ||||||
|  | 
 | ||||||
|  | /** strchr */ | ||||||
| char *strchr(const char *, char c); | char *strchr(const char *, char c); | ||||||
| int   strcmp(const char *, const char *); | 
 | ||||||
| void  fprintf(int, const char *, ...); | /** strcmp */ | ||||||
| void  printf(const char *, ...); | int strcmp(const char *, const char *); | ||||||
|  | 
 | ||||||
|  | /** fprintf */ | ||||||
|  | void fprintf(int, const char *, ...); | ||||||
|  | 
 | ||||||
|  | /** printf */ | ||||||
|  | void printf(const char *, ...); | ||||||
|  | 
 | ||||||
|  | /** gets */ | ||||||
| char *gets(char *, int max); | char *gets(char *, int max); | ||||||
| u32   strlen(const char *); | 
 | ||||||
|  | /** strlen */ | ||||||
|  | u32 strlen(const char *); | ||||||
|  | 
 | ||||||
|  | /** memset */ | ||||||
| void *memset(void *, int, u32); | void *memset(void *, int, u32); | ||||||
|  | 
 | ||||||
|  | /** malloc */ | ||||||
| void *malloc(u32); | void *malloc(u32); | ||||||
| void  free(void *); | 
 | ||||||
| int   atoi(const char *); | /** free */ | ||||||
| int   memcmp(const void *, const void *, u32); | void free(void *); | ||||||
|  | 
 | ||||||
|  | /** atoi */ | ||||||
|  | int atoi(const char *); | ||||||
|  | 
 | ||||||
|  | /** memcmp */ | ||||||
|  | int memcmp(const void *, const void *, u32); | ||||||
|  | 
 | ||||||
|  | /** memcpy */ | ||||||
| void *memcpy(void *, const void *, u32); | void *memcpy(void *, const void *, u32); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus