chiark / gitweb /
[PATCH] improve klibc fixup integration
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Wed, 20 Oct 2004 09:59:11 +0000 (11:59 +0200)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 05:06:44 +0000 (22:06 -0700)
Makefile
klibc_fixups.h [deleted file]
klibc_fixups/klibc_fixups.c [moved from klibc_fixups.c with 95% similarity]
klibc_fixups/klibc_fixups.h [new file with mode: 0644]
klibc_fixups/pwd.h [new file with mode: 0644]
namedev.c
udev_add.c
udevd.c

index 4d25aee..19dc72d 100644 (file)
--- 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 (file)
index 082105e..0000000
+++ /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__ */
similarity index 95%
rename from klibc_fixups.c
rename to klibc_fixups/klibc_fixups.c
index e68ce22..2d673d8 100644 (file)
 #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 (file)
index 0000000..8d2933b
--- /dev/null
@@ -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 (file)
index 0000000..f5de6c5
--- /dev/null
@@ -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__ */
index 03fc41d..80d5f1a 100644 (file)
--- 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);
index 0e7d575..689c2dc 100644 (file)
 #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 c5267d6..0150837 100644 (file)
--- 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>