Skip to content

Commit

Permalink
Add missing types and methods
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar committed Mar 11, 2014
1 parent 6d0ffb3 commit 323f081
Show file tree
Hide file tree
Showing 13 changed files with 347 additions and 2 deletions.
Expand Up @@ -30,6 +30,7 @@

using System;
using System.IO;
using Microsoft.Win32.SafeHandles;

namespace System.IO.MemoryMappedFiles
{
Expand All @@ -45,6 +46,12 @@ public sealed class MemoryMappedViewStream : UnmanagedMemoryStream {
CreateStream (fd, offset, size, access);
}

public SafeMemoryMappedViewHandle SafeMemoryMappedViewHandle {
get {
throw new NotImplementedException ();
}
}

unsafe void CreateStream (int fd, long offset, long size, MemoryMappedFileAccess access)
{
int offset_diff;
Expand Down
48 changes: 48 additions & 0 deletions mcs/class/corlib/System.Diagnostics.Tracing/EventAttribute.cs
@@ -0,0 +1,48 @@
//
// EventAttribute.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if NET_4_5

namespace System.Diagnostics.Tracing
{
[AttributeUsageAttribute (AttributeTargets.Method)]
public sealed class EventAttribute : Attribute
{
public EventAttribute (int eventId)
{
EventId = eventId;
}

public int EventId {
get; private set;
}

}
}

#endif
42 changes: 42 additions & 0 deletions mcs/class/corlib/System.Diagnostics.Tracing/EventCommand.cs
@@ -0,0 +1,42 @@
//
// EventCommand.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if NET_4_5

namespace System.Diagnostics.Tracing
{
public enum EventCommand
{
Update,
SendManifest = -1,
Enable = -2,
Disable = -3
}
}

#endif
@@ -1,5 +1,5 @@
//
// EventCommandEventArgs.cs.cs
// EventCommandEventArgs.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
Expand Down Expand Up @@ -28,13 +28,38 @@

#if NET_4_5

using System.Collections.Generic;

namespace System.Diagnostics.Tracing
{
public class EventCommandEventArgs : EventArgs
{
private EventCommandEventArgs ()
{
}

public IDictionary<string, string> Arguments {
get {
throw new NotImplementedException ();
}
}

public EventCommand Command {
get {
throw new NotImplementedException ();
}
}

public bool DisableEvent (int eventId)
{
return true;
}

public bool EnableEvent (int eventId)
{
return true;
}

}
}

Expand Down
47 changes: 47 additions & 0 deletions mcs/class/corlib/System.Diagnostics.Tracing/EventKeywords.cs
@@ -0,0 +1,47 @@
//
// EventKeywords.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if NET_4_5

namespace System.Diagnostics.Tracing
{
[Flags]
public enum EventKeywords : long
{
None,
WdiContext = 0x2000000000000,
WdiDiagnostic = 0x4000000000000,
Sqm = 0x8000000000000,
AuditFailure = 0x10000000000000,
AuditSuccess = 0x20000000000000,
CorrelationHint = 0x10000000000000,
EventLogClassic = 0x80000000000000
}
}

#endif
44 changes: 44 additions & 0 deletions mcs/class/corlib/System.Diagnostics.Tracing/EventLevel.cs
@@ -0,0 +1,44 @@
//
// EventLevel.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if NET_4_5

namespace System.Diagnostics.Tracing
{
public enum EventLevel
{
LogAlways,
Critical,
Error,
Warning,
Informational,
Verbose
}
}

#endif
21 changes: 21 additions & 0 deletions mcs/class/corlib/System.Diagnostics.Tracing/EventSource.cs
Expand Up @@ -45,6 +45,11 @@ public bool IsEnabled ()
return false;
}

public bool IsEnabled (EventLevel level, EventKeywords keywords)
{
return false;
}

public void Dispose ()
{
Dispose (true);
Expand All @@ -54,9 +59,25 @@ protected virtual void Dispose (bool disposing)
{
}

protected virtual void OnEventCommand (EventCommandEventArgs command)
{
}

protected void WriteEvent (int eventId, string arg1)
{
}

protected void WriteEvent (int eventId, string arg1, int arg2)
{
}

protected void WriteEvent (int eventId, int arg1, int arg2, int arg3)
{
}

protected void WriteEvent (int eventId, string arg1, int arg2, int arg3)
{
}
}
}

Expand Down
@@ -0,0 +1,50 @@
//
// EventSourceAttribute.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if NET_4_5

namespace System.Diagnostics.Tracing
{
[AttributeUsageAttribute (AttributeTargets.Class)]
public sealed class EventSourceAttribute : Attribute
{
public string Guid {
get; set;
}

public string LocalizationResources {
get; set;
}

public string Name {
get; set;
}
}
}

#endif
39 changes: 39 additions & 0 deletions mcs/class/corlib/System.Diagnostics.Tracing/NonEventAttribute.cs
@@ -0,0 +1,39 @@
//
// NonEventAttribute.cs
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#if NET_4_5

namespace System.Diagnostics.Tracing
{
[AttributeUsageAttribute (AttributeTargets.Method)]
public sealed class NonEventAttribute : Attribute
{
}
}

#endif
6 changes: 6 additions & 0 deletions mcs/class/corlib/System.Diagnostics/Debugger.cs
Expand Up @@ -104,6 +104,12 @@ public static bool Launch()
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public static extern void Log(int level, string category, string message);

#if NET_4_0
public static void NotifyOfCrossThreadDependency ()
{
}
#endif

#if NET_4_0
[ObsoleteAttribute("Call the static methods directly on this type", true)]
#endif
Expand Down

0 comments on commit 323f081

Please sign in to comment.