Add mode flags to open calls with O_CREAT.

Change-Id: Ib9fb61155d15ed9eb54942959af965df2fe21b71
diff --git a/bench/benchgen.py b/bench/benchgen.py
index d529332..ec14aef 100644
--- a/bench/benchgen.py
+++ b/bench/benchgen.py
@@ -183,7 +183,12 @@
                 if handle not in defined:
                     print >>bench, "int ",
                     defined.add(handle)
-                print >>bench, '%s = TEMP_FAILURE_RETRY(open("file%s", %s));' % (handle, f.ident, e.args[2])
+                create_mode = ''
+                if 'O_CREAT' in e.args[2]:
+                    assert len(e.args) > 3, 'File creation lacks a mode?'
+                    create_mode = ', ' + e.args[3]
+                print >>bench, '%s = TEMP_FAILURE_RETRY(open("file%s", %s%s));' \
+                        % (handle, f.ident, e.args[2], create_mode)
 
         elif e.call == "close":
             fd, f, handle = extract_file(e, e.args[0])