)]}'
{
  "commit": "22d2b35b200f76085c16a2e14ca30b58510fcbe7",
  "tree": "669ce98845b73c0a2e12b37beaa24aed8481e1d2",
  "parents": [
    "18796aa00243a594a2bd6733f1360aa38c3cd8f4"
  ],
  "author": {
    "name": "Ulrich Drepper",
    "email": "drepper@redhat.com",
    "time": "Tue Oct 16 23:30:26 2007 -0700"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@woody.linux-foundation.org",
    "time": "Wed Oct 17 08:43:01 2007 -0700"
  },
  "message": "F_DUPFD_CLOEXEC implementation\n\nOne more small change to extend the availability of creation of file\ndescriptors with FD_CLOEXEC set.  Adding a new command to fcntl() requires\nno new system call and the overall impact on code size if minimal.\n\nIf this patch gets accepted we will also add this change to the next\nrevision of the POSIX spec.\n\nTo test the patch, use the following little program.  Adjust the value of\nF_DUPFD_CLOEXEC appropriately.\n\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n#include \u003cerrno.h\u003e\n#include \u003cfcntl.h\u003e\n#include \u003cstdio.h\u003e\n#include \u003cstdlib.h\u003e\n#include \u003cunistd.h\u003e\n\n#ifndef F_DUPFD_CLOEXEC\n# define F_DUPFD_CLOEXEC 12\n#endif\n\nint\nmain (int argc, char *argv[])\n{\n  if  (argc \u003e 1)\n    {\n      if (fcntl (3, F_GETFD) \u003d\u003d 0)\n\t{\n\t  puts (\"descriptor not closed\");\n\t  exit (1);\n\t}\n      if (errno !\u003d EBADF)\n\t{\n\t  puts (\"error not EBADF\");\n\t  exit (1);\n\t}\n\n      exit (0);\n    }\n  int fd \u003d fcntl (STDOUT_FILENO, F_DUPFD_CLOEXEC, 0);\n  if (fd \u003d\u003d -1 \u0026\u0026 errno \u003d\u003d EINVAL)\n    {\n      puts (\"F_DUPFD_CLOEXEC not supported\");\n      return 0;\n    }\n  if (fd !\u003d 3)\n    {\n      puts (\"program called with descriptors other than 0,1,2\");\n      return 1;\n    }\n\n  execl (\"/proc/self/exe\", \"/proc/self/exe\", \"1\", NULL);\n  puts (\"execl failed\");\n  return 1;\n}\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nSigned-off-by: Ulrich Drepper \u003cdrepper@redhat.com\u003e\nCc: Al Viro \u003cviro@zeniv.linux.org.uk\u003e\nCc: Christoph Hellwig \u003chch@lst.de\u003e\nCc: \u003clinux-arch@vger.kernel.org\u003e\nCc: Kyle McMartin \u003ckyle@mcmartin.ca\u003e\nCc: Stephen Rothwell \u003csfr@canb.auug.org.au\u003e\nSigned-off-by: Andrew Morton \u003cakpm@linux-foundation.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@linux-foundation.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "78b2ff04405400c724c9aff18a0f000be577c908",
      "old_mode": 33188,
      "old_path": "fs/fcntl.c",
      "new_id": "c9db73fc5e3d2d2e137bab66724d4c91f3d7544c",
      "new_mode": 33188,
      "new_path": "fs/fcntl.c"
    },
    {
      "type": "modify",
      "old_id": "40b93265d4bae5240896a2c3eaac75fb2577ca76",
      "old_mode": 33188,
      "old_path": "include/linux/fcntl.h",
      "new_id": "86037400a6e380f8ec5b1bd31acc6ebfbb296bd1",
      "new_mode": 33188,
      "new_path": "include/linux/fcntl.h"
    }
  ]
}
