Changeset 7f9df7b9 in mainline for uspace/lib/posix/src/unistd.c


Ignore:
Timestamp:
2018-01-22T22:42:57Z (7 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7a08c70
Parents:
e0f47f5
Message:

Remove unnecessary symbol renaming from libposix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/src/unistd.c

    re0f47f5 r7f9df7b9  
    3434 */
    3535
    36 #define LIBPOSIX_INTERNAL
    37 #define __POSIX_DEF__(x) posix_##x
    38 
    3936#include "internal/common.h"
    4037#include "posix/unistd.h"
     
    7067 * @return Always 0 on HelenOS.
    7168 */
    72 unsigned int posix_sleep(unsigned int seconds)
     69unsigned int sleep(unsigned int seconds)
    7370{
    7471        return thread_sleep(seconds);
     
    8077 * @return User name (static) string or NULL if not found.
    8178 */
    82 char *posix_getlogin(void)
     79char *getlogin(void)
    8380{
    8481        /* There is currently no support for user accounts in HelenOS. */
     
    9390 * @return Zero on success, error code otherwise.
    9491 */
    95 int posix_getlogin_r(char *name, size_t namesize)
     92int getlogin_r(char *name, size_t namesize)
    9693{
    9794        /* There is currently no support for user accounts in HelenOS. */
    9895        if (namesize >= 5) {
    99                 posix_strcpy(name, (char *) "user");
     96                strcpy(name, (char *) "user");
    10097                return 0;
    10198        } else {
     
    111108 * @return Boolean result of the test.
    112109 */
    113 int posix_isatty(int fd)
     110int isatty(int fd)
    114111{
    115112        // TODO
     
    126123 * @return Buffer pointer on success, NULL on failure.
    127124 */
    128 char *posix_getcwd(char *buf, size_t size)
     125char *getcwd(char *buf, size_t size)
    129126{
    130127        if (failed(vfs_cwd_get(buf, size)))
     
    138135 * @param path New working directory.
    139136 */
    140 int posix_chdir(const char *path)
     137int chdir(const char *path)
    141138{
    142139        if (failed(vfs_cwd_set(path)))
     
    150147 * @return Page size of the process.
    151148 */
    152 int posix_getpagesize(void)
     149int getpagesize(void)
    153150{
    154151        return PAGE_SIZE;
     
    160157 * @return Process ID.
    161158 */
    162 posix_pid_t posix_getpid(void)
     159pid_t getpid(void)
    163160{
    164161        return task_get_id();
     
    170167 * @return User ID.
    171168 */
    172 posix_uid_t posix_getuid(void)
     169uid_t getuid(void)
    173170{
    174171        /* There is currently no support for user accounts in HelenOS. */
     
    181178 * @return Group ID.
    182179 */
    183 posix_gid_t posix_getgid(void)
     180gid_t getgid(void)
    184181{
    185182        /* There is currently no support for user accounts in HelenOS. */
     
    193190 * @return 0 on success, -1 on error.
    194191 */
    195 int posix_close(int fildes)
     192int close(int fildes)
    196193{
    197194        posix_pos[fildes] = 0;
     
    210207 * @return Number of read bytes on success, -1 otherwise.
    211208 */
    212 ssize_t posix_read(int fildes, void *buf, size_t nbyte)
     209ssize_t read(int fildes, void *buf, size_t nbyte)
    213210{
    214211        size_t nread;
     
    226223 * @return Number of written bytes on success, -1 otherwise.
    227224 */
    228 ssize_t posix_write(int fildes, const void *buf, size_t nbyte)
     225ssize_t write(int fildes, const void *buf, size_t nbyte)
    229226{
    230227        size_t nwr;
     
    243240 *         as measured in bytes from the beginning of the file, -1 otherwise.
    244241 */
    245 posix_off_t posix_lseek(int fildes, posix_off_t offset, int whence)
     242off_t lseek(int fildes, off_t offset, int whence)
    246243{
    247244        vfs_stat_t st;
     
    274271 * @return Zero on success, -1 otherwise.
    275272 */
    276 int posix_fsync(int fildes)
     273int fsync(int fildes)
    277274{
    278275        if (failed(vfs_sync(fildes)))
     
    289286 * @return Zero on success, -1 otherwise.
    290287 */
    291 int posix_ftruncate(int fildes, posix_off_t length)
     288int ftruncate(int fildes, off_t length)
    292289{
    293290        if (failed(vfs_resize(fildes, (aoff64_t) length)))
     
    303300 * @return Zero on success, -1 otherwise.
    304301 */
    305 int posix_rmdir(const char *path)
     302int rmdir(const char *path)
    306303{
    307304        if (failed(vfs_unlink_path(path)))
     
    317314 * @return Zero on success, -1 otherwise.
    318315 */
    319 int posix_unlink(const char *path)
     316int unlink(const char *path)
    320317{
    321318        if (failed(vfs_unlink_path(path)))
     
    331328 * @return On success, new file descriptor for the same file, otherwise -1.
    332329 */
    333 int posix_dup(int fildes)
    334 {
    335         return posix_fcntl(fildes, F_DUPFD, 0);
     330int dup(int fildes)
     331{
     332        return fcntl(fildes, F_DUPFD, 0);
    336333}
    337334
     
    344341 * @return fildes2 on success, -1 otherwise.
    345342 */
    346 int posix_dup2(int fildes, int fildes2)
     343int dup2(int fildes, int fildes2)
    347344{
    348345        int file;
     
    360357 * @return Zero on success, -1 otherwise.
    361358 */
    362 int posix_access(const char *path, int amode)
     359int access(const char *path, int amode)
    363360{
    364361        if (amode == F_OK || (amode & (X_OK | W_OK | R_OK))) {
     
    368365                 * Check file existence by attempting to open it.
    369366                 */
    370                 int fd = posix_open(path, O_RDONLY);
     367                int fd = open(path, O_RDONLY);
    371368                if (fd < 0)
    372369                        return -1;
    373                 posix_close(fd);
     370                close(fd);
    374371                return 0;
    375372        } else {
     
    386383 * @return Variable value.
    387384 */
    388 long posix_sysconf(int name)
     385long sysconf(int name)
    389386{
    390387        long clk_tck = 0;
     
    403400        stats_physmem_t *mem_stats = stats_get_physmem();
    404401        if (mem_stats) {
    405                 phys_pages = (long) (mem_stats->total / posix_getpagesize());
    406                 avphys_pages = (long) (mem_stats->free / posix_getpagesize());
     402                phys_pages = (long) (mem_stats->total / getpagesize());
     403                avphys_pages = (long) (mem_stats->free / getpagesize());
    407404                free(mem_stats);
    408405                mem_stats = 0;
     
    415412                return avphys_pages;
    416413        case _SC_PAGESIZE:
    417                 return posix_getpagesize();
     414                return getpagesize();
    418415        case _SC_CLK_TCK:
    419416                return clk_tck;
     
    430427 * @return
    431428 */
    432 long posix_pathconf(const char *path, int name)
     429long pathconf(const char *path, int name)
    433430{
    434431        // TODO: low priority, just a compile-time dependency of binutils
     
    441438 * @return
    442439 */
    443 posix_pid_t posix_fork(void)
     440pid_t fork(void)
    444441{
    445442        // TODO: low priority, just a compile-time dependency of binutils
     
    454451 * @return
    455452 */
    456 int posix_execv(const char *path, char *const argv[])
     453int execv(const char *path, char *const argv[])
    457454{
    458455        // TODO: low priority, just a compile-time dependency of binutils
     
    467464 * @return
    468465 */
    469 int posix_execvp(const char *file, char *const argv[])
     466int execvp(const char *file, char *const argv[])
    470467{
    471468        // TODO: low priority, just a compile-time dependency of binutils
     
    479476 * @return
    480477 */
    481 int posix_pipe(int fildes[2])
     478int pipe(int fildes[2])
    482479{
    483480        // TODO: low priority, just a compile-time dependency of binutils
     
    486483}
    487484
    488 unsigned int posix_alarm(unsigned int seconds)
     485unsigned int alarm(unsigned int seconds)
    489486{
    490487        not_implemented();
Note: See TracChangeset for help on using the changeset viewer.