From: Roland McGrath Date: Fri, 16 Feb 1996 02:19:52 +0000 (+0000) Subject: Thu Feb 15 13:57:08 1996 Roland McGrath X-Git-Tag: upstream/2.30~29657 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e3db9cd59f37a5a591ac341833508b4ba6b4f8d;p=external%2Fglibc.git Thu Feb 15 13:57:08 1996 Roland McGrath * mach/Machrules: Use -include for $(*.ir). * hurd/hurd/ioctl.h (_HURD_HANDLE_IOCTLS): Mask off type bits in request values. * sysdeps/mach/hurd/ioctls.h (_IOC_NOTYPE): New macro. (_IOT_COUNT2): Field is 3 bits, not 2. * sysdeps/mach/hurd/ioctl.c: Ignore handler if it fails with ENOTTY. * hurd/hurdioctl.c (_hurd_lookup_ioctl_handler): Mask off type bits before looking up handler. (fioctl): Use __hurd_dfail. (fioctl, fioclex): Use ENOTTY for bogus request instead of EGRATUITOUS. Wed Feb 14 00:21:17 1996 David Mosberger-Tang * sysdeps/alpha/memchr.c (memchr): loop searching for matching character bailed out one too early; changed constant 6 to 7 to fix this. --- diff --git a/ChangeLog b/ChangeLog index 5b71c40..d5b8122 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Thu Feb 15 13:57:08 1996 Roland McGrath + + * mach/Machrules: Use -include for $(*.ir). + + * hurd/hurd/ioctl.h (_HURD_HANDLE_IOCTLS): Mask off type bits in + request values. + * sysdeps/mach/hurd/ioctls.h (_IOC_NOTYPE): New macro. + (_IOT_COUNT2): Field is 3 bits, not 2. + * sysdeps/mach/hurd/ioctl.c: Ignore handler if it fails with ENOTTY. + * hurd/hurdioctl.c (_hurd_lookup_ioctl_handler): Mask off type + bits before looking up handler. + (fioctl): Use __hurd_dfail. + (fioctl, fioclex): Use ENOTTY for bogus request instead of EGRATUITOUS. + +Wed Feb 14 00:21:17 1996 David Mosberger-Tang + + * sysdeps/alpha/memchr.c (memchr): loop searching for matching + character bailed out one too early; changed constant 6 to + 7 to fix this. + Wed Feb 14 01:08:58 1996 Roland McGrath * posix/execvp.c: When executing shell on script, first arg is diff --git a/hurd/hurd/ioctl.h b/hurd/hurd/ioctl.h index 518ef51..431b3be 100644 --- a/hurd/hurd/ioctl.h +++ b/hurd/hurd/ioctl.h @@ -1,5 +1,5 @@ /* User-registered handlers for specific `ioctl' requests. -Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. +Copyright (C) 1993, 1994, 1995, 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 @@ -22,6 +22,7 @@ Cambridge, MA 02139, USA. */ #define __need___va_list #include +#include /* Type of handler function, called like ioctl to do its entire job. */ @@ -30,7 +31,8 @@ typedef int (*ioctl_handler_t) (int fd, int request, void *arg); /* Structure that records an ioctl handler. */ struct ioctl_handler { - int first_request, last_request; /* Range of handled request values. */ + /* Range of handled _IOC_NOTYPE (REQUEST) values. */ + int first_request, last_request; /* Handler function, called like ioctl to do its entire job. */ ioctl_handler_t handler; @@ -54,7 +56,8 @@ extern int hurd_register_ioctl_handler (int first_request, int last_request, #define _HURD_HANDLE_IOCTLS(handler, first, last) \ static const struct ioctl_handler handler##_ioctl_handler \ __attribute__ ((__unused__)) = \ - { (first), (last), (int (*) (int, int, void *)) (handler), NULL }; \ + { _IOC_NOTYPE (first), _IOC_NOTYPE (last), \ + (int (*) (int, int, void *)) (handler), NULL }; \ text_set_element (_hurd_ioctl_handler_lists, ##handler##_ioctl_handler) /* Define a library-internal handler for a single ioctl command. */ diff --git a/hurd/hurdioctl.c b/hurd/hurdioctl.c index 30cce1c..bd91389 100644 --- a/hurd/hurdioctl.c +++ b/hurd/hurdioctl.c @@ -36,6 +36,10 @@ _hurd_lookup_ioctl_handler (int request) void *const *ptr; const struct ioctl_handler *h; + /* Mask off the type bits, so that we see requests in a single group as a + contiguous block of values. */ + request = _IOC_NOTYPE (request); + for (ptr = symbol_set_first_element (_hurd_ioctl_handler_lists); !symbol_set_end_p (_hurd_ioctl_handler_lists, ptr); ++ptr) @@ -62,7 +66,7 @@ fioctl (int fd, switch (request) { default: - err = EGRATUITOUS; + err = ENOTTY; break; case FIONREAD: @@ -97,7 +101,7 @@ fioctl (int fd, break; } - return err ? __hurd_fail (err) : 0; + return err ? __hurd_dfail (fd, err) : 0; } _HURD_HANDLE_IOCTLS (fioctl, FIOGETOWN, FIONREAD); @@ -112,7 +116,7 @@ fioclex (int fd, switch (request) { default: - return __hurd_fail (EGRATUITOUS); + return __hurd_fail (ENOTTY); case FIOCLEX: flag = FD_CLOEXEC; break; @@ -123,7 +127,7 @@ fioclex (int fd, return __fcntl (fd, F_SETFD, flag); } -_HURD_HANDLE_IOCTLS (fioclex, FIOCLEX, FIONCLEX); +_HURD_HANDLE_IOCTL (fioclex, FIOCLEX, FIONCLEX); #include #include diff --git a/mach/Machrules b/mach/Machrules index d4e9ea0..ef5809b 100644 --- a/mach/Machrules +++ b/mach/Machrules @@ -60,7 +60,7 @@ ifdef user-interfaces *.ir := $(addprefix $(objpfx),$(foreach if,$(user-interfaces),$(if).ir)) ifndef no_deps ifndef inhibit_interface_rules -include $(*.ir) +-include $(*.ir) endif endif ifneq "$(*.ir)" "$(wildcard $(*.ir))" diff --git a/sysdeps/alpha/memchr.c b/sysdeps/alpha/memchr.c index 11ff542..a911302 100644 --- a/sysdeps/alpha/memchr.c +++ b/sysdeps/alpha/memchr.c @@ -72,7 +72,7 @@ memchr (const void *s, int c, size_t n) unsigned char *cp = (unsigned char *) (longword_ptr - 1); int i; - for (i = 0; i < 6; i++) + for (i = 0; i < 7; i++) if (cp[i] == c) return &cp[i]; return &cp[7]; diff --git a/sysdeps/mach/hurd/errnos.h b/sysdeps/mach/hurd/errnos.h index cd8e51e..acc9951 100644 --- a/sysdeps/mach/hurd/errnos.h +++ b/sysdeps/mach/hurd/errnos.h @@ -1,4 +1,4 @@ -/* This file generated by gawk ../manual/errno.texi ../../mach/mach/message.h ../../mach/mach/kern_return.h ../../mach/mach/mig_errors.h ../../mach/device/device_types.h. */ +/* This file generated by gawk ../manual/errno.texi /gd4/gnu/mach/mach/message.h /gd4/gnu/mach/mach/kern_return.h /gd4/gnu/mach/mach/mig_errors.h /gd4/gnu/mach/device/device_types.h. */ /* The Hurd uses Mach error system 0x10, currently only subsystem 0. */ #ifndef _HURD_ERRNO diff --git a/sysdeps/mach/hurd/ioctl.c b/sysdeps/mach/hurd/ioctl.c index acc34fa..24bfbed 100644 --- a/sysdeps/mach/hurd/ioctl.c +++ b/sysdeps/mach/hurd/ioctl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1993, 1994, 1995, 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 @@ -129,8 +129,17 @@ DEFUN(__ioctl, (fd, request), /* Check for a registered handler for REQUEST. */ ioctl_handler_t handler = _hurd_lookup_ioctl_handler (request); if (handler) - /* This handler groks REQUEST. Se lo puntamonos. */ - return (*handler) (fd, request, arg); + { + /* This handler groks REQUEST. Se lo puntamonos. */ + int save = errno; + int result = (*handler) (fd, request, arg); + if (result != -1 || errno != ENOTTY) + return result; + + /* The handler doesn't really grok this one. + Try the normal RPC translation. */ + errno = save; + } } /* Compute the Mach message ID for the RPC from the group and command diff --git a/sysdeps/mach/hurd/ioctls.h b/sysdeps/mach/hurd/ioctls.h index af44873..8036fd7 100644 --- a/sysdeps/mach/hurd/ioctls.h +++ b/sysdeps/mach/hurd/ioctls.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1992, 1993 Free Software Foundation, Inc. +/* Copyright (C) 1992, 1993, 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 @@ -21,16 +21,20 @@ Cambridge, MA 02139, USA. */ #define _IOCTLS_H 1 /* Hurd ioctl request are made up of several fields: - bits 31-30: inout direction (enum __ioctl_dir) - bits 29-12: type encoding as follows; zero count indicates omitted datum - 29-28: datum #0 type (enum __ioctl_datum) - 27-26: datum #1 type (enum __ioctl_datum) - 25-24: datum #2 type (enum __ioctl_datum) - 23-19: datum #0 count [0..31] - 18-14: datum #1 count [0..31] - 13-12: datum #2 count [0..3] - bits 11- 8: group (letter - 'f': ['f'..'v']) - bits 7- 0: command [0..127] + + 10987654321098765432109876543210 + IOt0t1t2cc0c0cc1c1cc2ggggccccccc + + bits [31,30]: inout direction (enum __ioctl_dir) + bits [29,11]: type encoding as follows; zero count indicates omitted datum + [29,28]: datum #0 type (enum __ioctl_datum) + [27,26]: datum #1 type (enum __ioctl_datum) + [24,25]: datum #2 type (enum __ioctl_datum) + [23,19]: datum #0 count [0,31] + [18,14]: datum #1 count [0,31] + [13,11]: datum #2 count [0,3] + bits [07,10]: group (letter - 'f': ['f','v']) + bits [00,06]: command [0,127] The following macros construct and dissect these fields. */ @@ -50,9 +54,10 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32 }; /* Dissect an ioctl into its component fields. */ #define _IOC_INOUT(request) (((unsigned int) (request) >> 30) & IOC_INOUT) -#define _IOC_GROUP(request) ('f' + (((unsigned int) (request) >> 7) & 15)) +#define _IOC_GROUP(request) ('f' + (((unsigned int) (request) >> 7) & 0xf)) #define _IOC_COMMAND(request) ((unsigned int) (request) & 0x7f) #define _IOC_TYPE(request) (((unsigned int) (request) >> 11) & 0x7ffff) +#define _IOC_NOTYPE(request) ((unsigned int) (request) & 0x3ff) /* Construct a type information field from the broken-out type and count fields. */ @@ -65,7 +70,7 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32 }; #define _IOT_TYPE2(type) (((unsigned int) (type) >> 13) & 3) #define _IOT_COUNT0(type) (((unsigned int) (type) >> 8) & 0x1f) #define _IOT_COUNT1(type) (((unsigned int) (type) >> 3) & 0x1f) -#define _IOT_COUNT2(type) (((unsigned int) (type) >> 0) & 3) +#define _IOT_COUNT2(type) (((unsigned int) (type) >> 0) & 7) /* Construct an ioctl from all the broken-out fields. */ #define _IOCT(inout, group, num, t0, c0, t1, c1, t2, c2) \ diff --git a/sysdeps/unix/sysv/sysv4/Makefile b/sysdeps/unix/sysv/sysv4/Makefile index 0c149da..320e99b 100644 --- a/sysdeps/unix/sysv/sysv4/Makefile +++ b/sysdeps/unix/sysv/sysv4/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1992, 1993, 1995 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1995, 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 @@ -22,13 +22,6 @@ sysdep_routines := $(sysdep_routines) sysconfig pgrpsys __waitid endif - -ifeq ($(subdir),signal) - -sysdep_routines := $(sysdep_routines) sys-sig - -endif - ifeq ($(subdir),misc) sysdep_routines := $(sysdep_routines) sysinfo