@@ -262,6 +262,24 @@ def generate_DN_flags(cw):
262262 generate_codes (cw , codeval , 'public' , hex , unix_only = True )
263263
264264
265+ # python3 -c 'import fcntl;print(dict(sorted((s, getattr(fcntl, s)) for s in dir(fcntl) if s.startswith("LOCK_"))))'
266+ # Python 3.6.15 [GCC 12.2.0] on linux 6.10.14
267+ # Python 3.12.3 [GCC 13.2.0] on linux 6.8.0
268+ LOCK_flags_linux = {'LOCK_EX' : 2 , 'LOCK_MAND' : 32 , 'LOCK_NB' : 4 , 'LOCK_READ' : 64 , 'LOCK_RW' : 192 , 'LOCK_SH' : 1 , 'LOCK_UN' : 8 , 'LOCK_WRITE' : 128 }
269+ # Python 3.7.0 [Clang 4.0.1 ] on darwin 24.2.0
270+ # Python 3.12.0 [Clang 14.0.6 ] on darwin 24.2.0
271+ LOCK_flags_darwin = {'LOCK_EX' : 2 , 'LOCK_NB' : 4 , 'LOCK_SH' : 1 , 'LOCK_UN' : 8 }
272+
273+ def generate_LOCK_flags (cw ):
274+ codeval = {}
275+ for name in LOCK_flags_linux :
276+ set_value (codeval , name , LOCK_flags_linux [name ], linux_idx )
277+ for name in LOCK_flags_darwin :
278+ set_value (codeval , name , LOCK_flags_darwin [name ], darwin_idx )
279+ codeval = OrderedDict (sorted (codeval .items ()))
280+ generate_codes (cw , codeval , 'public' , hex , unix_only = True )
281+
282+
265283def main ():
266284 return generate (
267285 ("Errno Codes" , generate_errno_codes ),
@@ -271,6 +289,7 @@ def main():
271289 ("Common O_Flags" , generate_common_O_flags ),
272290 ("FD Commands" , generate_FD_commands ),
273291 ("Directory Notify Flags" , generate_DN_flags ),
292+ ("LOCK Flags" , generate_LOCK_flags ),
274293 )
275294
276295if __name__ == "__main__" :
0 commit comments