1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-31 17:17:43 +03:00

[PATCH] improve klibc fixup integration

This commit is contained in:
kay.sievers@vrfy.org 2004-10-20 11:59:11 +02:00 committed by Greg KH
parent 5cab7caa2a
commit f8c1ccde6a
8 changed files with 58 additions and 89 deletions

View File

@ -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)

View File

@ -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__ */

View File

@ -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__ */

View File

@ -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__ */

27
klibc_fixups/pwd.h Normal file
View File

@ -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__ */

View File

@ -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);

View File

@ -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"

View File

@ -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>