Print this page
3665 Implement O_CLOEXEC as an open() flag
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/truss/codes.c
          +++ new/usr/src/cmd/truss/codes.c
↓ open down ↓ 16 lines elided ↑ open up ↑
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
  24   24   * Copyright (c) 2012 by Delphix. All rights reserved.
  25   25   * Copyright 2011 Nexenta Systems, Inc. All rights reserved.
  26   26   * Copyright (c) 2012, Joyent, Inc. All rights reserved.
       27 + * Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved.
  27   28   */
  28   29  
  29   30  /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
  30   31  /*        All Rights Reserved   */
  31   32  
  32   33  
  33   34  #include <stdio.h>
  34   35  #include <stdlib.h>
  35   36  #include <unistd.h>
  36   37  #include <sys/types.h>
↓ open down ↓ 1874 lines elided ↑ open up ↑
1911 1912          const char *str = NULL;
1912 1913  
1913 1914          if (code >= PATHCONFMIN && code <= PATHCONFMAX)
1914 1915                  str = PATHCONFname[code-PATHCONFMIN];
1915 1916          return (str);
1916 1917  }
1917 1918  
1918 1919  #define ALL_O_FLAGS \
1919 1920          (O_NDELAY|O_APPEND|O_SYNC|O_DSYNC|O_NONBLOCK|O_CREAT|O_TRUNC\
1920 1921          |O_EXCL|O_NOCTTY|O_LARGEFILE|O_RSYNC|O_XATTR|O_NOFOLLOW|O_NOLINKS\
1921      -        |FXATTRDIROPEN)
     1922 +        |O_CLOEXEC|FXATTRDIROPEN)
1922 1923  
1923 1924  const char *
1924 1925  openarg(private_t *pri, int arg)
1925 1926  {
1926 1927          char *str = pri->code_buf;
1927 1928  
1928 1929          if ((arg & ~(O_ACCMODE | ALL_O_FLAGS)) != 0)
1929 1930                  return (NULL);
1930 1931  
1931 1932          switch (arg & O_ACCMODE) {
↓ open down ↓ 37 lines elided ↑ open up ↑
1969 1970          if (arg & O_LARGEFILE)
1970 1971                  (void) strlcat(str, "|O_LARGEFILE", sizeof (pri->code_buf));
1971 1972          if (arg & O_RSYNC)
1972 1973                  (void) strlcat(str, "|O_RSYNC", sizeof (pri->code_buf));
1973 1974          if (arg & O_XATTR)
1974 1975                  (void) strlcat(str, "|O_XATTR", sizeof (pri->code_buf));
1975 1976          if (arg & O_NOFOLLOW)
1976 1977                  (void) strlcat(str, "|O_NOFOLLOW", sizeof (pri->code_buf));
1977 1978          if (arg & O_NOLINKS)
1978 1979                  (void) strlcat(str, "|O_NOLINKS", sizeof (pri->code_buf));
     1980 +        if (arg & O_CLOEXEC)
     1981 +                (void) strlcat(str, "|O_CLOEXEC", sizeof (pri->code_buf));
1979 1982          if (arg & FXATTRDIROPEN)
1980 1983                  (void) strlcat(str, "|FXATTRDIROPEN", sizeof (pri->code_buf));
1981 1984  
1982 1985          return ((const char *)str);
1983 1986  }
1984 1987  
1985 1988  const char *
1986 1989  whencearg(int arg)
1987 1990  {
1988 1991          const char *str = NULL;
↓ open down ↓ 379 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX