Changeset 7f9df7b9 in mainline for uspace/lib/posix/src/pwd.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/pwd.c

    re0f47f5 r7f9df7b9  
    3333 */
    3434
    35 #define LIBPOSIX_INTERNAL
    36 #define __POSIX_DEF__(x) posix_##x
    37 
    3835#include "libc/stdbool.h"
    3936#include "posix/pwd.h"
     
    4542
    4643/* dummy user account */
    47 static const struct posix_passwd dummy_pwd = {
     44static const struct passwd dummy_pwd = {
    4845        .pw_name = (char *) "user",
    4946        .pw_uid = 0,
     
    6259 *     doesn't have user accounts, this always returns the same made-up entry.
    6360 */
    64 struct posix_passwd *posix_getpwent(void)
     61struct passwd *getpwent(void)
    6562{
    6663        if (entry_read) {
     
    6966
    7067        entry_read = true;
    71         return (struct posix_passwd *) &dummy_pwd;
     68        return (struct passwd *) &dummy_pwd;
    7269}
    7370
     
    7572 * Rewind the user list.
    7673 */
    77 void posix_setpwent(void)
     74void setpwent(void)
    7875{
    7976        entry_read = false;
     
    8380 * Ends enumerating and releases all resources. (Noop)
    8481 */
    85 void posix_endpwent(void)
     82void endpwent(void)
    8683{
    8784        /* noop */
     
    9491 * @return Either found entry or NULL if no such entry exists.
    9592 */
    96 struct posix_passwd *posix_getpwnam(const char *name)
     93struct passwd *getpwnam(const char *name)
    9794{
    9895        assert(name != NULL);
    9996
    100         if (posix_strcmp(name, "user") != 0) {
     97        if (strcmp(name, "user") != 0) {
    10198                return NULL;
    10299        }
    103100
    104         return (struct posix_passwd *) &dummy_pwd;
     101        return (struct passwd *) &dummy_pwd;
    105102}
    106103
     
    116113 *     non-zero error number if error occured.
    117114 */
    118 int posix_getpwnam_r(const char *name, struct posix_passwd *pwd,
    119     char *buffer, size_t bufsize, struct posix_passwd **result)
     115int getpwnam_r(const char *name, struct passwd *pwd,
     116    char *buffer, size_t bufsize, struct passwd **result)
    120117{
    121118        assert(name != NULL);
     
    124121        assert(result != NULL);
    125122       
    126         if (posix_strcmp(name, "user") != 0) {
     123        if (strcmp(name, "user") != 0) {
    127124                *result = NULL;
    128125                return 0;
    129126        }
    130127       
    131         return posix_getpwuid_r(0, pwd, buffer, bufsize, result);
     128        return getpwuid_r(0, pwd, buffer, bufsize, result);
    132129}
    133130
     
    138135 * @return Either found entry or NULL if no such entry exists.
    139136 */
    140 struct posix_passwd *posix_getpwuid(posix_uid_t uid)
     137struct passwd *getpwuid(uid_t uid)
    141138{
    142139        if (uid != 0) {
     
    144141        }
    145142
    146         return (struct posix_passwd *) &dummy_pwd;
     143        return (struct passwd *) &dummy_pwd;
    147144}
    148145
     
    158155 *     non-zero error number if error occured.
    159156 */
    160 int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd *pwd,
    161     char *buffer, size_t bufsize, struct posix_passwd **result)
     157int getpwuid_r(uid_t uid, struct passwd *pwd,
     158    char *buffer, size_t bufsize, struct passwd **result)
    162159{
    163160        assert(pwd != NULL);
     
    184181        pwd->pw_dir = (char *) bf + 5;
    185182        pwd->pw_shell = (char *) bf + 7;
    186         *result = (struct posix_passwd *) pwd;
     183        *result = (struct passwd *) pwd;
    187184
    188185        return 0;
Note: See TracChangeset for help on using the changeset viewer.