Index: uspace/lib/posix/Makefile
===================================================================
--- uspace/lib/posix/Makefile	(revision e3891262fb73ff8c937e92fe4eaab29f686d997d)
+++ uspace/lib/posix/Makefile	(revision 90c5eb60ea05195ce94307a82beaf9f58c6873cb)
@@ -43,4 +43,5 @@
 	fnmatch.c \
 	math.c \
+	pwd.c \
 	stdio.c \
 	stdlib.c \
Index: uspace/lib/posix/pwd.c
===================================================================
--- uspace/lib/posix/pwd.c	(revision 90c5eb60ea05195ce94307a82beaf9f58c6873cb)
+++ uspace/lib/posix/pwd.c	(revision 90c5eb60ea05195ce94307a82beaf9f58c6873cb)
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
+#define LIBPOSIX_INTERNAL
+#include "pwd.h"
+#include "string.h"
+#include "errno.h"
+
+
+static bool entry_read = false;
+
+/* dummy user account */
+static const struct posix_passwd dummy_pwd = {
+	.pw_name = (char *) "user",
+	.pw_uid = 1,
+	.pw_gid = 1,
+	.pw_dir = (char *) "/",
+	.pw_shell = (char *) "bdsh"
+};
+
+/**
+ * Since HelenOS doesn't have user accounts, this always returns
+ * the same made-up entry.
+ */
+struct posix_passwd *posix_getpwent(void)
+{
+	if (entry_read) {
+		return NULL;
+	}
+
+	entry_read = true;
+	return (struct posix_passwd *) &dummy_pwd;
+}
+
+/**
+ * "Rewind the user list".
+ */
+void posix_setpwent(void)
+{
+	entry_read = false;
+}
+
+/**
+ * Ends enumerating and releases all resources. (Noop)
+ */
+void posix_endpwent(void)
+{
+	/* noop */
+}
+
+/**
+ * Find an entry by name.
+ *
+ * @param name Name of the entry.
+ * @return
+ */
+struct posix_passwd *posix_getpwnam(const char *name)
+{
+	assert(name != NULL);
+
+	if (posix_strcmp(name, "user") != 0) {
+		return NULL;
+	}
+
+	return (struct posix_passwd *) &dummy_pwd;
+}
+
+/**
+ * Find an entry by name, thread safely.
+ *
+ * @param name Name of the entry.
+ * @param pwd
+ * @param buffer
+ * @param bufsize
+ * @param result
+ * @return
+ */
+int posix_getpwnam_r(const char *name, struct posix_passwd *pwd,
+    char *buffer, size_t bufsize, struct posix_passwd **result)
+{
+	assert(name != NULL);
+	
+	if (posix_strcmp(name, "user") != 0) {
+		*result = NULL;
+		return 0;
+	}
+	
+	return posix_getpwuid_r(1, pwd, buffer, bufsize, result);
+}
+
+/**
+ * Find an entry by UID.
+ *
+ * @param uid UID of the entry.
+ * @return
+ */
+struct posix_passwd *posix_getpwuid(posix_uid_t uid)
+{
+	if (uid != 1) {
+		return NULL;
+	}
+
+	return (struct posix_passwd *) &dummy_pwd;
+}
+
+/**
+ * Find an entry by UID, thread safely.
+ *
+ * @param uid UID of the entry.
+ * @param pwd
+ * @param buffer
+ * @param bufsize
+ * @param result
+ * @return
+ */
+int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd *pwd,
+    char *buffer, size_t bufsize, struct posix_passwd **result)
+{
+	assert(pwd != NULL);
+	assert(buffer != NULL);
+	assert(result != NULL);
+	
+	static const char bf[] = { 'u', 's', 'e', 'r', '\0',
+	    '/', '\0', 'b', 'd', 's', 'h', '\0' };
+	
+	if (uid != 1) {
+		*result = NULL;
+		return 0;
+	}
+	if (bufsize < sizeof(bf)) {
+		*result = NULL;
+		return ERANGE;
+	}
+
+	memcpy(buffer, bf, sizeof(bf));
+
+	pwd->pw_name = (char *) bf;
+	pwd->pw_uid = 1;
+	pwd->pw_gid = 1;
+	pwd->pw_dir = (char *) bf + 5;
+	pwd->pw_shell = (char *) bf + 7;
+	*result = (struct posix_passwd *) pwd;
+
+	return 0;
+}
+
+/** @}
+ */
+
Index: uspace/lib/posix/pwd.h
===================================================================
--- uspace/lib/posix/pwd.h	(revision 90c5eb60ea05195ce94307a82beaf9f58c6873cb)
+++ uspace/lib/posix/pwd.h	(revision 90c5eb60ea05195ce94307a82beaf9f58c6873cb)
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2011 Jiri Zarevucky
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ * - Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ * - The name of the author may not be used to endorse or promote products
+ *   derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/** @addtogroup libposix
+ * @{
+ */
+/** @file
+ */
+
+#ifndef POSIX_PWD_H_
+#define POSIX_PWD_H_
+
+#include "sys/types.h"
+
+struct posix_passwd {
+	char *pw_name;
+	posix_uid_t pw_uid;
+	posix_gid_t pw_gid;
+	char *pw_dir;
+	char *pw_shell;
+};
+
+extern struct posix_passwd *posix_getpwent(void);
+extern void posix_setpwent(void);
+extern void posix_endpwent(void);
+
+extern struct posix_passwd *posix_getpwnam(const char *name);
+extern int posix_getpwnam_r(const char *name, struct posix_passwd *pwd,
+    char *buffer, size_t bufsize, struct posix_passwd **result);
+
+extern struct posix_passwd *posix_getpwuid(posix_uid_t uid);
+extern int posix_getpwuid_r(posix_uid_t uid, struct posix_passwd *pwd,
+    char *buffer, size_t bufsize, struct posix_passwd **result);
+
+#ifndef LIBPOSIX_INTERNAL
+	#define passwd posix_passwd
+	
+	#define getpwent posix_getpwent
+	#define setpwent posix_setpwent
+	#define endpwent posix_endpwent
+
+	#define getpwnam posix_getpwnam
+	#define getpwnam_r posix_getpwnam_r
+
+	#define getpwuid posix_getpwuid
+	#define getpwuid_r posix_getpwuid_r
+#endif
+
+#endif /* POSIX_PWD_H_ */
+
+/** @}
+ */
+
