[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Section 9.1.16 and related (API and ABI differences, &c)



As discussed in the face to face meeting yesterday, here are my notes
on some of the ABI-only functions that we need descriptions for.

This is mostly updated for 0.1 but I wanted to make sure to send it
out now rather than delaying to try to fix the last 2 or 3 items.

               Jim Kingdon's addendum to the Linux Standard Base
                                       
   For more of an introduction, see my [1]linux standards page.
   
   Disclaimer: this is my own unofficial addendum to the [2]LSB draft (3
   Oct 1998). It is not official in any way. Updated for LSB 0.1 (I
   think), Dec 1999.
   
9.1.16. Mangled Symbols

   Add:
/* This function, when passed a string containing an asserted
   expression, a filename, and a line number, prints a message
   on the standard error stream such as:
        a.c:10: foobar: Assertion `a == b' failed.
   It then aborts program execution via a call to `abort'.  The
   exact form of the message is up to the implementation.

   If FUNCTION is NULL, then omit information about the function.
   FILE, LINE, and ASSERTION must be non-NULL.  */

void
__assert_fail (const char *assertion, const char *file, unsigned int line,
               const char *function)

Chapter 6: Libraries: arpa/inet.h (?? - check 0.1?)

   Add:
  unsigned short int htons(unsigned short int hostshort);
  unsigned short int ntohs(unsigned short int netshort);

  The  htons() function converts the short integer hostshort
  from host byte order to network byte order.

  The  ntohs()  function converts the short integer netshort
  from network byte order to host byte order.

   Editorial note: htons and ntohs are mentioned in the [3]Library
   Reference.
   
9.1.17. Leftovers

   Add:
/* Return the address of the errno variable.  */

int *__errno_location (void);

glibc: intl.h (?? - check 0.1?)

   Add __dcgettext with same behavior as dcgettext.
   
glibc: netdb.h (?? - check 0.1?)

   Add:
/* Return the address of the h_errno variable, where h_errno
   is as specified in the Single Unix Specification.  */

extern int *__h_errno_location (void);

   Note that h_errno is not present in the binary standard, only the
   source standard.
   
glibc: sigjmp.h (?? - check 0.1?)

   Remove setjmp, _setjmp, and sigsetjmp. Add __sigsetjmp (with behavior
   identical to POSIX sigsetjmp). FIXME: need to specify (for each
   processor) the format of the jmp_buf and sigjmp_buf (which are the
   same as each other for glibc). Q: Or just the size? (setjmp and
   longjmp are in "9.1.17 Leftovers" in 0.1).
   
glibc: stdlib.h (?? - check 0.1?)

   Add:
/* __GROUP must be 0 or the behavior is undefined.  Otherwise the same
   as strtod (__nptr, __endptr).  */
double __strtod_internal (const char *__nptr,
                          char **__endptr, int __group);
/* __GROUP must be 0 or the behavior is undefined.  Otherwise the same
   as strtof (__nptr, __endptr).  FIXME: we also need to define strtof;
   I don't think it is in ANSI C.  */
float __strtof_internal (const char *__nptr, char **__endptr,
                         int __group);
/* __GROUP must be 0 or the behavior is undefined.  Otherwise the same
   as strtol (__nptr, __endptr, __base).  */
long int __strtol_internal (const char *__nptr, char **__endptr,
                            int __base, int __group);
/* __GROUP must be 0 or the behavior is undefined.  Otherwise the same
   as strtoul (__nptr, __endptr, __base).  */
unsigned long int __strtoul_internal (const char *__nptr,
                                      char **__endptr, int __base,
                                      int __group));

/* FIXME: Should, perhaps, also be including the functions for
   "long long int" and "long double".  */

glibc: strings.h (?? - check 0.1?)

   Specify index, rindex, bcopy, bcmp, and bzero, strcasecmp,
   strncasecmp, and ffs as in Single Unix Specification.
   
   Rationale: Although strchr, strrchr, memmove, memcmp, and memset have
   been preferred over index, rindex, bcopy, bcmp, and bzero in standards
   for over a decade now, the Single Unix Specification also includes the
   latter functions without marking them as legacy, and my testing did
   find linux applications which used them. Therefore, I am reluctantly
   including them.
   
   The same reluctance does not apply to strcasecmp, strncasecmp, and
   ffs. Whether these functions are widely used by linux applications I
   don't know, but following the Single Unix Specification seems
   sensible.
   
   Many linuxes provide __strcasecmp and __strncasecmp but I don't see
   why an application would need them.
   
9.1.16 Mangled Symbols

   Add the following:
/* VERSION must be 3 or else the behavior is undefined.  Otherwise the
   behavior is that of stat (__path, __statbuf) as specified by POSIX.
   FIXME: are we clear on specifying the correct struct stat, rather than
   the kernel one?  */
int __xstat (int version, char *__path, struct stat *__statbuf);

/* VERSION must be 3 or else the behavior is undefined.  Otherwise the
   behavior is that of lstat (__path, __statbuf) as specified by POSIX.
   FIXME: are we clear on specifying the correct struct stat, rather than
   the kernel one?  */
int __lxstat (int version, char *__path, struct stat *__statbuf);

/* VERSION must be 3 or else the behavior is undefined.  Otherwise the
   behavior is that of fstat (__fd, __statbuf) as specified by POSIX.
   FIXME: are we clear on specifying the correct struct stat, rather than
   the kernel one?  */
int __fxstat (version, int __fd, struct stat *__statbuf);

/* VERSION must be 1 or else the behavior is undefined.  Otherwise the
   behavior is that of mknod (__path, __mode, *__dev) as specified by
   POSIX.  FIXME: what is the format of dev_t?  Not the same as the
   argument that the kernel syscall uses.  */
int __xmknod (version, char *__path, mode_t __mode, dev_t *__dev);

9.9.1. Dynamic loader

   FIXME: Need to specify values for RTLD_* constants.
   
Uncategorized (but somewhere in the "libc" category)

   Add:
/* The application, upon starting, must call __libc_init_first__ and
   __gmon_start__, before calling other functions in libc (FIXME: I
   assume we should be specifying whether __libc_init_first__ or
   __gmon_start__ must be called first.  But which order is it?  Needs
   investigation).  */
void __gmon_start__ (void);
/* ARGC, ARGV, and ENVP must be the arguments that were passed to
   the application by (FIXME: what does the OS pass to the application
   and how?).  */
void __libc_init_first (int argc, char **argv, char **envp);

. . .

     _________________________________________________________________
   
   This page is part of [4]Jim Kingdon's personal pages.

References

   1. file://localhost/home/kingdon/topersonal/public_html/linux.html
   2. http://www.linuxbase.org/spec/
   3. http://www.linuxbase.org/libref.html
   4. http://www.panix.com/~kingdon/


Reply to: