Ownership of a New File by calling open() or creat()

UID

the effective UID of the creating process

GID

Option 1

the effective GID of the process

Option 2

the GID of directory in which the file is being created