From 439d1d4560aa3e261c065c43e3995779809b4cb2 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 22 Jul 1995 10:48:43 +0000 Subject: Sat Jul 22 01:56:03 1995 Roland McGrath * sysdeps/unix/i386/sysdep.h (JUMPTARGET): New macro; use name@PLT #ifdef PIC. (PSEUDO): Use JUMPTARGET(syscall_error) in jump insn. * sysdeps/unix/i386/syscall.S: Use JUMPTARGET(syscall_error) in jump insn. * sysdeps/unix/sysv/sysv4/linux/i386/sysdep.h: Rewritten. * sysdeps/unix/sysv/sysv4/linux/i386/syscall.S: New file. * sysdeps/unix/sysv/sysv4/linux/i386/socket.S: Include . Save %ebx in call-clobbered %edx instead of stack. Use JUMPTARGET(syscall_error) in jump insn. * Makeconfig (+gccwarn): Add -Wbad-function-cast -Wconversion. * sysdeps/unix/i386/sysdep.h (ENTRY): Use ASM_GLOBAL_DIRECTIVE and ASM_TYPE_DIRECTIVE. (ASM_TYPE_DIRECTIVE): New macro; defined using `.type' #ifdef ELF. * sysdeps/unix/sysv/sysv4/linux/i386/sysdep.S (__syscall_error): Rewritten, #include'ing unix/i386/sysdep.S for most of the code. * sysdeps/unix/i386/sysdep.S [PIC]: Store into `errno' through the GOT. Fixes to help Linux, inspired by drepper's work: * configure.in (os=linux*): Use unix/sysv/sysv4 for $base_os, instead of unix/sysv. * sysdeps/posix/utimes.c: New file. * sysdeps/generic/getdomain.c: New file. * sysdeps/i386/init-first.c: Removed gratuitous #include . * sysdeps/generic/dl-sysdep.c: Include and declare externals _dl_argc, _dl_argc, and _environ. * sysdeps/unix/sysv/linux/{accept,connect,getsockname,rename, socketpair,waitpid,bind,getpeername,listen,setsid,wait4}.S: Moved to new directory sysdeps/unix/sysv/sysv4/linux. * sysdeps/unix/sysv/linux: Directory removed. * sysdeps/unix/sysv/i386/linux/{socket.S,sysdep.h,sysdep.S}: Moved to new directory sysdeps/unix/sysv/sysv4/linux/i386. * sysdeps/unix/sysv/linux/i386: Directory removed. --- sysdeps/generic/getdomain.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sysdeps/generic/getdomain.c (limited to 'sysdeps/generic/getdomain.c') diff --git a/sysdeps/generic/getdomain.c b/sysdeps/generic/getdomain.c new file mode 100644 index 0000000000..0d675d6d22 --- /dev/null +++ b/sysdeps/generic/getdomain.c @@ -0,0 +1,43 @@ +/* Copyright (C) 1994, 1995 Free Software Foundation, Inc. +This file is part of the GNU C Library. + +The GNU C Library is free software; you can redistribute it and/or +modify it under the terms of the GNU Library General Public License as +published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version. + +The GNU C Library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Library General Public License for more details. + +You should have received a copy of the GNU Library General Public +License along with the GNU C Library; see the file COPYING.LIB. If +not, write to the Free Software Foundation, Inc., 675 Mass Ave, +Cambridge, MA 02139, USA. */ + +#include +#include +#include + +#if _UTSNAME_DOMAIN_LENGTH +/* The `uname' information includes the domain name. */ + +/* Put the name of the current YP domain in no more than LEN bytes of NAME. + The result is null-terminated if LEN is large enough for the full + name and the terminator. */ +int +getdomainname (char *name, size_t len) +{ + struct utsname u; + + if (uname (&u) < 0) + return -1; + + strncpy (name, u.domainname, len); + return 0; +} + +#else +#include +#endif -- cgit v1.2.1