This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Remove __FAVOR_BSD


Joseph,

I'm just looking at documenting some of the changes here in the man
pages, and I have a few questions.

First of all, would this revised test for the feature_test_macros(7)
page be correct:

       _BSD_SOURCE
              Defining this macro with any value causes  header  files
              to expose BSD-derived definitions.  In glibc versions up
              to and including 2.18, defining this macro  also  causes
              BSD definitions to be preferred in some situations where
              standards conflict, unless one or more of  _SVID_SOURCE,
              _POSIX_SOURCE,      _POSIX_C_SOURCE,      _XOPEN_SOURCE,
              _XOPEN_SOURCE_EXTENDED, or _GNU_SOURCE  is  defined,  in
              which  case BSD definitions are disfavored.  Since glibc
              2.19, _BSD_SOURCE no longer causes BSD definitions to be
              preferred in case of conflicts.

On Wed, Dec 18, 2013 at 7:10 AM, Joseph S. Myers
<joseph@codesourcery.com> wrote:
> On Tue, 17 Dec 2013, Roland McGrath wrote:
>
> diff --git a/posix/unistd.h b/posix/unistd.h
> index d4eeaf1..f37dce7 100644
> --- a/posix/unistd.h
> +++ b/posix/unistd.h
> @@ -630,17 +630,8 @@ extern __pid_t getpid (void) __THROW;
>  /* Get the process ID of the calling process's parent.  */
>  extern __pid_t getppid (void) __THROW;
>
> -/* Get the process group ID of the calling process.
> -   This function is different on old BSD. */
> -#ifndef __FAVOR_BSD
> +/* Get the process group ID of the calling process.  */
>  extern __pid_t getpgrp (void) __THROW;
> -#else
> -# ifdef __REDIRECT_NTH
> -extern __pid_t __REDIRECT_NTH (getpgrp, (__pid_t __pid), __getpgid);
> -# else
> -#  define getpgrp __getpgid
> -# endif
> -#endif
>
>  /* Get the process group ID of process PID.  */
>  extern __pid_t __getpgid (__pid_t __pid) __THROW;
> @@ -662,25 +653,12 @@ extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
>
>     New programs should always use `setpgid' instead.
>
> -   The default in GNU is to provide the System V function.  The BSD
> -   function is available under -D_BSD_SOURCE.  */
> -
> -# ifndef __FAVOR_BSD
> +   GNU provides the POSIX.1 function.  */
>
>  /* Set the process group ID of the calling process to its own PID.
>     This is exactly the same as `setpgid (0, 0)'.  */
>  extern int setpgrp (void) __THROW;
>
> -# else
> -
> -/* Another name for `setpgid' (above).  */
> -#  ifdef __REDIRECT_NTH
> -extern int __REDIRECT_NTH (setpgrp, (__pid_t __pid, __pid_t __pgrp), setpgid);
> -#  else
> -#   define setpgrp setpgid
> -#  endif
> -
> -# endif        /* Favor BSD.  */
>  #endif /* Use SVID or BSD.  */

What do (admittedly, strange) programs that employ the BSD getpgrp()
and setpgrp() interfaces now do? It looks as though they'll require
source code changes to call a different API, right?

> -/* The `sigpause' function has two different interfaces.  The original
> -   BSD definition defines the argument as a mask of the signal, while
> -   the more modern interface in X/Open defines it as the signal
> -   number.  We go with the BSD version unless the user explicitly
> -   selects the X/Open version.
> +/* The `sigpause' function in X/Open defines the argument as the
> +   signal number.  This requires redirecting to another function
> +   because the default version in glibc uses an old BSD interface.
>
>     This function is a cancellation point and therefore not marked with
>     __THROW.  */
>  extern int __sigpause (int __sig_or_mask, int __is_sig);
>
> -#ifdef __FAVOR_BSD
> -/* Set the mask of blocked signals to MASK,
> -   wait for a signal to arrive, and then restore the mask.  */
> -extern int sigpause (int __mask) __THROW __attribute_deprecated__;
> -#else
> -# ifdef __USE_XOPEN
> -#  ifdef __GNUC__
> +#ifdef __USE_XOPEN
> +# ifdef __GNUC__
>  extern int sigpause (int __sig) __asm__ ("__xpg_sigpause");
> -#  else
> +# else
>  /* Remove a signal from the signal mask and suspend the process.  */
> -#   define sigpause(sig) __sigpause ((sig), 1)
> -#  endif
> +#  define sigpause(sig) __sigpause ((sig), 1)
>  # endif
>  #endif

Same question for sigpause().

Thanks,

Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]