Changeset 626 for trunk/libs/mini-libc
- Timestamp:
- Apr 29, 2019, 7:25:09 PM (6 years ago)
- Location:
- trunk/libs/mini-libc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/mini-libc/unistd.c
r625 r626 66 66 } 67 67 68 ////////////////// 69 int fsync( int fd ) 70 { 71 return hal_user_syscall( SYS_FSYNC, 72 (reg_t)fd, 0, 0, 0 ); 73 } 74 68 75 ///////////////////////////// 69 76 int getcwd( char * buf, … … 75 82 } 76 83 77 //////////// 84 ////////////////// 78 85 int getpid( void ) 79 86 { … … 132 139 } 133 140 141 ///////////////// 142 void sync( void ) 143 { 144 hal_user_syscall( SYS_SYNC, 0, 0, 0, 0 ); 145 } 146 134 147 /////////////////////////////////// 135 148 int unlink( const char * pathname ) -
trunk/libs/mini-libc/unistd.h
r610 r626 35 35 36 36 /***************************************************************************************** 37 * This function sets a timer to deliver the signal SIGALRM to the calling process, 37 * This function implements the "alarm" system call. 38 * sets a timer to deliver the signal SIGALRM to the calling process, 38 39 * after the specified number of seconds. 39 40 * If an alarm has already been set with alarm() but has not been delivered, … … 48 49 49 50 /***************************************************************************************** 50 * This function change the current working directory in the reference process descriptor. 51 * This function implements the "chdir" system call. 52 * It changes the current working directory in the reference process descriptor. 51 53 ***************************************************************************************** 52 54 * @ pathname : pathname (can be relative or absolute). … … 56 58 57 59 /***************************************************************************************** 58 * This function release the memory allocated for the file descriptor identified by 59 * the <fd> argument, and remove the fd array_entry in all process descriptor copies. 60 * This function implements the "close" system call. 61 * It releases the memory allocated for the file identified by the <fd> argument, 62 * and remove the fd array_entry in all process descriptor copies. 60 63 ***************************************************************************************** 61 64 * @ fd : file descriptor index in fd_array. … … 65 68 66 69 /***************************************************************************************** 67 * This function implement the "exec" system call on the user side.70 * This function implement the "exec" system call. 68 71 * It creates, in the same cluster as the calling thread, a new process descriptor, 69 72 * and a new associated main thread descriptor, executing a new memory image defined … … 87 90 88 91 /***************************************************************************************** 89 * This function implement the "fork" system call on the user side.92 * This function implement the "fork" system call. 90 93 * The calling process descriptor (parent process), and the associated thread descriptor 91 94 * are replicated in a - likely - remote cluster, that becomes the new process owner. … … 103 106 104 107 /***************************************************************************************** 105 * This function returns the pathname of the current working directory. 108 * This function implements the "fsync" system call. 109 * It causes all the modified data and attributes of file identified by the <fd> argument 110 * to be copied from the file mapper and file descriptor to the IOC device. 111 ***************************************************************************************** 112 * @ fd : file descriptor index in fd_array. 113 * @ return 0 if success / returns -1 if failure. 114 ****************************************************************************************/ 115 int fsync( int fd ); 116 117 /***************************************************************************************** 118 * This function implements the "getcwd" system call. 119 * It returns the pathname of the current working directory. 106 120 ***************************************************************************************** 107 121 * buf : buffer addres in user space. … … 113 127 114 128 /***************************************************************************************** 115 * This function implements the "getpid" system call on the user side. 129 * This function implements the "getpid" system call. 130 * It returns the process identifier. 116 131 ***************************************************************************************** 117 132 * @ returns the process PID for the calling thread process. … … 120 135 121 136 /***************************************************************************************** 122 * This function test whether a file descriptor refers to a terminal. 137 * This function implements the "isatty" system call. 138 * It test whether a file descriptor refers to a terminal. 123 139 ***************************************************************************************** 124 140 * @ fd : file descriptor index in fd_array. … … 128 144 129 145 /***************************************************************************************** 130 * This function repositions the offset of the file descriptor identified by <fd>, 146 * This function implements the "lseek" system call. 147 * It repositions the offset of the file descriptor identified by <fd>, 131 148 * according to the operation type defined by the <whence> argument. 132 149 ***************************************************************************************** … … 141 158 142 159 /***************************************************************************************** 143 * This function stops the calling process until any signal is received. 160 * This function implements the "pause" system call. 161 * It stops the calling process until a signal is received. 144 162 ***************************************************************************************** 145 163 * @ return 0 if success / returns -1 if failure. … … 148 166 149 167 /***************************************************************************************** 150 * This function creates in the calling thread cluster an unnamed pipe, and two151 * (read and write) file descriptors to access this pipe. The calling function must pass152 * the pointer on thefd[] array.168 * This function implements the "pipe" system call. 169 * It creates in the calling thread cluster an unnamed pipe, and two (read and write) 170 * file descriptors to access this pipe. The argument is a pointer a fd[] array. 153 171 * TODO not implemented yet... 154 172 ***************************************************************************************** … … 160 178 161 179 /***************************************************************************************** 162 * This function read bytes from an open file identified by the <fd> file descriptor. 180 * This function implements the "read" system call. 181 * It reads bytes from an open file identified by the <fd> file descriptor. 163 182 * This file can be a regular file or a character oriented device. 164 183 ***************************************************************************************** … … 173 192 174 193 /***************************************************************************************** 175 * This function removes a directory file whose name is given by <pathname>. 176 * The directory must not have any entries other than `.' and `..'. 194 * This function implements the "rmdir" system call. 195 * It removes a directory file whose name is given by <pathname>. 196 * The directory must not contain any entries other than `.' and `..'. 177 197 ***************************************************************************************** 178 198 * @ pathname : pathname (can be relative or absolute). … … 182 202 183 203 /***************************************************************************************** 184 * This function removes a directory entry identified by the <pathname> from the 185 * directory, and decrement the link count of the file referenced by the link. 204 * This function implements the "sync" system call. 205 * It forces all kernel mappers (file caches) to be copied to the IOC device. 206 ****************************************************************************************/ 207 void sync( void ); 208 209 /***************************************************************************************** 210 * This function implements the "unlink" system call. 211 * It removes a directory entry identified by the <pathname> from the parent directory, 212 * and decrement the link count of the file referenced by the link. 186 213 * If the link count reduces to zero, and no process has the file open, then all resources 187 214 * associated with the file are released. If one or more process have the file open when … … 195 222 196 223 /***************************************************************************************** 197 * This function writes bytes to an open file identified by the <fd> file descriptor. 224 * This function implements the "write" system call. 225 * It writes bytes to an open file identified by the <fd> file descriptor. 198 226 * This file can be a regular file or character oriented device. 199 227 *****************************************************************************************
Note: See TracChangeset
for help on using the changeset viewer.