[tyndur-devel] [PATCH 5/5] libc: POSIX: uname()
Antoine Kaufmann ·
On Wed, Apr 22 20:18, Kevin Wolf wrote:
> + libc: POSIX: uname()
> ---
> src/include/lost/config.h | 9 ++++++
> src/modules/include/sys/utsname.h | 52 +++++++++++++++++++++++++++++++++++++
> 2 files changed, 61 insertions(+), 0 deletions(-)
> create mode 100644 src/modules/include/sys/utsname.h
>
> diff --git a/src/include/lost/config.h b/src/include/lost/config.h
> index 67cf7cc..25794af 100644
> --- a/src/include/lost/config.h
> +++ b/src/include/lost/config.h
> @@ -74,5 +74,14 @@
> #define CONFIG_LIBC_NO_STUBS
>
>
> +#define TYNDUR_VERSION "0.2.1"
> +#if CONFIG_ARCH == ARCH_I386
> + #define TYNDUR_ARCH "i386"
> +#elif CONFIG_ARCH == ARCH_AMD64
> + #define TYNDUR_ARCH "amd64"
> +#else
> + #error Unbekannte Architektur
> +#endif
> +
> #endif // _CONFIG_H_
>
> diff --git a/src/modules/include/sys/utsname.h b/src/modules/include/sys/utsname.h
> new file mode 100644
> index 0000000..7b53d53
> --- /dev/null
> +++ b/src/modules/include/sys/utsname.h
> @@ -0,0 +1,52 @@
> +/*
> + * Copyright (c) 2009 The tyndur Project. All rights reserved.
> + *
> + * This code is derived from software contributed to the tyndur Project
> + * by Kevin Wolf.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + * notice, this list of conditions and the following disclaimer.
> + * 2. 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.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
> + * ``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 COPYRIGHT HOLDERS OR
> + * CONTRIBUTORS 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.
> + */
> +#ifndef _SYS_UTSNAME_H_
> +#define _SYS_UTSNAME_H_
> +
> +#include <lost/config.h>
> +
> +struct utsname {
> + char sysname[32];
> + char nodename[32];
> + char release[32];
> + char version[32];
> + char machine[32];
> +};
> +
> +static int uname(struct utsname* utsname)
> +{
> + strcpy(utsname->sysname, "tyndur");
> + strcpy(utsname->nodename, "tyndur");
> + strcpy(utsname->release, "Gothmog");
Packen wir den vielleicht nich besser auch in ein Config-Makro? Sonst
vergessen wir das garantiert bei weiteren Releases. ;-)
> + strcpy(utsname->version, TYNDUR_VERSION);
> + strcpy(utsname->machine, TYNDUR_ARCH);
> +
> + return 0;
> +}
> +
> +#endif
Sieht sonst gut aus.
--
Antoine Kaufmann
<toni at famkaufmann.info>
-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname : nicht verfügbar
Dateityp : application/pgp-signature
Dateigröße : 197 bytes
Beschreibung: nicht verfügbar
URL : <http://list.tyndur.org/pipermail/tyndur-devel/attachments/20090425/4eb09ad6/attachment.pgp>