package sysfs

import (
	

	
)

// toOsOpenFlag converts the input to the flag parameter of os.OpenFile
func toOsOpenFlag( sys.Oflag) ( int) {
	// First flags are exclusive
	switch  & (sys.O_RDONLY | sys.O_RDWR | sys.O_WRONLY) {
	case sys.O_RDONLY:
		 |= os.O_RDONLY
	case sys.O_RDWR:
		 |= os.O_RDWR
	case sys.O_WRONLY:
		 |= os.O_WRONLY
	}

	// Run down the flags defined in the os package
	if &sys.O_APPEND != 0 {
		 |= os.O_APPEND
	}
	if &sys.O_CREAT != 0 {
		 |= os.O_CREATE
	}
	if &sys.O_EXCL != 0 {
		 |= os.O_EXCL
	}
	if &sys.O_SYNC != 0 {
		 |= os.O_SYNC
	}
	if &sys.O_TRUNC != 0 {
		 |= os.O_TRUNC
	}
	return withSyscallOflag(, )
}