~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to src/pkg/syscall/syscall_windows.go

  • Committer: Package Import Robot
  • Author(s): Ondřej Surý, Ondřej Surý, Michael Stapelberg
  • Date: 2012-06-28 12:14:15 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20120628121415-w1b0076ixkarr1ml
[ Ondřej Surý ]
* Imported Upstream version 1.0.2
* Update Vcs fields to reflect new git repository location
* Kill get-orig-source, since 1.0.0, the tarballs can be downloaded
  from webpage

[ Michael Stapelberg ]
* golang-mode: use debian-pkg-add-load-path-item (Closes: #664802)
* Add manpages (Closes: #632964)
* Use updated pt.po from Pedro Ribeiro (Closes: #674958)

Show diffs side-by-side

added added

removed removed

Lines of Context:
90
90
        b := make([]uint16, 300)
91
91
        n, err := FormatMessage(flags, 0, uint32(e), langid(LANG_ENGLISH, SUBLANG_ENGLISH_US), b, nil)
92
92
        if err != nil {
93
 
                return "error " + itoa(int(e)) + " (FormatMessage failed with err=" + itoa(int(err.(Errno))) + ")"
 
93
                // TODO(brainman): Call FormatMessage again asking for "native" error message.
 
94
                // http://code.google.com/p/go/issues/detail?id=3376 must be resolved first.
 
95
                return "winapi error #" + itoa(int(e))
94
96
        }
95
97
        // trim terminating \r and \n
96
98
        for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- {
127
129
//sys   SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) [failretval==0xffffffff]
128
130
//sys   CloseHandle(handle Handle) (err error)
129
131
//sys   GetStdHandle(stdhandle int) (handle Handle, err error) [failretval==InvalidHandle]
130
 
//sys   FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstFileW
131
 
//sys   FindNextFile(handle Handle, data *Win32finddata) (err error) = FindNextFileW
 
132
//sys   findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstFileW
 
133
//sys   findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW
132
134
//sys   FindClose(handle Handle) (err error)
133
135
//sys   GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error)
134
136
//sys   GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW
199
201
//sys   RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW
200
202
//sys   RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW
201
203
//sys   RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW
 
204
//sys   getCurrentProcessId() (pid uint32) = kernel32.getCurrentProcessId
202
205
 
203
206
// syscall interface implementation for other packages
204
207
 
681
684
}
682
685
func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return EWINDOWS }
683
686
 
 
687
func Getpid() (pid int) { return int(getCurrentProcessId()) }
 
688
 
 
689
func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) {
 
690
        // NOTE(rsc): The Win32finddata struct is wrong for the system call:
 
691
        // the two paths are each one uint16 short. Use the correct struct,
 
692
        // a win32finddata1, and then copy the results out.
 
693
        // There is no loss of expressivity here, because the final
 
694
        // uint16, if it is used, is supposed to be a NUL, and Go doesn't need that.
 
695
        // For Go 1.1, we might avoid the allocation of win32finddata1 here
 
696
        // by adding a final Bug [2]uint16 field to the struct and then
 
697
        // adjusting the fields in the result directly.
 
698
        var data1 win32finddata1
 
699
        handle, err = findFirstFile1(name, &data1)
 
700
        if err == nil {
 
701
                copyFindData(data, &data1)
 
702
        }
 
703
        return
 
704
}
 
705
 
 
706
func FindNextFile(handle Handle, data *Win32finddata) (err error) {
 
707
        var data1 win32finddata1
 
708
        err = findNextFile1(handle, &data1)
 
709
        if err == nil {
 
710
                copyFindData(data, &data1)
 
711
        }
 
712
        return
 
713
}
 
714
 
684
715
// TODO(brainman): fix all needed for os
685
 
 
686
 
func Getpid() (pid int)   { return -1 }
687
716
func Getppid() (ppid int) { return -1 }
688
717
 
689
718
func Fchdir(fd Handle) (err error)                        { return EWINDOWS }