summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-10-20 11:59:11 +0200
committerGreg KH <gregkh@suse.de>2005-04-26 22:06:44 -0700
commitf8c1ccde6aaf08c858616c9a8a83c06d609f52f5 (patch)
tree84272b3304984da52c70480f8c746057f965b216
parent5cab7caa2a767b16211c15f0051a2e21a96ebfd9 (diff)
[PATCH] improve klibc fixup integration
-rw-r--r--Makefile25
-rw-r--r--klibc_fixups.h66
-rw-r--r--klibc_fixups/klibc_fixups.c (renamed from klibc_fixups.c)11
-rw-r--r--klibc_fixups/klibc_fixups.h12
-rw-r--r--klibc_fixups/pwd.h27
-rw-r--r--namedev.c1
-rw-r--r--udev_add.c4
-rw-r--r--udevd.c1
8 files changed, 58 insertions, 89 deletions
diff --git a/Makefile b/Makefile
index 4d25aee73e..19dc72d952 100644
--- a/Makefile
+++ b/Makefile
@@ -137,6 +137,7 @@ endif
# link udev against it statically.
# Otherwise, use glibc and link dynamically.
ifeq ($(strip $(USE_KLIBC)),true)
+ KLIBC_FIXUPS_DIR= $(PWD)/klibc_fixups
KLIBC_BASE = $(PWD)/klibc
KLIBC_DIR = $(KLIBC_BASE)/klibc
INCLUDE_DIR := $(KLIBC_BASE)/include
@@ -149,13 +150,15 @@ ifeq ($(strip $(USE_KLIBC)),true)
CRT0 = $(KLIBC_DIR)/crt0.o
LIBC = $(ARCH_LIB_OBJS) $(LIB_OBJS) $(CRT0)
- CFLAGS += $(WARNINGS) -nostdinc \
- $(OPTFLAGS) \
- -D__KLIBC__ -fno-builtin-printf \
- -I$(INCLUDE_DIR) \
- -I$(INCLUDE_DIR)/arch/$(ARCH) \
- -I$(INCLUDE_DIR)/bits$(BITSIZE) \
- -I$(GCCINCDIR) \
+ CFLAGS += $(WARNINGS) -nostdinc \
+ $(OPTFLAGS) \
+ -D__KLIBC__ -fno-builtin-printf \
+ -I$(KLIBC_FIXUPS_DIR) \
+ -include $(KLIBC_FIXUPS_DIR)/klibc_fixups.h \
+ -I$(INCLUDE_DIR) \
+ -I$(INCLUDE_DIR)/arch/$(ARCH) \
+ -I$(INCLUDE_DIR)/bits$(BITSIZE) \
+ -I$(GCCINCDIR) \
-I$(LINUX_INCLUDE_DIR)
LIB_OBJS =
LDFLAGS = --static --nostdlib -nostartfiles -nodefaultlibs
@@ -226,14 +229,14 @@ HEADERS = udev.h \
udev_version.h \
udevdb.h \
udev_sysfs.h \
- klibc_fixups.h \
logging.h \
selinux.h \
- list.h
+ list.h \
+ klibc_fixups/klibc_fixups.h
ifeq ($(strip $(USE_KLIBC)),true)
- OBJS += klibc_fixups.o
- KLIBC_FIXUP = klibc_fixups.o
+ OBJS += klibc_fixups/klibc_fixups.o
+ KLIBC_FIXUP = klibc_fixups/klibc_fixups.o
endif
ifeq ($(strip $(V)),false)
diff --git a/klibc_fixups.h b/klibc_fixups.h
deleted file mode 100644
index 082105eb8e..0000000000
--- a/klibc_fixups.h
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifdef __KLIBC__
-
-#ifndef KLIBC_FIXUPS_H
-#define KLIBC_FIXUPS_H
-
-struct passwd {
- char *pw_name; /* user name */
- char *pw_passwd; /* user password */
- uid_t pw_uid; /* user id */
- gid_t pw_gid; /* group id */
- char *pw_gecos; /* real name */
- char *pw_dir; /* home directory */
- char *pw_shell; /* shell program */
-};
-
-struct group {
- char *gr_name; /* group name */
- char *gr_passwd; /* group password */
- gid_t gr_gid; /* group id */
- char **gr_mem; /* group members */
-};
-
-struct passwd *getpwnam(const char *name);
-struct group *getgrnam(const char *name);
-
-
-#define UT_LINESIZE 32
-#define UT_NAMESIZE 32
-#define UT_HOSTSIZE 256
-#define USER_PROCESS 7 /* normal process */
-#define ut_time ut_tv.tv_sec
-
-
-extern int ufd;
-
-struct exit_status {
- short int e_termination; /* process termination status */
- short int e_exit; /* process exit status */
-};
-
-struct utmp
-{
- short int ut_type; /* type of login */
- pid_t ut_pid; /* pid of login process */
- char ut_line[UT_LINESIZE]; /* devicename */
- char ut_id[4]; /* Inittab id */
- char ut_user[UT_NAMESIZE]; /* username */
- char ut_host[UT_HOSTSIZE]; /* hostname for remote login */
- struct exit_status ut_exit; /* exit status of a process marked as DEAD_PROCESS */
- /* The ut_session and ut_tv fields must be the same size for 32 and 64-bit */
-#if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32
- int32_t ut_session; /* sid used for windowing */
- struct {
- int32_t tv_sec; /* seconds */
- int32_t tv_usec; /* microseconds */
- } ut_tv;
-#else
- long int ut_session;
- struct timeval ut_tv;
-#endif
- int32_t ut_addr_v6[4]; /* internet address of remote host */
- char __unused[20]; /* reserved for future use */
-};
-
-#endif /* KLIBC_FIXUPS_H */
-#endif /* __KLIBC__ */
diff --git a/klibc_fixups.c b/klibc_fixups/klibc_fixups.c
index e68ce22b50..2d673d8ca9 100644
--- a/klibc_fixups.c
+++ b/klibc_fixups/klibc_fixups.c
@@ -28,14 +28,13 @@
#include <fcntl.h>
#include <sys/types.h>
-#include "udev.h"
-#include "klibc_fixups.h"
-#include "udev_lib.h"
-#include "logging.h"
+#include "pwd.h"
+#include "../udev.h"
+#include "../udev_lib.h"
+#include "../logging.h"
#define PW_FILE "/etc/passwd"
#define GR_FILE "/etc/group"
-#define UTMP_FILE "/var/run/utmp"
/* return the id of a passwd style line, selected by the users name */
static unsigned long get_id_by_name(const char *uname, const char *dbfile)
@@ -125,4 +124,4 @@ struct group *getgrnam(const char *name)
return &gr;
}
-#endif
+#endif /* __KLIBC__ */
diff --git a/klibc_fixups/klibc_fixups.h b/klibc_fixups/klibc_fixups.h
new file mode 100644
index 0000000000..8d2933b1b6
--- /dev/null
+++ b/klibc_fixups/klibc_fixups.h
@@ -0,0 +1,12 @@
+#ifdef __KLIBC__
+
+#ifndef _KLIBC_FIXUPS_H
+#define _KLIBC_FIXUPS_H
+
+struct exit_status {
+ short int e_termination; /* process termination status */
+ short int e_exit; /* process exit status */
+};
+
+#endif /* KLIBC_FIXUPS_H */
+#endif /* __KLIBC__ */
diff --git a/klibc_fixups/pwd.h b/klibc_fixups/pwd.h
new file mode 100644
index 0000000000..f5de6c50b8
--- /dev/null
+++ b/klibc_fixups/pwd.h
@@ -0,0 +1,27 @@
+#ifdef __KLIBC__
+
+#ifndef _PWD_H
+#define _PWD_H
+
+struct passwd {
+ char *pw_name; /* user name */
+ char *pw_passwd; /* user password */
+ uid_t pw_uid; /* user id */
+ gid_t pw_gid; /* group id */
+ char *pw_gecos; /* real name */
+ char *pw_dir; /* home directory */
+ char *pw_shell; /* shell program */
+};
+
+struct group {
+ char *gr_name; /* group name */
+ char *gr_passwd; /* group password */
+ gid_t gr_gid; /* group id */
+ char **gr_mem; /* group members */
+};
+
+struct passwd *getpwnam(const char *name);
+struct group *getgrnam(const char *name);
+
+#endif /* _PWD_H */
+#endif /* __KLIBC__ */
diff --git a/namedev.c b/namedev.c
index 03fc41d234..80d5f1a499 100644
--- a/namedev.c
+++ b/namedev.c
@@ -40,7 +40,6 @@
#include "udev_version.h"
#include "logging.h"
#include "namedev.h"
-#include "klibc_fixups.h"
#include "udevdb.h"
static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr);
diff --git a/udev_add.c b/udev_add.c
index 0e7d575d58..689c2dceec 100644
--- a/udev_add.c
+++ b/udev_add.c
@@ -34,10 +34,7 @@
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/sockios.h>
-#ifndef __KLIBC__
#include <pwd.h>
-#include <utmp.h>
-#endif
#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
@@ -46,7 +43,6 @@
#include "logging.h"
#include "namedev.h"
#include "udevdb.h"
-#include "klibc_fixups.h"
#include "selinux.h"
diff --git a/udevd.c b/udevd.c
index c5267d6d9f..0150837143 100644
--- a/udevd.c
+++ b/udevd.c
@@ -33,7 +33,6 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <fcntl.h>
-#include "klibc_fixups.h"
#include <sys/sysinfo.h>
#include <sys/stat.h>