From 49b986270035c7f86c3dc85383fd1da2e413fef9 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Thu, 18 Jul 1996 08:43:26 +0000 Subject: Thu Jul 18 04:33:21 1996 Roland McGrath * sysdeps/mach/hurd/errnos.awk: Move EWOULDBLOCK check before errno==0 check. mib's clueless hacking broke it. Thu Jul 18 04:27:21 1996 Roland McGrath * Makerules ($(libdir)/libc.so): Add missing / after $(cryptobjdir). Wed Jul 17 10:54:20 1996 David Mosberger-Tang * sysdeps/unix/sysv/linux/alpha/start.S: Move to ... * sysdeps/alpha/elf/start.S: here. * misc/sys/ustat.h: New file. * misc/ustat.h: Ditto. * sysdeps/generic/ustatbits.h: Ditto. * libc-orig/sysdeps/stub/ustat.c: Ditto. * sysdeps/unix/sysv/linux/ustatbits.h: Ditto. * misc/Makefile (headers): Mention ustat.h, sys/ustat.h, and ustatbits.h. (routines): Mention ustat. * sysdeps/unix/sysv/linux/syscalls.list: Mention klogctl in alphabetically correct place. Mention ustat. * sysdeps/unix/alpha/sysdep.S: Make errno a bss symbol, not a common symbol (makes errno accessible from gdb). * login/pututline_r.c (pututline_r): Test ut_id in repositioning test, not ut_type. * login/logwtmp.c (logwtmp): Reimplemented. Must ensure that a record always gets appended at end of file (wtmp is a log file, after all). Set ut_type to DEAD_PROCESS if name is empty. * login/getutid_r.c (getutid_r): Handle search for UT_TYPE in separate loop from search for UT_ID. Fix code so it is in sync with Unix man page. * login/getutline_r.c (getutline_r): Stop searching only if ut_line matches and type is either USER_PROCESS or LOGIN_PROCESS. Tue Jul 16 15:06:18 1996 David Mosberger-Tang * sysdeps/unix/sysv/linux/netinet/in.h: Base on to avoid duplicate declarations. Sun Jul 14 19:08:55 1996 David Mosberger-Tang * manual/maint.texi (Supported Configurations): Add alpha-gnu-linux and alpha-gnu-linuxecoff targets. Fri Jul 12 16:58:44 1996 David Mosberger-Tang * sysdeps/unix/sysv/linux/netinet/in.h: Declare bindresvport(). Sat Jun 22 23:30:07 1996 David Mosberger-Tang * resolv/res_send.c (res_send): Declare FROMLEN as size_t instead of int. * resolv/res_comp.c (res_hnok): Use empty statement in place of NULL (which generates a "useless expression" warning in gcc). --- ChangeLog | 66 +++++++++++++++++++++ Makerules | 2 +- login/getutid_r.c | 67 +++++++++++++++------- login/getutline_r.c | 22 +++---- login/logwtmp.c | 62 +++++++++++++------- login/pututline_r.c | 17 +++--- manual/maint.texi | 2 + misc/sys/ustat.h | 35 ++++++++++++ misc/ustat.h | 1 + resolv/res_comp.c | 2 +- resolv/res_send.c | 2 +- sysdeps/alpha/elf/start.S | 104 ++++++++++++++++++++++++++++++++++ sysdeps/generic/ustatbits.h | 26 +++++++++ sysdeps/mach/hurd/errnos.awk | 8 +-- sysdeps/mach/hurd/errnos.h | 22 ++++--- sysdeps/unix/alpha/sysdep.S | 8 ++- sysdeps/unix/sysv/linux/alpha/start.S | 103 --------------------------------- sysdeps/unix/sysv/linux/netinet/in.h | 98 +++----------------------------- sysdeps/unix/sysv/linux/syscalls.list | 3 +- sysdeps/unix/sysv/linux/ustatbits.h | 2 + 20 files changed, 376 insertions(+), 276 deletions(-) create mode 100644 misc/sys/ustat.h create mode 100644 misc/ustat.h create mode 100644 sysdeps/alpha/elf/start.S create mode 100644 sysdeps/generic/ustatbits.h delete mode 100644 sysdeps/unix/sysv/linux/alpha/start.S create mode 100644 sysdeps/unix/sysv/linux/ustatbits.h diff --git a/ChangeLog b/ChangeLog index beb67628b8..4c8ba94d9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,69 @@ +Thu Jul 18 04:33:21 1996 Roland McGrath + + * sysdeps/mach/hurd/errnos.awk: Move EWOULDBLOCK check before errno==0 + check. mib's clueless hacking broke it. + +Thu Jul 18 04:27:21 1996 Roland McGrath + + * Makerules ($(libdir)/libc.so): Add missing / after $(cryptobjdir). + +Wed Jul 17 10:54:20 1996 David Mosberger-Tang + + * sysdeps/unix/sysv/linux/alpha/start.S: Move to ... + * sysdeps/alpha/elf/start.S: here. + + * misc/sys/ustat.h: New file. + * misc/ustat.h: Ditto. + * sysdeps/generic/ustatbits.h: Ditto. + * libc-orig/sysdeps/stub/ustat.c: Ditto. + * sysdeps/unix/sysv/linux/ustatbits.h: Ditto. + * misc/Makefile (headers): Mention ustat.h, sys/ustat.h, and + ustatbits.h. + (routines): Mention ustat. + + * sysdeps/unix/sysv/linux/syscalls.list: Mention klogctl in + alphabetically correct place. Mention ustat. + + * sysdeps/unix/alpha/sysdep.S: Make errno a bss symbol, not a + common symbol (makes errno accessible from gdb). + + * login/pututline_r.c (pututline_r): Test ut_id in repositioning + test, not ut_type. + + * login/logwtmp.c (logwtmp): Reimplemented. Must ensure that a + record always gets appended at end of file (wtmp is a log file, + after all). Set ut_type to DEAD_PROCESS if name is empty. + + * login/getutid_r.c (getutid_r): Handle search for UT_TYPE in + separate loop from search for UT_ID. Fix code so it is in + sync with Unix man page. + + * login/getutline_r.c (getutline_r): Stop searching only if + ut_line matches and type is either USER_PROCESS or LOGIN_PROCESS. + +Tue Jul 16 15:06:18 1996 David Mosberger-Tang + + * sysdeps/unix/sysv/linux/netinet/in.h: Base on to + avoid duplicate declarations. + +Sun Jul 14 19:08:55 1996 David Mosberger-Tang + + * manual/maint.texi (Supported Configurations): Add alpha-gnu-linux + and alpha-gnu-linuxecoff targets. + +Fri Jul 12 16:58:44 1996 David Mosberger-Tang + + * sysdeps/unix/sysv/linux/netinet/in.h: Declare bindresvport(). + +Sat Jun 22 23:30:07 1996 David Mosberger-Tang + + * resolv/res_send.c (res_send): Declare FROMLEN as size_t instead + of int. + + * resolv/res_comp.c (res_hnok): Use empty statement in place + of NULL (which generates a "useless expression" warning in + gcc). + Wed Jul 17 23:56:35 1996 Roland McGrath * sysdeps/mach/hurd/Makefile ($(common-objpfx)errnos.d): Replace ../ diff --git a/Makerules b/Makerules index 06be41c35e..b995bef1b0 100644 --- a/Makerules +++ b/Makerules @@ -588,7 +588,7 @@ cryptobjdir := $(firstword $(objdir) $(patsubst ../$(subdir),.,$(..)crypt)) $(libdir)/libc.so: $(common-objpfx)libc.so$(libc.so-version) \ $(elfobjdir)/$(rtld-installed-name) \ $(common-objpfx)libc.a \ - $(cryptobjdir)libcrypt.so$(libcrypt.so-version) + $(cryptobjdir)/libcrypt.so$(libcrypt.so-version) (echo '/* Use the shared library, but some functions are only in';\ echo ' the static library, so try that secondarily.'; \ echo ' The dynamic linker defines some functions used by $(ut_fd, utmp_data->loc_utmp, SEEK_SET) == -1) return -1; - while (1) + if (id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME + || id->ut_type == OLD_TIME || id->ut_type == NEW_TIME) { - /* Read the next entry. */ - if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp)) - != sizeof (struct utmp)) + /* Search for next entry with type RUN_LVL, BOOT_TIME, + OLD_TIME, or NEW_TIME. */ + + while (1) { - errno = ESRCH; - return -1; + /* Read the next entry. */ + if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp)) + != sizeof (struct utmp)) + { + errno = ESRCH; + return -1; + } + + /* Update position pointer. */ + utmp_data->loc_utmp += sizeof (struct utmp); + + if (id->ut_type == utmp_data->ubuf.ut_type) + break; } + } + else + { + /* Search for the next entry with the specified ID and with type + INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS. */ - /* Update position pointer. */ - utmp_data->loc_utmp += sizeof (struct utmp); - - if ((id->ut_type == RUN_LVL || id->ut_type == BOOT_TIME - || id->ut_type == OLD_TIME || id->ut_type == NEW_TIME) - && id->ut_type != utmp_data->ubuf.ut_type) - /* Stop at the next entry with type RUN_LVL, BOOT_TIME, - OLD_TIME, or NEW_TIME. */ - break; - - if ((id->ut_type == INIT_PROCESS || id->ut_type == LOGIN_PROCESS - || id->ut_type == USER_PROCESS || id->ut_type == DEAD_PROCESS) - && strncmp (id->ut_id, utmp_data->ubuf.ut_id, sizeof id->ut_id) == 0) - /* Stop at the next entry with the specified ID and with type - INIT_PROCESS, LOGIN_PROCESS, USER_PROCESS, or DEAD_PROCESS. */ - break; + while (1) + { + /* Read the next entry. */ + if (read (utmp_data->ut_fd, &utmp_data->ubuf, sizeof (struct utmp)) + != sizeof (struct utmp)) + { + errno = ESRCH; + return -1; + } + + /* Update position pointer. */ + utmp_data->loc_utmp += sizeof (struct utmp); + + if (( utmp_data->ubuf.ut_type == INIT_PROCESS + || utmp_data->ubuf.ut_type == LOGIN_PROCESS + || utmp_data->ubuf.ut_type == USER_PROCESS + || utmp_data->ubuf.ut_type == DEAD_PROCESS) + && (strncmp (utmp_data->ubuf.ut_id, id->ut_id, sizeof id->ut_id) + == 0)) + break; + } } *utmp = &utmp_data->ubuf; diff --git a/login/getutline_r.c b/login/getutline_r.c index 965d46ce8f..4d3547181f 100644 --- a/login/getutline_r.c +++ b/login/getutline_r.c @@ -55,22 +55,16 @@ getutline_r (const struct utmp *line, struct utmp **utmp, /* Update position pointer. */ utmp_data->loc_utmp += sizeof (struct utmp); + if ( #if _HAVE_UT_TYPE - 0 - if (utmp_data->ubuf.ut_type == USER_PROCESS - && strncmp (line->ut_line, utmp_data->ubuf.ut_line, - sizeof line->ut_line) == 0) - /* Stop if we found an user entry. */ - break; - - if (utmp_data->ubuf.ut_type == LOGIN_PROCESS) - /* Stop if we found a login entry. */ - break; -#else /* !_HAVE_UT_TYPE */ - if (strncmp (line->ut_line, utmp_data->ubuf.ut_line, - sizeof line->ut_line) == 0) - /* Stop if the line match. */ - break; + (utmp_data->ubuf.ut_type == USER_PROCESS + || utmp_data->ubuf.ut_type == LOGIN_PROCESS) + && #endif + ! strncmp (line->ut_line, utmp_data->ubuf.ut_line, + sizeof line->ut_line)) + /* Stop if we found a user or login entry. */ + break; } *utmp = &utmp_data->ubuf; diff --git a/login/logwtmp.c b/login/logwtmp.c index 371f34ee76..2ae6a68dca 100644 --- a/login/logwtmp.c +++ b/login/logwtmp.c @@ -17,33 +17,31 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#include #include #include #include - +#include +#include void logwtmp (const char *line, const char *name, const char *host) { - struct utmp_data data; struct utmp ut; + struct stat st; + size_t written; + int fd; - /* Tell that we want to use the UTMP file. */ - if (utmpname (_PATH_WTMP) == 0) - return; - - /* Open UTMP file. */ - setutent_r (&data); - - /* Position at end of file. */ - data.loc_utmp = lseek (data.ut_fd, 0, SEEK_END); - if (data.loc_utmp == -1) - return; + /* Open WTMP file. */ + fd = __open (_PATH_WTMP, O_WRONLY | O_APPEND); + if (fd < 0) + return; /* Set information in new entry. */ - bzero (&ut, sizeof (ut)); + memset (&ut, 0, sizeof (ut)); + ut.ut_pid = getpid (); #if _HAVE_UT_TYPE - 0 - ut.ut_type = USER_PROCESS; + ut.ut_type = name[0] ? USER_PROCESS : DEAD_PROCESS; #endif strncpy (ut.ut_line, line, sizeof ut.ut_line); strncpy (ut.ut_name, name, sizeof ut.ut_name); @@ -52,14 +50,36 @@ logwtmp (const char *line, const char *name, const char *host) #endif #if _HAVE_UT_TV - 0 - gettimeofday (&ut.ut_tv, NULL); + __gettimeofday (&ut.ut_tv, NULL); #else - time (&ut.ut_time); + __time (&ut.ut_time); #endif - /* Write the entry. */ - pututline_r (&ut, &data); + /* Try to lock the file. */ + if (__flock (fd, LOCK_EX | LOCK_NB) < 0 && errno != ENOSYS) + { + /* Oh, oh. The file is already locked. Wait a bit and try again. */ + sleep (1); + + /* This time we ignore the error. */ + __flock (fd, LOCK_EX | LOCK_NB); + } + + /* Remeber original size of log file: */ + if (__fstat (fd, &st) < 0) + goto done; + + /* Write the entry. If we can't write all the bytes, reset the file + size back to the original size. That way, no partial entries + will remain. */ + written = __write (fd, &ut, sizeof (ut)); + if (written > 0 && written != sizeof (ut)) + ftruncate (fd, st.st_size); + +done: + /* And unlock the file. */ + __flock (fd, LOCK_UN); - /* Close UTMP file. */ - endutent_r (&data); + /* Close WTMP file. */ + __close (fd); } diff --git a/login/pututline_r.c b/login/pututline_r.c index 4c9a91fdec..42994e899f 100644 --- a/login/pututline_r.c +++ b/login/pututline_r.c @@ -58,12 +58,15 @@ pututline_r (const struct utmp *id, struct utmp_data *utmp_data) return -1; } -#if _HAVE_UT_TYPE - 0 - /* Seek position to write. */ - if (utmp_data->loc_utmp >= sizeof (struct utmp) - && utmp_data->ubuf.ut_type != id->ut_type) +#if _HAVE_UT_ID - 0 + /* Check whether we need to reposition. Repositioning is necessary + either if the data in UTMP_DATA is not valid or if the ids don't + match: */ + if (utmp_data->loc_utmp < (off_t) sizeof (struct utmp) + || strncmp(utmp_data->ubuf.ut_id, id->ut_id, sizeof (id->ut_id)) != 0) { - /* We must not overwrite the data in UTMP_DATA. */ + /* We must not overwrite the data in UTMP_DATA since ID may be + aliasing it. */ struct utmp_data *data_tmp = alloca (sizeof (*data_tmp)); struct utmp *dummy; @@ -77,7 +80,7 @@ pututline_r (const struct utmp *id, struct utmp_data *utmp_data) pointer now is at the end of the file. */ return -1; - /* Set position pointer to position after adding of the record. */ + /* Set position pointer to position behind the record. */ utmp_data->loc_utmp += sizeof (struct utmp); } } @@ -98,7 +101,7 @@ pututline_r (const struct utmp *id, struct utmp_data *utmp_data) if (result >= 0) /* Position file correctly. */ - if (utmp_data->loc_utmp < sizeof (struct utmp)) + if (utmp_data->loc_utmp < (off_t) sizeof (struct utmp)) /* Not located at any valid entry. Add at the end. */ { result = lseek (utmp_data->ut_fd, 0L, SEEK_END); diff --git a/manual/maint.texi b/manual/maint.texi index 639852d1ab..5bf473ecfd 100644 --- a/manual/maint.texi +++ b/manual/maint.texi @@ -223,6 +223,8 @@ following patterns: @smallexample alpha-dec-osf1 +alpha-gnu-linux +alpha-gnu-linuxecoff i@var{x}86-@var{anything}-bsd4.3 i@var{x}86-@var{anything}-gnu i@var{x}86-@var{anything}-isc2.2 diff --git a/misc/sys/ustat.h b/misc/sys/ustat.h new file mode 100644 index 0000000000..57086c96da --- /dev/null +++ b/misc/sys/ustat.h @@ -0,0 +1,35 @@ +/* Header describing obsolete `ustat' interface. +Copyright (C) 1996 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. */ + +/* This interface is obsolete. Use instead. */ + +#ifndef _SYS_USTAT_H +#define _SYS_USTAT_H 1 + +#include +#include + +__BEGIN_DECLS + +extern int __ustat __P ((dev_t, struct ustat *)); +extern int ustat __P ((dev_t, struct ustat *)); + +__END_DECLS + +#endif /* _SYS_USTAT_H */ diff --git a/misc/ustat.h b/misc/ustat.h new file mode 100644 index 0000000000..cba150e446 --- /dev/null +++ b/misc/ustat.h @@ -0,0 +1 @@ +#include diff --git a/resolv/res_comp.c b/resolv/res_comp.c index e105dbb0b6..103ebd9a52 100644 --- a/resolv/res_comp.c +++ b/resolv/res_comp.c @@ -397,7 +397,7 @@ res_hnok(dn) int nch = *dn++; if (periodchar(ch)) { - NULL; + /* NULL */; } else if (periodchar(pch)) { if (!borderchar(ch)) return (0); diff --git a/resolv/res_send.c b/resolv/res_send.c index d2c97d0cd4..bf8158aa52 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -499,7 +499,7 @@ read_len: struct timeval timeout; fd_set dsmask; struct sockaddr_in from; - int fromlen; + size_t fromlen; if ((s < 0) || vc) { if (vc) diff --git a/sysdeps/alpha/elf/start.S b/sysdeps/alpha/elf/start.S new file mode 100644 index 0000000000..c534d6987b --- /dev/null +++ b/sysdeps/alpha/elf/start.S @@ -0,0 +1,104 @@ +/* Startup code for Alpha/ELF. +Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. +Contributed by Richard Henderson + +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 + + .text + .globl __start + .align 3 + .ent __start, 0 +__start: + .frame fp, 0, zero + mov zero, fp + br gp, 1f +1: ldgp gp, 0(gp) + .prologue 1 + + /* Save v0. When starting a binary via the dynamic linker, s0 + contains the address of the shared library termination function, + which we will register below with atexit() to be called by exit(). + If we are statically linked, this will be NULL. */ + mov v0, s0 + + /* Do essential libc initialization (sp points to argc, argv, and envp) */ + jsr ra, __libc_init_first + ldgp gp, 0(ra) + + /* Now that we have the proper stack frame, register library termination + function, if there is any: */ + + beq s0, 1f + mov s0, a0 + jsr ra, atexit + ldgp gp, 0(ra) +1: + + /* Extract the arguments and environment as encoded on the stack. */ + ldl a0, 0(sp) /* get argc */ + lda a1, 8(sp) /* get argv */ + s8addq a0, a1, a2 /* get envp */ + addq a2, 8, a2 + stq a2, _environ + + mov a0, s0 /* tuck them away */ + mov a1, s1 + mov a2, s2 + +#ifdef HAVE_INITFINI + /* Call _init, the entry point to our own .init section. */ + jsr ra, _init + ldgp gp, 0(ra) + + /* Register our .fini section with atexit. */ + lda a0, _fini + jsr ra, atexit + ldgp gp, 0(ra) +#else + /* initialize constructors: */ + jsr ra, __main + ldgp gp, 0(ra) +#endif + mov s0, a0 + mov s1, a1 + mov s2, a2 + + /* Call the user's main and exit with its return value. */ + jsr ra, main + ldgp gp, 0(ra) + + mov v0, a0 + jsr ra, exit + + /* Die very horribly if exit returns. Call_pal hlt is callable from + kernel mode only; this will result in an illegal instruction trap. */ + call_pal 0 +END(__start) + +/* Define a symbol for the first piece of initialized data. */ + .data + .globl __data_start +__data_start: + .long 0 + +#ifdef __ELF__ + .size __data_start, 4 + .type __data_start, @object +#endif + +weak_alias(__data_start, data_start) diff --git a/sysdeps/generic/ustatbits.h b/sysdeps/generic/ustatbits.h new file mode 100644 index 0000000000..57bebdc66f --- /dev/null +++ b/sysdeps/generic/ustatbits.h @@ -0,0 +1,26 @@ +/* Generic declaration of ustat structure. +Copyright (C) 1994 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. */ + +struct ustat +{ + daddr_t f_tfree; /* total free */ + ino_t f_tinode; /* total inodes free */ + char f_fname[6]; /* filesystem name */ + char f_fpack[6]; /* filesystem pack name */ +}; diff --git a/sysdeps/mach/hurd/errnos.awk b/sysdeps/mach/hurd/errnos.awk index 5c88d11210..100e4b1114 100644 --- a/sysdeps/mach/hurd/errnos.awk +++ b/sysdeps/mach/hurd/errnos.awk @@ -54,15 +54,15 @@ errnoh == 2 && $1 == "@deftypevr" && $2 == "Macro" && $3 == "int" \ { ++errnoh; e = $4; next; } errnoh == 3 && $1 == "@comment" && $2 == "errno" { - errno = $3 + 0; - if (errno == 0) - next; - if (errno > maxerrno) maxerrno = errno; if (e == "EWOULDBLOCK") { print "#define EWOULDBLOCK EAGAIN /* Operation would block */"; next; } + errno = $3 + 0; + if (errno == 0) + next; + if (errno > maxerrno) maxerrno = errno; x = sprintf ("%-40s/*%s */", sprintf ("%-24s%s", "#define\t" e, "_HURD_ERRNO (" errno ")"), etext); diff --git a/sysdeps/mach/hurd/errnos.h b/sysdeps/mach/hurd/errnos.h index 2ec061596a..b14c98ab88 100644 --- a/sysdeps/mach/hurd/errnos.h +++ b/sysdeps/mach/hurd/errnos.h @@ -42,7 +42,7 @@ enum __error_t_codes ENOTBLK = _HURD_ERRNO (15), #define ENOTBLK _HURD_ERRNO (15)/* Block device required */ EBUSY = _HURD_ERRNO (16), -#define EBUSY _HURD_ERRNO (16)/* Device busy */ +#define EBUSY _HURD_ERRNO (16)/* Device or resource busy */ EEXIST = _HURD_ERRNO (17), #define EEXIST _HURD_ERRNO (17)/* File exists */ EXDEV = _HURD_ERRNO (18), @@ -103,11 +103,11 @@ enum __error_t_codes EPFNOSUPPORT = _HURD_ERRNO (46), #define EPFNOSUPPORT _HURD_ERRNO (46)/* Protocol family not supported */ EAFNOSUPPORT = _HURD_ERRNO (47), -#define EAFNOSUPPORT _HURD_ERRNO (47)/* Address family not supported by protocol family */ +#define EAFNOSUPPORT _HURD_ERRNO (47)/* Address family not supported by protocol */ EADDRINUSE = _HURD_ERRNO (48), #define EADDRINUSE _HURD_ERRNO (48)/* Address already in use */ EADDRNOTAVAIL = _HURD_ERRNO (49), -#define EADDRNOTAVAIL _HURD_ERRNO (49)/* Can't assign requested address */ +#define EADDRNOTAVAIL _HURD_ERRNO (49)/* Cannot assign requested address */ ENETDOWN = _HURD_ERRNO (50), #define ENETDOWN _HURD_ERRNO (50)/* Network is down */ ENETUNREACH = _HURD_ERRNO (51), @@ -121,15 +121,15 @@ enum __error_t_codes ENOBUFS = _HURD_ERRNO (55), #define ENOBUFS _HURD_ERRNO (55)/* No buffer space available */ EISCONN = _HURD_ERRNO (56), -#define EISCONN _HURD_ERRNO (56)/* Socket is already connected */ +#define EISCONN _HURD_ERRNO (56)/* Transport endpoint is already connected */ ENOTCONN = _HURD_ERRNO (57), -#define ENOTCONN _HURD_ERRNO (57)/* Socket is not connected */ +#define ENOTCONN _HURD_ERRNO (57)/* Transport endpoint is not connected */ EDESTADDRREQ = _HURD_ERRNO (39), #define EDESTADDRREQ _HURD_ERRNO (39)/* Destination address required */ ESHUTDOWN = _HURD_ERRNO (58), -#define ESHUTDOWN _HURD_ERRNO (58)/* Can't send after socket shutdown */ +#define ESHUTDOWN _HURD_ERRNO (58)/* Cannot send after transport endpoint shutdown */ ETOOMANYREFS = _HURD_ERRNO (59), -#define ETOOMANYREFS _HURD_ERRNO (59)/* Too many references: can't splice */ +#define ETOOMANYREFS _HURD_ERRNO (59)/* Too many references: cannot splice */ ETIMEDOUT = _HURD_ERRNO (60), #define ETIMEDOUT _HURD_ERRNO (60)/* Connection timed out */ ECONNREFUSED = _HURD_ERRNO (61), @@ -153,7 +153,7 @@ enum __error_t_codes ESTALE = _HURD_ERRNO (70), #define ESTALE _HURD_ERRNO (70)/* Stale NFS file handle */ EREMOTE = _HURD_ERRNO (71), -#define EREMOTE _HURD_ERRNO (71)/* Too many levels of remote in path */ +#define EREMOTE _HURD_ERRNO (71)/* Object is remote */ EBADRPC = _HURD_ERRNO (72), #define EBADRPC _HURD_ERRNO (72)/* RPC struct is bad */ ERPCMISMATCH = _HURD_ERRNO (73), @@ -174,6 +174,8 @@ enum __error_t_codes #define ENEEDAUTH _HURD_ERRNO (81)/* Need authenticator */ ENOSYS = _HURD_ERRNO (78), #define ENOSYS _HURD_ERRNO (78)/* Function not implemented */ + EILSEQ = _HURD_ERRNO (106), +#define EILSEQ _HURD_ERRNO (106)/* Invalid or incomplete multibyte or wide character */ EBACKGROUND = _HURD_ERRNO (100), #define EBACKGROUND _HURD_ERRNO (100)/* Inappropriate operation for background process */ EDIED = _HURD_ERRNO (101), @@ -240,6 +242,8 @@ enum __error_t_codes EKERN_RIGHT_EXISTS = 21, EKERN_INVALID_HOST = 22, EKERN_MEMORY_PRESENT = 23, + EKERN_WRITE_PROTECTION_FAILURE = 24, + EKERN_TERMINATED = 26, /* Errors from . */ EMIG_TYPE_ERROR = -300, /* client type check failure */ @@ -267,7 +271,7 @@ enum __error_t_codes }; -#define _HURD_ERRNOS 106 +#define _HURD_ERRNOS 107 /* User-visible type of error codes. It is ok to use `int' or `kern_return_t' for these, but with `error_t' the debugger prints diff --git a/sysdeps/unix/alpha/sysdep.S b/sysdeps/unix/alpha/sysdep.S index 6540b80af6..2d05305ce0 100644 --- a/sysdeps/unix/alpha/sysdep.S +++ b/sysdeps/unix/alpha/sysdep.S @@ -20,11 +20,15 @@ Cambridge, MA 02139, USA. */ #define _ERRNO_H #include - .comm errno, 4 + .section .bss + .globl errno +errno: .space 4 #ifdef __ELF__ - .type errno, @object + .type errno, @object + .size errno, 4 #endif + .text LEAF(__syscall_error, 0) ldgp gp, 0(t12) .prologue 1 diff --git a/sysdeps/unix/sysv/linux/alpha/start.S b/sysdeps/unix/sysv/linux/alpha/start.S deleted file mode 100644 index bffa913538..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/start.S +++ /dev/null @@ -1,103 +0,0 @@ -/* Copyright (C) 1993, 1995, 1996 Free Software Foundation, Inc. - Contributed by Richard Henderson - -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 - - .text - .globl __start - .align 3 - .ent __start, 0 -__start: - .frame fp, 0, zero - mov zero, fp - br gp, 1f -1: ldgp gp, 0(gp) - .prologue 1 - - /* Save v0. When starting a binary via the dynamic linker, s0 - contains the address of the shared library termination function, - which we will register below with atexit() to be called by exit(). - If we are statically linked, this will be NULL. */ - mov v0, s0 - - /* Do essential libc initialization (sp points to argc, argv, and envp) */ - jsr ra, __libc_init_first - ldgp gp, 0(ra) - - /* Now that we have the proper stack frame, register library termination - function, if there is any: */ - - beq s0, 1f - mov s0, a0 - jsr ra, atexit - ldgp gp, 0(ra) -1: - - /* Extract the arguments and environment as encoded on the stack. */ - ldl a0, 0(sp) /* get argc */ - lda a1, 8(sp) /* get argv */ - s8addq a0, a1, a2 /* get envp */ - addq a2, 8, a2 - stq a2, _environ - - mov a0, s0 /* tuck them away */ - mov a1, s1 - mov a2, s2 - -#ifdef HAVE_INITFINI - /* Call _init, the entry point to our own .init section. */ - jsr ra, _init - ldgp gp, 0(ra) - - /* Register our .fini section with atexit. */ - lda a0, _fini - jsr ra, atexit - ldgp gp, 0(ra) -#else - /* initialize constructors: */ - jsr ra, __main - ldgp gp, 0(ra) -#endif - mov s0, a0 - mov s1, a1 - mov s2, a2 - - /* Call the user's main and exit with its return value. */ - jsr ra, main - ldgp gp, 0(ra) - - mov v0, a0 - jsr ra, exit - - /* Die very horribly if exit returns. Call_pal hlt is callable from - kernel mode only; this will result in an illegal instruction trap. */ - call_pal 0 -END(__start) - -/* Define a symbol for the first piece of initialized data. */ - .data - .globl __data_start -__data_start: - .long 0 - -#ifdef __ELF__ - .size __data_start, 4 - .type __data_start, @object -#endif - -weak_alias(__data_start, data_start) diff --git a/sysdeps/unix/sysv/linux/netinet/in.h b/sysdeps/unix/sysv/linux/netinet/in.h index ebe6b4cf58..a0b8714fd6 100644 --- a/sysdeps/unix/sysv/linux/netinet/in.h +++ b/sysdeps/unix/sysv/linux/netinet/in.h @@ -21,23 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include - - -/* Standard well-defined IP protocols. */ -enum - { - IPPROTO_IP = 0, /* Dummy protocol for TCP. */ - IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */ - IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */ - IPPROTO_TCP = 6, /* Transmission Control Protocol. */ - IPPROTO_EGP = 8, /* Exterior Gateway Protocol. */ - IPPROTO_PUP = 12, /* PUP protocol. */ - IPPROTO_UDP = 17, /* User Datagram Protocol. */ - IPPROTO_IDP = 22, /* XNS IDP protocol. */ - - IPPROTO_RAW = 255, /* Raw IP packets. */ - IPPROTO_MAX - }; +#include /* Standard well-known ports. */ enum @@ -85,75 +69,9 @@ enum #define IMPLINK_LOWEXPER 156 #define IMPLINK_HIGHEXPER 158 - -/* Internet address. */ -struct in_addr - { - unsigned int s_addr; - }; - - -/* Definitions of the bits in an Internet address integer. - - On subnets, host and network parts are found according to - the subnet mask, not these masks. */ - -#define IN_CLASSA(a) ((((unsigned) (a)) & 0x80000000) == 0) -#define IN_CLASSA_NET 0xff000000 -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) -#define IN_CLASSA_MAX 128 - -#define IN_CLASSB(a) ((((unsigned) (a)) & 0xc0000000) == 0x80000000) -#define IN_CLASSB_NET 0xffff0000 -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) -#define IN_CLASSB_MAX 65536 - -#define IN_CLASSC(a) ((((unsigned) (a)) & 0xc0000000) == 0xc0000000) -#define IN_CLASSC_NET 0xffffff00 -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) - -#define IN_CLASSD(a) ((((unsigned) (a)) & 0xf0000000) == 0xe0000000) -#define IN_MULTICAST(a) IN_CLASSD(a) - -#define IN_EXPERIMENTAL(a) ((((unsigned) (a)) & 0xe0000000) == 0xe0000000) -#define IN_BADCLASS(a) ((((unsigned) (a)) & 0xf0000000) == 0xf0000000) - -/* Address to accept any incoming messages. */ -#define INADDR_ANY ((unsigned) 0x00000000) -/* Address to send to all hosts. */ -#define INADDR_BROADCAST ((unsigned) 0xffffffff) -/* Address indicating an error return. */ -#define INADDR_NONE 0xffffffff - -/* Network number for local host loopback. */ -#define IN_LOOPBACKNET 127 -/* Address to loopback in software to local host. */ -#ifndef INADDR_LOOPBACK -#define INADDR_LOOPBACK 0x7f000001 /* Internet address 127.0.0.1. */ -#endif - - /* Get the definition of the macro to define the common sockaddr members. */ #include - -/* Structure describing an Internet socket address. */ -struct sockaddr_in - { - __SOCKADDR_COMMON (sin_); - unsigned short int sin_port; /* Port number. */ - struct in_addr sin_addr; /* Internet address. */ - - /* Pad to size of `struct sockaddr'. */ - unsigned char sin_zero[sizeof(struct sockaddr) - - __SOCKADDR_COMMON_SIZE - - sizeof(unsigned short int) - - sizeof(struct in_addr)]; - }; - /* Structure used to describe IP options for IP_OPTIONS and IP_RETOPTS. The `ip_dst' field is used for the first-hop gateway when using a source route (this gets put into the header proper). */ @@ -163,13 +81,6 @@ struct ip_opts char ip_opts[40]; /* Actually variable in size. */ }; -/* Structure used for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP. */ -struct ip_mreq -{ - struct in_addr imr_multiaddr; /* IP multicast address of group */ - struct in_addr imr_interface; /* local IP address of interface */ -}; - /* Functions to convert between host and network byte order. */ extern unsigned long int ntohl __P ((unsigned long int)); @@ -188,4 +99,11 @@ extern unsigned short int htons __P ((unsigned short int)); #define htons(x) (x) #endif +__BEGIN_DECLS + +/* Bind socket FD to a privileged IP address SIN. */ +extern int bindresvport __P((int __fd, struct sockaddr_in * __sin)); + +__END_DECLS + #endif /* netinet/in.h */ diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index da10170bf5..d9dd3d100a 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -18,6 +18,7 @@ init_module EXTRA init_module 5 init_module ioperm - ioperm 3 ioperm iopl - iopl 1 iopl ipc msgget ipc 5 __ipc +klogctl EXTRA syslog 3 klogctl llseek EXTRA _llseek 5 llseek mlock - mlock 2 __mlock mlock mlockall - mlockall 1 __mlockall mlockall @@ -49,7 +50,7 @@ sigprocmask - sigprocmask 3 __sigprocmask sigprocmask s_sysctl sysctl _sysctl 1 __syscall__sysctl sysinfo EXTRA sysinfo 1 sysinfo swapon - swapon 2 swapon -klogctl EXTRA syslog 3 klogctl umount EXTRA umount 1 __umount umount uselib EXTRA uselib 1 uselib +ustat - ustat 2 __ustat ustat wait4 - wait4 4 __wait4 wait4 diff --git a/sysdeps/unix/sysv/linux/ustatbits.h b/sysdeps/unix/sysv/linux/ustatbits.h new file mode 100644 index 0000000000..96580031c7 --- /dev/null +++ b/sysdeps/unix/sysv/linux/ustatbits.h @@ -0,0 +1,2 @@ +/* struct ustat is currently in . Good or bad? */ +#include -- cgit 1.4.1